aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/viewtopic.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r--phpBB/viewtopic.php33
1 files changed, 22 insertions, 11 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php
index fc3a7321f0..1a74ad3e38 100644
--- a/phpBB/viewtopic.php
+++ b/phpBB/viewtopic.php
@@ -842,9 +842,11 @@ if (!empty($topic_data['poll_start']))
}
$poll_total = 0;
+ $poll_most = 0;
foreach ($poll_info as $poll_option)
{
$poll_total += $poll_option['poll_option_total'];
+ $poll_most = ($poll_option['poll_option_total'] >= $poll_most) ? $poll_option['poll_option_total'] : $poll_most;
}
$parse_flags = ($poll_info[0]['bbcode_bitfield'] ? OPTION_FLAG_BBCODE : 0) | OPTION_FLAG_SMILIES;
@@ -860,16 +862,19 @@ if (!empty($topic_data['poll_start']))
{
$option_pct = ($poll_total > 0) ? $poll_option['poll_option_total'] / $poll_total : 0;
$option_pct_txt = sprintf("%.1d%%", round($option_pct * 100));
+ $option_pct_rel = ($poll_most > 0) ? $poll_option['poll_option_total'] / $poll_most : 0;
+ $option_pct_rel_txt = sprintf("%.1d%%", round($option_pct_rel * 100));
$template->assign_block_vars('poll_option', array(
- 'POLL_OPTION_ID' => $poll_option['poll_option_id'],
- 'POLL_OPTION_CAPTION' => $poll_option['poll_option_text'],
- 'POLL_OPTION_RESULT' => $poll_option['poll_option_total'],
- 'POLL_OPTION_PERCENT' => $option_pct_txt,
- 'POLL_OPTION_PCT' => round($option_pct * 100),
- 'POLL_OPTION_WIDTH' => round($option_pct * 250),
- 'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false)
- );
+ 'POLL_OPTION_ID' => $poll_option['poll_option_id'],
+ 'POLL_OPTION_CAPTION' => $poll_option['poll_option_text'],
+ 'POLL_OPTION_RESULT' => $poll_option['poll_option_total'],
+ 'POLL_OPTION_PERCENT' => $option_pct_txt,
+ 'POLL_OPTION_PERCENT_REL' => $option_pct_rel_txt,
+ 'POLL_OPTION_PCT' => round($option_pct * 100),
+ 'POLL_OPTION_WIDTH' => round($option_pct * 250),
+ 'POLL_OPTION_VOTED' => (in_array($poll_option['poll_option_id'], $cur_voted_id)) ? true : false,
+ ));
}
$poll_end = $topic_data['poll_length'] + $topic_data['poll_start'];
@@ -889,8 +894,8 @@ if (!empty($topic_data['poll_start']))
'S_IS_MULTI_CHOICE' => ($topic_data['poll_max_options'] > 1) ? true : false,
'S_POLL_ACTION' => $viewtopic_url,
- 'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll')
- );
+ 'U_VIEW_RESULTS' => $viewtopic_url . '&view=viewpoll',
+ ));
unset($poll_end, $poll_info, $voted_id);
}
@@ -1562,13 +1567,19 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
$edit_allowed = ($user->data['is_registered'] && ($auth->acl_get('m_edit', $forum_id) || (
$user->data['user_id'] == $poster_id &&
$auth->acl_get('f_edit', $forum_id) &&
+ $topic_data['topic_status'] != ITEM_LOCKED &&
!$row['post_edit_locked'] &&
($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])
)));
+ $quote_allowed = $auth->acl_get('m_edit', $forum_id) || ($topic_data['topic_status'] != ITEM_LOCKED &&
+ ($user->data['user_id'] == ANONYMOUS || $auth->acl_get('f_reply', $forum_id))
+ );
+
$delete_allowed = ($user->data['is_registered'] && (($auth->acl_get('m_delete', $forum_id) || ($auth->acl_get('m_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) || (
$user->data['user_id'] == $poster_id &&
($auth->acl_get('f_delete', $forum_id) || ($auth->acl_get('f_softdelete', $forum_id) && $row['post_visibility'] != ITEM_DELETED)) &&
+ $topic_data['topic_status'] != ITEM_LOCKED &&
$topic_data['topic_last_post_id'] == $row['post_id'] &&
($row['post_time'] > time() - ($config['delete_time'] * 60) || !$config['delete_time']) &&
// we do not want to allow removal of the last post if a moderator locked it!
@@ -1609,7 +1620,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false),
'U_EDIT' => ($edit_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&amp;f=$forum_id&amp;p={$row['post_id']}") : '',
- 'U_QUOTE' => ($auth->acl_get('f_reply', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&amp;f=$forum_id&amp;p={$row['post_id']}") : '',
+ 'U_QUOTE' => ($quote_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&amp;f=$forum_id&amp;p={$row['post_id']}") : '',
'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&amp;mode=post_details&amp;f=$forum_id&amp;p=" . $row['post_id'], true, $user->session_id) : '',
'U_DELETE' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&amp;f=$forum_id&amp;p={$row['post_id']}") : '',