Vergleich polls.php - 1.6.4 - 1.6.6

  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 5486 2011-07-12 01:55:58Z jammerx2 $

 * $Id: polls.php 5538 2011-08-08 09:46:13Z PirataNervo $

 */

define("IN_MYBB", 1);

 */

define("IN_MYBB", 1);

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


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

		error_no_permission();

	}

	}


if($thread['poll'])
{


if($thread['poll'])
{

Zeile 74Zeile 90
	}

// Sanitize number of poll options

	}

// Sanitize number of poll options

	if($mybb->input['numpolloptions'] > 0)
{
$mybb->input['polloptions'] = $mybb->input['numpolloptions'];
}

	if($mybb->input['numpolloptions'] > 0)
{
$mybb->input['polloptions'] = $mybb->input['numpolloptions'];
}

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

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

	}

	}

	elseif($mybb->input['polloptions'] < 2)
{ // Too small
$polloptions = 2;

	elseif($mybb->input['polloptions'] < 2)
{ // Too small
$polloptions = 2;

Zeile 89Zeile 105
	else
{ // Just right
$polloptions = intval($mybb->input['polloptions']);

	else
{ // Just right
$polloptions = intval($mybb->input['polloptions']);

	}


	}


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

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

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

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

	{

	{

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

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

	}


	}


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

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

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

Zeile 153Zeile 185
	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['multiple'] = 0;


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

	}

	}


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


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

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

		{
$lengtherror = 1;
break;

		}
}


		}
}


	if($lengtherror)

	if($lengtherror)

	{

	{

		error($lang->error_polloptiontoolong);

		error($lang->error_polloptiontoolong);

	}

	}

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

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

	}


	}


	$optionslist = '';
$voteslist = '';
for($i = 1; $i <= $optioncount; ++$i)

	$optionslist = '';
$voteslist = '';
for($i = 1; $i <= $optioncount; ++$i)

Zeile 254Zeile 286
	{
redirect(get_thread_link($thread['tid']), $lang->redirect_pollposted);
}

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

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

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

}

if($mybb->input['action'] == "editpoll")

}

if($mybb->input['action'] == "editpoll")

Zeile 278Zeile 310
	build_forum_breadcrumb($fid);
add_breadcrumb(htmlspecialchars_uni($thread['subject']), get_thread_link($thread['tid']));
add_breadcrumb($lang->nav_editpoll);

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

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


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


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

Zeile 307Zeile 354
		if($poll['multiple'] == 1)
{
$postoptionschecked['multiple'] = 'checked="checked"';

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

		}

		}

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

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

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

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

			

			

			if(!$optionvotes)
{
$optionvotes = 0;

			if(!$optionvotes)
{
$optionvotes = 0;

Zeile 357Zeile 404
		if($mybb->settings['maxpolloptions'] && $mybb->input['numoptions'] > $mybb->settings['maxpolloptions'])
{
$numoptions = $mybb->settings['maxpolloptions'];

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

		}

		}

		elseif($mybb->input['numoptions'] < 2)

		elseif($mybb->input['numoptions'] < 2)

		{

		{

			$numoptions = "2";

			$numoptions = "2";

		}

		}

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

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

Zeile 370Zeile 417

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


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

		{

		{

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

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

		}

		}

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

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

		{

		{

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

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

		}

		}

		
if($postoptions['closed'] == 1)
{
$postoptionschecked['closed'] = 'checked="checked"';

		
if($postoptions['closed'] == 1)
{
$postoptionschecked['closed'] = 'checked="checked"';

		}


		}


		$options = $mybb->input['options'];
$votes = $mybb->input['votes'];
$optionbits = '';

		$options = $mybb->input['options'];
$votes = $mybb->input['votes'];
$optionbits = '';

Zeile 408Zeile 455
			$timeout = $mybb->input['timeout'];
}
else

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

		{

		{

			$timeout = 0;
}
}

			$timeout = 0;
}
}

Zeile 433Zeile 480
	$thread = $db->fetch_array($query);

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

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

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

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


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


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

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

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

	}


	}


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

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

	}

	}

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

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

Zeile 472Zeile 535
	}

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

	}

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

	{

	{

		$postoptions['closed'] = 0;
}
$optioncount = "0";

		$postoptions['closed'] = 0;
}
$optioncount = "0";

Zeile 498Zeile 561
	}

if(trim($mybb->input['question']) == '' || $optioncount < 2)

	}

if(trim($mybb->input['question']) == '' || $optioncount < 2)

	{

	{

		error($lang->error_noquestionoptions);
}


		error($lang->error_noquestionoptions);
}


Zeile 561Zeile 624
}

if($mybb->input['action'] == "showresults")

}

if($mybb->input['action'] == "showresults")

{

{

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

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

Zeile 574Zeile 637
	if(!$forum)
{
error($lang->error_invalidforum);

	if(!$forum)
{
error($lang->error_invalidforum);

	}

	}


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



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


Zeile 599Zeile 662
	build_forum_breadcrumb($fid);
add_breadcrumb(htmlspecialchars_uni($thread['subject']), get_thread_link($thread['tid']));
add_breadcrumb($lang->nav_pollresults);

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





	$voters = array();

// Calculate votes

	$voters = array();

// Calculate votes

Zeile 623Zeile 686
		{
// 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']] = $voter['username'];
}
}

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

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

		}

		}

		
if($votes == '0')
{

		
if($votes == '0')
{

Zeile 686Zeile 749
				{
$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 739Zeile 802
	$thread = $db->fetch_array($query);

if(!$thread['tid'])

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

if(!$thread['tid'])

	{

	{

		error($lang->error_invalidthread);

		error($lang->error_invalidthread);

	}


	}


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

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

	{

	{

		error_no_permission();

		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 764Zeile 843
	
// 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);
}

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

Zeile 777Zeile 856
	{
// Give a cookie to guests to inhibit revotes
if(is_array($mybb->input['option']))

	{
// 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 815Zeile 894
		if(!isset($votesarray[$option-1]))
{
error($lang->error_nopolloptions);

		if(!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;

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

Zeile 828Zeile 907
	");
$voteslist = '';
for($i = 1; $i <= $poll['numoptions']; ++$i)

	");
$voteslist = '';
for($i = 1; $i <= $poll['numoptions']; ++$i)

	{

	{

		if($i > 1)
{
$voteslist .= "||~|~||";

		if($i > 1)
{
$voteslist .= "||~|~||";

Zeile 866Zeile 945
	{
error($lang->error_invalidpoll);
}

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