Vergleich polls.php - 1.8.4 - 1.8.7

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 57Zeile 57
	}

// Is the currently logged in user a moderator of this forum?

	}

// Is the currently logged in user a moderator of this forum?

	if(is_moderator($thread['fid']))
{
$ismod = true;
}
else
{
$ismod = false;
}

	$ismod = is_moderator($thread['fid']);









// Make sure we are looking at a real thread here.
if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))


// Make sure we are looking at a real thread here.
if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))

Zeile 99Zeile 92
	if(($thread['uid'] != $mybb->user['uid'] && !is_moderator($fid, "canmanagepolls")) || ($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $forumpermissions['canpostpolls'] == 0))
{
error_no_permission();

	if(($thread['uid'] != $mybb->user['uid'] && !is_moderator($fid, "canmanagepolls")) || ($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $forumpermissions['canpostpolls'] == 0))
{
error_no_permission();

	}

	}


if($thread['poll'])
{


if($thread['poll'])
{

Zeile 121Zeile 114
	if($mybb->settings['maxpolloptions'] && $mybb->get_input('polloptions', MyBB::INPUT_INT) > $mybb->settings['maxpolloptions'])
{ // Too big
$polloptions = $mybb->settings['maxpolloptions'];

	if($mybb->settings['maxpolloptions'] && $mybb->get_input('polloptions', MyBB::INPUT_INT) > $mybb->settings['maxpolloptions'])
{ // Too big
$polloptions = $mybb->settings['maxpolloptions'];

	}

	}

	elseif($mybb->get_input('polloptions', MyBB::INPUT_INT) < 2)
{ // Too small
$polloptions = 2;

	elseif($mybb->get_input('polloptions', MyBB::INPUT_INT) < 2)
{ // Too small
$polloptions = 2;

Zeile 156Zeile 149
		$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('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $polloptions)
{
$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);
}
else
{
$maxoptions = 0;
}

$plugins->run_hooks("polls_newpoll_end");

	}

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)
{
$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);
}
else
{
$maxoptions = 0;
}

$plugins->run_hooks("polls_newpoll_end");


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


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

Zeile 220Zeile 213
	}

if($thread['poll'])

	}

if($thread['poll'])

	{

	{

		error($lang->error_pollalready);

		error($lang->error_pollalready);

	}

	}


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


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

	{

	{

		$polloptions = $mybb->settings['maxpolloptions'];
}


		$polloptions = $mybb->settings['maxpolloptions'];
}


Zeile 234Zeile 227
	if(!isset($postoptions['multiple']) || $postoptions['multiple'] != '1')
{
$postoptions['multiple'] = 0;

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

	}


	}


	if(!isset($postoptions['public']) || $postoptions['public'] != '1')

	if(!isset($postoptions['public']) || $postoptions['public'] != '1')

	{

	{

		$postoptions['public'] = 0;

		$postoptions['public'] = 0;

	}


	}


	if($polloptions < 2)

	if($polloptions < 2)

	{

	{

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

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


for($i = 1; $i <= $polloptions; ++$i)
{


for($i = 1; $i <= $polloptions; ++$i)
{

		if(!isset($options[$i]))

		if(!isset($options[$i]))

		{

		{

			$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(trim($options[$i]) != "")
{
$optioncount++;

		}

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

 
		}
}

if(isset($lengtherror))
{
error($lang->error_polloptiontoolong);

		}
}

if(isset($lengtherror))
{
error($lang->error_polloptiontoolong);

 
	}

if(isset($sequenceerror))
{
error($lang->error_polloptionsequence);

	}

$mybb->input['question'] = $mybb->get_input('question');

	}

$mybb->input['question'] = $mybb->get_input('question');

Zeile 292Zeile 296
			}
$optionslist .= trim($options[$i]);
$voteslist .= '0';

			}
