Vergleich polls.php - 1.6.5 - 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 5538 2011-08-08 09:46:13Z PirataNervo $

 * $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 237Zeile 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';
}
}

			$voteslist .= '0';
}
}

Zeile 300Zeile 300

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


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

Zeile 322Zeile 327
	else
{
// Is our forum closed?

	else
{
// Is our forum closed?

		if ($forum['open'] == 0)

		if($forum['open'] == 0)

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

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

	}

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


	}






if(!$tid)


if(!$tid)

	{

	{

		error($lang->error_invalidthread);
}


		error($lang->error_invalidthread);
}


	if(!is_moderator($fid, "caneditposts"))
{
error_no_permission();
}


	if(!is_moderator($fid, "caneditposts"))
{
error_no_permission();
}


	$polldate = my_date($mybb->settings['dateformat'], $poll['dateline']);
if(!$mybb->input['preview'] && !$mybb->input['updateoptions'])
{

	$polldate = my_date($mybb->settings['dateformat'], $poll['dateline']);
if(!$mybb->input['preview'] && !$mybb->input['updateoptions'])
{

Zeile 352Zeile 353
		}

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

		}

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

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


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


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

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

Zeile 379Zeile 380
			$option = $optionsarray[$i];
$option = htmlspecialchars_uni($option);
$optionvotes = intval($votesarray[$i]);

			$option = $optionsarray[$i];
$option = htmlspecialchars_uni($option);
$optionvotes = intval($votesarray[$i]);

			
if(!$optionvotes)

			
if(!$optionvotes)

			{
$optionvotes = 0;
}

			{
$optionvotes = 0;
}

Zeile 417Zeile 418

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


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

		{

		{

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


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


Zeile 442Zeile 443
			$optionvotes = $votes[$i];

if(!$optionvotes)

			$optionvotes = $votes[$i];

if(!$optionvotes)

			{

			{

				$optionvotes = 0;
}

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

				$optionvotes = 0;
}

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


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

Zeile 490Zeile 496
	else
{
// Is our forum closed?

	else
{
// Is our forum closed?

		if ($forum['open'] == 0)

		if($forum['open'] == 0)

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

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


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

 

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


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

Zeile 569Zeile 572
	$voteslist = '';
$numvotes = '';
$votes = $mybb->input['votes'];

	$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 602Zeile 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 611Zeile 614
	);

$plugins->run_hooks("polls_do_editpoll_process");

	);

$plugins->run_hooks("polls_do_editpoll_process");





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

$plugins->run_hooks("polls_do_editpoll_end");

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

$plugins->run_hooks("polls_do_editpoll_end");

Zeile 627Zeile 630
{
$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);
}


	$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 642Zeile 651
	$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)
{
error($lang->error_pollpermissions);
}

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


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

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

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

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

Zeile 664Zeile 673
	add_breadcrumb($lang->nav_pollresults);

$voters = array();

	add_breadcrumb($lang->nav_pollresults);

$voters = array();





	// Calculate votes
$query = $db->query("
SELECT v.*, u.username

	// Calculate votes
$query = $db->query("
SELECT v.*, u.username

Zeile 725Zeile 734
		{
$optionbg = 'trow1';
$votestar = '';

		{
$optionbg = 'trow1';
$votestar = '';

		}


		}


		if($votes == '0')
{
$percent = '0';

		if($votes == '0')
{
$percent = '0';

Zeile 749Zeile 758
				{
$userlist .= $comma.build_profile_link($username, $uid);
$comma = $guest_comma = $lang->comma;

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

				}
}


				}
}


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

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

Zeile 872Zeile 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 940Zeile 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'])
{

	
if(!$poll['pid'])
{

Zeile 1061Zeile 1079

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


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



 
?>

?>