Zeile 482 | Zeile 482 |
---|
$showresults = 1; }
|
$showresults = 1; }
|
// If the user is not a guest, check if he already voted. if($mybb->user['uid'] != 0)
| if($forumpermissions['canvotepolls'] != 1)
|
{
|
{
|
$query = $db->simple_select("pollvotes", "*", "uid='".$mybb->user['uid']."' AND pid='".$poll['pid']."'"); while($votecheck = $db->fetch_array($query)) { $alreadyvoted = 1; $votedfor[$votecheck['voteoption']] = 1; }
| $nopermission = 1; }
// Check if the user has voted before... if($mybb->user['uid']) { $user_check = "uid='{$mybb->user['uid']}'";
|
} else {
|
} else {
|
if(isset($mybb->cookies['pollvotes'][$poll['pid']]) && $mybb->cookies['pollvotes'][$poll['pid']] !== "") { $alreadyvoted = 1; }
| $user_check = "uid='0' AND ipaddress=".$db->escape_binary($session->packedip); }
$query = $db->simple_select("pollvotes", "*", "{$user_check} AND pid='".$poll['pid']."'"); while($votecheck = $db->fetch_array($query)) { $alreadyvoted = 1; $votedfor[$votecheck['voteoption']] = 1;
|
}
|
}
|
|
|
$optionsarray = explode("||~|~||", $poll['options']); $votesarray = explode("||~|~||", $poll['votes']); $poll['question'] = htmlspecialchars_uni($poll['question']); $polloptions = ''; $totalvotes = 0; $poll['totvotes'] = 0;
|
$optionsarray = explode("||~|~||", $poll['options']); $votesarray = explode("||~|~||", $poll['votes']); $poll['question'] = htmlspecialchars_uni($poll['question']); $polloptions = ''; $totalvotes = 0; $poll['totvotes'] = 0;
|
|
|
for($i = 1; $i <= $poll['numoptions']; ++$i) { $poll['totvotes'] = $poll['totvotes'] + $votesarray[$i-1];
| for($i = 1; $i <= $poll['numoptions']; ++$i) { $poll['totvotes'] = $poll['totvotes'] + $votesarray[$i-1];
|
Zeile 549 | Zeile 554 |
---|
{ $optionbg = "trow1"; $votestar = "";
|
{ $optionbg = "trow1"; $votestar = "";
|
}
| }
|
// If the user already voted or if the results need to be shown, do so; else show voting screen. if(isset($alreadyvoted) || isset($showresults)) { if((int)$votes == "0")
|
// If the user already voted or if the results need to be shown, do so; else show voting screen. if(isset($alreadyvoted) || isset($showresults)) { if((int)$votes == "0")
|
{
| {
|
$percent = "0";
|
$percent = "0";
|
}
| }
|
else { $percent = number_format($votes / $poll['totvotes'] * 100, 2); } $imagewidth = round($percent); eval("\$polloptions .= \"".$templates->get("showthread_poll_resultbit")."\";");
|
else { $percent = number_format($votes / $poll['totvotes'] * 100, 2); } $imagewidth = round($percent); eval("\$polloptions .= \"".$templates->get("showthread_poll_resultbit")."\";");
|
}
| }
|
else { if($poll['multiple'] == 1)
| else { if($poll['multiple'] == 1)
|
Zeile 594 | Zeile 599 |
---|
{ eval("\$edit_poll = \"".$templates->get("showthread_poll_editpoll")."\";"); }
|
{ eval("\$edit_poll = \"".$templates->get("showthread_poll_editpoll")."\";"); }
|
|
|
// Decide what poll status to show depending on the status of the poll and whether or not the user voted already.
|
// Decide what poll status to show depending on the status of the poll and whether or not the user voted already.
|
if(isset($alreadyvoted) || isset($showresults))
| if(isset($alreadyvoted) || isset($showresults) || isset($nopermission))
|
{ if($alreadyvoted)
|
{ if($alreadyvoted)
|
{
| {
|
$pollstatus = $lang->already_voted;
|
$pollstatus = $lang->already_voted;
|
| $undovote = '';
|
if($mybb->usergroup['canundovotes'] == 1) {
|
if($mybb->usergroup['canundovotes'] == 1) {
|
eval("\$pollstatus .= \"".$templates->get("showthread_poll_undovote")."\";");
| eval("\$undovote = \"".$templates->get("showthread_poll_undovote")."\";");
|
}
|
}
|
| } elseif($nopermission) { $pollstatus = $lang->no_voting_permission;
|
} else { $pollstatus = $lang->poll_closed; }
|
} else { $pollstatus = $lang->poll_closed; }
|
|
|
$lang->total_votes = $lang->sprintf($lang->total_votes, $totalvotes); eval("\$pollbox = \"".$templates->get("showthread_poll_results")."\";"); $plugins->run_hooks("showthread_poll_results");
| $lang->total_votes = $lang->sprintf($lang->total_votes, $totalvotes); eval("\$pollbox = \"".$templates->get("showthread_poll_results")."\";"); $plugins->run_hooks("showthread_poll_results");
|
Zeile 924 | Zeile 935 |
---|
if(!empty($mybb->input['pid'])) { $post = get_post($mybb->input['pid']);
|
if(!empty($mybb->input['pid'])) { $post = get_post($mybb->input['pid']);
|
if(empty($post) || ($post['visible'] == 0 && !is_moderator($post['fid'], 'canviewunapprove')) || ($post['visible'] == -1 && !is_moderator($post['fid'], 'canviewdeleted')))
| if(empty($post) || ($post['visible'] == 0 && !is_moderator($post['fid'], 'canviewunapprove')) || ($post['visible'] == -1 && !is_moderator($post['fid'], 'canviewdeleted') && $forumpermissions['canviewdeletionnotice'] == 0))
|
{ $footer .= '<script type="text/javascript">$(document).ready(function() { $.jGrowl(\''.$lang->error_invalidpost.'\', {theme: \'jgrowl_error\'}); });</script>'; }
| { $footer .= '<script type="text/javascript">$(document).ready(function() { $.jGrowl(\''.$lang->error_invalidpost.'\', {theme: \'jgrowl_error\'}); });</script>'; }
|
Zeile 1314 | Zeile 1325 |
---|
while($tool = $db->fetch_array($query)) {
|
while($tool = $db->fetch_array($query)) {
|
| $tool['name'] = htmlspecialchars_uni($tool['name']);
|
if($tool['type'] == 'p') { eval("\$customposttools .= \"".$templates->get("showthread_inlinemoderation_custom_tool")."\";");
| if($tool['type'] == 'p') { eval("\$customposttools .= \"".$templates->get("showthread_inlinemoderation_custom_tool")."\";");
|