$optionslist .= trim($options[$i]);
$voteslist .= '0';

		}
}

		}
}


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


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

	{

	{

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

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

	}

	}

	else

	else

	{

	{

		$timeout = 0;
}

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

		$timeout = 0;
}

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

	{

	{

		$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);

		$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);

	}

	}

	else
{
$maxoptions = 0;
}

	else
{
$maxoptions = 0;
}

	



	$newpoll = array(
"tid" => $thread['tid'],
"question" => $db->escape_string($mybb->input['question']),

	$newpoll = array(
"tid" => $thread['tid'],
"question" => $db->escape_string($mybb->input['question']),

Zeile 333Zeile 337
	$pid = $db->insert_query("polls", $newpoll);

$db->update_query("threads", array('poll' => $pid), "tid='".$thread['tid']."'");

	$pid = $db->insert_query("polls", $newpoll);

$db->update_query("threads", array('poll' => $pid), "tid='".$thread['tid']."'");





	$plugins->run_hooks("polls_do_newpoll_end");

if($thread['visible'] == 1)

	$plugins->run_hooks("polls_do_newpoll_end");

if($thread['visible'] == 1)

Zeile 405Zeile 409
	{
if($poll['closed'] == 1)
{

	{
if($poll['closed'] == 1)
{

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

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

if($poll['public'] == 1)
{

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

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

if($poll['public'] == 1)
{

			$postoptionschecked['public'] = 'checked="checked"';
}


			$postoptionschecked['public'] = 'checked="checked"';
}


Zeile 425Zeile 429
		for($i = 1; $i <= $poll['numoptions']; ++$i)
{
$poll['totvotes'] = $poll['totvotes'] + $votesarray[$i-1];

		for($i = 1; $i <= $poll['numoptions']; ++$i)
{
$poll['totvotes'] = $poll['totvotes'] + $votesarray[$i-1];

		}


		}


		$question = htmlspecialchars_uni($poll['question']);
$numoptions = $poll['numoptions'];
$optionbits = "";

		$question = htmlspecialchars_uni($poll['question']);
$numoptions = $poll['numoptions'];
$optionbits = "";

Zeile 437Zeile 441
			$option = htmlspecialchars_uni($option);
$optionvotes = (int)$votesarray[$i];


			$option = htmlspecialchars_uni($option);
$optionvotes = (int)$votesarray[$i];


			if(!$optionvotes)
{
$optionvotes = 0;
}


			if(!$optionvotes)
{
$optionvotes = 0;
}


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

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

		}

		}


if(!$poll['timeout'])
{


if(!$poll['timeout'])
{

Zeile 454Zeile 458
		else
{
$timeout = $poll['timeout'];

		else
{
$timeout = $poll['timeout'];

		}


		}


		if(!$poll['maxoptions'])
{
$maxoptions = 0;

		if(!$poll['maxoptions'])
{
$maxoptions = 0;

Zeile 468Zeile 472
	else
{
if($mybb->settings['maxpolloptions'] && $mybb->get_input('numoptions', MyBB::INPUT_INT) > $mybb->settings['maxpolloptions'])

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

		{

		{

			$numoptions = $mybb->settings['maxpolloptions'];

			$numoptions = $mybb->settings['maxpolloptions'];

		}

		}

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

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

		{

		{

			$numoptions = 2;

			$numoptions = 2;

		}

		}

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

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

Zeile 483Zeile 487

$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);
if(isset($postoptions['multiple']) && $postoptions['multiple'] == 1)


$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);
if(isset($postoptions['multiple']) && $postoptions['multiple'] == 1)

		{

		{

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


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


Zeile 526Zeile 530
		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;

		}


		}


		if(!$poll['maxoptions'])
{
$maxoptions = 0;

		if(!$poll['maxoptions'])
{
$maxoptions = 0;

		}

		}

		else
{
$maxoptions = $poll['maxoptions'];

		else
{
$maxoptions = $poll['maxoptions'];

		}
}


		}
}


	$plugins->run_hooks("polls_editpoll_end");

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

	$plugins->run_hooks("polls_editpoll_end");

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

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

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

	}

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

	}

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


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


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

Zeile 614Zeile 618
	}

if(!isset($postoptions['public']) || $postoptions['public'] != '1')

	}

if(!isset($postoptions['public']) || $postoptions['public'] != '1')

	{

	{

		$postoptions['public'] = 0;
}


		$postoptions['public'] = 0;
}


Zeile 631Zeile 635
		{
$options[$i] = '';
}

		{
$options[$i] = '';
}

		if(trim($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++;

		{
$optioncount++;

		}

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

 
		}
}

if(isset($lengtherror))

		}
}

