root / tags / release_2_0_2 / phpBB / viewtopic.php
History | View | Annotate | Download (44.3 kB)
| 1 | 2 | thefinn | <?php
|
|---|---|---|---|
| 2 | 83 | thefinn | /***************************************************************************
|
| 3 | 585 | psotfx | * viewtopic.php |
| 4 | 83 | thefinn | * ------------------- |
| 5 | 83 | thefinn | * begin : Saturday, Feb 13, 2001 |
| 6 | 83 | thefinn | * copyright : (C) 2001 The phpBB Group |
| 7 | 83 | thefinn | * email : support@phpbb.com |
| 8 | 83 | thefinn | * |
| 9 | 83 | thefinn | * $Id$ |
| 10 | 83 | thefinn | * |
| 11 | 83 | thefinn | * |
| 12 | 83 | thefinn | ***************************************************************************/ |
| 13 | 2 | thefinn | |
| 14 | 1008 | thefinn | /***************************************************************************
|
| 15 | 1008 | thefinn | * |
| 16 | 1008 | thefinn | * This program is free software; you can redistribute it and/or modify |
| 17 | 1008 | thefinn | * it under the terms of the GNU General Public License as published by |
| 18 | 1008 | thefinn | * the Free Software Foundation; either version 2 of the License, or |
| 19 | 1008 | thefinn | * (at your option) any later version. |
| 20 | 1008 | thefinn | * |
| 21 | 1008 | thefinn | ***************************************************************************/ |
| 22 | 942 | psotfx | |
| 23 | 2305 | psotfx | define('IN_PHPBB', true); |
| 24 | 2411 | psotfx | $phpbb_root_path = './'; |
| 25 | 646 | psotfx | include($phpbb_root_path . 'extension.inc'); |
| 26 | 646 | psotfx | include($phpbb_root_path . 'common.'.$phpEx); |
| 27 | 646 | psotfx | include($phpbb_root_path . 'includes/bbcode.'.$phpEx); |
| 28 | 2 | thefinn | |
| 29 | 355 | psotfx | //
|
| 30 | 355 | psotfx | // Start initial var setup
|
| 31 | 355 | psotfx | //
|
| 32 | 2411 | psotfx | if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) ) |
| 33 | 89 | psotfx | {
|
| 34 | 1147 | psotfx | $topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]); |
| 35 | 89 | psotfx | } |
| 36 | 2411 | psotfx | else if ( isset($HTTP_GET_VARS['topic']) ) |
| 37 | 1778 | bartvb | {
|
| 38 | 1778 | bartvb | $topic_id = intval($HTTP_GET_VARS['topic']); |
| 39 | 1778 | bartvb | } |
| 40 | 1778 | bartvb | |
| 41 | 2411 | psotfx | if ( isset($HTTP_GET_VARS[POST_POST_URL])) |
| 42 | 370 | psotfx | {
|
| 43 | 1147 | psotfx | $post_id = intval($HTTP_GET_VARS[POST_POST_URL]); |
| 44 | 370 | psotfx | } |
| 45 | 355 | psotfx | |
| 46 | 1147 | psotfx | $start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0; |
| 47 | 1215 | dougk_ff7 | |
| 48 | 2448 | psotfx | if ( !isset($topic_id) && !isset($post_id) ) |
| 49 | 81 | thefinn | {
|
| 50 | 1291 | psotfx | message_die(GENERAL_MESSAGE, 'Topic_post_not_exist'); |
| 51 | 81 | thefinn | } |
| 52 | 2 | thefinn | |
| 53 | 541 | psotfx | //
|
| 54 | 566 | psotfx | // Find topic id if user requested a newer
|
| 55 | 566 | psotfx | // or older topic
|
| 56 | 566 | psotfx | //
|
| 57 | 2376 | psotfx | if ( isset($HTTP_GET_VARS['view']) && empty($HTTP_GET_VARS[POST_POST_URL]) ) |
| 58 | 301 | thefinn | {
|
| 59 | 2376 | psotfx | if ( $HTTP_GET_VARS['view'] == 'newest' ) |
| 60 | 301 | thefinn | {
|
| 61 | 2448 | psotfx | $header_location = ( @preg_match('/Microsoft|WebSTAR|Xitami/', getenv('SERVER_SOFTWARE')) ) ? 'Refresh: 0; URL=' : 'Location: '; |
| 62 | 2448 | psotfx | |
| 63 | 2376 | psotfx | if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) ) |
| 64 | 1093 | psotfx | {
|
| 65 | 2376 | psotfx | $session_id = $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']; |
| 66 | 1093 | psotfx | |
| 67 | 2376 | psotfx | if ( $session_id ) |
| 68 | 1093 | psotfx | {
|
| 69 | 1511 | psotfx | $sql = "SELECT p.post_id |
| 70 | 1604 | psotfx | FROM " . POSTS_TABLE . " p, " . SESSIONS_TABLE . " s, " . USERS_TABLE . " u |
| 71 | 1604 | psotfx | WHERE s.session_id = '$session_id' |
| 72 | 1604 | psotfx | AND u.user_id = s.session_user_id |
| 73 | 1604 | psotfx | AND p.topic_id = $topic_id |
| 74 | 1604 | psotfx | AND p.post_time >= u.user_lastvisit |
| 75 | 1511 | psotfx | ORDER BY p.post_time ASC |
| 76 | 1511 | psotfx | LIMIT 1";
|
| 77 | 2376 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 78 | 1511 | psotfx | {
|
| 79 | 2376 | psotfx | message_die(GENERAL_ERROR, 'Could not obtain newer/older topic information', '', __LINE__, __FILE__, $sql); |
| 80 | 1511 | psotfx | } |
| 81 | 1093 | psotfx | |
| 82 | 2376 | psotfx | if ( !($row = $db->sql_fetchrow($result)) ) |
| 83 | 1511 | psotfx | {
|
| 84 | 1605 | psotfx | message_die(GENERAL_MESSAGE, 'No_new_posts_last_visit'); |
| 85 | 1511 | psotfx | } |
| 86 | 2448 | psotfx | |
| 87 | 2448 | psotfx | $post_id = $row['post_id']; |
| 88 | 2448 | psotfx | header($header_location . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id", true)); |
| 89 | 2376 | psotfx | exit;
|
| 90 | 1093 | psotfx | } |
| 91 | 1093 | psotfx | } |
| 92 | 2448 | psotfx | |
| 93 | 2448 | psotfx | header($header_location . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", true)); |
| 94 | 2448 | psotfx | exit;
|
| 95 | 1093 | psotfx | } |
| 96 | 2411 | psotfx | else if ( $HTTP_GET_VARS['view'] == 'next' || $HTTP_GET_VARS['view'] == 'previous' ) |
| 97 | 1093 | psotfx | {
|
| 98 | 2376 | psotfx | $sql_condition = ( $HTTP_GET_VARS['view'] == 'next' ) ? '>' : '<'; |
| 99 | 2376 | psotfx | $sql_ordering = ( $HTTP_GET_VARS['view'] == 'next' ) ? 'ASC' : 'DESC'; |
| 100 | 302 | thefinn | |
| 101 | 2376 | psotfx | $sql = "SELECT t.topic_id |
| 102 | 2376 | psotfx | FROM " . TOPICS_TABLE . " t, " . TOPICS_TABLE . " t2, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 |
| 103 | 2376 | psotfx | WHERE t2.topic_id = $topic_id |
| 104 | 2376 | psotfx | AND p2.post_id = t2.topic_last_post_id |
| 105 | 2376 | psotfx | AND t.forum_id = t2.forum_id |
| 106 | 2376 | psotfx | AND p.post_id = t.topic_last_post_id |
| 107 | 2376 | psotfx | AND p.post_time $sql_condition p2.post_time |
| 108 | 2376 | psotfx | AND p.topic_id = t.topic_id |
| 109 | 2376 | psotfx | ORDER BY p.post_time $sql_ordering |
| 110 | 2376 | psotfx | LIMIT 1";
|
| 111 | 2376 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 112 | 2376 | psotfx | {
|
| 113 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not obtain newer/older topic information", '', __LINE__, __FILE__, $sql); |
| 114 | 2376 | psotfx | } |
| 115 | 792 | thefinn | |
| 116 | 2579 | psotfx | if ( $row = $db->sql_fetchrow($result) ) |
| 117 | 566 | psotfx | {
|
| 118 | 2579 | psotfx | $topic_id = $row['topic_id']; |
| 119 | 566 | psotfx | } |
| 120 | 566 | psotfx | else
|
| 121 | 566 | psotfx | {
|
| 122 | 2579 | psotfx | $message = ( $HTTP_GET_VARS['view'] == 'next' ) ? 'No_newer_topics' : 'No_older_topics'; |
| 123 | 2579 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 124 | 566 | psotfx | } |
| 125 | 566 | psotfx | } |
| 126 | 301 | thefinn | } |
| 127 | 566 | psotfx | |
| 128 | 301 | thefinn | //
|
| 129 | 566 | psotfx | // This rather complex gaggle of code handles querying for topics but
|
| 130 | 566 | psotfx | // also allows for direct linking to a post (and the calculation of which
|
| 131 | 566 | psotfx | // page the post is on and the correct display of viewtopic)
|
| 132 | 301 | thefinn | //
|
| 133 | 2376 | psotfx | $join_sql_table = ( !isset($post_id) ) ? '' : ", " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2 "; |
| 134 | 1511 | psotfx | $join_sql = ( !isset($post_id) ) ? "t.topic_id = $topic_id" : "p.post_id = $post_id AND t.topic_id = p.topic_id AND p2.topic_id = p.topic_id AND p2.post_id <= $post_id"; |
| 135 | 2376 | psotfx | $count_sql = ( !isset($post_id) ) ? '' : ", COUNT(p2.post_id) AS prev_posts"; |
| 136 | 87 | psotfx | |
| 137 | 2572 | psotfx | $order_sql = ( !isset($post_id) ) ? '' : "GROUP BY p.post_id, t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments ORDER BY p.post_id ASC"; |
| 138 | 506 | psotfx | |
| 139 | 2572 | psotfx | $sql = "SELECT t.topic_id, t.topic_title, t.topic_status, t.topic_replies, t.topic_time, t.topic_type, t.topic_vote, t.topic_last_post_id, f.forum_name, f.forum_status, f.forum_id, f.auth_view, f.auth_read, f.auth_post, f.auth_reply, f.auth_edit, f.auth_delete, f.auth_sticky, f.auth_announce, f.auth_pollcreate, f.auth_vote, f.auth_attachments" . $count_sql . " |
| 140 | 1511 | psotfx | FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f" . $join_sql_table . " |
| 141 | 1222 | dougk_ff7 | WHERE $join_sql |
| 142 | 1222 | dougk_ff7 | AND f.forum_id = t.forum_id |
| 143 | 1222 | dougk_ff7 | $order_sql"; |
| 144 | 2411 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 145 | 83 | thefinn | {
|
| 146 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not obtain topic information", '', __LINE__, __FILE__, $sql); |
| 147 | 81 | thefinn | } |
| 148 | 355 | psotfx | |
| 149 | 2572 | psotfx | if ( !($forum_topic_data = $db->sql_fetchrow($result)) ) |
| 150 | 81 | thefinn | {
|
| 151 | 2079 | psotfx | message_die(GENERAL_MESSAGE, 'Topic_post_not_exist'); |
| 152 | 81 | thefinn | } |
| 153 | 566 | psotfx | |
| 154 | 2572 | psotfx | $forum_id = $forum_topic_data['forum_id']; |
| 155 | 143 | psotfx | |
| 156 | 824 | psotfx | //
|
| 157 | 824 | psotfx | // Start session management
|
| 158 | 824 | psotfx | //
|
| 159 | 1997 | psotfx | $userdata = session_pagestart($user_ip, $forum_id); |
| 160 | 824 | psotfx | init_userprefs($userdata);
|
| 161 | 824 | psotfx | //
|
| 162 | 824 | psotfx | // End session management
|
| 163 | 824 | psotfx | //
|
| 164 | 824 | psotfx | |
| 165 | 143 | psotfx | //
|
| 166 | 377 | psotfx | // Start auth check
|
| 167 | 377 | psotfx | //
|
| 168 | 1147 | psotfx | $is_auth = array(); |
| 169 | 2572 | psotfx | $is_auth = auth(AUTH_ALL, $forum_id, $userdata, $forum_topic_data); |
| 170 | 377 | psotfx | |
| 171 | 1619 | psotfx | if( !$is_auth['auth_view'] || !$is_auth['auth_read'] ) |
| 172 | 377 | psotfx | {
|
| 173 | 2079 | psotfx | if ( !$userdata['session_logged_in'] ) |
| 174 | 2079 | psotfx | {
|
| 175 | 2079 | psotfx | $redirect = ( isset($post_id) ) ? POST_POST_URL . "=$post_id" : POST_TOPIC_URL . "=$topic_id"; |
| 176 | 2411 | psotfx | $redirect .= ( isset($start) ) ? "&start=$start" : ''; |
| 177 | 2444 | the_systech | $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; |
| 178 | 2411 | psotfx | header($header_location . append_sid("login.$phpEx?redirect=viewtopic.$phpEx&$redirect", true)); |
| 179 | 2575 | psotfx | exit;
|
| 180 | 2079 | psotfx | } |
| 181 | 421 | thefinn | |
| 182 | 2079 | psotfx | $message = ( !$is_auth['auth_view'] ) ? $lang['Topic_post_not_exist'] : sprintf($lang['Sorry_auth_read'], $is_auth['auth_read_type']); |
| 183 | 2079 | psotfx | |
| 184 | 1435 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 185 | 377 | psotfx | } |
| 186 | 377 | psotfx | //
|
| 187 | 377 | psotfx | // End auth check
|
| 188 | 421 | thefinn | //
|
| 189 | 377 | psotfx | |
| 190 | 2572 | psotfx | $forum_name = $forum_topic_data['forum_name']; |
| 191 | 2572 | psotfx | $topic_title = $forum_topic_data['topic_title']; |
| 192 | 2572 | psotfx | $topic_id = $forum_topic_data['topic_id']; |
| 193 | 2572 | psotfx | $topic_time = $forum_topic_data['topic_time']; |
| 194 | 2079 | psotfx | |
| 195 | 2079 | psotfx | if ( !empty($post_id) ) |
| 196 | 2079 | psotfx | {
|
| 197 | 2572 | psotfx | $start = floor(($forum_topic_data['prev_posts'] - 1) / $board_config['posts_per_page']) * $board_config['posts_per_page']; |
| 198 | 2079 | psotfx | } |
| 199 | 2079 | psotfx | |
| 200 | 431 | psotfx | //
|
| 201 | 2110 | psotfx | // Is user watching this thread?
|
| 202 | 862 | psotfx | //
|
| 203 | 2110 | psotfx | if( $userdata['session_logged_in'] ) |
| 204 | 862 | psotfx | {
|
| 205 | 862 | psotfx | $can_watch_topic = TRUE; |
| 206 | 862 | psotfx | |
| 207 | 1008 | thefinn | $sql = "SELECT notify_status |
| 208 | 1008 | thefinn | FROM " . TOPICS_WATCH_TABLE . " |
| 209 | 1008 | thefinn | WHERE topic_id = $topic_id |
| 210 | 862 | psotfx | AND user_id = " . $userdata['user_id']; |
| 211 | 2448 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 212 | 862 | psotfx | {
|
| 213 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not obtain topic watch information", '', __LINE__, __FILE__, $sql); |
| 214 | 862 | psotfx | } |
| 215 | 2110 | psotfx | |
| 216 | 2411 | psotfx | if ( $row = $db->sql_fetchrow($result) ) |
| 217 | 862 | psotfx | {
|
| 218 | 2411 | psotfx | if ( isset($HTTP_GET_VARS['unwatch']) ) |
| 219 | 862 | psotfx | {
|
| 220 | 2411 | psotfx | if ( $HTTP_GET_VARS['unwatch'] == 'topic' ) |
| 221 | 862 | psotfx | {
|
| 222 | 862 | psotfx | $is_watching_topic = 0; |
| 223 | 862 | psotfx | |
| 224 | 2411 | psotfx | $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ''; |
| 225 | 1008 | thefinn | $sql = "DELETE $sql_priority FROM " . TOPICS_WATCH_TABLE . " |
| 226 | 1008 | thefinn | WHERE topic_id = $topic_id |
| 227 | 862 | psotfx | AND user_id = " . $userdata['user_id']; |
| 228 | 2411 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 229 | 862 | psotfx | {
|
| 230 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not delete topic watch information", '', __LINE__, __FILE__, $sql); |
| 231 | 862 | psotfx | } |
| 232 | 862 | psotfx | } |
| 233 | 1093 | psotfx | |
| 234 | 1093 | psotfx | $template->assign_vars(array( |
| 235 | 2411 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">') |
| 236 | 1093 | psotfx | ); |
| 237 | 1093 | psotfx | |
| 238 | 2110 | psotfx | $message = $lang['No_longer_watching'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">', '</a>'); |
| 239 | 1093 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 240 | 862 | psotfx | } |
| 241 | 862 | psotfx | else
|
| 242 | 862 | psotfx | {
|
| 243 | 862 | psotfx | $is_watching_topic = TRUE; |
| 244 | 862 | psotfx | |
| 245 | 2411 | psotfx | if ( $row['notify_status'] ) |
| 246 | 862 | psotfx | {
|
| 247 | 2411 | psotfx | $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ''; |
| 248 | 1008 | thefinn | $sql = "UPDATE $sql_priority " . TOPICS_WATCH_TABLE . " |
| 249 | 1008 | thefinn | SET notify_status = 0 |
| 250 | 1008 | thefinn | WHERE topic_id = $topic_id |
| 251 | 862 | psotfx | AND user_id = " . $userdata['user_id']; |
| 252 | 2411 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 253 | 862 | psotfx | {
|
| 254 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not update topic watch information", '', __LINE__, __FILE__, $sql); |
| 255 | 862 | psotfx | } |
| 256 | 862 | psotfx | } |
| 257 | 862 | psotfx | } |
| 258 | 862 | psotfx | } |
| 259 | 862 | psotfx | else
|
| 260 | 862 | psotfx | {
|
| 261 | 2411 | psotfx | if ( isset($HTTP_GET_VARS['watch']) ) |
| 262 | 862 | psotfx | {
|
| 263 | 2411 | psotfx | if ( $HTTP_GET_VARS['watch'] == 'topic' ) |
| 264 | 862 | psotfx | {
|
| 265 | 862 | psotfx | $is_watching_topic = TRUE; |
| 266 | 862 | psotfx | |
| 267 | 2411 | psotfx | $sql_priority = (SQL_LAYER == "mysql") ? "LOW_PRIORITY" : ''; |
| 268 | 1008 | thefinn | $sql = "INSERT $sql_priority INTO " . TOPICS_WATCH_TABLE . " (user_id, topic_id, notify_status) |
| 269 | 862 | psotfx | VALUES (" . $userdata['user_id'] . ", $topic_id, 0)"; |
| 270 | 2411 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 271 | 862 | psotfx | {
|
| 272 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not insert topic watch information", '', __LINE__, __FILE__, $sql); |
| 273 | 862 | psotfx | } |
| 274 | 862 | psotfx | } |
| 275 | 1093 | psotfx | |
| 276 | 1093 | psotfx | $template->assign_vars(array( |
| 277 | 2411 | psotfx | 'META' => '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">') |
| 278 | 1093 | psotfx | ); |
| 279 | 1093 | psotfx | |
| 280 | 2110 | psotfx | $message = $lang['You_are_watching'] . '<br /><br />' . sprintf($lang['Click_return_topic'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start") . '">', '</a>'); |
| 281 | 1093 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 282 | 862 | psotfx | } |
| 283 | 862 | psotfx | else
|
| 284 | 862 | psotfx | {
|
| 285 | 862 | psotfx | $is_watching_topic = 0; |
| 286 | 862 | psotfx | } |
| 287 | 862 | psotfx | } |
| 288 | 862 | psotfx | } |
| 289 | 862 | psotfx | else
|
| 290 | 862 | psotfx | {
|
| 291 | 2411 | psotfx | if ( isset($HTTP_GET_VARS['unwatch']) ) |
| 292 | 866 | psotfx | {
|
| 293 | 2411 | psotfx | if ( $HTTP_GET_VARS['unwatch'] == 'topic' ) |
| 294 | 866 | psotfx | {
|
| 295 | 2444 | the_systech | $header_location = ( @preg_match("/Microsoft|WebSTAR|Xitami/", getenv("SERVER_SOFTWARE")) ) ? "Refresh: 0; URL=" : "Location: "; |
| 296 | 2411 | psotfx | header($header_location . append_sid("login.$phpEx?redirect=viewtopic.$phpEx&" . POST_TOPIC_URL . "=$topic_id&unwatch=topic", true)); |
| 297 | 2575 | psotfx | exit;
|
| 298 | 866 | psotfx | } |
| 299 | 866 | psotfx | } |
| 300 | 866 | psotfx | else
|
| 301 | 866 | psotfx | {
|
| 302 | 866 | psotfx | $can_watch_topic = 0; |
| 303 | 866 | psotfx | $is_watching_topic = 0; |
| 304 | 866 | psotfx | } |
| 305 | 862 | psotfx | } |
| 306 | 862 | psotfx | |
| 307 | 862 | psotfx | //
|
| 308 | 770 | psotfx | // Generate a 'Show posts in previous x days' select box. If the postdays var is POSTed
|
| 309 | 770 | psotfx | // then get it's value, find the number of topics with dates newer than it (to properly
|
| 310 | 770 | psotfx | // handle pagination) and alter the main query
|
| 311 | 770 | psotfx | //
|
| 312 | 770 | psotfx | $previous_days = array(0, 1, 7, 14, 30, 90, 180, 364); |
| 313 | 1332 | psotfx | $previous_days_text = array($lang['All_Posts'], $lang['1_Day'], $lang['7_Days'], $lang['2_Weeks'], $lang['1_Month'], $lang['3_Months'], $lang['6_Months'], $lang['1_Year']); |
| 314 | 770 | psotfx | |
| 315 | 1511 | psotfx | if( !empty($HTTP_POST_VARS['postdays']) || !empty($HTTP_GET_VARS['postdays']) ) |
| 316 | 770 | psotfx | {
|
| 317 | 1511 | psotfx | $post_days = ( !empty($HTTP_POST_VARS['postdays']) ) ? $HTTP_POST_VARS['postdays'] : $HTTP_GET_VARS['postdays']; |
| 318 | 770 | psotfx | $min_post_time = time() - ($post_days * 86400); |
| 319 | 770 | psotfx | |
| 320 | 2564 | psotfx | $sql = "SELECT COUNT(p.post_id) AS num_posts |
| 321 | 2564 | psotfx | FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p |
| 322 | 2564 | psotfx | WHERE t.topic_id = $topic_id |
| 323 | 2564 | psotfx | AND p.topic_id = t.topic_id |
| 324 | 2564 | psotfx | AND p.post_time >= $min_post_time"; |
| 325 | 2411 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 326 | 770 | psotfx | {
|
| 327 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not obtain limited topics count information", '', __LINE__, __FILE__, $sql); |
| 328 | 770 | psotfx | } |
| 329 | 770 | psotfx | |
| 330 | 987 | psotfx | $total_replies = ( $row = $db->sql_fetchrow($result) ) ? $row['num_posts'] : 0; |
| 331 | 987 | psotfx | |
| 332 | 770 | psotfx | $limit_posts_time = "AND p.post_time >= $min_post_time "; |
| 333 | 770 | psotfx | |
| 334 | 2411 | psotfx | if ( !empty($HTTP_POST_VARS['postdays'])) |
| 335 | 770 | psotfx | {
|
| 336 | 770 | psotfx | $start = 0; |
| 337 | 770 | psotfx | } |
| 338 | 770 | psotfx | } |
| 339 | 770 | psotfx | else
|
| 340 | 770 | psotfx | {
|
| 341 | 2572 | psotfx | $total_replies = $forum_topic_data['topic_replies'] + 1; |
| 342 | 770 | psotfx | |
| 343 | 2411 | psotfx | $limit_posts_time = ''; |
| 344 | 770 | psotfx | $post_days = 0; |
| 345 | 770 | psotfx | } |
| 346 | 770 | psotfx | |
| 347 | 2110 | psotfx | $select_post_days = '<select name="postdays">'; |
| 348 | 770 | psotfx | for($i = 0; $i < count($previous_days); $i++) |
| 349 | 770 | psotfx | {
|
| 350 | 1851 | psotfx | $selected = ($post_days == $previous_days[$i]) ? ' selected="selected"' : ''; |
| 351 | 2110 | psotfx | $select_post_days .= '<option value="' . $previous_days[$i] . '"' . $selected . '>' . $previous_days_text[$i] . '</option>'; |
| 352 | 770 | psotfx | } |
| 353 | 2110 | psotfx | $select_post_days .= '</select>'; |
| 354 | 770 | psotfx | |
| 355 | 770 | psotfx | //
|
| 356 | 770 | psotfx | // Decide how to order the post display
|
| 357 | 770 | psotfx | //
|
| 358 | 2411 | psotfx | if ( !empty($HTTP_POST_VARS['postorder']) || !empty($HTTP_GET_VARS['postorder']) ) |
| 359 | 770 | psotfx | {
|
| 360 | 770 | psotfx | $post_order = (!empty($HTTP_POST_VARS['postorder'])) ? $HTTP_POST_VARS['postorder'] : $HTTP_GET_VARS['postorder']; |
| 361 | 770 | psotfx | $post_time_order = ($post_order == "asc") ? "ASC" : "DESC"; |
| 362 | 770 | psotfx | } |
| 363 | 770 | psotfx | else
|
| 364 | 770 | psotfx | {
|
| 365 | 2411 | psotfx | $post_order = 'asc'; |
| 366 | 2411 | psotfx | $post_time_order = 'ASC'; |
| 367 | 770 | psotfx | } |
| 368 | 770 | psotfx | |
| 369 | 2110 | psotfx | $select_post_order = '<select name="postorder">'; |
| 370 | 2411 | psotfx | if ( $post_time_order == 'ASC' ) |
| 371 | 770 | psotfx | {
|
| 372 | 2110 | psotfx | $select_post_order .= '<option value="asc" selected="selected">' . $lang['Oldest_First'] . '</option><option value="desc">' . $lang['Newest_First'] . '</option>'; |
| 373 | 770 | psotfx | } |
| 374 | 770 | psotfx | else
|
| 375 | 770 | psotfx | {
|
| 376 | 2110 | psotfx | $select_post_order .= '<option value="asc">' . $lang['Oldest_First'] . '</option><option value="desc" selected="selected">' . $lang['Newest_First'] . '</option>'; |
| 377 | 770 | psotfx | } |
| 378 | 2110 | psotfx | $select_post_order .= '</select>'; |
| 379 | 770 | psotfx | |
| 380 | 770 | psotfx | //
|
| 381 | 355 | psotfx | // Go ahead and pull all data for this topic
|
| 382 | 355 | psotfx | //
|
| 383 | 1647 | psotfx | $sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid |
| 384 | 566 | psotfx | FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt |
| 385 | 281 | psotfx | WHERE p.topic_id = $topic_id |
| 386 | 792 | thefinn | $limit_posts_time |
| 387 | 1851 | psotfx | AND pt.post_id = p.post_id |
| 388 | 1851 | psotfx | AND u.user_id = p.poster_id |
| 389 | 770 | psotfx | ORDER BY p.post_time $post_time_order |
| 390 | 237 | psotfx | LIMIT $start, ".$board_config['posts_per_page']; |
| 391 | 2334 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 392 | 81 | thefinn | {
|
| 393 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not obtain post/user information.", '', __LINE__, __FILE__, $sql); |
| 394 | 81 | thefinn | } |
| 395 | 566 | psotfx | |
| 396 | 2334 | psotfx | if ( $row = $db->sql_fetchrow($result) ) |
| 397 | 81 | thefinn | {
|
| 398 | 2334 | psotfx | $postrow = array(); |
| 399 | 2334 | psotfx | do
|
| 400 | 2334 | psotfx | {
|
| 401 | 2334 | psotfx | $postrow[] = $row; |
| 402 | 2334 | psotfx | } |
| 403 | 2334 | psotfx | while ( $row = $db->sql_fetchrow($result) ); |
| 404 | 2334 | psotfx | $db->sql_freeresult($result); |
| 405 | 2334 | psotfx | |
| 406 | 2334 | psotfx | $total_posts = count($postrow); |
| 407 | 2334 | psotfx | } |
| 408 | 2334 | psotfx | else
|
| 409 | 2334 | psotfx | {
|
| 410 | 1233 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_posts_topic']); |
| 411 | 81 | thefinn | } |
| 412 | 566 | psotfx | |
| 413 | 136 | psotfx | $sql = "SELECT * |
| 414 | 566 | psotfx | FROM " . RANKS_TABLE . " |
| 415 | 566 | psotfx | ORDER BY rank_special, rank_min";
|
| 416 | 2334 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 417 | 136 | psotfx | {
|
| 418 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not obtain ranks information.", '', __LINE__, __FILE__, $sql); |
| 419 | 136 | psotfx | } |
| 420 | 81 | thefinn | |
| 421 | 2334 | psotfx | $ranksrow = array(); |
| 422 | 2334 | psotfx | while ( $row = $db->sql_fetchrow($result) ) |
| 423 | 2334 | psotfx | {
|
| 424 | 2334 | psotfx | $ranksrow[] = $row; |
| 425 | 2334 | psotfx | } |
| 426 | 2334 | psotfx | $db->sql_freeresult($result); |
| 427 | 2334 | psotfx | |
| 428 | 237 | psotfx | //
|
| 429 | 884 | psotfx | // Define censored word matches
|
| 430 | 880 | psotfx | //
|
| 431 | 987 | psotfx | $orig_word = array(); |
| 432 | 987 | psotfx | $replacement_word = array(); |
| 433 | 987 | psotfx | obtain_word_list($orig_word, $replacement_word); |
| 434 | 880 | psotfx | |
| 435 | 880 | psotfx | //
|
| 436 | 1830 | psotfx | // Censor topic title
|
| 437 | 1830 | psotfx | //
|
| 438 | 2411 | psotfx | if ( count($orig_word) ) |
| 439 | 1830 | psotfx | {
|
| 440 | 1830 | psotfx | $topic_title = preg_replace($orig_word, $replacement_word, $topic_title); |
| 441 | 1830 | psotfx | } |
| 442 | 1830 | psotfx | |
| 443 | 1830 | psotfx | //
|
| 444 | 1830 | psotfx | // Was a highlight request part of the URI? Yes, this idea was
|
| 445 | 1830 | psotfx | // taken from vB but we did already have a highlighter in place
|
| 446 | 1830 | psotfx | // in search itself ... it's just been extended a bit!
|
| 447 | 1830 | psotfx | //
|
| 448 | 2411 | psotfx | if ( isset($HTTP_GET_VARS['highlight']) ) |
| 449 | 1830 | psotfx | {
|
| 450 | 1830 | psotfx | $highlight_match = array(); |
| 451 | 1830 | psotfx | |
| 452 | 1830 | psotfx | //
|
| 453 | 1830 | psotfx | // Split words and phrases
|
| 454 | 1830 | psotfx | //
|
| 455 | 2411 | psotfx | $words = explode(' ', trim(urldecode($HTTP_GET_VARS['highlight']))); |
| 456 | 1830 | psotfx | |
| 457 | 1830 | psotfx | for($i = 0; $i < count($words); $i++) |
| 458 | 1830 | psotfx | {
|
| 459 | 2411 | psotfx | if ( trim($words[$i]) != '' ) |
| 460 | 1830 | psotfx | {
|
| 461 | 2448 | psotfx | $highlight_match[] = '#\b(' . str_replace("*", "([\w]+)?", $words[$i]) . ')\b#is'; |
| 462 | 1830 | psotfx | } |
| 463 | 1830 | psotfx | } |
| 464 | 1830 | psotfx | |
| 465 | 1830 | psotfx | $highlight_active = ( count($highlight_match) ) ? true : false; |
| 466 | 1830 | psotfx | } |
| 467 | 1830 | psotfx | else
|
| 468 | 1830 | psotfx | {
|
| 469 | 1830 | psotfx | $highlight_active = false; |
| 470 | 1830 | psotfx | } |
| 471 | 1830 | psotfx | |
| 472 | 1830 | psotfx | //
|
| 473 | 1452 | bartvb | // Post, reply and other URL generation for
|
| 474 | 1452 | bartvb | // templating vars
|
| 475 | 1452 | bartvb | //
|
| 476 | 1452 | bartvb | $new_topic_url = append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id"); |
| 477 | 1452 | bartvb | $reply_topic_url = append_sid("posting.$phpEx?mode=reply&" . POST_TOPIC_URL . "=$topic_id"); |
| 478 | 1452 | bartvb | $view_forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"); |
| 479 | 1452 | bartvb | $view_prev_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=previous"); |
| 480 | 1452 | bartvb | $view_next_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=next"); |
| 481 | 1452 | bartvb | |
| 482 | 1452 | bartvb | //
|
| 483 | 1452 | bartvb | // Mozilla navigation bar
|
| 484 | 1452 | bartvb | //
|
| 485 | 1452 | bartvb | $nav_links['prev'] = array( |
| 486 | 1452 | bartvb | 'url' => $view_prev_topic_url, |
| 487 | 1452 | bartvb | 'title' => $lang['View_previous_topic'] |
| 488 | 1452 | bartvb | ); |
| 489 | 1452 | bartvb | $nav_links['next'] = array( |
| 490 | 1452 | bartvb | 'url' => $view_next_topic_url, |
| 491 | 1452 | bartvb | 'title' => $lang['View_next_topic'] |
| 492 | 1452 | bartvb | ); |
| 493 | 1452 | bartvb | $nav_links['up'] = array( |
| 494 | 1452 | bartvb | 'url' => $view_forum_url, |
| 495 | 1452 | bartvb | 'title' => $forum_name |
| 496 | 1452 | bartvb | ); |
| 497 | 1452 | bartvb | |
| 498 | 2572 | psotfx | $reply_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $images['reply_locked'] : $images['reply_new']; |
| 499 | 2572 | psotfx | $reply_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['Reply_to_topic']; |
| 500 | 2572 | psotfx | $post_img = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new']; |
| 501 | 2572 | psotfx | $post_alt = ( $forum_topic_data['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic']; |
| 502 | 1452 | bartvb | |
| 503 | 1452 | bartvb | //
|
| 504 | 1851 | psotfx | // Set a cookie for this topic
|
| 505 | 355 | psotfx | //
|
| 506 | 2411 | psotfx | if ( $userdata['session_logged_in'] ) |
| 507 | 1511 | psotfx | {
|
| 508 | 2411 | psotfx | $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) : array(); |
| 509 | 2411 | psotfx | $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) : array(); |
| 510 | 1161 | psotfx | |
| 511 | 2411 | psotfx | if ( !empty($tracking_topics[$topic_id]) && !empty($tracking_forums[$forum_id]) ) |
| 512 | 1997 | psotfx | {
|
| 513 | 2411 | psotfx | $topic_last_read = ( $tracking_topics[$topic_id] > $tracking_forums[$forum_id] ) ? $tracking_topics[$topic_id] : $tracking_forums[$forum_id]; |
| 514 | 1997 | psotfx | } |
| 515 | 2411 | psotfx | else if ( !empty($tracking_topics[$topic_id]) || !empty($tracking_forums[$forum_id]) ) |
| 516 | 1997 | psotfx | {
|
| 517 | 2411 | psotfx | $topic_last_read = ( !empty($tracking_topics[$topic_id]) ) ? $tracking_topics[$topic_id] : $tracking_forums[$forum_id]; |
| 518 | 1997 | psotfx | } |
| 519 | 1997 | psotfx | else
|
| 520 | 1997 | psotfx | {
|
| 521 | 1997 | psotfx | $topic_last_read = $userdata['user_lastvisit']; |
| 522 | 1997 | psotfx | } |
| 523 | 1851 | psotfx | |
| 524 | 2448 | psotfx | if ( count($tracking_topics) >= 150 && empty($tracking_topics[$topic_id]) ) |
| 525 | 1997 | psotfx | {
|
| 526 | 1997 | psotfx | asort($tracking_topics); |
| 527 | 1997 | psotfx | unset($tracking_topics[key($tracking_topics)]); |
| 528 | 1997 | psotfx | } |
| 529 | 1851 | psotfx | |
| 530 | 2411 | psotfx | $tracking_topics[$topic_id] = time(); |
| 531 | 1851 | psotfx | |
| 532 | 2448 | psotfx | setcookie($board_config['cookie_name'] . '_t', serialize($tracking_topics), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); |
| 533 | 1997 | psotfx | } |
| 534 | 1997 | psotfx | |
| 535 | 1511 | psotfx | //
|
| 536 | 1511 | psotfx | // Load templates
|
| 537 | 1511 | psotfx | //
|
| 538 | 355 | psotfx | $template->set_filenames(array( |
| 539 | 2448 | psotfx | 'body' => 'viewtopic_body.tpl') |
| 540 | 355 | psotfx | ); |
| 541 | 2448 | psotfx | make_jumpbox('viewforum.'.$phpEx, $forum_id); |
| 542 | 566 | psotfx | |
| 543 | 1851 | psotfx | //
|
| 544 | 1851 | psotfx | // Output page header
|
| 545 | 1851 | psotfx | //
|
| 546 | 2411 | psotfx | $page_title = $lang['View_topic'] .' - ' . $topic_title; |
| 547 | 1851 | psotfx | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 548 | 1851 | psotfx | |
| 549 | 1851 | psotfx | //
|
| 550 | 1851 | psotfx | // User authorisation levels output
|
| 551 | 1851 | psotfx | //
|
| 552 | 2411 | psotfx | $s_auth_can = ( ( $is_auth['auth_post'] ) ? $lang['Rules_post_can'] : $lang['Rules_post_cannot'] ) . '<br />'; |
| 553 | 2411 | psotfx | $s_auth_can .= ( ( $is_auth['auth_reply'] ) ? $lang['Rules_reply_can'] : $lang['Rules_reply_cannot'] ) . '<br />'; |
| 554 | 2411 | psotfx | $s_auth_can .= ( ( $is_auth['auth_edit'] ) ? $lang['Rules_edit_can'] : $lang['Rules_edit_cannot'] ) . '<br />'; |
| 555 | 2411 | psotfx | $s_auth_can .= ( ( $is_auth['auth_delete'] ) ? $lang['Rules_delete_can'] : $lang['Rules_delete_cannot'] ) . '<br />'; |
| 556 | 2411 | psotfx | $s_auth_can .= ( ( $is_auth['auth_vote'] ) ? $lang['Rules_vote_can'] : $lang['Rules_vote_cannot'] ) . '<br />'; |
| 557 | 1851 | psotfx | |
| 558 | 2731 | psotfx | $topic_mod = ''; |
| 559 | 2731 | psotfx | |
| 560 | 2411 | psotfx | if ( $is_auth['auth_mod'] ) |
| 561 | 1851 | psotfx | {
|
| 562 | 1851 | psotfx | $s_auth_can .= sprintf($lang['Rules_moderate'], '<a href="' . append_sid("modcp.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>'); |
| 563 | 1851 | psotfx | |
| 564 | 2731 | psotfx | $topic_mod .= '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=delete") . '"><img src="' . $images['topic_mod_delete'] . '" alt="' . $lang['Delete_topic'] . '" title="' . $lang['Delete_topic'] . '" border="0" /></a> '; |
| 565 | 1851 | psotfx | |
| 566 | 1851 | psotfx | $topic_mod .= '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=move"). '"><img src="' . $images['topic_mod_move'] . '" alt="' . $lang['Move_topic'] . '" title="' . $lang['Move_topic'] . '" border="0" /></a> '; |
| 567 | 1851 | psotfx | |
| 568 | 2572 | psotfx | $topic_mod .= ( $forum_topic_data['topic_status'] == TOPIC_UNLOCKED ) ? '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=lock") . '"><img src="' . $images['topic_mod_lock'] . '" alt="' . $lang['Lock_topic'] . '" title="' . $lang['Lock_topic'] . '" border="0" /></a> ' : '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=unlock") . '"><img src="' . $images['topic_mod_unlock'] . '" alt="' . $lang['Unlock_topic'] . '" title="' . $lang['Unlock_topic'] . '" border="0" /></a> '; |
| 569 | 1851 | psotfx | |
| 570 | 1851 | psotfx | $topic_mod .= '<a href="' . append_sid("modcp.$phpEx?" . POST_TOPIC_URL . "=$topic_id&mode=split") . '"><img src="' . $images['topic_mod_split'] . '" alt="' . $lang['Split_topic'] . '" title="' . $lang['Split_topic'] . '" border="0" /></a> '; |
| 571 | 1851 | psotfx | } |
| 572 | 1851 | psotfx | |
| 573 | 1851 | psotfx | //
|
| 574 | 1851 | psotfx | // Topic watch information
|
| 575 | 1851 | psotfx | //
|
| 576 | 2411 | psotfx | $s_watching_topic = ''; |
| 577 | 2411 | psotfx | if ( $can_watch_topic ) |
| 578 | 1851 | psotfx | {
|
| 579 | 2411 | psotfx | if ( $is_watching_topic ) |
| 580 | 1851 | psotfx | {
|
| 581 | 1851 | psotfx | $s_watching_topic = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&start=$start") . '">' . $lang['Stop_watching_topic'] . '</a>'; |
| 582 | 1997 | psotfx | $s_watching_topic_img = ( isset($images['Topic_un_watch']) ) ? '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&unwatch=topic&start=$start") . '"><img src="' . $images['Topic_un_watch'] . '" alt="' . $lang['Stop_watching_topic'] . '" title="' . $lang['Stop_watching_topic'] . '" border="0"></a>' : ''; |
| 583 | 1851 | psotfx | } |
| 584 | 1851 | psotfx | else
|
| 585 | 1851 | psotfx | {
|
| 586 | 1851 | psotfx | $s_watching_topic = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&watch=topic&start=$start") . '">' . $lang['Start_watching_topic'] . '</a>'; |
| 587 | 1997 | psotfx | $s_watching_topic_img = ( isset($images['Topic_watch']) ) ? '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&watch=topic&start=$start") . '"><img src="' . $images['Topic_watch'] . '" alt="' . $lang['Stop_watching_topic'] . '" title="' . $lang['Start_watching_topic'] . '" border="0"></a>' : ''; |
| 588 | 1851 | psotfx | } |
| 589 | 1851 | psotfx | } |
| 590 | 1851 | psotfx | |
| 591 | 1851 | psotfx | //
|
| 592 | 1851 | psotfx | // If we've got a hightlight set pass it on to pagination,
|
| 593 | 1851 | psotfx | // I get annoyed when I lose my highlight after the first page.
|
| 594 | 1851 | psotfx | //
|
| 595 | 1851 | psotfx | $pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=" . $HTTP_GET_VARS['highlight'], $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start); |
| 596 | 1851 | psotfx | |
| 597 | 1851 | psotfx | //
|
| 598 | 1851 | psotfx | // Send vars to template
|
| 599 | 1851 | psotfx | //
|
| 600 | 355 | psotfx | $template->assign_vars(array( |
| 601 | 2411 | psotfx | 'FORUM_ID' => $forum_id, |
| 602 | 2411 | psotfx | 'FORUM_NAME' => $forum_name, |
| 603 | 2411 | psotfx | 'TOPIC_ID' => $topic_id, |
| 604 | 2411 | psotfx | 'TOPIC_TITLE' => $topic_title, |
| 605 | 2411 | psotfx | 'PAGINATION' => $pagination, |
| 606 | 2411 | psotfx | 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['posts_per_page'] ) + 1 ), ceil( $total_replies / $board_config['posts_per_page'] )), |
| 607 | 770 | psotfx | |
| 608 | 2448 | psotfx | 'POST_IMG' => $post_img, |
| 609 | 2448 | psotfx | 'REPLY_IMG' => $reply_img, |
| 610 | 770 | psotfx | |
| 611 | 2448 | psotfx | 'L_AUTHOR' => $lang['Author'], |
| 612 | 2448 | psotfx | 'L_MESSAGE' => $lang['Message'], |
| 613 | 2448 | psotfx | 'L_POSTED' => $lang['Posted'], |
| 614 | 2411 | psotfx | 'L_POST_SUBJECT' => $lang['Post_subject'], |
| 615 | 2411 | psotfx | 'L_VIEW_NEXT_TOPIC' => $lang['View_next_topic'], |
| 616 | 2411 | psotfx | 'L_VIEW_PREVIOUS_TOPIC' => $lang['View_previous_topic'], |
| 617 | 2411 | psotfx | 'L_POST_NEW_TOPIC' => $post_alt, |
| 618 | 2411 | psotfx | 'L_POST_REPLY_TOPIC' => $reply_alt, |
| 619 | 2411 | psotfx | 'L_BACK_TO_TOP' => $lang['Back_to_top'], |
| 620 | 2411 | psotfx | 'L_DISPLAY_POSTS' => $lang['Display_posts'], |
| 621 | 2411 | psotfx | 'L_LOCK_TOPIC' => $lang['Lock_topic'], |
| 622 | 2411 | psotfx | 'L_UNLOCK_TOPIC' => $lang['Unlock_topic'], |
| 623 | 2411 | psotfx | 'L_MOVE_TOPIC' => $lang['Move_topic'], |
| 624 | 2411 | psotfx | 'L_SPLIT_TOPIC' => $lang['Split_topic'], |
| 625 | 2411 | psotfx | 'L_DELETE_TOPIC' => $lang['Delete_topic'], |
| 626 | 2411 | psotfx | 'L_GOTO_PAGE' => $lang['Goto_page'], |
| 627 | 1578 | bartvb | |
| 628 | 2411 | psotfx | 'S_TOPIC_LINK' => POST_TOPIC_URL, |
| 629 | 2411 | psotfx | 'S_SELECT_POST_DAYS' => $select_post_days, |
| 630 | 2411 | psotfx | 'S_SELECT_POST_ORDER' => $select_post_order, |
| 631 | 2411 | psotfx | 'S_POST_DAYS_ACTION' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $topic_id . "&start=$start"), |
| 632 | 2411 | psotfx | 'S_AUTH_LIST' => $s_auth_can, |
| 633 | 2411 | psotfx | 'S_TOPIC_ADMIN' => $topic_mod, |
| 634 | 2411 | psotfx | 'S_WATCH_TOPIC' => $s_watching_topic, |
| 635 | 659 | psotfx | |
| 636 | 2411 | psotfx | 'U_VIEW_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&highlight=" . $HTTP_GET_VARS['highlight']), |
| 637 | 2411 | psotfx | 'U_VIEW_FORUM' => $view_forum_url, |
| 638 | 2411 | psotfx | 'U_VIEW_OLDER_TOPIC' => $view_prev_topic_url, |
| 639 | 2411 | psotfx | 'U_VIEW_NEWER_TOPIC' => $view_next_topic_url, |
| 640 | 2411 | psotfx | 'U_POST_NEW_TOPIC' => $new_topic_url, |
| 641 | 2411 | psotfx | 'U_POST_REPLY_TOPIC' => $reply_topic_url) |
| 642 | 579 | psotfx | ); |
| 643 | 237 | psotfx | |
| 644 | 237 | psotfx | //
|
| 645 | 1851 | psotfx | // Does this topic contain a poll?
|
| 646 | 1830 | psotfx | //
|
| 647 | 2572 | psotfx | if ( !empty($forum_topic_data['topic_vote']) ) |
| 648 | 987 | psotfx | {
|
| 649 | 1008 | thefinn | $sql = "SELECT vd.vote_id, vd.vote_text, vd.vote_start, vd.vote_length, vr.vote_option_id, vr.vote_option_text, vr.vote_result |
| 650 | 1008 | thefinn | FROM " . VOTE_DESC_TABLE . " vd, " . VOTE_RESULTS_TABLE . " vr |
| 651 | 1008 | thefinn | WHERE vd.topic_id = $topic_id |
| 652 | 1008 | thefinn | AND vr.vote_id = vd.vote_id |
| 653 | 987 | psotfx | ORDER BY vr.vote_option_id ASC";
|
| 654 | 2411 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 655 | 987 | psotfx | {
|
| 656 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not obtain vote data for this topic", '', __LINE__, __FILE__, $sql); |
| 657 | 987 | psotfx | } |
| 658 | 987 | psotfx | |
| 659 | 2411 | psotfx | if ( $vote_info = $db->sql_fetchrowset($result) ) |
| 660 | 987 | psotfx | {
|
| 661 | 2415 | psotfx | $db->sql_freeresult($result); |
| 662 | 2415 | psotfx | $vote_options = count($vote_info); |
| 663 | 2415 | psotfx | |
| 664 | 2117 | psotfx | $vote_id = $vote_info[0]['vote_id']; |
| 665 | 2117 | psotfx | $vote_title = $vote_info[0]['vote_text']; |
| 666 | 987 | psotfx | |
| 667 | 1008 | thefinn | $sql = "SELECT vote_id |
| 668 | 1008 | thefinn | FROM " . VOTE_USERS_TABLE . " |
| 669 | 2117 | psotfx | WHERE vote_id = $vote_id |
| 670 | 987 | psotfx | AND vote_user_id = " . $userdata['user_id']; |
| 671 | 2411 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 672 | 987 | psotfx | {
|
| 673 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not obtain user vote data for this topic", '', __LINE__, __FILE__, $sql); |
| 674 | 987 | psotfx | } |
| 675 | 987 | psotfx | |
| 676 | 2415 | psotfx | $user_voted = ( $row = $db->sql_fetchrow($result) ) ? TRUE : 0; |
| 677 | 2415 | psotfx | $db->sql_freeresult($result); |
| 678 | 987 | psotfx | |
| 679 | 2411 | psotfx | if ( isset($HTTP_GET_VARS['vote']) || isset($HTTP_POST_VARS['vote']) ) |
| 680 | 987 | psotfx | {
|
| 681 | 2411 | psotfx | $view_result = ( ( ( isset($HTTP_GET_VARS['vote']) ) ? $HTTP_GET_VARS['vote'] : $HTTP_POST_VARS['vote'] ) == 'viewresult' ) ? TRUE : 0; |
| 682 | 987 | psotfx | } |
| 683 | 987 | psotfx | else
|
| 684 | 987 | psotfx | {
|
| 685 | 987 | psotfx | $view_result = 0; |
| 686 | 987 | psotfx | } |
| 687 | 987 | psotfx | |
| 688 | 2117 | psotfx | $poll_expired = ( $vote_info[0]['vote_length'] ) ? ( ( $vote_info[0]['vote_start'] + $vote_info[0]['vote_length'] < time() ) ? TRUE : 0 ) : 0; |
| 689 | 987 | psotfx | |
| 690 | 2572 | psotfx | if ( $user_voted || $view_result || $poll_expired || !$is_auth['auth_vote'] || $forum_topic_data['topic_status'] == TOPIC_LOCKED ) |
| 691 | 987 | psotfx | {
|
| 692 | 2117 | psotfx | $template->set_filenames(array( |
| 693 | 2411 | psotfx | 'pollbox' => 'viewtopic_poll_result.tpl') |
| 694 | 2117 | psotfx | ); |
| 695 | 2117 | psotfx | |
| 696 | 987 | psotfx | $vote_results_sum = 0; |
| 697 | 2117 | psotfx | |
| 698 | 987 | psotfx | for($i = 0; $i < $vote_options; $i++) |
| 699 | 987 | psotfx | {
|
| 700 | 987 | psotfx | $vote_results_sum += $vote_info[$i]['vote_result']; |
| 701 | 987 | psotfx | } |
| 702 | 987 | psotfx | |
| 703 | 987 | psotfx | $vote_graphic = 0; |
| 704 | 987 | psotfx | $vote_graphic_max = count($images['voting_graphic']); |
| 705 | 987 | psotfx | |
| 706 | 2117 | psotfx | for($i = 0; $i < $vote_options; $i++) |
| 707 | 987 | psotfx | {
|
| 708 | 2117 | psotfx | $vote_percent = ( $vote_results_sum > 0 ) ? $vote_info[$i]['vote_result'] / $vote_results_sum : 0; |
| 709 | 2117 | psotfx | $vote_graphic_length = round($vote_percent * $board_config['vote_graphic_length']); |
| 710 | 987 | psotfx | |
| 711 | 2117 | psotfx | $vote_graphic_img = $images['voting_graphic'][$vote_graphic]; |
| 712 | 2117 | psotfx | $vote_graphic = ($vote_graphic < $vote_graphic_max - 1) ? $vote_graphic + 1 : 0; |
| 713 | 2117 | psotfx | |
| 714 | 2411 | psotfx | if ( count($orig_word) ) |
| 715 | 2117 | psotfx | {
|
| 716 | 2117 | psotfx | $vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']); |
| 717 | 2117 | psotfx | } |
| 718 | 2117 | psotfx | |
| 719 | 987 | psotfx | $template->assign_block_vars("poll_option", array( |
| 720 | 2411 | psotfx | 'POLL_OPTION_CAPTION' => $vote_info[$i]['vote_option_text'], |
| 721 | 2411 | psotfx | 'POLL_OPTION_RESULT' => $vote_info[$i]['vote_result'], |
| 722 | 2411 | psotfx | 'POLL_OPTION_PERCENT' => sprintf("%.1d%%", ($vote_percent * 100)), |
| 723 | 987 | psotfx | |
| 724 | 2411 | psotfx | 'POLL_OPTION_IMG' => $vote_graphic_img, |
| 725 | 2411 | psotfx | 'POLL_OPTION_IMG_WIDTH' => $vote_graphic_length) |
| 726 | 987 | psotfx | ); |
| 727 | 987 | psotfx | } |
| 728 | 987 | psotfx | |
| 729 | 987 | psotfx | $template->assign_vars(array( |
| 730 | 2411 | psotfx | 'L_TOTAL_VOTES' => $lang['Total_votes'], |
| 731 | 2411 | psotfx | 'TOTAL_VOTES' => $vote_results_sum) |
| 732 | 987 | psotfx | ); |
| 733 | 987 | psotfx | |
| 734 | 987 | psotfx | } |
| 735 | 987 | psotfx | else
|
| 736 | 987 | psotfx | {
|
| 737 | 987 | psotfx | $template->set_filenames(array( |
| 738 | 2411 | psotfx | 'pollbox' => 'viewtopic_poll_ballot.tpl') |
| 739 | 987 | psotfx | ); |
| 740 | 987 | psotfx | |
| 741 | 2117 | psotfx | for($i = 0; $i < $vote_options; $i++) |
| 742 | 987 | psotfx | {
|
| 743 | 2411 | psotfx | if ( count($orig_word) ) |
| 744 | 2117 | psotfx | {
|
| 745 | 2117 | psotfx | $vote_info[$i]['vote_option_text'] = preg_replace($orig_word, $replacement_word, $vote_info[$i]['vote_option_text']); |
| 746 | 2117 | psotfx | } |
| 747 | 2117 | psotfx | |
| 748 | 987 | psotfx | $template->assign_block_vars("poll_option", array( |
| 749 | 2411 | psotfx | 'POLL_OPTION_ID' => $vote_info[$i]['vote_option_id'], |
| 750 | 2411 | psotfx | 'POLL_OPTION_CAPTION' => $vote_info[$i]['vote_option_text']) |
| 751 | 987 | psotfx | ); |
| 752 | 987 | psotfx | } |
| 753 | 987 | psotfx | |
| 754 | 987 | psotfx | $template->assign_vars(array( |
| 755 | 2411 | psotfx | 'L_SUBMIT_VOTE' => $lang['Submit_vote'], |
| 756 | 2411 | psotfx | 'L_VIEW_RESULTS' => $lang['View_results'], |
| 757 | 1008 | thefinn | |
| 758 | 2411 | psotfx | 'U_VIEW_RESULTS' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&vote=viewresult")) |
| 759 | 987 | psotfx | ); |
| 760 | 987 | psotfx | |
| 761 | 987 | psotfx | $s_hidden_fields = '<input type="hidden" name="topic_id" value="' . $topic_id . '"><input type="hidden" name="mode" value="vote">'; |
| 762 | 987 | psotfx | } |
| 763 | 987 | psotfx | |
| 764 | 2411 | psotfx | if ( count($orig_word) ) |
| 765 | 2117 | psotfx | {
|
| 766 | 2117 | psotfx | $vote_title = preg_replace($orig_word, $replacement_word, $vote_title); |
| 767 | 2117 | psotfx | } |
| 768 | 2117 | psotfx | |
| 769 | 987 | psotfx | $template->assign_vars(array( |
| 770 | 2411 | psotfx | 'POLL_QUESTION' => $vote_title, |
| 771 | 1008 | thefinn | |
| 772 | 2411 | psotfx | 'S_HIDDEN_FIELDS' => ( !empty($s_hidden_fields) ) ? $s_hidden_fields : '', |
| 773 | 2448 | psotfx | 'S_POLL_ACTION' => append_sid("posting.$phpEx?" . POST_TOPIC_URL . "=$topic_id")) |
| 774 | 987 | psotfx | ); |
| 775 | 987 | psotfx | |
| 776 | 2411 | psotfx | $template->assign_var_from_handle('POLL_DISPLAY', 'pollbox'); |
| 777 | 987 | psotfx | } |
| 778 | 987 | psotfx | } |
| 779 | 987 | psotfx | |
| 780 | 987 | psotfx | //
|
| 781 | 355 | psotfx | // Update the topic view counter
|
| 782 | 321 | thefinn | //
|
| 783 | 566 | psotfx | $sql = "UPDATE " . TOPICS_TABLE . " |
| 784 | 421 | thefinn | SET topic_views = topic_views + 1 |
| 785 | 355 | psotfx | WHERE topic_id = $topic_id"; |
| 786 | 2411 | psotfx | if ( !$db->sql_query($sql) ) |
| 787 | 355 | psotfx | {
|
| 788 | 2411 | psotfx | message_die(GENERAL_ERROR, "Could not update topic views.", '', __LINE__, __FILE__, $sql); |
| 789 | 355 | psotfx | } |
| 790 | 321 | thefinn | |
| 791 | 321 | thefinn | //
|
| 792 | 237 | psotfx | // Okay, let's do the loop, yeah come on baby let's do the loop
|
| 793 | 237 | psotfx | // and it goes like this ...
|
| 794 | 237 | psotfx | //
|
| 795 | 566 | psotfx | for($i = 0; $i < $total_posts; $i++) |
| 796 | 81 | thefinn | {
|
| 797 | 566 | psotfx | $poster_id = $postrow[$i]['user_id']; |
| 798 | 2415 | psotfx | $poster = ( $poster_id == ANONYMOUS ) ? $lang['Guest'] : $postrow[$i]['username']; |
| 799 | 462 | psotfx | |
| 800 | 1010 | bartvb | $post_date = create_date($board_config['default_dateformat'], $postrow[$i]['post_time'], $board_config['board_timezone']); |
| 801 | 462 | psotfx | |
| 802 | 2411 | psotfx | $poster_posts = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Posts'] . ': ' . $postrow[$i]['user_posts'] : ''; |
| 803 | 462 | psotfx | |
| 804 | 2411 | psotfx | $poster_from = ( $postrow[$i]['user_from'] && $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Location'] . ': ' . $postrow[$i]['user_from'] : ''; |
| 805 | 462 | psotfx | |
| 806 | 2411 | psotfx | $poster_joined = ( $postrow[$i]['user_id'] != ANONYMOUS ) ? $lang['Joined'] . ': ' . create_date($lang['DATE_FORMAT'], $postrow[$i]['user_regdate'], $board_config['board_timezone']) : ''; |
| 807 | 462 | psotfx | |
| 808 | 2411 | psotfx | $poster_avatar = ''; |
| 809 | 2411 | psotfx | if ( $postrow[$i]['user_avatar_type'] && $poster_id != ANONYMOUS && $postrow[$i]['user_allowavatar'] ) |
| 810 | 136 | psotfx | {
|
| 811 | 1173 | psotfx | switch( $postrow[$i]['user_avatar_type'] ) |
| 812 | 1173 | psotfx | {
|
| 813 | 1173 | psotfx | case USER_AVATAR_UPLOAD: |
| 814 | 2411 | psotfx | $poster_avatar = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : ''; |
| 815 | 1173 | psotfx | break;
|
| 816 | 1173 | psotfx | case USER_AVATAR_REMOTE: |
| 817 | 1930 | psotfx | $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : ''; |
| 818 | 1173 | psotfx | break;
|
| 819 | 1173 | psotfx | case USER_AVATAR_GALLERY: |
| 820 | 2411 | psotfx | $poster_avatar = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' : ''; |
| 821 | 1173 | psotfx | break;
|
| 822 | 1173 | psotfx | } |
| 823 | 566 | psotfx | } |
| 824 | 566 | psotfx | |
| 825 | 566 | psotfx | //
|
| 826 | 1093 | psotfx | // Define the little post icon
|
| 827 | 1093 | psotfx | //
|
| 828 | 2411 | psotfx | if ( $userdata['session_logged_in'] && $postrow[$i]['post_time'] > $userdata['user_lastvisit'] && $postrow[$i]['post_time'] > $topic_last_read ) |
| 829 | 1093 | psotfx | {
|
| 830 | 2448 | psotfx | $mini_post_img = $images['icon_minipost_new']; |
| 831 | 2448 | psotfx | $mini_post_alt = $lang['New_post']; |
| 832 | 1093 | psotfx | } |
| 833 | 1093 | psotfx | else
|
| 834 | 1093 | psotfx | {
|
| 835 | 2448 | psotfx | $mini_post_img = $images['icon_minipost']; |
| 836 | 2448 | psotfx | $mini_post_alt = $lang['Post']; |
| 837 | 1093 | psotfx | } |
| 838 | 1578 | bartvb | |
| 839 | 2411 | psotfx | $mini_post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $postrow[$i]['post_id']) . '#' . $postrow[$i]['post_id']; |
| 840 | 1093 | psotfx | |
| 841 | 1093 | psotfx | //
|
| 842 | 2448 | psotfx | // Generate ranks, set them to empty string initially.
|
| 843 | 566 | psotfx | //
|
| 844 | 1830 | psotfx | $poster_rank = ''; |
| 845 | 1830 | psotfx | $rank_image = ''; |
| 846 | 2411 | psotfx | if ( $postrow[$i]['user_id'] == ANONYMOUS ) |
| 847 | 566 | psotfx | {
|
| 848 | 566 | psotfx | } |
| 849 | 2411 | psotfx | else if ( $postrow[$i]['user_rank'] ) |
| 850 | 566 | psotfx | {
|
| 851 | 566 | psotfx | for($j = 0; $j < count($ranksrow); $j++) |
| 852 | 136 | psotfx | {
|
| 853 | 2411 | psotfx | if ( $postrow[$i]['user_rank'] == $ranksrow[$j]['rank_id'] && $ranksrow[$j]['rank_special'] ) |
| 854 | 136 | psotfx | {
|
| 855 | 987 | psotfx | $poster_rank = $ranksrow[$j]['rank_title']; |
| 856 | 1830 | psotfx | $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : ''; |
| 857 | 136 | psotfx | } |
| 858 | 136 | psotfx | } |
| 859 | 431 | psotfx | } |
| 860 | 792 | thefinn | else
|
| 861 | 431 | psotfx | {
|
| 862 | 566 | psotfx | for($j = 0; $j < count($ranksrow); $j++) |
| 863 | 136 | psotfx | {
|
| 864 | 2411 | psotfx | if ( $postrow[$i]['user_posts'] >= $ranksrow[$j]['rank_min'] && !$ranksrow[$j]['rank_special'] ) |
| 865 | 281 | psotfx | {
|
| 866 | 987 | psotfx | $poster_rank = $ranksrow[$j]['rank_title']; |
| 867 | 1830 | psotfx | $rank_image = ( $ranksrow[$j]['rank_image'] ) ? '<img src="' . $ranksrow[$j]['rank_image'] . '" alt="' . $poster_rank . '" title="' . $poster_rank . '" border="0" /><br />' : ''; |
| 868 | 281 | psotfx | } |
| 869 | 136 | psotfx | } |
| 870 | 136 | psotfx | } |
| 871 | 136 | psotfx | |
| 872 | 566 | psotfx | //
|
| 873 | 463 | thefinn | // Handle anon users posting with usernames
|
| 874 | 566 | psotfx | //
|
| 875 | 2411 | psotfx | if ( $poster_id == ANONYMOUS && $postrow[$i]['post_username'] != '' ) |
| 876 | 463 | thefinn | {
|
| 877 | 987 | psotfx | $poster = $postrow[$i]['post_username']; |
| 878 | 463 | thefinn | $poster_rank = $lang['Guest']; |
| 879 | 463 | thefinn | } |
| 880 | 463 | thefinn | |
| 881 | 2448 | psotfx | $temp_url = ''; |
| 882 | 2448 | psotfx | |
| 883 | 2411 | psotfx | if ( $poster_id != ANONYMOUS ) |
| 884 | 613 | psotfx | {
|
| 885 | 2448 | psotfx | $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id"); |
| 886 | 2448 | psotfx | $profile_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_profile'] . '" alt="' . $lang['Read_profile'] . '" title="' . $lang['Read_profile'] . '" border="0" /></a>'; |
| 887 | 2448 | psotfx | $profile = '<a href="' . $temp_url . '">' . $lang['Read_profile'] . '</a>'; |
| 888 | 462 | psotfx | |
| 889 | 2448 | psotfx | $temp_url = append_sid("privmsg.$phpEx?mode=post&" . POST_USERS_URL . "=$poster_id"); |
| 890 | 2448 | psotfx | $pm_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_pm'] . '" alt="' . $lang['Send_private_message'] . '" title="' . $lang['Send_private_message'] . '" border="0" /></a>'; |
| 891 | 2448 | psotfx | $pm = '<a href="' . $temp_url . '">' . $lang['Send_private_message'] . '</a>'; |
| 892 | 566 | psotfx | |
| 893 | 2411 | psotfx | if ( !empty($postrow[$i]['user_viewemail']) || $is_auth['auth_mod'] ) |
| 894 | 1320 | psotfx | {
|
| 895 | 2411 | psotfx | $email_uri = ( $board_config['board_email_form'] ) ? append_sid("profile.$phpEx?mode=email&" . POST_USERS_URL .'=' . $poster_id) : 'mailto:' . $postrow[$i]['user_email']; |
| 896 | 1320 | psotfx | |
| 897 | 1830 | psotfx | $email_img = '<a href="' . $email_uri . '"><img src="' . $images['icon_email'] . '" alt="' . $lang['Send_email'] . '" title="' . $lang['Send_email'] . '" border="0" /></a>'; |
| 898 | 2448 | psotfx | $email = '<a href="' . $email_uri . '">' . $lang['Send_email'] . '</a>'; |
| 899 | 1320 | psotfx | } |
| 900 | 1320 | psotfx | else
|
| 901 | 1320 | psotfx | {
|
| 902 | 1830 | psotfx | $email_img = ''; |
| 903 | 2448 | psotfx | $email = ''; |
| 904 | 1320 | psotfx | } |
| 905 | 1320 | psotfx | |
| 906 | 2448 | psotfx | $www_img = ( $postrow[$i]['user_website'] ) ? '<a href="' . $postrow[$i]['user_website'] . '" target="_userwww"><img src="' . $images['icon_www'] . '" alt="' . $lang['Visit_website'] . '" title="' . $lang['Visit_website'] . '" border="0" /></a>' : ''; |
| 907 | 2448 | psotfx | $www = ( $postrow[$i]['user_website'] ) ? '<a href="' . $postrow[$i]['user_website'] . '" target="_userwww">' . $lang['Visit_website'] . '</a>' : ''; |
| 908 | 462 | psotfx | |
| 909 | 2411 | psotfx | if ( !empty($postrow[$i]['user_icq']) ) |
| 910 | 613 | psotfx | {
|
| 911 | 1898 | psotfx | $icq_status_img = '<a href="http://wwp.icq.com/' . $postrow[$i]['user_icq'] . '#pager"><img src="http://web.icq.com/whitepages/online?icq=' . $postrow[$i]['user_icq'] . '&img=5" width="18" height="18" border="0" /></a>'; |
| 912 | 2448 | psotfx | $icq_img = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $postrow[$i]['user_icq'] . '"><img src="' . $images['icon_icq'] . '" alt="' . $lang['ICQ'] . '" title="' . $lang['ICQ'] . '" border="0" /></a>'; |
| 913 | 2448 | psotfx | $icq = '<a href="http://wwp.icq.com/scripts/search.dll?to=' . $postrow[$i]['user_icq'] . '">' . $lang['ICQ'] . '</a>'; |
| 914 | 613 | psotfx | } |
| 915 | 613 | psotfx | else
|
| 916 | 613 | psotfx | {
|
| 917 | 1830 | psotfx | $icq_status_img = ''; |
| 918 | 2448 | psotfx | $icq_img = ''; |
| 919 | 2448 | psotfx | $icq = ''; |
| 920 | 613 | psotfx | } |
| 921 | 462 | psotfx | |
| 922 | 1830 | psotfx | $aim_img = ( $postrow[$i]['user_aim'] ) ? '<a href="aim:goim?screenname=' . $postrow[$i]['user_aim'] . '&message=Hello+Are+you+there?"><img src="' . $images['icon_aim'] . '" alt="' . $lang['AIM'] . '" title="' . $lang['AIM'] . '" border="0" /></a>' : ''; |
| 923 | 2448 | psotfx | $aim = ( $postrow[$i]['user_aim'] ) ? '<a href="aim:goim?screenname=' . $postrow[$i]['user_aim'] . '&message=Hello+Are+you+there?">' . $lang['AIM'] . '</a>' : ''; |
| 924 | 613 | psotfx | |
| 925 | 2448 | psotfx | $temp_url = append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$poster_id"); |
| 926 | 2448 | psotfx | $msn_img = ( $postrow[$i]['user_msnm'] ) ? '<a href="' . $temp_url . '"><img src="' . $images['icon_msnm'] . '" alt="' . $lang['MSNM'] . '" title="' . $lang['MSNM'] . '" border="0" /></a>' : ''; |
| 927 | 2448 | psotfx | $msn = ( $postrow[$i]['user_msnm'] ) ? '<a href="' . $temp_url . '">' . $lang['MSNM'] . '</a>' : ''; |
| 928 | 613 | psotfx | |
| 929 | 1830 | psotfx | $yim_img = ( $postrow[$i]['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $postrow[$i]['user_yim'] . '&.src=pg"><img src="' . $images['icon_yim'] . '" alt="' . $lang['YIM'] . '" title="' . $lang['YIM'] . '" border="0" /></a>' : ''; |
| 930 | 2448 | psotfx | $yim = ( $postrow[$i]['user_yim'] ) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $postrow[$i]['user_yim'] . '&.src=pg">' . $lang['YIM'] . '</a>' : ''; |
| 931 | 87 | psotfx | } |
| 932 | 87 | psotfx | else
|
| 933 | 87 | psotfx | {
|
| 934 | 1830 | psotfx | $profile_img = ''; |
| 935 | 2448 | psotfx | $profile = ''; |
| 936 | 1830 | psotfx | $pm_img = ''; |
| 937 | 2448 | psotfx | $pm = ''; |
| 938 | 1830 | psotfx | $email_img = ''; |
| 939 | 2448 | psotfx | $email = ''; |
| 940 | 1830 | psotfx | $www_img = ''; |
| 941 | 2448 | psotfx | $www = ''; |
| 942 | 1830 | psotfx | $icq_status_img = ''; |
| 943 | 2448 | psotfx | $icq_img = ''; |
| 944 | 2448 | psotfx | $icq = ''; |
| 945 | 1830 | psotfx | $aim_img = ''; |
| 946 | 2448 | psotfx | $aim = ''; |
| 947 | 1830 | psotfx | $msn_img = ''; |
| 948 | 2448 | psotfx | $msn = ''; |
| 949 | 1830 | psotfx | $yim_img = ''; |
| 950 | 2448 | psotfx | $yim = ''; |
| 951 | 87 | psotfx | } |
| 952 | 303 | thefinn | |
| 953 | 2448 | psotfx | $temp_url = append_sid("posting.$phpEx?mode=quote&" . POST_POST_URL . "=" . $postrow[$i]['post_id']); |
| 954 | 2448 | psotfx | $quote_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_quote'] . '" alt="' . $lang['Reply_with_quote'] . '" title="' . $lang['Reply_with_quote'] . '" border="0" /></a>'; |
| 955 | 2448 | psotfx | $quote = '<a href="' . $temp_url . '">' . $lang['Reply_with_quote'] . '</a>'; |
| 956 | 987 | psotfx | |
| 957 | 2448 | psotfx | $temp_url = append_sid("search.$phpEx?search_author=" . urlencode($postrow[$i]['username']) . "&showresults=posts"); |
| 958 | 2448 | psotfx | $search_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_search'] . '" alt="' . $lang['Search_user_posts'] . '" title="' . $lang['Search_user_posts'] . '" border="0" /></a>'; |
| 959 | 2448 | psotfx | $search = '<a href="' . $temp_url . '">' . $lang['Search_user_posts'] . '</a>'; |
| 960 | 462 | psotfx | |
| 961 | 2411 | psotfx | if ( ( $userdata['user_id'] == $poster_id && $is_auth['auth_edit'] ) || $is_auth['auth_mod'] ) |
| 962 | 987 | psotfx | {
|
| 963 | 2448 | psotfx | $temp_url = append_sid("posting.$phpEx?mode=editpost&" . POST_POST_URL . "=" . $postrow[$i]['post_id']); |
| 964 | 2448 | psotfx | $edit_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_edit'] . '" alt="' . $lang['Edit_delete_post'] . '" title="' . $lang['Edit_delete_post'] . '" border="0" /></a>'; |
| 965 | 2448 | psotfx | $edit = '<a href="' . $temp_url . '">' . $lang['Edit_delete_post'] . '</a>'; |
| 966 | 987 | psotfx | } |
| 967 | 987 | psotfx | else
|
| 968 | 987 | psotfx | {
|
| 969 | 1830 | psotfx | $edit_img = ''; |
| 970 | 2448 | psotfx | $edit = ''; |
| 971 | 987 | psotfx | } |
| 972 | 303 | thefinn | |
| 973 | 2411 | psotfx | if ( $is_auth['auth_mod'] ) |
| 974 | 87 | psotfx | {
|
| 975 | 2448 | psotfx | $temp_url = append_sid("modcp.$phpEx?mode=ip&" . POST_POST_URL . "=" . $postrow[$i]['post_id'] . "&" . POST_TOPIC_URL . "=" . $topic_id); |
| 976 | 2448 | psotfx | $ip_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_ip'] . '" alt="' . $lang['View_IP'] . '" title="' . $lang['View_IP'] . '" border="0" /></a>'; |
| 977 | 2448 | psotfx | $ip = '<a href="' . $temp_url . '">' . $lang['View_IP'] . '</a>'; |
| 978 | 462 | psotfx | |
| 979 | 2448 | psotfx | $temp_url = append_sid("posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id']); |
| 980 | 2448 | psotfx | $delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>'; |
| 981 | 2448 | psotfx | $delpost = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>'; |
| 982 | 87 | psotfx | } |
| 983 | 987 | psotfx | else
|
| 984 | 987 | psotfx | {
|
| 985 | 1830 | psotfx | $ip_img = ''; |
| 986 | 2448 | psotfx | $ip = ''; |
| 987 | 1161 | psotfx | |
| 988 | 2572 | psotfx | if ( $userdata['user_id'] == $poster_id && $is_auth['auth_delete'] && $forum_topic_data['topic_last_post_id'] == $postrow[$i]['post_id'] ) |
| 989 | 1161 | psotfx | {
|
| 990 | 2448 | psotfx | $temp_url = append_sid("posting.$phpEx?mode=delete&" . POST_POST_URL . "=" . $postrow[$i]['post_id']); |
| 991 | 2448 | psotfx | $delpost_img = '<a href="' . $temp_url . '"><img src="' . $images['icon_delpost'] . '" alt="' . $lang['Delete_post'] . '" title="' . $lang['Delete_post'] . '" border="0" /></a>'; |
| 992 | 2490 | psotfx | $delpost = '<a href="' . $temp_url . '">' . $lang['Delete_post'] . '</a>'; |
| 993 | 1161 | psotfx | } |
| 994 | 1161 | psotfx | else
|
| 995 | 1161 | psotfx | {
|
| 996 | 1830 | psotfx | $delpost_img = ''; |
| 997 | 2448 | psotfx | $delpost = ''; |
| 998 | 1161 | psotfx | } |
| 999 | 987 | psotfx | } |
| 1000 | 1008 | thefinn | |
| 1001 | 2411 | psotfx | $post_subject = ( $postrow[$i]['post_subject'] != '' ) ? $postrow[$i]['post_subject'] : ''; |
| 1002 | 1083 | psotfx | |
| 1003 | 987 | psotfx | $message = $postrow[$i]['post_text']; |
| 1004 | 566 | psotfx | $bbcode_uid = $postrow[$i]['bbcode_uid']; |
| 1005 | 462 | psotfx | |
| 1006 | 2411 | psotfx | $user_sig = ( $postrow[$i]['enable_sig'] && $postrow[$i]['user_sig'] != '' && $board_config['allow_sig'] ) ? $postrow[$i]['user_sig'] : ''; |
| 1007 | 1083 | psotfx | $user_sig_bbcode_uid = $postrow[$i]['user_sig_bbcode_uid']; |
| 1008 | 134 | thefinn | |
| 1009 | 987 | psotfx | //
|
| 1010 | 2448 | psotfx | // Note! The order used for parsing the message _is_ important, moving things around could break any
|
| 1011 | 1511 | psotfx | // output
|
| 1012 | 1511 | psotfx | //
|
| 1013 | 1511 | psotfx | |
| 1014 | 1511 | psotfx | //
|
| 1015 | 987 | psotfx | // If the board has HTML off but the post has HTML
|
| 1016 | 987 | psotfx | // on then we process it, else leave it alone
|
| 1017 | 987 | psotfx | //
|
| 1018 | 2411 | psotfx | if ( !$board_config['allow_html'] ) |
| 1019 | 87 | psotfx | {
|
| 1020 | 2411 | psotfx | if ( $user_sig != '' && $userdata['user_allowhtml'] ) |
| 1021 | 673 | psotfx | {
|
| 1022 | 2411 | psotfx | $user_sig = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $user_sig); |
| 1023 | 673 | psotfx | } |
| 1024 | 987 | psotfx | |
| 1025 | 2411 | psotfx | if ( $postrow[$i]['enable_html'] ) |
| 1026 | 987 | psotfx | {
|
| 1027 | 2411 | psotfx | $message = preg_replace('#(<)([\/]?.*?)(>)#is', "<\\2>", $message); |
| 1028 | 987 | psotfx | } |
| 1029 | 87 | psotfx | } |
| 1030 | 566 | psotfx | |
| 1031 | 1511 | psotfx | //
|
| 1032 | 1647 | psotfx | // Parse message and/or sig for BBCode if reqd
|
| 1033 | 1511 | psotfx | //
|
| 1034 | 2411 | psotfx | if ( $board_config['allow_bbcode'] ) |
| 1035 | 87 | psotfx | {
|
| 1036 | 2411 | psotfx | if ( $user_sig != '' && $user_sig_bbcode_uid != '' ) |
| 1037 | 1647 | psotfx | {
|
| 1038 | 2411 | psotfx | $user_sig = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($user_sig, $user_sig_bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $user_sig); |
| 1039 | 1647 | psotfx | } |
| 1040 | 303 | thefinn | |
| 1041 | 2411 | psotfx | if ( $bbcode_uid != '' ) |
| 1042 | 1647 | psotfx | {
|
| 1043 | 2411 | psotfx | $message = ( $board_config['allow_bbcode'] ) ? bbencode_second_pass($message, $bbcode_uid) : preg_replace('/\:[0-9a-z\:]+\]/si', ']', $message); |
| 1044 | 1647 | psotfx | } |
| 1045 | 836 | psotfx | } |
| 1046 | 303 | thefinn | |
| 1047 | 2566 | psotfx | if ( $user_sig != '' ) |
| 1048 | 1649 | psotfx | {
|
| 1049 | 1649 | psotfx | $user_sig = make_clickable($user_sig); |
| 1050 | 1649 | psotfx | } |
| 1051 | 1555 | natec | $message = make_clickable($message); |
| 1052 | 1566 | psotfx | |
| 1053 | 1511 | psotfx | //
|
| 1054 | 2066 | psotfx | // Highlight active words (primarily for search)
|
| 1055 | 2066 | psotfx | //
|
| 1056 | 2411 | psotfx | if ( $highlight_active ) |
| 1057 | 2066 | psotfx | {
|
| 1058 | 2448 | psotfx | if ( preg_match('/<.*>/', $message) ) |
| 1059 | 2448 | psotfx | {
|
| 1060 | 2448 | psotfx | $message = preg_replace($highlight_match, '<!-- #sh -->\1<!-- #eh -->', $message); |
| 1061 | 2448 | psotfx | |
| 1062 | 2448 | psotfx | $end_html = 0; |
| 1063 | 2448 | psotfx | $start_html = 1; |
| 1064 | 2448 | psotfx | $temp_message = ''; |
| 1065 | 2448 | psotfx | $message = ' ' . $message . ' '; |
| 1066 | 2448 | psotfx | |
| 1067 | 2448 | psotfx | while( $start_html = strpos($message, '<', $start_html) ) |
| 1068 | 2448 | psotfx | {
|
| 1069 | 2448 | psotfx | $grab_length = $start_html - $end_html - 1; |
| 1070 | 2448 | psotfx | $temp_message .= substr($message, $end_html + 1, $grab_length); |
| 1071 | 2448 | psotfx | |
| 1072 | 2448 | psotfx | if ( $end_html = strpos($message, '>', $start_html) ) |
| 1073 | 2448 | psotfx | {
|
| 1074 | 2448 | psotfx | $length = $end_html - $start_html + 1; |
| 1075 | 2448 | psotfx | $hold_string = substr($message, $start_html, $length); |
| 1076 | 2448 | psotfx | |
| 1077 | 2448 | psotfx | if ( strrpos(' ' . $hold_string, '<') != 1 ) |
| 1078 | 2448 | psotfx | {
|
| 1079 | 2448 | psotfx | $end_html = $start_html + 1; |
| 1080 | 2448 | psotfx | $end_counter = 1; |
| 1081 | 2448 | psotfx | |
| 1082 | 2448 | psotfx | while ( $end_counter && $end_html < strlen($message) ) |
| 1083 | 2448 | psotfx | {
|
| 1084 | 2448 | psotfx | if ( substr($message, $end_html, 1) == '>' ) |
| 1085 | 2448 | psotfx | {
|
| 1086 | 2448 | psotfx | $end_counter--;
|
| 1087 | 2448 | psotfx | } |
| 1088 | 2448 | psotfx | else if ( substr($message, $end_html, 1) == '<' ) |
| 1089 | 2448 | psotfx | {
|
| 1090 | 2448 | psotfx | $end_counter++;
|
| 1091 | 2448 | psotfx | } |
| 1092 | 2448 | psotfx | |
| 1093 | 2448 | psotfx | $end_html++;
|
| 1094 | 2448 | psotfx | } |
| 1095 | 2448 | psotfx | |
| 1096 | 2448 | psotfx | $length = $end_html - $start_html + 1; |
| 1097 | 2448 | psotfx | $hold_string = substr($message, $start_html, $length); |
| 1098 | 2448 | psotfx | $hold_string = str_replace('<!-- #sh -->', '', $hold_string); |
| 1099 | 2448 | psotfx | $hold_string = str_replace('<!-- #eh -->', '', $hold_string); |
| 1100 | 2448 | psotfx | } |
| 1101 | 2448 | psotfx | else if ( $hold_string == '<!-- #sh -->' ) |
| 1102 | 2448 | psotfx | {
|
| 1103 | 2448 | psotfx | $hold_string = str_replace('<!-- #sh -->', '<span style="color:#' . $theme['fontcolor3'] . '"><b>', $hold_string); |
| 1104 | 2448 | psotfx | } |
| 1105 | 2448 | psotfx | else if ( $hold_string == '<!-- #eh -->' ) |
| 1106 | 2448 | psotfx | {
|
| 1107 | 2448 | psotfx | $hold_string = str_replace('<!-- #eh -->', '</b></span>', $hold_string); |
| 1108 | 2448 | psotfx | } |
| 1109 | 2448 | psotfx | |
| 1110 | 2448 | psotfx | $temp_message .= $hold_string; |
| 1111 | 2448 | psotfx | |
| 1112 | 2448 | psotfx | $start_html += $length; |
| 1113 | 2448 | psotfx | } |
| 1114 | 2448 | psotfx | else
|
| 1115 | 2448 | psotfx | {
|
| 1116 | 2448 | psotfx | $start_html = strlen($message); |
| 1117 | 2448 | psotfx | } |
| 1118 | 2448 | psotfx | } |
| 1119 | 2448 | psotfx | |
| 1120 | 2448 | psotfx | $grab_length = strlen($message) - $end_html - 1; |
| 1121 | 2448 | psotfx | $temp_message .= substr($message, $end_html + 1, $grab_length); |
| 1122 | 2448 | psotfx | |
| 1123 | 2448 | psotfx | $message = trim($temp_message); |
| 1124 | 2448 | psotfx | } |
| 1125 | 2448 | psotfx | else
|
| 1126 | 2448 | psotfx | {
|
| 1127 | 2448 | psotfx | $message = preg_replace($highlight_match, '<span style="color:#' . $theme['fontcolor3'] . '"><b>\1</b></span>', $message); |
| 1128 | 2448 | psotfx | } |
| 1129 | 2066 | psotfx | } |
| 1130 | 2066 | psotfx | |
| 1131 | 2066 | psotfx | //
|
| 1132 | 1511 | psotfx | // Replace naughty words
|
| 1133 | 1511 | psotfx | //
|
| 1134 | 2411 | psotfx | if ( count($orig_word) ) |
| 1135 | 884 | psotfx | {
|
| 1136 | 2411 | psotfx | if ( $user_sig != '' ) |
| 1137 | 1647 | psotfx | {
|
| 1138 | 1647 | psotfx | $user_sig = preg_replace($orig_word, $replacement_word, $user_sig); |
| 1139 | 1647 | psotfx | } |
| 1140 | 1649 | psotfx | |
| 1141 | 1649 | psotfx | $post_subject = preg_replace($orig_word, $replacement_word, $post_subject); |
| 1142 | 1649 | psotfx | $message = preg_replace($orig_word, $replacement_word, $message); |
| 1143 | 884 | psotfx | } |
| 1144 | 884 | psotfx | |
| 1145 | 1511 | psotfx | //
|
| 1146 | 1511 | psotfx | // Parse smilies
|
| 1147 | 1511 | psotfx | //
|
| 1148 | 2411 | psotfx | if ( $board_config['allow_smilies'] ) |
| 1149 | 744 | psotfx | {
|
| 1150 | 2411 | psotfx | if ( $postrow[$i]['user_allowsmile'] && $user_sig != '' ) |
| 1151 | 1647 | psotfx | {
|
| 1152 | 1649 | psotfx | $user_sig = smilies_pass($user_sig); |
| 1153 | 1647 | psotfx | } |
| 1154 | 1647 | psotfx | |
| 1155 | 2411 | psotfx | if ( $postrow[$i]['enable_smilies'] ) |
| 1156 | 1647 | psotfx | {
|
| 1157 | 1649 | psotfx | $message = smilies_pass($message); |
| 1158 | 1647 | psotfx | } |
| 1159 | 744 | psotfx | } |
| 1160 | 744 | psotfx | |
| 1161 | 1511 | psotfx | //
|
| 1162 | 1511 | psotfx | // Replace newlines (we use this rather than nl2br because
|
| 1163 | 1511 | psotfx | // till recently it wasn't XHTML compliant)
|
| 1164 | 1511 | psotfx | //
|
| 1165 | 2411 | psotfx | if ( $user_sig != '' ) |
| 1166 | 1647 | psotfx | {
|
| 1167 | 2448 | psotfx | $user_sig = '<br />_________________<br />' . str_replace("\n", "\n<br />\n", $user_sig); |
| 1168 | 1647 | psotfx | } |
| 1169 | 1647 | psotfx | |
| 1170 | 1649 | psotfx | $message = str_replace("\n", "\n<br />\n", $message); |
| 1171 | 1649 | psotfx | |
| 1172 | 355 | psotfx | //
|
| 1173 | 673 | psotfx | // Editing information
|
| 1174 | 673 | psotfx | //
|
| 1175 | 2411 | psotfx | if ( $postrow[$i]['post_edit_count'] ) |
| 1176 | 673 | psotfx | {
|
| 1177 | 1247 | psotfx | $l_edit_time_total = ( $postrow[$i]['post_edit_count'] == 1 ) ? $lang['Edited_time_total'] : $lang['Edited_times_total']; |
| 1178 | 1247 | psotfx | |
| 1179 | 2411 | psotfx | $l_edited_by = '<br /><br />' . sprintf($l_edit_time_total, $poster, create_date($board_config['default_dateformat'], $postrow[$i]['post_edit_time'], $board_config['board_timezone']), $postrow[$i]['post_edit_count']); |
| 1180 | 673 | psotfx | } |
| 1181 | 1248 | psotfx | else
|
| 1182 | 1248 | psotfx | {
|
| 1183 | 2411 | psotfx | $l_edited_by = ''; |
| 1184 | 1248 | psotfx | } |
| 1185 | 673 | psotfx | |
| 1186 | 673 | psotfx | //
|
| 1187 | 355 | psotfx | // Again this will be handled by the templating
|
| 1188 | 355 | psotfx | // code at some point
|
| 1189 | 355 | psotfx | //
|
| 1190 | 824 | psotfx | $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; |
| 1191 | 770 | psotfx | $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; |
| 1192 | 303 | thefinn | |
| 1193 | 2411 | psotfx | $template->assign_block_vars('postrow', array( |
| 1194 | 2411 | psotfx | 'ROW_COLOR' => '#' . $row_color, |
| 1195 | 2411 | psotfx | 'ROW_CLASS' => $row_class, |
| 1196 | 2411 | psotfx | 'POSTER_NAME' => $poster, |
| 1197 | 2411 | psotfx | 'POSTER_RANK' => $poster_rank, |
| 1198 | 2411 | psotfx | 'RANK_IMAGE' => $rank_image, |
| 1199 | 2411 | psotfx | 'POSTER_JOINED' => $poster_joined, |
| 1200 | 2411 | psotfx | 'POSTER_POSTS' => $poster_posts, |
| 1201 | 2411 | psotfx | 'POSTER_FROM' => $poster_from, |
| 1202 | 2411 | psotfx | 'POSTER_AVATAR' => $poster_avatar, |
| 1203 | 2411 | psotfx | 'POST_DATE' => $post_date, |
| 1204 | 2411 | psotfx | 'POST_SUBJECT' => $post_subject, |
| 1205 | 2411 | psotfx | 'MESSAGE' => $message, |
| 1206 | 2411 | psotfx | 'SIGNATURE' => $user_sig, |
| 1207 | 2411 | psotfx | 'EDITED_MESSAGE' => $l_edited_by, |
| 1208 | 1247 | psotfx | |
| 1209 | 2448 | psotfx | 'MINI_POST_IMG' => $mini_post_img, |
| 1210 | 2448 | psotfx | 'PROFILE_IMG' => $profile_img, |
| 1211 | 2448 | psotfx | 'PROFILE' => $profile, |
| 1212 | 2411 | psotfx | 'SEARCH_IMG' => $search_img, |
| 1213 | 2448 | psotfx | 'SEARCH' => $search, |
| 1214 | 2411 | psotfx | 'PM_IMG' => $pm_img, |
| 1215 | 2448 | psotfx | 'PM' => $pm, |
| 1216 | 2411 | psotfx | 'EMAIL_IMG' => $email_img, |
| 1217 | 2448 | psotfx | 'EMAIL' => $email, |
| 1218 | 2411 | psotfx | 'WWW_IMG' => $www_img, |
| 1219 | 2448 | psotfx | 'WWW' => $www, |
| 1220 | 2411 | psotfx | 'ICQ_STATUS_IMG' => $icq_status_img, |
| 1221 | 2448 | psotfx | 'ICQ_IMG' => $icq_img, |
| 1222 | 2448 | psotfx | 'ICQ' => $icq, |
| 1223 | 2411 | psotfx | 'AIM_IMG' => $aim_img, |
| 1224 | 2448 | psotfx | 'AIM' => $aim, |
| 1225 | 2411 | psotfx | 'MSN_IMG' => $msn_img, |
| 1226 | 2448 | psotfx | 'MSN' => $msn, |
| 1227 | 2411 | psotfx | 'YIM_IMG' => $yim_img, |
| 1228 | 2448 | psotfx | 'YIM' => $yim, |
| 1229 | 2411 | psotfx | 'EDIT_IMG' => $edit_img, |
| 1230 | 2448 | psotfx | 'EDIT' => $edit, |
| 1231 | 2411 | psotfx | 'QUOTE_IMG' => $quote_img, |
| 1232 | 2448 | psotfx | 'QUOTE' => $quote, |
| 1233 | 2411 | psotfx | 'IP_IMG' => $ip_img, |
| 1234 | 2448 | psotfx | 'IP' => $ip, |
| 1235 | 2411 | psotfx | 'DELETE_IMG' => $delpost_img, |
| 1236 | 2448 | psotfx | 'DELETE' => $delpost, |
| 1237 | 462 | psotfx | |
| 1238 | 2448 | psotfx | 'L_MINI_POST_ALT' => $mini_post_alt, |
| 1239 | 2448 | psotfx | |
| 1240 | 2411 | psotfx | 'U_MINI_POST' => $mini_post_url, |
| 1241 | 2411 | psotfx | 'U_POST_ID' => $postrow[$i]['post_id']) |
| 1242 | 566 | psotfx | ); |
| 1243 | 81 | thefinn | } |
| 1244 | 82 | thefinn | |
| 1245 | 2411 | psotfx | $template->pparse('body'); |
| 1246 | 105 | natec | |
| 1247 | 646 | psotfx | include($phpbb_root_path . 'includes/page_tail.'.$phpEx); |
| 1248 | 81 | thefinn | |
| 1249 | 2448 | psotfx | ?> |

