Vergleich polls.php - 1.8.6 - 1.8.8

  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 94Zeile 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 166Zeile 160
	{
$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 176
	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 incoming POST request

	verify_post_check($mybb->get_input('my_post_key'));

$plugins->run_hooks("polls_do_newpoll_start");

	verify_post_check($mybb->get_input('my_post_key'));

$plugins->run_hooks("polls_do_newpoll_start");

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

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

		{

		{

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

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

Zeile 242Zeile 236
	}

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)
{
if(!isset($options[$i]))
{
$options[$i] = '';

	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;

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

Zeile 277Zeile 271
	{
error($lang->error_polloptiontoolong);
}

	{
error($lang->error_polloptiontoolong);
}

	



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

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

Zeile 323Zeile 317
	{
$maxoptions = 0;
}

	{
$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 380Zeile 374

$tid = $thread['tid'];
$fid = $thread['fid'];


$tid = $thread['tid'];
$fid = $thread['fid'];





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

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





	$forumpermissions = forum_permissions($fid);

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

	$forumpermissions = forum_permissions($fid);

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

	{

	{

		error($lang->error_invalidforum);

		error($lang->error_invalidforum);

	}

	}

	else
{
// Is our forum closed?

	else
{
// Is our forum closed?

Zeile 401Zeile 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"))

	{

	{

		error_no_permission();
}

		error_no_permission();
}





	$postoptionschecked = array('closed' => '', 'multiple' => '', 'public' => '');

	$postoptionschecked = array('closed' => '', 'multiple' => '', 'public' => '');





	$polldate = my_date($mybb->settings['dateformat'], $poll['dateline']);
if(empty($mybb->input['updateoptions']))
{
if($poll['closed'] == 1)

	$polldate = my_date($mybb->settings['dateformat'], $poll['dateline']);
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 461Zeile 455
		if(!$poll['timeout'])
{
$timeout = 0;

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

		}

		}

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

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

		



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

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

Zeile 542Zeile 536
		{
$timeout = 0;
}

		{
$timeout = 0;
}

		



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

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

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

if(!$poll)

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

if(!$poll)

	{

	{

		error($lang->error_invalidpoll);
}


		error($lang->error_invalidpoll);
}


Zeile 597Zeile 591
		{
// 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 608
		$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 652
		if(trim($options[$i]) != "")
{
$optioncount++;

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

		}
}

		}
}


if(isset($lengtherror))
{


if(isset($lengtherror))
{

Zeile 702Zeile 696
	}

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 725
		"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 754
	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']);

	}

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


$plugins->run_hooks("polls_showresults_start");

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


// Make navigation
build_forum_breadcrumb($fid);

Zeile 808Zeile 802
		{
// 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']] = htmlspecialchars_uni($voter['username']);

		}
}


		}
}


Zeile 869Zeile 863
			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 891
	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 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);


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

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

	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 982
		{
$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 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 1017Zeile 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']));