Vergleich polls.php - 1.6.1 - 1.6.10

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 6Zeile 6
 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * Website: http://mybb.com
* License: http://mybb.com/about/license
*

 * $Id: polls.php 5125 2010-07-27 07:28:03Z RyanGordon $

 * $Id$

 */

define("IN_MYBB", 1);
define('THIS_SCRIPT', 'polls.php');


 */

define("IN_MYBB", 1);
define('THIS_SCRIPT', 'polls.php');


$templatelist = "poll_newpoll,redirect_pollposted,redirect_pollupdated,redirect_votethanks";

$templatelist = "changeuserbox,loginbox,polls_newpoll_option,polls_newpoll,polls_editpoll_option,polls_editpoll,polls_showresults_resultbit,polls_showresults";

require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/class_parser.php";

require_once "./global.php";
require_once MYBB_ROOT."inc/functions_post.php";
require_once MYBB_ROOT."inc/class_parser.php";

Zeile 52Zeile 52
	$thread = $db->fetch_array($query);
$fid = $thread['fid'];
$forumpermissions = forum_permissions($fid);

	$thread = $db->fetch_array($query);
$fid = $thread['fid'];
$forumpermissions = forum_permissions($fid);

 
	
// Get forum info
$forum = get_forum($fid);
if(!$forum)
{
error($lang->error_invalidforum);
}
else
{
// Is our forum closed?
if ($forum['open'] == 0)
{
// Doesn't look like it is
error($lang->error_closedinvalidforum);
}
}


if(!$thread['tid'])
{


if(!$thread['tid'])
{

Zeile 61Zeile 77
	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)) || ($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $forumpermissions['canpostpolls'] == 0))
{
error_no_permission();


// 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)) || ($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $forumpermissions['canpostpolls'] == 0))
{
error_no_permission();

	}

if($thread['poll'])

	}

if($thread['poll'])

Zeile 120Zeile 136
	else
{
$timeout = 0;

	else
{
$timeout = 0;

	}


	}


	$plugins->run_hooks("polls_newpoll_end");

eval("\$newpoll = \"".$templates->get("polls_newpoll")."\";");

	$plugins->run_hooks("polls_newpoll_end");

eval("\$newpoll = \"".$templates->get("polls_newpoll")."\";");

Zeile 138Zeile 154
	$thread = $db->fetch_array($query);
$fid = $thread['fid'];
$forumpermissions = forum_permissions($fid);

	$thread = $db->fetch_array($query);
$fid = $thread['fid'];
$forumpermissions = forum_permissions($fid);

 
	
// Get forum info
$forum = get_forum($fid);
if(!$forum)
{
error($lang->error_invalidforum);
}
else
{
// Is our forum closed?
if ($forum['open'] == 0)
{
// Doesn't look like it is
error($lang->error_closedinvalidforum);
}
}


if(!$thread['tid'])


if(!$thread['tid'])

	{

	{

		error($lang->error_invalidthread);
}


		error($lang->error_invalidthread);
}


Zeile 148Zeile 180
	if(($thread['uid'] != $mybb->user['uid'] && !is_moderator($fid)) || ($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $forumpermissions['canpostpolls'] == 0))
{
error_no_permission();

	if(($thread['uid'] != $mybb->user['uid'] && !is_moderator($fid)) || ($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $forumpermissions['canpostpolls'] == 0))
{
error_no_permission();

	}


	}


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

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

	}


	}


	$polloptions = $mybb->input['polloptions'];
if($mybb->settings['maxpolloptions'] && $polloptions > $mybb->settings['maxpolloptions'])
{
$polloptions = $mybb->settings['maxpolloptions'];

	$polloptions = $mybb->input['polloptions'];
if($mybb->settings['maxpolloptions'] && $polloptions > $mybb->settings['maxpolloptions'])
{
$polloptions = $mybb->settings['maxpolloptions'];

	}

$postoptions = $mybb->input['postoptions'];
if($postoptions['multiple'] != '1')

	}

$postoptions = $mybb->input['postoptions'];
if($postoptions['multiple'] != '1')

	{
$postoptions['multiple'] = 0;
}

	{
$postoptions['multiple'] = 0;
}

Zeile 190Zeile 222
		{
$lengtherror = 1;
break;

		{
$lengtherror = 1;
break;

		}

		}

	}

if($lengtherror)

	}

