Vergleich polls.php - 1.8.4 - 1.8.12

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 24Zeile 24

if($mybb->user['uid'] != 0)
{


if($mybb->user['uid'] != 0)
{

 
	$mybb->user['username'] = htmlspecialchars_uni($mybb->user['username']);

	eval("\$loginbox = \"".$templates->get("changeuserbox")."\";");
}
else

	eval("\$loginbox = \"".$templates->get("changeuserbox")."\";");
}
else

Zeile 57Zeile 58
	}

// 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 93
	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 115
	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 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('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 214
	}

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 228
	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 297
			}
$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 338
	$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 410
	{
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 430
		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 442
			$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 459
		else
{
$timeout = $poll['timeout'];

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

		}


		}


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

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

Zeile 468Zeile 473
	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 488

$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 531
		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")."\";");
output_page($editpoll);
}


$plugins->run_hooks("polls_editpoll_end");

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





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

$plugins->run_hooks("polls_do_editpoll_start");

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

$plugins->run_hooks("polls_do_editpoll_start");





	$query = $db->simple_select("polls", "*", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");
$poll = $db->fetch_array($query);


	$query = $db->simple_select("polls", "*", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");
$poll = $db->fetch_array($query);


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

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

	}

	}


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



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


Zeile 624Zeile 629
	}
$optioncount = "0";
$options = $mybb->input['options'];

	}
$optioncount = "0";
$options = $mybb->input['options'];





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

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

		{

		{

			$options[$i] = '';

			$options[$i] = '';

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

 
		}


		}


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







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

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

			break;

			break;

 
		}

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

		}
}

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 666Zeile 683
			{
$optionslist .= "||~|~||";
$voteslist .= "||~|~||";

			{
$optionslist .= "||~|~||";
$voteslist .= "||~|~||";

			}

			}


$optionslist .= trim($options[$i]);
if(!isset($votes[$i]) || (int)$votes[$i] <= 0)


$optionslist .= trim($options[$i]);
if(!isset($votes[$i]) || (int)$votes[$i] <= 0)

Zeile 676Zeile 693
			$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 788Zeile 805
		}
else
{

		}
else
{

			$voters[$voter['voteoption']][$voter['uid']] = $voter['username'];

			$voters[$voter['voteoption']][$voter['uid']] = htmlspecialchars_uni($voter['username']);

		}
}


		}
}


Zeile 874Zeile 891
	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 922
	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 938
		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 952
	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 967
	}

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 996
		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 1011
					$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']));