Vergleich polls.php - 1.6.0 - 1.6.5

  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: 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();
}


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


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

Zeile 114Zeile 130
	}

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

	}

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

	{

	{

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

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

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 151Zeile 183
	}

if($thread['poll'])

	}

if($thread['poll'])

	{

	{

		error($lang->error_pollalready);
}


		error($lang->error_pollalready);
}


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

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

	}

	}

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

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

Zeile 251Zeile 283
	$plugins->run_hooks("polls_do_newpoll_end");

if($thread['visible'] == 1)

	$plugins->run_hooks("polls_do_newpoll_end");

if($thread['visible'] == 1)

	{

	{

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

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

	}

	}

	else
{

	else
{

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

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

	}
}

	}
}





if($mybb->input['action'] == "editpoll")
{
$pid = intval($mybb->input['pid']);

$plugins->run_hooks("polls_editpoll_start");

if($mybb->input['action'] == "editpoll")
{
$pid = intval($mybb->input['pid']);

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


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






	if(!$tid)
{
error($lang->error_invalidthread);

	if(!$tid)
{
error($lang->error_invalidthread);

	}


	}


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

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

	{

	{

		error_no_permission();
}


		error_no_permission();
}


Zeile 302Zeile 349
		if($poll['closed'] == 1)
{
$postoptionschecked['closed'] = 'checked="checked"';

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

		}

		}

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

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

Zeile 327Zeile 374
		$numoptions = $poll['numoptions'];
$optionbits = "";
for($i = 0; $i < $numoptions; ++$i)

		$numoptions = $poll['numoptions'];
$optionbits = "";
for($i = 0; $i < $numoptions; ++$i)

		{

		{

			$counter = $i + 1;
$option = $optionsarray[$i];
$option = htmlspecialchars_uni($option);

			$counter = $i + 1;
$option = $optionsarray[$i];
$option = htmlspecialchars_uni($option);

Zeile 350Zeile 397
		else
{
$timeout = $poll['timeout'];

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

		}
}
else

		}
}
else

	{
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";
}
else
{
$numoptions = $mybb->input['numoptions'];

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

		}

		}

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

		}

		}

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

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

Zeile 401Zeile 448
			
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 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);

if($thread['visible'] == 0 || !$thread['tid'])
{
error($lang->error_invalidthread);

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

if($thread['visible'] == 0 || !$thread['tid'])
{
error($lang->error_invalidthread);

	}

	}

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

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

	{

	{

		error_no_permission();

		error_no_permission();

	}

	}


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


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

	{

	{

		$numoptions = 2;

		$numoptions = 2;

	}

	}

	else

	else

	{

	{

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


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


Zeile 464Zeile 527
	if($postoptions['multiple'] != '1')
{
$postoptions['multiple'] = 0;

	if($postoptions['multiple'] != '1')
{
$postoptions['multiple'] = 0;

	}


	}


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

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

	{

	{

		$postoptions['public'] = 0;
}


		$postoptions['public'] = 0;
}


Zeile 477Zeile 540
	}
$optioncount = "0";
$options = $mybb->input['options'];

	}
$optioncount = "0";
$options = $mybb->input['options'];





	for($i = 1; $i <= $numoptions; ++$i)
{
if(trim($options[$i]) != '')

	for($i = 1; $i <= $numoptions; ++$i)
{
if(trim($options[$i]) != '')

		{

		{

			$optioncount++;
}


			$optioncount++;
}


Zeile 489Zeile 552
		{
$lengtherror = 1;
break;

		{
$lengtherror = 1;
break;

		}
}

		}
}

	
if($lengtherror)
{

	
if($lengtherror)
{

Zeile 527Zeile 590
	}

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

	}

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

	{

	{

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

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

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

	

	

	$modlogdata['fid'] = $thread['fid'];
$modlogdata['tid'] = $thread['tid'];
log_moderator_action($modlogdata, $lang->poll_edited);

	$modlogdata['fid'] = $thread['fid'];
$modlogdata['tid'] = $thread['tid'];
log_moderator_action($modlogdata, $lang->poll_edited);

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

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

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

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;

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

Zeile 745Zeile 811
	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 752Zeile 834
	if($poll['closed'] == 1 || $thread['closed'] == 1 || ($expiretime < $now && $poll['timeout']))
{
error($lang->error_pollclosed);

	if($poll['closed'] == 1 || $thread['closed'] == 1 || ($expiretime < $now && $poll['timeout']))
{
error($lang->error_pollclosed);

	}


	}


	if(!isset($mybb->input['option']))
{
error($lang->error_nopolloptions);

	if(!isset($mybb->input['option']))
{
error($lang->error_nopolloptions);

Zeile 773Zeile 855
	elseif(!$mybb->user['uid'])
{
// Give a cookie to guests to inhibit revotes

	elseif(!$mybb->user['uid'])
{
// Give a cookie to guests to inhibit revotes

		$votes_cookie = implode(',', array_keys($mybb->input['option']));










		if(is_array($mybb->input['option']))
{
// We have multiple options here...
$votes_cookie = implode(',', array_keys($mybb->input['option']));
}
else
{
$votes_cookie = $mybb->input['option'];
}


		my_setcookie("pollvotes[{$poll['pid']}]", $votes_cookie);
}


		my_setcookie("pollvotes[{$poll['pid']}]", $votes_cookie);
}


Zeile 816Zeile 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 829Zeile 920
	);

$plugins->run_hooks("polls_vote_process");

	);

$plugins->run_hooks("polls_vote_process");





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

Zeile 854Zeile 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;