if($lengtherror)

Zeile 205Zeile 237
	
$optionslist = '';
$voteslist = '';

	
$optionslist = '';
$voteslist = '';

	for($i = 1; $i <= $optioncount; ++$i)

	for($i = 1; $i <= $polloptions; ++$i)

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

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

			if($i > 1)

			if($optionslist != '')

			{
$optionslist .= '||~|~||';
$voteslist .= '||~|~||';
}

			{
$optionslist .= '||~|~||';
$voteslist .= '||~|~||';
}

			$optionslist .= $options[$i];

			$optionslist .= trim($options[$i]);

			$voteslist .= '0';
}
}

if($mybb->input['timeout'] > 0)

			$voteslist .= '0';
}
}

if($mybb->input['timeout'] > 0)

	{

	{

		$timeout = intval($mybb->input['timeout']);
}
else

		$timeout = intval($mybb->input['timeout']);
}
else

Zeile 256Zeile 288
	}
else
{

	}
else
{

		redirect(get_forum_link($forum['fid']), $lang->redirect_pollpostedmoderated);

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

	}
}


	}
}


Zeile 264Zeile 296
{
$pid = intval($mybb->input['pid']);


{
$pid = intval($mybb->input['pid']);


	$plugins->run_hooks("polls_editpoll_start");


	$plugins->run_hooks("polls_editpoll_start");


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

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

 
	
if(!$poll['pid'])
{
error($lang->error_invalidpoll);
}


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


$query = $db->simple_select("threads", "*", "poll='$pid'");
$thread = $db->fetch_array($query);
$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);

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


$forumpermissions = forum_permissions($fid);


$forumpermissions = forum_permissions($fid);


$query = $db->simple_select("forums", "*", "fid='$fid'");
$forum = $db->fetch_array($query);














	
// Get forum info
$forum = get_forum($fid);
if(!$forum)
{
error($lang->error_invalidforum);
}
else
{
// Is our forum closed?
if($forum['open'] == 0)
{
// Doesn't look like it is
error($lang->error_closedinvalidforum);
}
}


if(!$tid)
{


if(!$tid)
{

Zeile 292Zeile 340
	}

if(!is_moderator($fid, "caneditposts"))

	}

if(!is_moderator($fid, "caneditposts"))

	{

	{

		error_no_permission();
}


		error_no_permission();
}


Zeile 300Zeile 348
	if(!$mybb->input['preview'] && !$mybb->input['updateoptions'])
{
if($poll['closed'] == 1)

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

		{

		{

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

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

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

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

		{
$postoptionschecked['multiple'] = 'checked="checked"';

		{
$postoptionschecked['multiple'] = 'checked="checked"';

		}

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

		}

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

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

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

		}
else

		}
else

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

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

Zeile 361Zeile 409
		elseif($mybb->input['numoptions'] < 2)
{
$numoptions = "2";

		elseif($mybb->input['numoptions'] < 2)
{
$numoptions = "2";

		}

		}

		else

		else

		{

		{

			$numoptions = $mybb->input['numoptions'];

			$numoptions = $mybb->input['numoptions'];

		}

		}

		$question = htmlspecialchars_uni($mybb->input['question']);

$postoptions = $mybb->input['postoptions'];

		$question = htmlspecialchars_uni($mybb->input['question']);

$postoptions = $mybb->input['postoptions'];

Zeile 375Zeile 423
		}

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

		}

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

		{

		{

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

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

		}

		}

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

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

Zeile 388Zeile 436
		$votes = $mybb->input['votes'];
$optionbits = '';
for($i = 1; $i <= $numoptions; ++$i)

		$votes = $mybb->input['votes'];
