Vergleich polls.php - 1.8.16 - 1.8.38

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 29Zeile 29
}
else
{

}
else
{

 
	$username = '';

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


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


Zeile 52Zeile 53
	$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?


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

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


	$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))
{
error($lang->error_invalidthread);
}

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





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

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





	// Get forum info
$forum = get_forum($fid);
if(!$forum)
{
error($lang->error_invalidforum);

	// Get forum info
$forum = get_forum($fid);
if(!$forum)
{
error($lang->error_invalidforum);

	}

	}

	else
{
// Is our forum closed?

	else
{
// Is our forum closed?

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

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

		}
}

		}
}

	// 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 91Zeile 92

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

	{

	{

		error_no_permission();

		error_no_permission();

	}

	}


if($thread['poll'])
{
error($lang->error_pollalready);


if($thread['poll'])
{
error($lang->error_pollalready);

	}


	}


	$time = TIME_NOW;
if($thread['dateline'] < ($time-($mybb->settings['polltimelimit']*60*60)) && $mybb->settings['polltimelimit'] != 0 && $ismod == false)
{

	$time = TIME_NOW;
if($thread['dateline'] < ($time-($mybb->settings['polltimelimit']*60*60)) && $mybb->settings['polltimelimit'] != 0 && $ismod == false)
{

Zeile 159Zeile 160
	else
{
$timeout = 0;

	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)

	{

	{

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

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

	}

	}

	else
{
$maxoptions = 0;

	else
{
$maxoptions = 0;

Zeile 176Zeile 177
	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");

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

	$plugins->run_hooks("polls_do_newpoll_start");

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

Zeile 204Zeile 205
		{
// 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
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 236Zeile 237
	}

if($polloptions < 2)

	}

if($polloptions < 2)

	{

	{

		$polloptions = "2";
}
$optioncount = "0";

		$polloptions = "2";
}
$optioncount = "0";

Zeile 264Zeile 265
		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 297Zeile 298
			}
$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);
}
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 554Zeile 555
}

if($mybb->input['action'] == "do_editpoll" && $mybb->request_method == "post")

}

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

if(!$poll)

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

if(!$poll)

	{
error($lang->error_invalidpoll);
}

	{
error($lang->error_invalidpoll);
}

Zeile 595Zeile 596
	}

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

	{

	{

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

	}


	}


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

Zeile 690Zeile 691
			{
$votes[$i] = "0";
}

			{
$votes[$i] = "0";
}

			$voteslist .= $votes[$i];

			$voteslist .= (int)$votes[$i];

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

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

		}

		}

	}

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

	}

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

Zeile 773Zeile 774
	{
error_no_permission();
}

	{
error_no_permission();
}





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


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


	$voters = $votedfor = array();

	$voters = $votedfor = $guest_voters = array();


// Calculate votes
$query = $db->query("


// Calculate votes
$query = $db->query("

Zeile 801Zeile 802
		if($voter['uid'] == 0 || $voter['username'] == '')
{
// Add one to the number of voters for guests

		if($voter['uid'] == 0 || $voter['username'] == '')
{
// Add one to the number of voters for guests

			++$guest_voters[$voter['voteoption']];








			if(isset($guest_voters[$voter['voteoption']]))
{
++$guest_voters[$voter['voteoption']];
}
else
{
$guest_voters[$voter['voteoption']] = 1;
}

		}
else
{

		}
else
{

Zeile 917Zeile 925

$poll['timeout'] = $poll['timeout']*60*60*24;



$poll['timeout'] = $poll['timeout']*60*60*24;


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

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



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


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

Zeile 930Zeile 937
	if($forumpermissions['canvotepolls'] == 0)
{
error_no_permission();

	if($forumpermissions['canvotepolls'] == 0)
{
error_no_permission();

	}

	}


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


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

Zeile 951Zeile 958
	$expiretime = $poll['dateline'] + $poll['timeout'];
$now = TIME_NOW;
if($poll['closed'] == 1 || $thread['closed'] == 1 || ($expiretime < $now && $poll['timeout']))

	$expiretime = $poll['dateline'] + $poll['timeout'];
$now = TIME_NOW;
if($poll['closed'] == 1 || $thread['closed'] == 1 || ($expiretime < $now && $poll['timeout']))

	{

	{

		error($lang->error_pollclosed);
}


		error($lang->error_pollclosed);
}


Zeile 973Zeile 980
	$query = $db->simple_select("pollvotes", "*", "{$user_check} AND pid='".$poll['pid']."'");
$votecheck = $db->fetch_array($query);


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


	if($votecheck['vid'])

	if($votecheck)

	{
error($lang->error_alreadyvoted);
}

	{
error($lang->error_alreadyvoted);
}

Zeile 1032Zeile 1039
	}

if(!$votesql)

	}

if(!$votesql)

	{

	{

		error($lang->error_nopolloptions);
}


		error($lang->error_nopolloptions);
}


Zeile 1064Zeile 1071
	$db->update_query("polls", $updatedpoll, "pid='".$poll['pid']."'");

$plugins->run_hooks("polls_vote_end");

	$db->update_query("polls", $updatedpoll, "pid='".$poll['pid']."'");

$plugins->run_hooks("polls_vote_end");





	redirect(get_thread_link($poll['tid']), $lang->redirect_votethanks);
}


	redirect(get_thread_link($poll['tid']), $lang->redirect_votethanks);
}


Zeile 1076Zeile 1083
	{
error_no_permission();
}

	{
error_no_permission();
}





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


	if(!$poll['pid'])

	if(!$poll)

	{
error($lang->error_invalidpoll);
}

	{
error($lang->error_invalidpoll);
}

Zeile 1151Zeile 1158
	$votesarray = explode("||~|~||", $poll['votes']);
if(count($votesarray) > $poll['numoptions'])
{

	$votesarray = explode("||~|~||", $poll['votes']);
if(count($votesarray) > $poll['numoptions'])
{

		$votesarray = array_slice(0, $poll['numoptions']);

		$votesarray = array_slice($votesarray, 0, $poll['numoptions']);

	}

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

	}

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