diff options
Diffstat (limited to 'phpBB/viewtopic.php')
-rw-r--r-- | phpBB/viewtopic.php | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/phpBB/viewtopic.php b/phpBB/viewtopic.php index 61a28940b1..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); } @@ -1110,7 +1115,6 @@ while ($row = $db->sql_fetchrow($result)) 'rank_image' => '', 'rank_image_src' => '', 'sig' => '', - 'profile' => '', 'pm' => '', 'email' => '', 'jabber' => '', @@ -1175,7 +1179,6 @@ while ($row = $db->sql_fetchrow($result)) 'user_colour' => $row['user_colour'], 'online' => false, - 'profile' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=$poster_id"), 'jabber' => ($row['user_jabber'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=$poster_id") : '', 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=$poster_id&sr=posts") : '', @@ -1621,7 +1624,6 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) 'U_INFO' => ($auth->acl_get('m_info', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=main&mode=post_details&f=$forum_id&p=" . $row['post_id'], true, $user->session_id) : '', 'U_DELETE' => ($delete_allowed) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : '', - 'U_PROFILE' => $user_cache[$poster_id]['profile'], 'U_SEARCH' => $user_cache[$poster_id]['search'], 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') && ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_'))) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=' . $row['post_id']) : '', 'U_EMAIL' => $user_cache[$poster_id]['email'], |