$optionbits = '';
for($i = 1; $i <= $numoptions; ++$i)

		{

		{

			$counter = $i;
$option = $options[$i];
$option = htmlspecialchars_uni($option);

			$counter = $i;
$option = $options[$i];
$option = htmlspecialchars_uni($option);

Zeile 401Zeile 449
			
eval("\$optionbits .= \"".$templates->get("polls_editpoll_option")."\";");
$option = "";

			
eval("\$optionbits .= \"".$templates->get("polls_editpoll_option")."\";");
$option = "";

		}


		}


		if($mybb->input['timeout'] > 0)
{
$timeout = $mybb->input['timeout'];

		if($mybb->input['timeout'] > 0)
{
$timeout = $mybb->input['timeout'];

Zeile 428Zeile 476

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


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

 
	
if(!$poll['pid'])
{
error($lang->error_invalidpoll);
}


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

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


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

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


$query = $db->simple_select("forums", "*", "fid='".$thread['fid']."'");
$forum = $db->fetch_array($query);














	
// Get forum info
$forum = get_forum($thread['fid']);
if(!$forum)
{
error($lang->error_invalidforum);
}
else
{
// Is our forum closed?
if($forum['open'] == 0)
{
// Doesn't look like it is
error($lang->error_closedinvalidforum);
}
}


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


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

Zeile 445Zeile 511
	if(!is_moderator($thread['fid'], "caneditposts"))
{
error_no_permission();

	if(!is_moderator($thread['fid'], "caneditposts"))
{
error_no_permission();

	}


	}


	if($mybb->settings['maxpolloptions'] && $mybb->input['numoptions'] > $mybb->settings['maxpolloptions'])

	if($mybb->settings['maxpolloptions'] && $mybb->input['numoptions'] > $mybb->settings['maxpolloptions'])

	{

	{

		$numoptions = $mybb->settings['maxpolloptions'];
}
elseif(!$mybb->input['numoptions'])
{
$numoptions = 2;

		$numoptions = $mybb->settings['maxpolloptions'];
}
elseif(!$mybb->input['numoptions'])
{
$numoptions = 2;

	}

	}

	else
{
$numoptions = $mybb->input['numoptions'];

	else
{
$numoptions = $mybb->input['numoptions'];

	}


	}


	$postoptions = $mybb->input['postoptions'];
if($postoptions['multiple'] != '1')
{

	$postoptions = $mybb->input['postoptions'];
if($postoptions['multiple'] != '1')
{

Zeile 500Zeile 566
	if(trim($mybb->input['question']) == '' || $optioncount < 2)
{
error($lang->error_noquestionoptions);

	if(trim($mybb->input['question']) == '' || $optioncount < 2)
{
error($lang->error_noquestionoptions);

	}

	}

	
$optionslist = '';
$voteslist = '';
$numvotes = '';
$votes = $mybb->input['votes'];

	
$optionslist = '';
$voteslist = '';
$numvotes = '';
$votes = $mybb->input['votes'];

	for($i = 1; $i <= $optioncount; ++$i)

	for($i = 1; $i <= $numoptions; ++$i)

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

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

			if($i > 1)

			if($optionslist != '')

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


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


			$optionslist .= $options[$i];

			$optionslist .= trim($options[$i]);

			if(intval($votes[$i]) <= 0)
{
$votes[$i] = "0";

			if(intval($votes[$i]) <= 0)
{
$votes[$i] = "0";

Zeile 531Zeile 597
		$timeout = intval($mybb->input['timeout']);
}
else

		$timeout = intval($mybb->input['timeout']);
}
else

	{

	{

		$timeout = 0;
}


		$timeout = 0;
}


Zeile 539Zeile 605
		"question" => $db->escape_string($mybb->input['question']),
"options" => $db->escape_string($optionslist),
"votes" => $db->escape_string($voteslist),

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

		"numoptions" => intval($numoptions),

		"numoptions" => intval($optioncount),

		"numvotes" => $numvotes,
"timeout" => $timeout,
"closed" => $postoptions['closed'],

		"numvotes" => $numvotes,
"timeout" => $timeout,
"closed" => $postoptions['closed'],

Zeile 547Zeile 613
		"public" => $postoptions['public']
);


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


	$plugins->run_hooks("polls_do_editpoll_process");

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

	$plugins->run_hooks("polls_do_editpoll_process");

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


$plugins->run_hooks("polls_do_editpoll_end");



$plugins->run_hooks("polls_do_editpoll_end");


Zeile 559Zeile 625

redirect(get_thread_link($thread['tid']), $lang->redirect_pollupdated);
}


redirect(get_thread_link($thread['tid']), $lang->redirect_pollupdated);
}





if($mybb->input['action'] == "showresults")
{
$query = $db->simple_select("polls", "*", "pid='".intval($mybb->input['pid'])."'");
$poll = $db->fetch_array($query);

if($mybb->input['action'] == "showresults")
{
$query = $db->simple_select("polls", "*", "pid='".intval($mybb->input['pid'])."'");
$poll = $db->fetch_array($query);

 
	
if(!$poll['pid'])
{
error($lang->error_invalidpoll);
}


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

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

Zeile 580Zeile 652

$plugins->run_hooks("polls_showresults_start");



$plugins->run_hooks("polls_showresults_start");


	if($forumpermissions['canviewthreads'] == 0 || $forumpermissions['canview'] == 0)

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

	{

	{

		error($lang->error_pollpermissions);

		error_no_permission();

	}

if(!$poll['pid'])

	}

if(!$poll['pid'])

Zeile 616Zeile 688
		if($mybb->user['uid'] == $voter['uid'] && $mybb->user['uid'])
{
$votedfor[$voter['voteoption']] = 1;

		if($mybb->user['uid'] == $voter['uid'] && $mybb->user['uid'])
{
$votedfor[$voter['voteoption']] = 1;

		}

		}


// Count number of guests and users without a username (assumes they've been deleted)
if($voter['uid'] == 0 || $voter['username'] == '')


// Count number of guests and users without a username (assumes they've been deleted)
if($voter['uid'] == 0 || $voter['username'] == '')

		{

		{

			// 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
{
$voters[$voter['voteoption']][$voter['uid']] = $voter['username'];

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

		}
}

		}
}

	
$optionsarray = explode("||~|~||", $poll['options']);
$votesarray = explode("||~|~||", $poll['votes']);

	
$optionsarray = explode("||~|~||", $poll['options']);
$votesarray = explode("||~|~||", $poll['votes']);

Zeile 654Zeile 726
		$number = $i;
// Make the mark for current user's voted option
if($votedfor[$number])

		$number = $i;
// Make the mark for current user's voted option
if($votedfor[$number])

		{

		{

			$optionbg = 'trow2';
$votestar = '*';
}

			$optionbg = 'trow2';
$votestar = '*';
}

Zeile 692Zeile 764
			if($guest_voters[$number] > 0)
{
if($guest_voters[$number] == 1)

			if($guest_voters[$number] > 0)
{
if($guest_voters[$number] == 1)

				{

				{

					$userlist .= $guest_comma.$lang->guest_count;
}
else

					$userlist .= $guest_comma.$lang->guest_count;
}
else

Zeile 705Zeile 777
	}

if($poll['totvotes'])

	}

if($poll['totvotes'])

	{

	{

		$totpercent = '100%';

		$totpercent = '100%';

	}

	}

	else
{
$totpercent = '0%';
}

$plugins->run_hooks("polls_showresults_end");

	else
{
$totpercent = '0%';
}

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

}
if($mybb->input['action'] == "vote")
{
$query = $db->simple_select("polls", "*", "pid='".intval($mybb->input['pid'])."'");
$poll = $db->fetch_array($query);
$poll['timeout'] = $poll['timeout']*60*60*24;

$plugins->run_hooks("polls_vote_start");

if(!$poll['pid'])




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

$query = $db->simple_select("polls", "*", "pid='".intval($mybb->input['pid'])."'");
$poll = $db->fetch_array($query);
$poll['timeout'] = $poll['timeout']*60*60*24;

$plugins->run_hooks("polls_vote_start");

if(!$poll['pid'])

	{
error($lang->error_invalidpoll);
}

	{
error($lang->error_invalidpoll);
}

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

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

 
	}

// Get forum info
$forum = get_forum($fid);
if(!$forum)
{
error($lang->error_invalidforum);
}
else
{
// Is our forum closed?
if ($forum['open'] == 0)
{
// Doesn't look like it is
error($lang->error_closedinvalidforum);
}

	}

$expiretime = $poll['dateline'] + $poll['timeout'];

	}

