Vergleich polls.php - 1.8.16 - 1.8.30

  Keine Änderungen   Hinzugefügt   Modifiziert   Entfernt
Zeile 29Zeile 29
}
else
{

}
else
{

 
	$username = '';

	eval("\$loginbox = \"".$templates->get("loginbox")."\";");
}


	eval("\$loginbox = \"".$templates->get("loginbox")."\";");
}


Zeile 52Zeile 53
	$plugins->run_hooks("polls_newpoll_start");

$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));

	$plugins->run_hooks("polls_newpoll_start");

$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));

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


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


	// Is the currently logged in user a moderator of this forum?
$ismod = is_moderator($thread['fid']);


	// Is the currently logged in user a moderator of this forum?
$ismod = is_moderator($thread['fid']);


Zeile 64Zeile 65
	if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
{
error($lang->error_invalidthread);

	if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true))
{
error($lang->error_invalidthread);

	}


	}


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


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


Zeile 136Zeile 137
	if(isset($postoptions['public']) && $postoptions['public'] == 1)
{
$postoptionschecked['public'] = 'checked="checked"';

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

	}


	}


	$options = $mybb->get_input('options', MyBB::INPUT_ARRAY);
$optionbits = '';
for($i = 1; $i <= $polloptions; ++$i)

	$options = $mybb->get_input('options', MyBB::INPUT_ARRAY);
$optionbits = '';
for($i = 1; $i <= $polloptions; ++$i)

Zeile 150Zeile 151
		$option = htmlspecialchars_uni($option);
eval("\$optionbits .= \"".$templates->get("polls_newpoll_option")."\";");
$option = "";

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

	}

if($mybb->get_input('timeout', MyBB::INPUT_INT) > 0)
{
$timeout = $mybb->get_input('timeout', MyBB::INPUT_INT);
}
else
{
$timeout = 0;
}

	}

if($mybb->get_input('timeout', MyBB::INPUT_INT) > 0)
{
$timeout = $mybb->get_input('timeout', MyBB::INPUT_INT);
}
else
{
$timeout = 0;
}


