Zeile 52 | Zeile 52 |
---|
$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 64 | Zeile 64 |
---|
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);
// Get forum info $forum = get_forum($fid); if(!$forum)
|
$fid = $thread['fid']; $forumpermissions = forum_permissions($fid);
// Get forum info $forum = get_forum($fid); if(!$forum)
|
{
| {
|
error($lang->error_invalidforum);
|
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 88 | Zeile 88 |
---|
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, "canmanagepolls")) || ($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, "canmanagepolls")) || ($forumpermissions['canview'] == 0 || $forumpermissions['canpostthreads'] == 0 || $forumpermissions['canpostpolls'] == 0)) {
|
Zeile 123 | Zeile 123 |
---|
else { // Just right $polloptions = $mybb->get_input('polloptions', MyBB::INPUT_INT);
|
else { // Just right $polloptions = $mybb->get_input('polloptions', MyBB::INPUT_INT);
|
}
$question = htmlspecialchars_uni($mybb->get_input('question'));
| }
$question = htmlspecialchars_uni($mybb->get_input('question'));
|
$postoptionschecked = array('public' => '', 'multiple' => ''); $postoptions = $mybb->get_input('postoptions', MyBB::INPUT_INT); if(isset($postoptions['multiple']) && $postoptions['multiple'] == 1)
|
$postoptionschecked = array('public' => '', 'multiple' => ''); $postoptions = $mybb->get_input('postoptions', MyBB::INPUT_INT); if(isset($postoptions['multiple']) && $postoptions['multiple'] == 1)
|
{
| {
|
$postoptionschecked['multiple'] = 'checked="checked"'; } if(isset($postoptions['public']) && $postoptions['public'] == 1) { $postoptionschecked['public'] = 'checked="checked"';
|
$postoptionschecked['multiple'] = '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 150 | Zeile 150 |
---|
$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) { $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 194 | Zeile 194 |
---|
// 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 211 | Zeile 211 |
---|
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)) { error($lang->error_polloptiontoolong);
| }
$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);
|
}
if(isset($sequenceerror))
| }
if(isset($sequenceerror))
|
Zeile 282 | Zeile 282 |
---|
if(trim($mybb->input['question']) == '' || $optioncount < 2) { error($lang->error_noquestionoptions);
|
if(trim($mybb->input['question']) == '' || $optioncount < 2) { error($lang->error_noquestionoptions);
|
}
| }
|
$optionslist = ''; $voteslist = '';
| $optionslist = ''; $voteslist = '';
|
Zeile 336 | Zeile 336 |
---|
$plugins->run_hooks("polls_do_newpoll_process");
$pid = $db->insert_query("polls", $newpoll);
|
$plugins->run_hooks("polls_do_newpoll_process");
$pid = $db->insert_query("polls", $newpoll);
|
|
|
$db->update_query("threads", array('poll' => $pid), "tid='".$thread['tid']."'");
$plugins->run_hooks("polls_do_newpoll_end");
| $db->update_query("threads", array('poll' => $pid), "tid='".$thread['tid']."'");
$plugins->run_hooks("polls_do_newpoll_end");
|
Zeile 363 | Zeile 363 |
---|
if(!$poll) { error($lang->error_invalidpoll);
|
if(!$poll) { error($lang->error_invalidpoll);
|
}
| }
|
$query = $db->simple_select("threads", "*", "poll='$pid'"); $thread = $db->fetch_array($query); if(!$thread) { error($lang->error_invalidthread); }
|
$query = $db->simple_select("threads", "*", "poll='$pid'"); $thread = $db->fetch_array($query); if(!$thread) { error($lang->error_invalidthread); }
|
|
|
$tid = $thread['tid'];
|
$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);
|
Zeile 591 | Zeile 591 |
---|
{ // 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"))
|
if(!is_moderator($thread['fid'], "canmanagepolls"))
|
{
| {
|
error_no_permission();
|
error_no_permission();
|
}
| }
|
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)
|
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 = 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')
|
if(!isset($postoptions['closed']) || $postoptions['closed'] != '1')
|
{
| {
|
$postoptions['closed'] = 0; } $optioncount = "0"; $options = $mybb->input['options'];
|
$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]))
|
{
| {
|
$options[$i] = '';
|
$options[$i] = '';
|
}
| }
|
if($mybb->settings['polloptionlimit'] != 0 && my_strlen($options[$i]) > $mybb->settings['polloptionlimit']) { $lengtherror = 1;
| if($mybb->settings['polloptionlimit'] != 0 && my_strlen($options[$i]) > $mybb->settings['polloptionlimit']) { $lengtherror = 1;
|
Zeile 644 | Zeile 644 |
---|
}
if(strpos($options[$i], '||~|~||') !== false)
|
}
if(strpos($options[$i], '||~|~||') !== false)
|
{
| {
|
$sequenceerror = 1; break; }
| $sequenceerror = 1; break; }
|
Zeile 683 | Zeile 683 |
---|
{ $optionslist .= "||~|~||"; $voteslist .= "||~|~||";
|
{ $optionslist .= "||~|~||"; $voteslist .= "||~|~||";
|
}
| }
|
$optionslist .= trim($options[$i]); if(!isset($votes[$i]) || (int)$votes[$i] <= 0) {
| $optionslist .= trim($options[$i]); if(!isset($votes[$i]) || (int)$votes[$i] <= 0) {
|
Zeile 693 | Zeile 693 |
---|
$voteslist .= $votes[$i]; $numvotes = (int)$numvotes + (int)$votes[$i]; }
|
$voteslist .= $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 { $timeout = 0;
| } else { $timeout = 0;
|
}
if($mybb->get_input('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $numoptions)
|
}
if($mybb->get_input('maxoptions', MyBB::INPUT_INT) > 0 && $mybb->get_input('maxoptions', MyBB::INPUT_INT) < $numoptions)
|
{
| {
|
$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);
|
$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);
|
}
| }
|
else { $maxoptions = 0;
|
else { $maxoptions = 0;
|
}
| }
|
$updatedpoll = array( "question" => $db->escape_string($mybb->input['question']),
| $updatedpoll = array( "question" => $db->escape_string($mybb->input['question']),
|
Zeile 738 | Zeile 738 |
---|
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 763 | Zeile 763 |
---|
if(!$forum) { error($lang->error_invalidforum);
|
if(!$forum) { error($lang->error_invalidforum);
|
}
$forumpermissions = forum_permissions($forum['fid']);
| }
$forumpermissions = forum_permissions($forum['fid']);
|
$plugins->run_hooks("polls_showresults_start");
| $plugins->run_hooks("polls_showresults_start");
|
Zeile 778 | Zeile 778 |
---|
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 = $votedfor = array();
// Calculate votes
| $voters = $votedfor = array();
// Calculate votes
|
Zeile 806 | Zeile 806 |
---|
else { $voters[$voter['voteoption']][$voter['uid']] = htmlspecialchars_uni($voter['username']);
|
else { $voters[$voter['voteoption']][$voter['uid']] = htmlspecialchars_uni($voter['username']);
|
} }
| } }
|
$optionsarray = explode("||~|~||", $poll['options']); $votesarray = explode("||~|~||", $poll['votes']); $poll['totvotes'] = 0;
| $optionsarray = explode("||~|~||", $poll['options']); $votesarray = explode("||~|~||", $poll['votes']); $poll['totvotes'] = 0;
|
Zeile 849 | Zeile 849 |
---|
$percent = 0; } else
|
$percent = 0; } else
|
{
| {
|
$percent = number_format($votes / $poll['totvotes'] * 100, 2); }
| $percent = number_format($votes / $poll['totvotes'] * 100, 2); }
|
Zeile 889 | Zeile 889 |
---|
$totpercent = '100%'; } else
|
$totpercent = '100%'; } else
|
{
| {
|
$totpercent = '0%'; }
| $totpercent = '0%'; }
|
Zeile 917 | Zeile 917 |
---|
$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")))) {
|