$expiretime = $poll['dateline'] + $poll['timeout'];

Zeile 755Zeile 846
	}

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

Zeile 767Zeile 858
	}

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 777Zeile 868
		{
// 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']));

		}

		}

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

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

Zeile 790Zeile 881
	$now = TIME_NOW;
$votesarray = explode("||~|~||", $poll['votes']);
$option = $mybb->input['option'];

	$now = TIME_NOW;
$votesarray = explode("||~|~||", $poll['votes']);
$option = $mybb->input['option'];

	$numvotes = $poll['numvotes'];

	$numvotes = (int)$poll['numvotes'];

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

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

		foreach($option as $voteoption => $vote)

		if(is_array($option))

		{

		{

			if($vote == 1 && isset($votesarray[$voteoption-1]))

			foreach($option as $voteoption => $vote)

			{

			{

				if($votesql)

				if($vote == 1 && isset($votesarray[$voteoption-1]))

				{

				{

					$votesql .= ",";







					if($votesql)
{
$votesql .= ",";
}
$votesql .= "('".$poll['pid']."','".$mybb->user['uid']."','".$db->escape_string($voteoption)."','$now')";
$votesarray[$voteoption-1]++;
$numvotes = $numvotes+1;

				}

				}

				$votesql .= "('".$poll['pid']."','".$mybb->user['uid']."','".$db->escape_string($voteoption)."','$now')";
$votesarray[$voteoption-1]++;
$numvotes = $numvotes+1;

 
			}

			}

		}

		}

	}