if(isset($lengtherror))

	{

	{

		error($lang->error_polloptiontoolong);

		error($lang->error_polloptiontoolong);

 
	}

if(isset($sequenceerror))
{
error($lang->error_polloptionsequence);

	}

$mybb->input['question'] = $mybb->get_input('question');
if(trim($mybb->input['question']) == '' || $optioncount < 2)

	}

$mybb->input['question'] = $mybb->get_input('question');
if(trim($mybb->input['question']) == '' || $optioncount < 2)

	{

	{

		error($lang->error_noquestionoptions);
}


		error($lang->error_noquestionoptions);
}


Zeile 676Zeile 692
			$voteslist .= $votes[$i];
$numvotes = $numvotes + $votes[$i];
}

			$voteslist .= $votes[$i];
$numvotes = $numvotes + $votes[$i];
}

	}

	}


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
{
$timeout = 0;
}

	else
{
$timeout = 0;
}

	



	if($mybb->get_input('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $numoptions)
{
$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);

	if($mybb->get_input('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $numoptions)
{
$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);

Zeile 874Zeile 890
	else
{
$totpercent = '0%';

	else
{
$totpercent = '0%';

	}

$plugins->run_hooks("polls_showresults_end");


	}

$plugins->run_hooks("polls_showresults_end");


	$poll['question'] = htmlspecialchars_uni($poll['question']);
eval("\$showresults = \"".$templates->get("polls_showresults")."\";");
output_page($showresults);

	$poll['question'] = htmlspecialchars_uni($poll['question']);
eval("\$showresults = \"".$templates->get("polls_showresults")."\";");
output_page($showresults);

Zeile 905Zeile 921
	if(!$thread || $thread['visible'] == 0)
{
error($lang->error_invalidthread);

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

	}


	}


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

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

	{

	{

		error_no_permission();

		error_no_permission();

	}

	}


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


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

Zeile 921Zeile 937
		error($lang->error_invalidforum);
}
else

		error($lang->error_invalidforum);
}
else

	{

	{

		// Is our forum closed?
if($forum['open'] == 0)
{

		// Is our forum closed?
if($forum['open'] == 0)
{

Zeile 935Zeile 951
	if($poll['closed'] == 1 || $thread['closed'] == 1 || ($expiretime < $now && $poll['timeout']))
{
error($lang->error_pollclosed);

	if($poll['closed'] == 1 || $thread['closed'] == 1 || ($expiretime < $now && $poll['timeout']))
{
error($lang->error_pollclosed);

	}

	}


if(!isset($mybb->input['option']))
{
error($lang->error_nopolloptions);


if(!isset($mybb->input['option']))
{
error($lang->error_nopolloptions);

	}


	}


	// Check if the user has voted before...
if($mybb->user['uid'])
{

	// Check if the user has voted before...
if($mybb->user['uid'])
{

Zeile 950Zeile 966
	}

if($votecheck['vid'] || (isset($mybb->cookies['pollvotes'][$poll['pid']]) && $mybb->cookies['pollvotes'][$poll['pid']] !== ""))

	}

if($votecheck['vid'] || (isset($mybb->cookies['pollvotes'][$poll['pid']]) && $mybb->cookies['pollvotes'][$poll['pid']] !== ""))

	{

	{

		error($lang->error_alreadyvoted);
}
elseif(!$mybb->user['uid'])

		error($lang->error_alreadyvoted);
}
elseif(!$mybb->user['uid'])

Zeile 979Zeile 995
		if(is_array($option))
{
$total_options = 0;

		if(is_array($option))
{
$total_options = 0;

		



			foreach($option as $voteoption => $vote)
{
if($vote == 1 && isset($votesarray[$voteoption-1]))

			foreach($option as $voteoption => $vote)
{
if($vote == 1 && isset($votesarray[$voteoption-1]))

Zeile 994Zeile 1010
					$total_options++;
}
}

					$total_options++;
}
}

			



			if($total_options > $poll['maxoptions'] && $poll['maxoptions'] != 0)
{
error($lang->sprintf($lang->error_maxpolloptions, $poll['maxoptions']));

			if($total_options > $poll['maxoptions'] && $poll['maxoptions'] != 0)
{
error($lang->sprintf($lang->error_maxpolloptions, $poll['maxoptions']));