Zeile 6 | Zeile 6 |
---|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* Website: http://mybb.com * License: http://mybb.com/about/license *
|
* $Id: polls.php 5826 2012-05-04 10:30:10Z Tomm $
| * $Id$
|
*/
define("IN_MYBB", 1); define('THIS_SCRIPT', 'polls.php');
|
*/
define("IN_MYBB", 1); define('THIS_SCRIPT', 'polls.php');
|
$templatelist = "poll_newpoll,redirect_pollposted,redirect_pollupdated,redirect_votethanks";
| $templatelist = "changeuserbox,loginbox,polls_newpoll_option,polls_newpoll,polls_editpoll_option,polls_editpoll,polls_showresults_resultbit,polls_showresults";
|
require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php"; require_once MYBB_ROOT."inc/class_parser.php";
| require_once "./global.php"; require_once MYBB_ROOT."inc/functions_post.php"; require_once MYBB_ROOT."inc/class_parser.php";
|
Zeile 237 | Zeile 237 |
---|
$optionslist = ''; $voteslist = '';
|
$optionslist = ''; $voteslist = '';
|
for($i = 1; $i <= $optioncount; ++$i)
| for($i = 1; $i <= $polloptions; ++$i)
|
{ if(trim($options[$i]) != '') {
|
{ if(trim($options[$i]) != '') {
|
if($i > 1)
| if($optionslist != '')
|
{ $optionslist .= '||~|~||'; $voteslist .= '||~|~||'; }
|
{ $optionslist .= '||~|~||'; $voteslist .= '||~|~||'; }
|
$optionslist .= $options[$i];
| $optionslist .= trim($options[$i]);
|
$voteslist .= '0'; } } if($mybb->input['timeout'] > 0)
|
$voteslist .= '0'; } } if($mybb->input['timeout'] > 0)
|
{
| {
|
$timeout = intval($mybb->input['timeout']); } else { $timeout = 0;
|
$timeout = intval($mybb->input['timeout']); } else { $timeout = 0;
|
}
| }
|
$newpoll = array( "tid" => $thread['tid'],
| $newpoll = array( "tid" => $thread['tid'],
|
Zeile 277 | Zeile 277 |
---|
$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']."'");
|
$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)
|
{
| {
|
redirect(get_thread_link($thread['tid']), $lang->redirect_pollposted); } else { redirect(get_forum_link($thread['fid']), $lang->redirect_pollpostedmoderated);
|
redirect(get_thread_link($thread['tid']), $lang->redirect_pollposted); } else { redirect(get_forum_link($thread['fid']), $lang->redirect_pollpostedmoderated);
|
}
| }
|
}
if($mybb->input['action'] == "editpoll")
| }
if($mybb->input['action'] == "editpoll")
|
Zeile 300 | Zeile 300 |
---|
$query = $db->simple_select("polls", "*", "pid='$pid'"); $poll = $db->fetch_array($query);
|
$query = $db->simple_select("polls", "*", "pid='$pid'"); $poll = $db->fetch_array($query);
|
| if(!$poll['pid']) { error($lang->error_invalidpoll); }
|
$query = $db->simple_select("threads", "*", "poll='$pid'"); $thread = $db->fetch_array($query);
| $query = $db->simple_select("threads", "*", "poll='$pid'"); $thread = $db->fetch_array($query);
|
Zeile 312 | Zeile 317 |
---|
add_breadcrumb($lang->nav_editpoll);
$forumpermissions = forum_permissions($fid);
|
add_breadcrumb($lang->nav_editpoll);
$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 330 | Zeile 335 |
---|
}
if(!$tid)
|
}
if(!$tid)
|
{ error($lang->error_invalidthread); } if(!is_moderator($fid, "caneditposts")) { error_no_permission(); }
| { error($lang->error_invalidthread); } if(!is_moderator($fid, "caneditposts")) { error_no_permission(); }
|
$polldate = my_date($mybb->settings['dateformat'], $poll['dateline']); if(!$mybb->input['preview'] && !$mybb->input['updateoptions']) { if($poll['closed'] == 1) { $postoptionschecked['closed'] = 'checked="checked"';
|
$polldate = my_date($mybb->settings['dateformat'], $poll['dateline']); if(!$mybb->input['preview'] && !$mybb->input['updateoptions']) { if($poll['closed'] == 1) { $postoptionschecked['closed'] = 'checked="checked"';
|
}
| }
|
if($poll['multiple'] == 1) { $postoptionschecked['multiple'] = 'checked="checked"';
|
if($poll['multiple'] == 1) { $postoptionschecked['multiple'] = 'checked="checked"';
|
}
| }
|
if($poll['public'] == 1) { $postoptionschecked['public'] = 'checked="checked"';
| if($poll['public'] == 1) { $postoptionschecked['public'] = 'checked="checked"';
|
Zeile 375 | Zeile 380 |
---|
$option = $optionsarray[$i]; $option = htmlspecialchars_uni($option); $optionvotes = intval($votesarray[$i]);
|
$option = $optionsarray[$i]; $option = htmlspecialchars_uni($option); $optionvotes = intval($votesarray[$i]);
|
|
|
if(!$optionvotes) { $optionvotes = 0;
| if(!$optionvotes) { $optionvotes = 0;
|
Zeile 387 | Zeile 392 |
---|
} if(!$poll['timeout'])
|
} if(!$poll['timeout'])
|
{
| {
|
$timeout = 0; } else
| $timeout = 0; } else
|
Zeile 400 | Zeile 405 |
---|
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) { $numoptions = "2"; } else
|
elseif($mybb->input['numoptions'] < 2) { $numoptions = "2"; } else
|
{
| {
|
$numoptions = $mybb->input['numoptions']; } $question = htmlspecialchars_uni($mybb->input['question']);
| $numoptions = $mybb->input['numoptions']; } $question = htmlspecialchars_uni($mybb->input['question']);
|
Zeile 418 | Zeile 423 |
---|
} if($postoptions['public'] == 1)
|
} if($postoptions['public'] == 1)
|
{
| {
|
$postoptionschecked['public'] = 'checked="checked"'; }
| $postoptionschecked['public'] = 'checked="checked"'; }
|
Zeile 436 | Zeile 441 |
---|
$option = $options[$i]; $option = htmlspecialchars_uni($option); $optionvotes = $votes[$i];
|
$option = $options[$i]; $option = htmlspecialchars_uni($option); $optionvotes = $votes[$i];
|
|
|
if(!$optionvotes) { $optionvotes = 0;
| if(!$optionvotes) { $optionvotes = 0;
|
Zeile 444 | Zeile 449 |
---|
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'];
|
}
| }
|
else { $timeout = 0;
| else { $timeout = 0;
|
Zeile 466 | Zeile 471 |
---|
{ // Verify incoming POST request verify_post_check($mybb->input['my_post_key']);
|
{ // Verify incoming POST request verify_post_check($mybb->input['my_post_key']);
|
|
|
$plugins->run_hooks("polls_do_editpoll_start");
$query = $db->simple_select("polls", "*", "pid='".intval($mybb->input['pid'])."'"); $poll = $db->fetch_array($query);
|
$plugins->run_hooks("polls_do_editpoll_start");
$query = $db->simple_select("polls", "*", "pid='".intval($mybb->input['pid'])."'"); $poll = $db->fetch_array($query);
|
| if(!$poll['pid']) { error($lang->error_invalidpoll); }
|
$query = $db->simple_select("threads", "*", "poll='".intval($mybb->input['pid'])."'"); $thread = $db->fetch_array($query);
| $query = $db->simple_select("threads", "*", "poll='".intval($mybb->input['pid'])."'"); $thread = $db->fetch_array($query);
|
Zeile 533 | Zeile 543 |
---|
} $optioncount = "0"; $options = $mybb->input['options'];
|
} $optioncount = "0"; $options = $mybb->input['options'];
|
for($i = 1; $i <= $numoptions; ++$i)
| for($i = 1; $i <= $numoptions; ++$i)
|
{ if(trim($options[$i]) != '') {
| { if(trim($options[$i]) != '') {
|
Zeile 551 | Zeile 561 |
---|
if($lengtherror) { error($lang->error_polloptiontoolong);
|
if($lengtherror) { error($lang->error_polloptiontoolong);
|
}
| }
|
if(trim($mybb->input['question']) == '' || $optioncount < 2) {
| if(trim($mybb->input['question']) == '' || $optioncount < 2) {
|
Zeile 562 | Zeile 572 |
---|
$voteslist = ''; $numvotes = ''; $votes = $mybb->input['votes'];
|
$voteslist = ''; $numvotes = ''; $votes = $mybb->input['votes'];
|
for($i = 1; $i <= $optioncount; ++$i)
| for($i = 1; $i <= $numoptions; ++$i)
|
{ if(trim($options[$i]) != '') {
|
{ if(trim($options[$i]) != '') {
|
if($i > 1)
| if($optionslist != '')
|
{ $optionslist .= "||~|~||"; $voteslist .= "||~|~||"; }
|
{ $optionslist .= "||~|~||"; $voteslist .= "||~|~||"; }
|
$optionslist .= $options[$i];
| $optionslist .= trim($options[$i]);
|
if(intval($votes[$i]) <= 0) { $votes[$i] = "0";
| if(intval($votes[$i]) <= 0) { $votes[$i] = "0";
|
Zeile 595 | Zeile 605 |
---|
"question" => $db->escape_string($mybb->input['question']), "options" => $db->escape_string($optionslist), "votes" => $db->escape_string($voteslist),
|
"question" => $db->escape_string($mybb->input['question']), "options" => $db->escape_string($optionslist), "votes" => $db->escape_string($voteslist),
|
"numoptions" => intval($numoptions),
| "numoptions" => intval($optioncount),
|
"numvotes" => $numvotes, "timeout" => $timeout, "closed" => $postoptions['closed'],
| "numvotes" => $numvotes, "timeout" => $timeout, "closed" => $postoptions['closed'],
|
Zeile 606 | Zeile 616 |
---|
$plugins->run_hooks("polls_do_editpoll_process");
$db->update_query("polls", $updatedpoll, "pid='".intval($mybb->input['pid'])."'");
|
$plugins->run_hooks("polls_do_editpoll_process");
$db->update_query("polls", $updatedpoll, "pid='".intval($mybb->input['pid'])."'");
|
|
|
$plugins->run_hooks("polls_do_editpoll_end"); $modlogdata['fid'] = $thread['fid'];
| $plugins->run_hooks("polls_do_editpoll_end"); $modlogdata['fid'] = $thread['fid'];
|
Zeile 620 | Zeile 630 |
---|
{ $query = $db->simple_select("polls", "*", "pid='".intval($mybb->input['pid'])."'"); $poll = $db->fetch_array($query);
|
{ $query = $db->simple_select("polls", "*", "pid='".intval($mybb->input['pid'])."'"); $poll = $db->fetch_array($query);
|
| if(!$poll['pid']) { error($lang->error_invalidpoll); }
|
$tid = $poll['tid']; $query = $db->simple_select("threads", "*", "tid='$tid'"); $thread = $db->fetch_array($query);
| $tid = $poll['tid']; $query = $db->simple_select("threads", "*", "tid='$tid'"); $thread = $db->fetch_array($query);
|
Zeile 631 | Zeile 647 |
---|
{ error($lang->error_invalidforum); }
|
{ 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");
|
if($forumpermissions['canviewthreads'] == 0 || $forumpermissions['canview'] == 0)
| if($forumpermissions['canviewthreads'] == 0 || $forumpermissions['canview'] == 0 || ($forumpermissions['canonlyviewownthreads'] != 0 && $thread['uid'] != $mybb->user['uid']))
|
{
|
{
|
error($lang->error_pollpermissions);
| error_no_permission();
|
} if(!$poll['pid'])
| } if(!$poll['pid'])
|
Zeile 865 | Zeile 881 |
---|
$now = TIME_NOW; $votesarray = explode("||~|~||", $poll['votes']); $option = $mybb->input['option'];
|
$now = TIME_NOW; $votesarray = explode("||~|~||", $poll['votes']); $option = $mybb->input['option'];
|
$numvotes = $poll['numvotes'];
| $numvotes = (int)$poll['numvotes'];
|
if($poll['multiple'] == 1) { if(is_array($option))
| if($poll['multiple'] == 1) { if(is_array($option))
|
Zeile 941 | Zeile 957 |
---|
$query = $db->simple_select("polls", "*", "pid='".intval($mybb->input['pid'])."'"); $poll = $db->fetch_array($query);
|
$query = $db->simple_select("polls", "*", "pid='".intval($mybb->input['pid'])."'"); $poll = $db->fetch_array($query);
|
| $poll['numvotes'] = (int)$poll['numvotes'];
|
if(!$poll['pid']) {
| if(!$poll['pid']) {
|