else

	}
else

	{
if(!isset($votesarray[$option-1]))

	{
if(is_array($option) || !isset($votesarray[$option-1]))

		{
error($lang->error_nopolloptions);
}
$votesql = "('".$poll['pid']."','".$mybb->user['uid']."','".$db->escape_string($option)."','$now')";
$votesarray[$option-1]++;
$numvotes = $numvotes+1;

		{
error($lang->error_nopolloptions);
}
$votesql = "('".$poll['pid']."','".$mybb->user['uid']."','".$db->escape_string($option)."','$now')";
$votesarray[$option-1]++;
$numvotes = $numvotes+1;

 
	}

if(!$votesql)
{
error($lang->error_nopolloptions);

	}

$db->write_query("

	}

$db->write_query("

Zeile 858Zeile 957
	
$query = $db->simple_select("polls", "*", "pid='".intval($mybb->input['pid'])."'");
$poll = $db->fetch_array($query);

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

 
	$poll['numvotes'] = (int)$poll['numvotes'];

	
if(!$poll['pid'])
{
error($lang->error_invalidpoll);
}

	
if(!$poll['pid'])
{
error($lang->error_invalidpoll);
}

 
	
// 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
$query = $db->simple_select("threads", "*", "tid='".intval($poll['tid'])."'");
$thread = $db->fetch_array($query);
$fid = $thread['fid'];

// Get forum info
$forum = get_forum($fid);
if(!$forum)
{
error($lang->error_invalidforum);
}
else
{
// Is our forum closed?
if ($forum['open'] == 0)
{
// Doesn't look like it is
error($lang->error_closedinvalidforum);
}
}


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



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



Zeile 886Zeile 1009
	{
// for Guests, we simply see if they've got the cookie
$vote_options = explode(',', $mybb->cookies['pollvotes'][$poll['pid']]);

	{
// for Guests, we simply see if they've got the cookie
$vote_options = explode(',', $mybb->cookies['pollvotes'][$poll['pid']]);

	}

	}

	$votecheck = !empty($vote_options);

if(!$votecheck)

	$votecheck = !empty($vote_options);

if(!$votecheck)

Zeile 898Zeile 1021
		// clear cookie for Guests
my_setcookie("pollvotes[{$poll['pid']}]", "");
}

		// clear cookie for Guests
my_setcookie("pollvotes[{$poll['pid']}]", "");
}

	

	

	// Note, this is not thread safe!
$votesarray = explode("||~|~||", $poll['votes']);
if(count($votesarray) > $poll['numoptions'])

	// Note, this is not thread safe!
$votesarray = explode("||~|~||", $poll['votes']);
if(count($votesarray) > $poll['numoptions'])

Zeile 909Zeile 1032
	if($poll['multiple'] == 1)
{
foreach($vote_options as $vote)

	if($poll['multiple'] == 1)
{
foreach($vote_options as $vote)

		{

		{

			if(isset($votesarray[$vote-1]))
{
--$votesarray[$vote-1];

			if(isset($votesarray[$vote-1]))
{
--$votesarray[$vote-1];

Zeile 921Zeile 1044
	{
$voteoption = reset($vote_options);
if(isset($votesarray[$voteoption-1]))

	{
$voteoption = reset($vote_options);
if(isset($votesarray[$voteoption-1]))

		{

		{

			--$votesarray[$voteoption-1];
--$poll['numvotes'];
}

			--$votesarray[$voteoption-1];
--$poll['numvotes'];
}

Zeile 956Zeile 1079

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


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



 
?>

?>