--- viewtopic_phpbb.php 2009-03-16 17:49:19.000000000 +0100 +++ viewtopic_opt.php 2009-03-17 12:51:18.000000000 +0100 @@ -915,6 +915,16 @@ if (!sizeof($post_list)) } } +$user_acl_sendim = $auth->acl_get('u_sendim'); +$user_url_cache = array( + 'profile' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=viewprofile&u=%s"), + 'aim' => $user_acl_sendim ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=aim&u=%s") : '', + 'msn' => $user_acl_sendim ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=msnm&u=%s") : '', + 'jabber' => $user_acl_sendim ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=jabber&u=%s") : '', + 'search' => ($auth->acl_get('u_search')) ? append_sid("{$phpbb_root_path}search.$phpEx", "author_id=%s&sr=posts") : '', + 'email' => append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=%s"), +); + // Holding maximum post time for marking topic read // We need to grab it because we do reverse ordering sometimes $max_post_time = 0; @@ -1085,20 +1095,20 @@ 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"), + 'profile' => str_replace('%s', $poster_id, $user_url_cache['profile']), 'www' => $row['user_website'], - 'aim' => ($row['user_aim'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=aim&u=$poster_id") : '', - 'msn' => ($row['user_msnm'] && $auth->acl_get('u_sendim')) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=contact&action=msnm&u=$poster_id") : '', - 'yim' => ($row['user_yim']) ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '', - '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") : '', + 'aim' => $row['user_aim'] ? str_replace('%s', $poster_id, $user_url_cache['aim']) : '', + 'msn' => $row['user_msnm'] ? str_replace('%s', $poster_id, $user_url_cache['msn']) : '', + 'yim' => $row['user_yim'] ? 'http://edit.yahoo.com/config/send_webmesg?.target=' . urlencode($row['user_yim']) . '&.src=pg' : '', + 'jabber' => $row['user_jabber'] ? str_replace('%s', $poster_id, $user_url_cache['jabber']) : '', + 'search' => str_replace('%s', $poster_id, $user_url_cache['search']), ); get_user_rank($row['user_rank'], $row['user_posts'], $user_cache[$poster_id]['rank_title'], $user_cache[$poster_id]['rank_image'], $user_cache[$poster_id]['rank_image_src']); if (!empty($row['user_allow_viewemail']) || $auth->acl_get('a_email')) { - $user_cache[$poster_id]['email'] = ($config['board_email_form'] && $config['email_enable']) ? append_sid("{$phpbb_root_path}memberlist.$phpEx", "mode=email&u=$poster_id") : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']); + $user_cache[$poster_id]['email'] = ($config['board_email_form'] && $config['email_enable']) ? str_replace('%s', $poster_id, $user_url_cache['email']) : (($config['board_hide_emails'] && !$auth->acl_get('a_email')) ? '' : 'mailto:' . $row['user_email']); } else { @@ -1253,6 +1263,24 @@ $template->assign_vars(array( 'S_NUM_POSTS' => sizeof($post_list)) ); +$url_cache = array( + 'U_EDIT' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p=%s") : ''), + 'U_QUOTE' => ($auth->acl_get('f_reply', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f=$forum_id&p=%s") : '', + '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=%s", true, $user->session_id) : '', + 'U_DELETE' => (!$user->data['is_registered'] || !$auth->acl_get('f_delete', $forum_id)) ? '' : append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p=%s"), + 'U_PM' => ($poster_id != ANONYMOUS && $config['allow_privmsg'] && $auth->acl_get('u_sendpm') ) ? append_sid("{$phpbb_root_path}ucp.$phpEx", 'i=pm&mode=compose&action=quotepost&p=%s') : '', + + 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", "f=$forum_id&p=%s") : '', + 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=reports&mode=report_details&f=$forum_id&p=%s", true, $user->session_id) : '', + 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&mode=approve_details&f=$forum_id&p=%s", true, $user->session_id) : '', + 'U_MINI_POST_BASE' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=%s'), + 'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=%s', true, $user->session_id) : '', + 'U_WARN' => ($auth->acl_get('m_warn') && $poster_id != $user->data['user_id'] && $poster_id != ANONYMOUS) ? append_sid("{$phpbb_root_path}mcp.$phpEx", "i=warn&mode=warn_post&f=$forum_id&p=%s", true, $user->session_id) : '', +); + +$user_acl_m_delete = $auth->acl_get('m_delete', $forum_id); + + // Output the posts $first_unread = $post_unread = false; for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i) @@ -1437,14 +1465,14 @@ for ($i = 0, $end = sizeof($post_list); 'ONLINE_IMG' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? '' : (($user_cache[$poster_id]['online']) ? $user->img('icon_user_online', 'ONLINE') : $user->img('icon_user_offline', 'OFFLINE')), 'S_ONLINE' => ($poster_id == ANONYMOUS || !$config['load_onlinetrack']) ? false : (($user_cache[$poster_id]['online']) ? true : false), - 'U_EDIT' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_edit', $forum_id) && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_edit', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=edit&f=$forum_id&p={$row['post_id']}") : ''), - 'U_QUOTE' => ($auth->acl_get('f_reply', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=quote&f=$forum_id&p={$row['post_id']}") : '', - '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' => (!$user->data['is_registered']) ? '' : ((($user->data['user_id'] == $poster_id && $auth->acl_get('f_delete', $forum_id) && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $auth->acl_get('m_delete', $forum_id)) ? append_sid("{$phpbb_root_path}posting.$phpEx", "mode=delete&f=$forum_id&p={$row['post_id']}") : ''), + 'U_EDIT' => str_replace('%s', $row['post_id'], $url_cache['U_EDIT']), + 'U_QUOTE' => str_replace('%s', $row['post_id'], $url_cache['U_QUOTE']), + 'U_INFO' => str_replace('%s', $row['post_id'], $url_cache['U_INFO']), + 'U_DELETE' => (($user->data['user_id'] == $poster_id && $topic_data['topic_last_post_id'] == $row['post_id'] && !$row['post_edit_locked'] && ($row['post_time'] > time() - ($config['edit_time'] * 60) || !$config['edit_time'])) || $user_acl_m_delete) ? str_replace('%s', $row['post_id'], $url_cache['U_DELETE']) : '', '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_PM' => ($user_cache[$poster_id]['allow_pm'] || $auth->acl_gets('a_', 'm_') || $auth->acl_getf_global('m_')) ? sprintf($url_cache['U_PM'], $row['post_id']) : '', 'U_EMAIL' => $user_cache[$poster_id]['email'], 'U_WWW' => $user_cache[$poster_id]['www'], 'U_ICQ' => $user_cache[$poster_id]['icq'], @@ -1453,14 +1481,14 @@ for ($i = 0, $end = sizeof($post_list); 'U_YIM' => $user_cache[$poster_id]['yim'], 'U_JABBER' => $user_cache[$poster_id]['jabber'], - 'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $row['post_id']) : '', - 'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', - 'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', - 'U_MINI_POST' => append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'p=' . $row['post_id']) . (($topic_data['topic_type'] == POST_GLOBAL) ? '&f=' . $forum_id : '') . '#p' . $row['post_id'], + 'U_REPORT' => str_replace('%s', $row['post_id'], $url_cache['U_REPORT']), + 'U_MCP_REPORT' => str_replace('%s', $row['post_id'], $url_cache['U_MCP_REPORT']), + 'U_MCP_APPROVE' => str_replace('%s', $row['post_id'], $url_cache['U_MCP_APPROVE']), + 'U_MINI_POST' => str_replace('%s', $row['post_id'], $url_cache['U_MINI_POST_BASE']) . (($topic_data['topic_type'] == POST_GLOBAL) ? '&f=' . $forum_id : '') . '#p' . $row['post_id'], 'U_NEXT_POST_ID' => ($i < $i_total && isset($rowset[$post_list[$i + 1]])) ? $rowset[$post_list[$i + 1]]['post_id'] : '', 'U_PREV_POST_ID' => $prev_post_id, - 'U_NOTES' => ($auth->acl_getf_global('m_')) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=notes&mode=user_notes&u=' . $poster_id, true, $user->session_id) : '', - 'U_WARN' => ($auth->acl_get('m_warn') && $poster_id != $user->data['user_id'] && $poster_id != ANONYMOUS) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=warn&mode=warn_post&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '', + 'U_NOTES' => str_replace('%s', $poster_id, $url_cache['U_NOTES']), + 'U_WARN' => str_replace('%s', $row['post_id'], $url_cache['U_WARN']), 'POST_ID' => $row['post_id'], 'POSTER_ID' => $poster_id,