Vergleich polls.php - 1.8.15 - 1.8.18

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 52Zeile 52
	$plugins->run_hooks("polls_newpoll_start");

$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));

	$plugins->run_hooks("polls_newpoll_start");

$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));

	if(!$thread)
{
error($lang->error_invalidthread);
}

	if(!$thread || $thread['visible'] == -1)
{
error($lang->error_invalidthread);
}


// Is the currently logged in user a moderator of this forum?
$ismod = is_moderator($thread['fid']);


// Is the currently logged in user a moderator of this forum?
$ismod = is_moderator($thread['fid']);

Zeile 64Zeile 64
	if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
{
error($lang->error_invalidthread);

	if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
{
error($lang->error_invalidthread);

	}


	}


	$fid = $thread['fid'];
$forumpermissions = forum_permissions($fid);

// Get forum info
$forum = get_forum($fid);
if(!$forum)

	$fid = $thread['fid'];
$forumpermissions = forum_permissions($fid);

// Get forum info
$forum = get_forum($fid);
if(!$forum)

	{

	{

		error($lang->error_invalidforum);

		error($lang->error_invalidforum);

	}
else
{

	}
else
{

		// Is our forum closed?
if($forum['open'] == 0 && !is_moderator($fid, "canmanagepolls"))
{

		// Is our forum closed?
if($forum['open'] == 0 && !is_moderator($fid, "canmanagepolls"))
{

Zeile 88Zeile 88
	build_forum_breadcrumb($fid);
add_breadcrumb(htmlspecialchars_uni($thread['subject']), get_thread_link($thread['tid']));
add_breadcrumb($lang->nav_postpoll);

	build_forum_breadcrumb($fid);
add_breadcrumb(htmlspecialchars_uni($thread['subject']), get_thread_link($thread['tid']));
add_breadcrumb($lang->nav_postpoll);





	// No permission if: Not thread author; not moderator; no forum perms to view, post threads, post polls
if(($thread['uid'] != $mybb->user['uid'] && !is_moderator($fid, "canmanagepolls")) || ($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $forumpermissions['canpostpolls'] == 0))
{

	// No permission if: Not thread author; not moderator; no forum perms to view, post threads, post polls
if(($thread['uid'] != $mybb->user['uid'] && !is_moderator($fid, "canmanagepolls")) || ($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $forumpermissions['canpostpolls'] == 0))
{

Zeile 136Zeile 136
	if(isset($postoptions['public']) && $postoptions['public'] == 1)
{
$postoptionschecked['public'] = 'checked="checked"';

	if(isset($postoptions['public']) && $postoptions['public'] == 1)
{
$postoptionschecked['public'] = 'checked="checked"';

	}


	}


	$options = $mybb->get_input('options', MyBB::INPUT_ARRAY);
$optionbits = '';
for($i = 1; $i <= $polloptions; ++$i)

	$options = $mybb->get_input('options', MyBB::INPUT_ARRAY);
$optionbits = '';
for($i = 1; $i <= $polloptions; ++$i)

Zeile 150Zeile 150
		$option = htmlspecialchars_uni($option);
eval("\$optionbits .= \"".$templates->get("polls_newpoll_option")."\";");
$option = "";

		$option = htmlspecialchars_uni($option);
eval("\$optionbits .= \"".$templates->get("polls_newpoll_option")."\";");
$option = "";

	}

if($mybb->get_input('timeout', MyBB::INPUT_INT) > 0)
{
$timeout = $mybb->get_input('timeout', MyBB::INPUT_INT);
}
else
{
$timeout = 0;

	}

if($mybb->get_input('timeout', MyBB::INPUT_INT) > 0)
{
$timeout = $mybb->get_input('timeout', MyBB::INPUT_INT);
}
else
{
$timeout = 0;

	}

if($mybb->get_input('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $polloptions)

	}

if($mybb->get_input('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $polloptions)

Zeile 168Zeile 168
	else
{
$maxoptions = 0;

	else
{
$maxoptions = 0;

	}


	}


	$plugins->run_hooks("polls_newpoll_end");

eval("\$newpoll = \"".$templates->get("polls_newpoll")."\";");

	$plugins->run_hooks("polls_newpoll_end");

eval("\$newpoll = \"".$templates->get("polls_newpoll")."\";");

Zeile 186Zeile 186
	if(!$thread)
{
error($lang->error_invalidthread);

	if(!$thread)
{
error($lang->error_invalidthread);

	}

	}


$fid = $thread['fid'];
$forumpermissions = forum_permissions($fid);


$fid = $thread['fid'];
$forumpermissions = forum_permissions($fid);

Zeile 204Zeile 204
		{
// Doesn't look like it is
error($lang->error_closedinvalidforum);

		{
// Doesn't look like it is
error($lang->error_closedinvalidforum);

		}

		}

	}

// No permission if: Not thread author; not moderator; no forum perms to view, post threads, post polls

	}

// No permission if: Not thread author; not moderator; no forum perms to view, post threads, post polls

Zeile 222Zeile 222
	if($mybb->settings['maxpolloptions'] && $polloptions > $mybb->settings['maxpolloptions'])
{
$polloptions = $mybb->settings['maxpolloptions'];

	if($mybb->settings['maxpolloptions'] && $polloptions > $mybb->settings['maxpolloptions'])
{
$polloptions = $mybb->settings['maxpolloptions'];

	}

$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);
if(!isset($postoptions['multiple']) || $postoptions['multiple'] != '1')
{
$postoptions['multiple'] = 0;
}

if(!isset($postoptions['public']) || $postoptions['public'] != '1')
{
$postoptions['public'] = 0;
}

if($polloptions < 2)
{
$polloptions = "2";
}
$optioncount = "0";
$options = $mybb->get_input('options', MyBB::INPUT_ARRAY);

for($i = 1; $i <= $polloptions; ++$i)
{
if(!isset($options[$i]))
{
$options[$i] = '';
}

if($mybb->settings['polloptionlimit'] != 0 && my_strlen($options[$i]) > $mybb->settings['polloptionlimit'])
{
$lengtherror = 1;
break;
}

if(strpos($options[$i], '||~|~||') !== false)
{
$sequenceerror = 1;
break;
}

if(trim($options[$i]) != "")
{
$optioncount++;
}

	}

$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);
if(!isset($postoptions['multiple']) || $postoptions['multiple'] != '1')
{
$postoptions['multiple'] = 0;
}

if(!isset($postoptions['public']) || $postoptions['public'] != '1')
{
$postoptions['public'] = 0;
}

if($polloptions < 2)
{
$polloptions = "2";
}
$optioncount = "0";
$options = $mybb->get_input('options', MyBB::INPUT_ARRAY);

for($i = 1; $i <= $polloptions; ++$i)
{
if(!isset($options[$i]))
{
$options[$i] = '';
}

if($mybb->settings['polloptionlimit'] != 0 && my_strlen($options[$i]) > $mybb->settings['polloptionlimit'])
{
$lengtherror = 1;
break;
}

if(strpos($options[$i], '||~|~||') !== false)
{
$sequenceerror = 1;
break;
}

if(trim($options[$i]) != "")
{
$optioncount++;
}

	}

if(isset($lengtherror))

	}

if(isset($lengtherror))

Zeile 303Zeile 303
	if($mybb->get_input('timeout', MyBB::INPUT_INT) > 0)
{
$timeout = $mybb->get_input('timeout', MyBB::INPUT_INT);

	if($mybb->get_input('timeout', MyBB::INPUT_INT) > 0)
{
$timeout = $mybb->get_input('timeout', MyBB::INPUT_INT);

	}
else
{

	}
else
{

		$timeout = 0;
}


		$timeout = 0;
}


Zeile 344Zeile 344
	if($thread['visible'] == 1)
{
redirect(get_thread_link($thread['tid']), $lang->redirect_pollposted);

	if($thread['visible'] == 1)
{
redirect(get_thread_link($thread['tid']), $lang->redirect_pollposted);

	}

	}

	else
{
redirect(get_forum_link($thread['fid']), $lang->redirect_pollpostedmoderated);

	else
{
redirect(get_forum_link($thread['fid']), $lang->redirect_pollpostedmoderated);

Zeile 366Zeile 366
	}

$query = $db->simple_select("threads", "*", "poll='$pid'");

	}

$query = $db->simple_select("threads", "*", "poll='$pid'");

	$thread = $db->fetch_array($query);
if(!$thread)
{
error($lang->error_invalidthread);

	$thread = $db->fetch_array($query);
if(!$thread)
{
error($lang->error_invalidthread);

	}

$tid = $thread['tid'];

	}

$tid = $thread['tid'];

Zeile 395Zeile 395
		{
// Doesn't look like it is
error($lang->error_closedinvalidforum);

		{
// Doesn't look like it is
error($lang->error_closedinvalidforum);

		}
}

		}
}


if(!is_moderator($fid, "canmanagepolls"))
{


if(!is_moderator($fid, "canmanagepolls"))
{

Zeile 409Zeile 409
	if(empty($mybb->input['updateoptions']))
{
if($poll['closed'] == 1)

	if(empty($mybb->input['updateoptions']))
{
if($poll['closed'] == 1)

		{

		{

			$postoptionschecked['closed'] = 'checked="checked"';

			$postoptionschecked['closed'] = 'checked="checked"';

		}

		}


if($poll['multiple'] == 1)


if($poll['multiple'] == 1)

		{

		{

			$postoptionschecked['multiple'] = 'checked="checked"';

			$postoptionschecked['multiple'] = 'checked="checked"';

		}


		}


		if($poll['public'] == 1)
{
$postoptionschecked['public'] = 'checked="checked"';

		if($poll['public'] == 1)
{
$postoptionschecked['public'] = 'checked="checked"';

		}


		}


		$optionsarray = explode("||~|~||", $poll['options']);
$votesarray = explode("||~|~||", $poll['votes']);


		$optionsarray = explode("||~|~||", $poll['options']);
$votesarray = explode("||~|~||", $poll['votes']);


Zeile 436Zeile 436
		$numoptions = $poll['numoptions'];
$optionbits = "";
for($i = 0; $i < $numoptions; ++$i)

		$numoptions = $poll['numoptions'];
$optionbits = "";
for($i = 0; $i < $numoptions; ++$i)

		{

		{

			$counter = $i + 1;
$option = $optionsarray[$i];
$option = htmlspecialchars_uni($option);

			$counter = $i + 1;
$option = $optionsarray[$i];
$option = htmlspecialchars_uni($option);

Zeile 462Zeile 462
		}

if(!$poll['maxoptions'])

		}

if(!$poll['maxoptions'])

		{

		{

			$maxoptions = 0;
}
else

			$maxoptions = 0;
}
else

		{

		{

			$maxoptions = $poll['maxoptions'];

			$maxoptions = $poll['maxoptions'];

		}

		}

	}
else
{
if($mybb->settings['maxpolloptions'] && $mybb->get_input('numoptions', MyBB::INPUT_INT) > $mybb->settings['maxpolloptions'])
{
$numoptions = $mybb->settings['maxpolloptions'];

	}
else
{
if($mybb->settings['maxpolloptions'] && $mybb->get_input('numoptions', MyBB::INPUT_INT) > $mybb->settings['maxpolloptions'])
{
$numoptions = $mybb->settings['maxpolloptions'];

		}

		}

		elseif($mybb->get_input('numoptions', MyBB::INPUT_INT) < 2)
{
$numoptions = 2;

		elseif($mybb->get_input('numoptions', MyBB::INPUT_INT) < 2)
{
$numoptions = 2;

Zeile 500Zeile 500
		if(isset($postoptions['closed']) && $postoptions['closed'] == 1)
{
$postoptionschecked['closed'] = 'checked="checked"';

		if(isset($postoptions['closed']) && $postoptions['closed'] == 1)
{
$postoptionschecked['closed'] = 'checked="checked"';

		}

		}


$options = $mybb->get_input('options', MyBB::INPUT_ARRAY);
$votes = $mybb->get_input('votes', MyBB::INPUT_ARRAY);


$options = $mybb->get_input('options', MyBB::INPUT_ARRAY);
$votes = $mybb->get_input('votes', MyBB::INPUT_ARRAY);

Zeile 526Zeile 526

eval("\$optionbits .= \"".$templates->get("polls_editpoll_option")."\";");
$option = "";


eval("\$optionbits .= \"".$templates->get("polls_editpoll_option")."\";");
$option = "";

		}

		}


if($mybb->get_input('timeout', MyBB::INPUT_INT) > 0)
{


if($mybb->get_input('timeout', MyBB::INPUT_INT) > 0)
{

Zeile 552Zeile 552
	eval("\$editpoll = \"".$templates->get("polls_editpoll")."\";");
output_page($editpoll);
}

	eval("\$editpoll = \"".$templates->get("polls_editpoll")."\";");
output_page($editpoll);
}





if($mybb->input['action'] == "do_editpoll" && $mybb->request_method == "post")
{
// Verify incoming POST request

if($mybb->input['action'] == "do_editpoll" && $mybb->request_method == "post")
{
// Verify incoming POST request

Zeile 579Zeile 579

// Get forum info
$forum = get_forum($thread['fid']);


// Get forum info
$forum = get_forum($thread['fid']);

	$fid = $thread['fid'];
if(!$forum)
{

	$fid = $thread['fid'];
if(!$forum)
{

		error($lang->error_invalidforum);
}
else

		error($lang->error_invalidforum);
}
else

Zeile 691Zeile 691
				$votes[$i] = "0";
}
$voteslist .= $votes[$i];

				$votes[$i] = "0";
}
$voteslist .= $votes[$i];

			$numvotes = $numvotes + $votes[$i];

			$numvotes = (int)$numvotes + (int)$votes[$i];

		}
}


		}
}


Zeile 751Zeile 751

$tid = $poll['tid'];
$thread = get_thread($tid);


$tid = $poll['tid'];
$thread = get_thread($tid);

	if(!$thread)

	if(!$thread || ($thread['visible'] != 1 && ($thread['visible'] == 0 && !is_moderator($thread['fid'], "canviewunapprove")) || ($thread['visible'] == -1 && !is_moderator($thread['fid'], "canviewdeleted"))))

	{
error($lang->error_invalidthread);
}

	{
error($lang->error_invalidthread);
}

Zeile 899Zeile 899
	eval("\$showresults = \"".$templates->get("polls_showresults")."\";");
output_page($showresults);
}

	eval("\$showresults = \"".$templates->get("polls_showresults")."\";");
output_page($showresults);
}

 


