Vergleich polls.php - 1.8.6 - 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 94Zeile 87
	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 166Zeile 159
	{
$timeout = 0;
}

	{
$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);

	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);

Zeile 182Zeile 175
	output_page($newpoll);
}
if($mybb->input['action'] == "do_newpoll" && $mybb->request_method == "post")

	output_page($newpoll);
}
if($mybb->input['action'] == "do_newpoll" && $mybb->request_method == "post")

{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));

{
// Verify incoming POST request
verify_post_check($mybb->get_input('my_post_key'));


$plugins->run_hooks("polls_do_newpoll_start");



$plugins->run_hooks("polls_do_newpoll_start");


Zeile 228Zeile 221
	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;

	$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')

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

	{

	{

		$postoptions['public'] = 0;
}

if($polloptions < 2)
{
$polloptions = "2";

		$postoptions['public'] = 0;
}

if($polloptions < 2)
{
$polloptions = "2";

	}

	}

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

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





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

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

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

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

			break;
}

			break;
}


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


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

		}

		}

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

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

Zeile 274Zeile 267
	}

if(isset($lengtherror))

	}

if(isset($lengtherror))

	{

	{

		error($lang->error_polloptiontoolong);
}

		error($lang->error_polloptiontoolong);
}

	



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

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

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

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

		}
}


		}
}


	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;
}

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 344Zeile 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 415Zeile 408
	if(empty($mybb->input['updateoptions']))
{
if($poll['closed'] == 1)

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

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

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

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

if($poll['multiple'] == 1)
{
$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 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 447Zeile 440
			$option = $optionsarray[$i];
$option = htmlspecialchars_uni($option);
$optionvotes = (int)$votesarray[$i];

			$option = $optionsarray[$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'])
{
$timeout = 0;
}
else
{
$timeout = $poll['timeout'];
}

if(!$poll['maxoptions'])

		if(!$poll['timeout'])
{
$timeout = 0;
}
else
{
$timeout = $poll['timeout'];
}

if(!$poll['maxoptions'])

		{
$maxoptions = 0;
}

		{
$maxoptions = 0;
}

Zeile 496Zeile 489
		if(isset($postoptions['multiple']) && $postoptions['multiple'] == 1)
{
$postoptionschecked['multiple'] = 'checked="checked"';

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

		}


		}


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

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

		{

		{

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

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

		}

		}


if(isset($postoptions['closed']) && $postoptions['closed'] == 1)
{


if(isset($postoptions['closed']) && $postoptions['closed'] == 1)
{

Zeile 512Zeile 505
		$votes = $mybb->get_input('votes', MyBB::INPUT_ARRAY);
$optionbits = '';
for($i = 1; $i <= $numoptions; ++$i)

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

		{

		{

			$counter = $i;
if(!isset($options[$i]))
{

			$counter = $i;
if(!isset($options[$i]))
{

Zeile 541Zeile 534
		else
{
$timeout = 0;

		else
{
$timeout = 0;

		}


		}


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

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

Zeile 570Zeile 563
	$poll = $db->fetch_array($query);

if(!$poll)

	$poll = $db->fetch_array($query);

if(!$poll)

	{

	{

		error($lang->error_invalidpoll);
}


		error($lang->error_invalidpoll);
}


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

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

		}
}


		}
}


	if(!is_moderator($thread['fid'], "canmanagepolls"))

	if(!is_moderator($thread['fid'], "canmanagepolls"))

	{

	{

		error_no_permission();

		error_no_permission();

	}

	}


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


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

Zeile 614Zeile 607
		$numoptions = 2;
}
else

		$numoptions = 2;
}
else

	{

	{

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

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

	}


	}


	$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')

	{

	{

		$postoptions['multiple'] = 0;

		$postoptions['multiple'] = 0;

	}


	}


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

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

	}


	}


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

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

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

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

		}
}


		}
}


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

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

Zeile 702Zeile 695
	}

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
{
$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 731Zeile 724
		"public" => $postoptions['public'],
"maxoptions" => $maxoptions
);

		"public" => $postoptions['public'],
