Vergleich polls.php - 1.8.15 - 1.8.36

  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?
$ismod = is_moderator($thread['fid']);


	// Is the currently logged in user a moderator of this forum?
$ismod = is_moderator($thread['fid']);


Zeile 64Zeile 65
	if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
{
error($lang->error_invalidthread);

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


Zeile 136Zeile 137
	if(isset($postoptions['public']) && $postoptions['public'] == 1)
{
$postoptionschecked['public'] = 'checked="checked"';

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

	}


	}


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

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

Zeile 150Zeile 151
		$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('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 194Zeile 195
	// Get forum info
$forum = get_forum($fid);
if(!$forum)

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

	{

	{

		error($lang->error_invalidforum);
}
else

		error($lang->error_invalidforum);
}
else

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

	{

	{

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

	}

$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')
{
$postoptions['public'] = 0;
}

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

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

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

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

if(isset($lengtherror))

	}

$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')
{
$postoptions['public'] = 0;
}

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

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

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

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

if(isset($lengtherror))

	{
error($lang->error_polloptiontoolong);
}

	{
error($lang->error_polloptiontoolong);
}

Zeile 307Zeile 308
	else
{
$timeout = 0;

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

	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 335Zeile 336

$plugins->run_hooks("polls_do_newpoll_process");



$plugins->run_hooks("polls_do_newpoll_process");


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



$plugins->run_hooks("polls_do_newpoll_end");


Zeile 348Zeile 349
	else
{
redirect(get_forum_link($thread['fid']), $lang->redirect_pollpostedmoderated);

	else
{
redirect(get_forum_link($thread['fid']), $lang->redirect_pollpostedmoderated);

	}

	}

}

}





if($mybb->input['action'] == "editpoll")
{
$pid = $mybb->get_input('pid', MyBB::INPUT_INT);

if($mybb->input['action'] == "editpoll")
{
$pid = $mybb->get_input('pid', MyBB::INPUT_INT);

Zeile 361Zeile 362
	$poll = $db->fetch_array($query);

if(!$poll)

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

if(!$poll)

	{

	{

		error($lang->error_invalidpoll);

		error($lang->error_invalidpoll);

	}

	}


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


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

Zeile 371Zeile 372
	{
error($lang->error_invalidthread);
}

	{
error($lang->error_invalidthread);
}





	$tid = $thread['tid'];

	$tid = $thread['tid'];

	$fid = $thread['fid'];


	$fid = $thread['fid'];


	// 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 690Zeile 691
			{
$votes[$i] = "0";
}

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

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

			$voteslist .= (int)$votes[$i];
$numvotes = (int)$numvotes + (int)$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

	}
else

	{
$timeout = 0;
}

	{
$timeout = 0;
}

Zeile 711Zeile 712
	else
{
$maxoptions = 0;

	else
{
$maxoptions = 0;

	}


	}


	$updatedpoll = array(
"question" => $db->escape_string($mybb->input['question']),
"options" => $db->escape_string($optionslist),

	$updatedpoll = array(
"question" => $db->escape_string($mybb->input['question']),
"options" => $db->escape_string($optionslist),

Zeile 751Zeile 752

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


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

	if(!$thread)

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

	{
error($lang->error_invalidthread);
}

	{
error($lang->error_invalidthread);
}

Zeile 779Zeile 780
	add_breadcrumb(htmlspecialchars_uni($thread['subject']), get_thread_link($thread['tid']));
add_breadcrumb($lang->nav_pollresults);


	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 899Zeile 907
	eval("\$showresults = \"".$templates->get("polls_showresults")."\";");
output_page($showresults);
}

	eval("\$showresults = \"".$templates->get("polls_showresults")."\";");
output_page($showresults);
}

 


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

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





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


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


Zeile 916Zeile 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'] == 0)

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

	{
error($lang->error_invalidthread);
}

	{
error($lang->error_invalidthread);
}

Zeile 972Zeile 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(!empty($votecheck['vid']))

	{
error($lang->error_alreadyvoted);
}

	{
error($lang->error_alreadyvoted);
}

Zeile 1091Zeile 1099
	// We do not have $forum_cache available here since no forums permissions are checked in undo vote
// Get thread ID and then get forum info
$thread = get_thread($poll['tid']);

	// We do not have $forum_cache available here since no forums permissions are checked in undo vote
// Get thread ID and then get forum info
$thread = get_thread($poll['tid']);

	if(!$thread || $thread['visible'] == 0)

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

	{
error($lang->error_invalidthread);
}

	{
error($lang->error_invalidthread);
}

Zeile 1150Zeile 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)