Vergleich polls.php - 1.6.2 - 1.6.8

  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 5826 2012-05-04 10:30:10Z Tomm $

 */

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))
{
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->input['polloptions'];
if($mybb->settings['maxpolloptions'] && $polloptions > $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 247Zeile 279
	$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");

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

	$plugins->run_hooks("polls_do_newpoll_end");

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

Zeile 256Zeile 288
	}
else
{

	}
else
{

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

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

	}
}


	}
}


Zeile 272Zeile 304
	$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);

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

	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 433Zeile 476
	$thread = $db->fetch_array($query);

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

	$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 718Zeile 774
	$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($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);

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

Zeile 745Zeile 804
	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 781Zeile 856
		else
{
$votes_cookie = $mybb->input['option'];

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

		}


		}


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


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


Zeile 793Zeile 868
	$numvotes = $poll['numvotes'];
if($poll['multiple'] == 1)
{

	$numvotes = $poll['numvotes'];
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 844Zeile 927
	$plugins->run_hooks("polls_vote_end");

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

	$plugins->run_hooks("polls_vote_end");

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

}


}


if($mybb->input['action'] == "do_undovote")
{
verify_post_check($mybb->input['my_post_key']);

if($mybb->input['action'] == "do_undovote")
{
verify_post_check($mybb->input['my_post_key']);

Zeile 863Zeile 946
	{
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;



Zeile 915Zeile 1021
				--$votesarray[$vote-1];
--$poll['numvotes'];
}

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

		}

		}

	}
else
{

	}
else
{

Zeile 929Zeile 1035
	
// check if anything < 0 - possible if Guest vote undoing is allowed (generally Guest unvoting should be disabled >_>)
if($poll['numvotes'] < 0)

	
// check if anything < 0 - possible if Guest vote undoing is allowed (generally Guest unvoting should be disabled >_>)
if($poll['numvotes'] < 0)

	{

	{

		$poll['numvotes'] = 0;
}


		$poll['numvotes'] = 0;
}


Zeile 956Zeile 1062

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


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



 
?>

?>