"maxoptions" => $maxoptions
);





	$plugins->run_hooks("polls_do_editpoll_process");

$db->update_query("polls", $updatedpoll, "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");

	$plugins->run_hooks("polls_do_editpoll_process");

$db->update_query("polls", $updatedpoll, "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");

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

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

	}

$fid = $thread['fid'];

	}

$fid = $thread['fid'];


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


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

	{

	{

		error($lang->error_invalidforum);

		error($lang->error_invalidforum);

	}

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

$plugins->run_hooks("polls_showresults_start");

	}

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

$plugins->run_hooks("polls_showresults_start");


if($forumpermissions['canviewthreads'] == 0 || $forumpermissions['canview'] == 0 || (isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] != 0 && $thread['uid'] != $mybb->user['uid']))


if($forumpermissions['canviewthreads'] == 0 || $forumpermissions['canview'] == 0 || (isset($forumpermissions['canonlyviewownthreads']) && $forumpermissions['canonlyviewownthreads'] != 0 && $thread['uid'] != $mybb->user['uid']))

	{
error_no_permission();
}


	{
error_no_permission();
}


	// Make navigation
build_forum_breadcrumb($fid);
add_breadcrumb(htmlspecialchars_uni($thread['subject']), get_thread_link($thread['tid']));

	// Make navigation
build_forum_breadcrumb($fid);
add_breadcrumb(htmlspecialchars_uni($thread['subject']), get_thread_link($thread['tid']));

Zeile 808Zeile 801
		{
// Add one to the number of voters for guests
++$guest_voters[$voter['voteoption']];

		{
// Add one to the number of voters for guests
++$guest_voters[$voter['voteoption']];

		}
else

		}
else

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

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

Zeile 869Zeile 862
			if(isset($voters[$number]) && is_array($voters[$number]))
{
foreach($voters[$number] as $uid => $username)

			if(isset($voters[$number]) && is_array($voters[$number]))
{
foreach($voters[$number] as $uid => $username)

				{

				{

					$userlist .= $comma.build_profile_link($username, $uid);
$comma = $guest_comma = $lang->comma;
}

					$userlist .= $comma.build_profile_link($username, $uid);
$comma = $guest_comma = $lang->comma;
}

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

	else
{
$totpercent = '0%';

	}


	}


	$plugins->run_hooks("polls_showresults_end");

$poll['question'] = htmlspecialchars_uni($poll['question']);

	$plugins->run_hooks("polls_showresults_end");

$poll['question'] = htmlspecialchars_uni($poll['question']);

Zeile 928Zeile 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);


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

Zeile 958Zeile 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']))

	if(!isset($mybb->input['option']))

	{

	{

		error($lang->error_nopolloptions);

		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'])

	{

	{

		$query = $db->simple_select("pollvotes", "*", "uid='".$mybb->user['uid']."' AND pid='".$poll['pid']."'");
$votecheck = $db->fetch_array($query);
}

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

		$query = $db->simple_select("pollvotes", "*", "uid='".$mybb->user['uid']."' AND pid='".$poll['pid']."'");
$votecheck = $db->fetch_array($query);
}

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

	{

	{

		error($lang->error_alreadyvoted);
}
elseif(!$mybb->user['uid'])
{
// Give a cookie to guests to inhibit revotes
if(is_array($mybb->input['option']))

		error($lang->error_alreadyvoted);
}
elseif(!$mybb->user['uid'])
{
// Give a cookie to guests to inhibit revotes
if(is_array($mybb->input['option']))

		{

		{

			// We have multiple options here...
$votes_cookie = implode(',', array_keys($mybb->input['option']));
}

			// We have multiple options here...
$votes_cookie = implode(',', array_keys($mybb->input['option']));
}

Zeile 988Zeile 981
		{
$votes_cookie = $mybb->input['option'];
}

		{
$votes_cookie = $mybb->input['option'];
}





		my_setcookie("pollvotes[{$poll['pid']}]", $votes_cookie);
}


		my_setcookie("pollvotes[{$poll['pid']}]", $votes_cookie);
}


Zeile 1002Zeile 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 1017Zeile 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']));