Zeile 29 | Zeile 29 |
---|
} else {
|
} else {
|
| $username = '';
|
eval("\$loginbox = \"".$templates->get("loginbox")."\";"); }
| eval("\$loginbox = \"".$templates->get("loginbox")."\";"); }
|
Zeile 52 | Zeile 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?
|
// Is the currently logged in user a moderator of this forum?
|
$ismod = is_moderator($thread['fid']);
| $ismod = is_moderator($thread['fid']);
|
// Make sure we are looking at a real thread here. if(($thread['visible'] != 1 && $ismod == false) || ($thread['visible'] > 1 && $ismod == true)) { error($lang->error_invalidthread); }
|
// Make sure we are looking at a real thread here. 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);
|
|
|
// Get forum info $forum = get_forum($fid); if(!$forum) { error($lang->error_invalidforum);
|
// Get forum info $forum = get_forum($fid); if(!$forum) { error($lang->error_invalidforum);
|
}
| }
|
else { // Is our forum closed?
| else { // Is our forum closed?
|
Zeile 82 | Zeile 83 |
---|
{ // Doesn't look like it is error($lang->error_closedinvalidforum);
|
{ // Doesn't look like it is error($lang->error_closedinvalidforum);
|
} }
| } }
|
// Make navigation build_forum_breadcrumb($fid); add_breadcrumb(htmlspecialchars_uni($thread['subject']), get_thread_link($thread['tid']));
| // Make navigation build_forum_breadcrumb($fid); add_breadcrumb(htmlspecialchars_uni($thread['subject']), get_thread_link($thread['tid']));
|
Zeile 91 | Zeile 92 |
---|
// 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))
|
{
| {
|
error_no_permission();
|
error_no_permission();
|
}
| }
|
if($thread['poll']) { error($lang->error_pollalready);
|
if($thread['poll']) { error($lang->error_pollalready);
|
}
| }
|
$time = TIME_NOW; if($thread['dateline'] < ($time-($mybb->settings['polltimelimit']*60*60)) && $mybb->settings['polltimelimit'] != 0 && $ismod == false) {
| $time = TIME_NOW; if($thread['dateline'] < ($time-($mybb->settings['polltimelimit']*60*60)) && $mybb->settings['polltimelimit'] != 0 && $ismod == false) {
|
Zeile 159 | Zeile 160 |
---|
else { $timeout = 0;
|
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)
|
{
| {
|
$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);
|
$maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT);
|
}
| }
|
else { $maxoptions = 0;
| else { $maxoptions = 0;
|
Zeile 176 | Zeile 177 |
---|
output_page($newpoll); } if($mybb->input['action'] == "do_newpoll" && $mybb->request_method == "post")
|
output_page($newpoll); } if($mybb->input['action'] == "do_newpoll" && $mybb->request_method == "post")
|
{ // Verify incoming POST request verify_post_check($mybb->get_input('my_post_key'));
| { // Verify incoming POST request verify_post_check($mybb->get_input('my_post_key'));
|
$plugins->run_hooks("polls_do_newpoll_start");
$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));
| $plugins->run_hooks("polls_do_newpoll_start");
$thread = get_thread($mybb->get_input('tid', MyBB::INPUT_INT));
|
Zeile 204 | Zeile 205 |
---|
{ // Doesn't look like it is error($lang->error_closedinvalidforum);
|
{ // Doesn't look like it is error($lang->error_closedinvalidforum);
|
} }
| } }
|
// 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 236 | Zeile 237 |
---|
}
if($polloptions < 2)
|
}
if($polloptions < 2)
|
{
| {
|
$polloptions = "2"; } $optioncount = "0";
| $polloptions = "2"; } $optioncount = "0";
|
Zeile 264 | Zeile 265 |
---|
if(trim($options[$i]) != "") { $optioncount++;
|
if(trim($options[$i]) != "") { $optioncount++;
|
} }
| } }
|
if(isset($lengtherror)) { error($lang->error_polloptiontoolong);
| if(isset($lengtherror)) { error($lang->error_polloptiontoolong);
|
Zeile 297 | Zeile 298 |
---|
} $optionslist .= trim($options[$i]); $voteslist .= '0';
|
} $optionslist .= trim($options[$i]); $voteslist .= '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('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 554 | Zeile 555 |
---|
}
if($mybb->input['action'] == "do_editpoll" && $mybb->request_method == "post")
|
}
if($mybb->input['action'] == "do_editpoll" && $mybb->request_method == "post")
|
{ // Verify incoming POST request verify_post_check($mybb->get_input('my_post_key'));
$plugins->run_hooks("polls_do_editpoll_start");
$query = $db->simple_select("polls", "*", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'"); $poll = $db->fetch_array($query);
| { // Verify incoming POST request verify_post_check($mybb->get_input('my_post_key'));
$plugins->run_hooks("polls_do_editpoll_start");
$query = $db->simple_select("polls", "*", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'"); $poll = $db->fetch_array($query);
|
if(!$poll) {
| if(!$poll) {
|
Zeile 591 | Zeile 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();
|
Zeile 640 | Zeile 641 |
---|
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;
|
break; }
| break; }
|
if(strpos($options[$i], '||~|~||') !== false) {
| if(strpos($options[$i], '||~|~||') !== false) {
|
Zeile 689 | Zeile 690 |
---|
if(!isset($votes[$i]) || (int)$votes[$i] <= 0) { $votes[$i] = "0";
|
if(!isset($votes[$i]) || (int)$votes[$i] <= 0) { $votes[$i] = "0";
|
} $voteslist .= $votes[$i]; $numvotes = $numvotes + $votes[$i];
| } $voteslist .= (int)$votes[$i]; $numvotes = (int)$numvotes + (int)$votes[$i];
|
}
|
}
|
}
| }
|
if($mybb->get_input('timeout', MyBB::INPUT_INT) > 0) { $timeout = $mybb->get_input('timeout', MyBB::INPUT_INT);
|
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) < $numoptions)
|
else { $timeout = 0; }
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); } else
| $maxoptions = $mybb->get_input('maxoptions', MyBB::INPUT_INT); } else
|
Zeile 745 | Zeile 746 |
---|
$poll = $db->fetch_array($query);
if(!$poll)
|
$poll = $db->fetch_array($query);
if(!$poll)
|
{
| {
|
error($lang->error_invalidpoll); }
$tid = $poll['tid']; $thread = get_thread($tid);
|
error($lang->error_invalidpoll); }
$tid = $poll['tid']; $thread = get_thread($tid);
|
if(!$thread)
| if(!$thread || ($thread['visible'] != 1 && ($thread['visible'] == 0 && !is_moderator($thread['fid'], "canviewunapprove")) || ($thread['visible'] == -1 && !is_moderator($thread['fid'], "canviewdeleted"))))
|
{ error($lang->error_invalidthread); }
| { error($lang->error_invalidthread); }
|
Zeile 779 | Zeile 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 801 | Zeile 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 899 | Zeile 907 |
---|
eval("\$showresults = \"".$templates->get("polls_showresults")."\";"); output_page($showresults); }
|
eval("\$showresults = \"".$templates->get("polls_showresults")."\";"); output_page($showresults); }
|
|
|
if($mybb->input['action'] == "vote" && $mybb->request_method == "post") { // Verify incoming POST request
| if($mybb->input['action'] == "vote" && $mybb->request_method == "post") { // Verify incoming POST request
|
Zeile 910 | Zeile 919 |
---|
if(!$poll) { error($lang->error_invalidpoll);
|
if(!$poll) { error($lang->error_invalidpoll);
|
}
| }
|
$plugins->run_hooks("polls_vote_start");
|
$plugins->run_hooks("polls_vote_start");
|
|
|
$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);
if(!$thread || $thread['visible'] == 0)
| $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"))))
|
{ error($lang->error_invalidthread); }
| { error($lang->error_invalidthread); }
|
Zeile 950 | Zeile 958 |
---|
$expiretime = $poll['dateline'] + $poll['timeout']; $now = TIME_NOW; if($poll['closed'] == 1 || $thread['closed'] == 1 || ($expiretime < $now && $poll['timeout']))
|
$expiretime = $poll['dateline'] + $poll['timeout']; $now = TIME_NOW; if($poll['closed'] == 1 || $thread['closed'] == 1 || ($expiretime < $now && $poll['timeout']))
|
{
| {
|
error($lang->error_pollclosed); }
| error($lang->error_pollclosed); }
|
Zeile 972 | Zeile 980 |
---|
$query = $db->simple_select("pollvotes", "*", "{$user_check} AND pid='".$poll['pid']."'"); $votecheck = $db->fetch_array($query);
|
$query = $db->simple_select("pollvotes", "*", "{$user_check} AND pid='".$poll['pid']."'"); $votecheck = $db->fetch_array($query);
|
if($votecheck['vid'])
| if($votecheck)
|
{ error($lang->error_alreadyvoted); }
| { error($lang->error_alreadyvoted); }
|
Zeile 1031 | Zeile 1039 |
---|
}
if(!$votesql)
|
}
if(!$votesql)
|
{
| {
|
error($lang->error_nopolloptions); }
| error($lang->error_nopolloptions); }
|
Zeile 1063 | Zeile 1071 |
---|
$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");
|
|
|
redirect(get_thread_link($poll['tid']), $lang->redirect_votethanks); }
| redirect(get_thread_link($poll['tid']), $lang->redirect_votethanks); }
|
Zeile 1075 | Zeile 1083 |
---|
{ error_no_permission(); }
|
{ error_no_permission(); }
|
|
|
$query = $db->simple_select("polls", "*", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'"); $poll = $db->fetch_array($query);
|
$query = $db->simple_select("polls", "*", "pid='".$mybb->get_input('pid', MyBB::INPUT_INT)."'"); $poll = $db->fetch_array($query);
|
if(!$poll['pid'])
| if(!$poll)
|
{ error($lang->error_invalidpoll); }
| { error($lang->error_invalidpoll); }
|
Zeile 1091 | Zeile 1099 |
---|
// 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 $thread = get_thread($poll['tid']);
|
// 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 $thread = get_thread($poll['tid']);
|
if(!$thread || $thread['visible'] == 0)
| if(!$thread || ($thread['visible'] != 1 && ($thread['visible'] == 0 && !is_moderator($thread['fid'], "canviewunapprove")) || ($thread['visible'] == -1 && !is_moderator($thread['fid'], "canviewdeleted"))))
|
{ error($lang->error_invalidthread); }
| { error($lang->error_invalidthread); }
|
Zeile 1150 | Zeile 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)
|