if($mybb->get_input('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $polloptions)
{


if($mybb->get_input('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $polloptions)
{

Zeile 194Zeile 195
	// Get forum info
$forum = get_forum($fid);
if(!$forum)

	// Get forum info
$forum = get_forum($fid);
if(!$forum)

	{

	{

		error($lang->error_invalidforum);
}
else

		error($lang->error_invalidforum);
}
else

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

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

	}


	}


	if($thread['poll'])

	if($thread['poll'])

	{

	{

		error($lang->error_pollalready);

		error($lang->error_pollalready);

	}


	}


	$polloptions = $mybb->get_input('polloptions', MyBB::INPUT_INT);
if($mybb->settings['maxpolloptions'] && $polloptions > $mybb->settings['maxpolloptions'])

	$polloptions = $mybb->get_input('polloptions', MyBB::INPUT_INT);
if($mybb->settings['maxpolloptions'] && $polloptions > $mybb->settings['maxpolloptions'])

	{

	{

		$polloptions = $mybb->settings['maxpolloptions'];

		$polloptions = $mybb->settings['maxpolloptions'];

	}

$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);
if(!isset($postoptions['multiple']) || $postoptions['multiple'] != '1')
{
$postoptions['multiple'] = 0;
}

if(!isset($postoptions['public']) || $postoptions['public'] != '1')
{
$postoptions['public'] = 0;
}

if($polloptions < 2)
{
$polloptions = "2";
}
$optioncount = "0";
$options = $mybb->get_input('options', MyBB::INPUT_ARRAY);

for($i = 1; $i <= $polloptions; ++$i)
{
if(!isset($options[$i]))
{
$options[$i] = '';
}

if($mybb->settings['polloptionlimit'] != 0 && my_strlen($options[$i]) > $mybb->settings['polloptionlimit'])
{
$lengtherror = 1;
break;
}

if(strpos($options[$i], '||~|~||') !== false)
{
$sequenceerror = 1;
break;
}

if(trim($options[$i]) != "")
{
$optioncount++;
}
}

if(isset($lengtherror))

	}

$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);
if(!isset($postoptions['multiple']) || $postoptions['multiple'] != '1')
{
$postoptions['multiple'] = 0;
}

if(!isset($postoptions['public']) || $postoptions['public'] != '1')
{
$postoptions['public'] = 0;
}

if($polloptions < 2)
{
$polloptions = "2";
}
$optioncount = "0";
$options = $mybb->get_input('options', MyBB::INPUT_ARRAY);

for($i = 1; $i <= $polloptions; ++$i)
{
if(!isset($options[$i]))
{
$options[$i] = '';
}

if($mybb->settings['polloptionlimit'] != 0 && my_strlen($options[$i]) > $mybb->settings['polloptionlimit'])
{
$lengtherror = 1;
break;
}

if(strpos($options[$i], '||~|~||') !== false)
{
$sequenceerror = 1;
break;
}

if(trim($options[$i]) != "")
{
$optioncount++;
}
}

if(isset($lengtherror))

	{
error($lang->error_polloptiontoolong);
}

	{
error($lang->error_polloptiontoolong);
}

Zeile 307Zeile 308
	else
{
$timeout = 0;

	else
{
$timeout = 0;

	}


	}


	if($mybb->get_input('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $polloptions)
{
$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);

	if($mybb->get_input('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $polloptions)
{
$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);

Zeile 348Zeile 349
	else
{
redirect(get_forum_link($thread['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 373Zeile 374
	}

$tid = $thread['tid'];

	}

$tid = $thread['tid'];

	$fid = $thread['fid'];

// Make navigation

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

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





	$forumpermissions = forum_permissions($fid);

// Get forum info

	$forumpermissions = forum_permissions($fid);

// Get forum info

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

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

	}
else
{

	}
else
{

		// Is our forum closed?
if($forum['open'] == 0 && !is_moderator($fid, "canmanagepolls"))
{

		// Is our forum closed?
if($forum['open'] == 0 && !is_moderator($fid, "canmanagepolls"))
{

Zeile 401Zeile 402
	if(!is_moderator($fid, "canmanagepolls"))
{
error_no_permission();

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

	}

$postoptionschecked = array('closed' => '', 'multiple' => '', 'public' => '');

	}

$postoptionschecked = array('closed' => '', 'multiple' => '', 'public' => '');


$polldate = my_date($mybb->settings['dateformat'], $poll['dateline']);
if(empty($mybb->input['updateoptions']))
{
if($poll['closed'] == 1)


$polldate = my_date($mybb->settings['dateformat'], $poll['dateline']);
if(empty($mybb->input['updateoptions']))
{
if($poll['closed'] == 1)

		{

		{

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

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

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

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

		}

		}


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


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

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

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

		}
else

		}
else

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

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

Zeile 483Zeile 484
		else
{
$numoptions = $mybb->get_input('numoptions', MyBB::INPUT_INT);

		else
{
$numoptions = $mybb->get_input('numoptions', MyBB::INPUT_INT);

		}

		}

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

$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);

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

$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);

Zeile 564Zeile 565
	$poll = $db->fetch_array($query);

if(!$poll)

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

if(!$poll)

	{

	{

		error($lang->error_invalidpoll);
}


		error($lang->error_invalidpoll);
}


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

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

		}
}


		}
}


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

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

	}

	}


if($mybb->settings['maxpolloptions'] && $mybb->get_input('numoptions', MyBB::INPUT_INT) > $mybb->settings['maxpolloptions'])


if($mybb->settings['maxpolloptions'] && $mybb->get_input('numoptions', MyBB::INPUT_INT) > $mybb->settings['maxpolloptions'])

	{

	{

		$numoptions = $mybb->settings['maxpolloptions'];
}
elseif($mybb->get_input('numoptions', MyBB::INPUT_INT) < 2)

		$numoptions = $mybb->settings['maxpolloptions'];
}
elseif($mybb->get_input('numoptions', MyBB::INPUT_INT) < 2)

	{

	{

		$numoptions = 2;

		$numoptions = 2;

	}

	}

	else

	else

	{

	{

		$numoptions = $mybb->get_input('numoptions', MyBB::INPUT_INT);

		$numoptions = $mybb->get_input('numoptions', MyBB::INPUT_INT);

	}


	}


	$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);