if($mybb->input['action'] == "vote" && $mybb->request_method == "post")
{
// Verify incoming POST request

if($mybb->input['action'] == "vote" && $mybb->request_method == "post")
{
// Verify incoming POST request

Zeile 919Zeile 920
	$query = $db->simple_select("threads", "*", "poll='".(int)$poll['pid']."'");
$thread = $db->fetch_array($query);


	$query = $db->simple_select("threads", "*", "poll='".(int)$poll['pid']."'");
$thread = $db->fetch_array($query);


	if(!$thread || $thread['visible'] == 0)

	if(!$thread || ($thread['visible'] != 1 && ($thread['visible'] == 0 && !is_moderator($thread['fid'], "canviewunapprove")) || ($thread['visible'] == -1 && !is_moderator($thread['fid'], "canviewdeleted"))))

	{
error($lang->error_invalidthread);
}

	{
error($lang->error_invalidthread);
}

Zeile 1091Zeile 1092
	// We do not have $forum_cache available here since no forums permissions are checked in undo vote
// Get thread ID and then get forum info
$thread = get_thread($poll['tid']);

	// We do not have $forum_cache available here since no forums permissions are checked in undo vote
// Get thread ID and then get forum info
$thread = get_thread($poll['tid']);

	if(!$thread || $thread['visible'] == 0)

	if(!$thread || ($thread['visible'] != 1 && ($thread['visible'] == 0 && !is_moderator($thread['fid'], "canviewunapprove")) || ($thread['visible'] == -1 && !is_moderator($thread['fid'], "canviewdeleted"))))

	{
error($lang->error_invalidthread);
}

	{
error($lang->error_invalidthread);
}