if(!isset($postoptions['multiple']) || $postoptions['multiple'] != '1')
{
$postoptions['multiple'] = 0;

	$postoptions = $mybb->get_input('postoptions', MyBB::INPUT_ARRAY);
if(!isset($postoptions['multiple']) || $postoptions['multiple'] != '1')
{
$postoptions['multiple'] = 0;

	}


	}


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

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

	{

	{

		$postoptions['public'] = 0;

		$postoptions['public'] = 0;

	}


	}


	if(!isset($postoptions['closed']) || $postoptions['closed'] != '1')
{
$postoptions['closed'] = 0;
}
$optioncount = "0";
$options = $mybb->input['options'];

	if(!isset($postoptions['closed']) || $postoptions['closed'] != '1')
{
$postoptions['closed'] = 0;
}
$optioncount = "0";
$options = $mybb->input['options'];


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


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

	{
if(!isset($options[$i]))
{

	{
if(!isset($options[$i]))
{

Zeile 669Zeile 670
	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 = '';

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

Zeile 683Zeile 684
			{
$optionslist .= "||~|~||";
$voteslist .= "||~|~||";

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

			}

			}


$optionslist .= trim($options[$i]);
if(!isset($votes[$i]) || (int)$votes[$i] <= 0)
{
$votes[$i] = "0";
}


$optionslist .= trim($options[$i]);
if(!isset($votes[$i]) || (int)$votes[$i] <= 0)
{
$votes[$i] = "0";
}

			$voteslist .= $votes[$i];

			$voteslist .= (int)$votes[$i];

			$numvotes = (int)$numvotes + (int)$votes[$i];
}

			$numvotes = (int)$numvotes + (int)$votes[$i];
}

	}

	}


if($mybb->get_input('timeout', MyBB::INPUT_INT) > 0)


if($mybb->get_input('timeout', MyBB::INPUT_INT) > 0)

	{

	{

		$timeout = $mybb->get_input('timeout', MyBB::INPUT_INT);

		$timeout = $mybb->get_input('timeout', MyBB::INPUT_INT);

	}
else
{

	}
else
{

		$timeout = 0;
}


		$timeout = 0;
}


Zeile 726Zeile 727
		"maxoptions" => $maxoptions
);


		"maxoptions" => $maxoptions
);


	$plugins->run_hooks("polls_do_editpoll_process");

$db->update_query("polls", $updatedpoll, "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");

	$plugins->run_hooks("polls_do_editpoll_process");

$db->update_query("polls", $updatedpoll, "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");


$plugins->run_hooks("polls_do_editpoll_end");



$plugins->run_hooks("polls_do_editpoll_end");


Zeile 738Zeile 739

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='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");

if($mybb->input['action'] == "showresults")
{
$query = $db->simple_select("polls", "*", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'");

Zeile 779Zeile 780
	add_breadcrumb(htmlspecialchars_uni($thread['subject']), get_thread_link($thread['tid']));
add_breadcrumb($lang->nav_pollresults);


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


	$voters = $votedfor = array();

	$voters = $votedfor = $guest_voters = array();


// Calculate votes
$query = $db->query("


// Calculate votes
$query = $db->query("

Zeile 801Zeile 802
		if($voter['uid'] == 0 || $voter['username'] == '')
{
// Add one to the number of voters for guests

		if($voter['uid'] == 0 || $voter['username'] == '')
{
// Add one to the number of voters for guests

			++$guest_voters[$voter['voteoption']];








			if(isset($guest_voters[$voter['voteoption']]))
{
++$guest_voters[$voter['voteoption']];
}
else
{
$guest_voters[$voter['voteoption']] = 1;
}

		}
else
{

		}
else
{

Zeile 917Zeile 925

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



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


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

	$thread = get_thread($poll['tid']);



if(!$thread || ($thread['visible'] != 1 && ($thread['visible'] == 0 && !is_moderator($thread['fid'], "canviewunapprove")) || ($thread['visible'] == -1 && !is_moderator($thread['fid'], "canviewdeleted"))))
{


if(!$thread || ($thread['visible'] != 1 && ($thread['visible'] == 0 && !is_moderator($thread['fid'], "canviewunapprove")) || ($thread['visible'] == -1 && !is_moderator($thread['fid'], "canviewdeleted"))))
{

Zeile 1151Zeile 1158
	$votesarray = explode("||~|~||", $poll['votes']);
if(count($votesarray) > $poll['numoptions'])
{

	$votesarray = explode("||~|~||", $poll['votes']);
if(count($votesarray) > $poll['numoptions'])
{

		$votesarray = array_slice(0, $poll['numoptions']);

		$votesarray = array_slice($votesarray, 0, $poll['numoptions']);

	}

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

	}

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