root / tags / release_2_0_2 / phpBB / index.php
History | View | Annotate | Download (13.9 kB)
| 1 | 2 | thefinn | <?php
|
|---|---|---|---|
| 2 | 172 | thefinn | /***************************************************************************
|
| 3 | 172 | thefinn | * index.php |
| 4 | 172 | thefinn | * ------------------- |
| 5 | 172 | thefinn | * begin : Saturday, Feb 13, 2001 |
| 6 | 172 | thefinn | * copyright : (C) 2001 The phpBB Group |
| 7 | 172 | thefinn | * email : support@phpbb.com |
| 8 | 172 | thefinn | * |
| 9 | 27 | psotfx | * $Id$ |
| 10 | 172 | thefinn | * |
| 11 | 172 | thefinn | * |
| 12 | 172 | thefinn | ***************************************************************************/ |
| 13 | 2 | thefinn | |
| 14 | 943 | thefinn | /***************************************************************************
|
| 15 | 943 | thefinn | * |
| 16 | 943 | thefinn | * This program is free software; you can redistribute it and/or modify |
| 17 | 943 | thefinn | * it under the terms of the GNU General Public License as published by |
| 18 | 943 | thefinn | * the Free Software Foundation; either version 2 of the License, or |
| 19 | 943 | thefinn | * (at your option) any later version. |
| 20 | 943 | thefinn | * |
| 21 | 943 | thefinn | ***************************************************************************/ |
| 22 | 943 | thefinn | |
| 23 | 2305 | psotfx | define('IN_PHPBB', true); |
| 24 | 2349 | psotfx | $phpbb_root_path = './'; |
| 25 | 646 | psotfx | include($phpbb_root_path . 'extension.inc'); |
| 26 | 646 | psotfx | include($phpbb_root_path . 'common.'.$phpEx); |
| 27 | 2 | thefinn | |
| 28 | 143 | psotfx | //
|
| 29 | 143 | psotfx | // Start session management
|
| 30 | 143 | psotfx | //
|
| 31 | 1997 | psotfx | $userdata = session_pagestart($user_ip, PAGE_INDEX); |
| 32 | 143 | psotfx | init_userprefs($userdata);
|
| 33 | 143 | psotfx | //
|
| 34 | 143 | psotfx | // End session management
|
| 35 | 143 | psotfx | //
|
| 36 | 143 | psotfx | |
| 37 | 1958 | psotfx | $viewcat = ( !empty($HTTP_GET_VARS[POST_CAT_URL]) ) ? $HTTP_GET_VARS[POST_CAT_URL] : -1; |
| 38 | 1566 | psotfx | |
| 39 | 813 | psotfx | if( isset($HTTP_GET_VARS['mark']) || isset($HTTP_POST_VARS['mark']) ) |
| 40 | 813 | psotfx | {
|
| 41 | 1068 | psotfx | $mark_read = ( isset($HTTP_POST_VARS['mark']) ) ? $HTTP_POST_VARS['mark'] : $HTTP_GET_VARS['mark']; |
| 42 | 813 | psotfx | } |
| 43 | 813 | psotfx | else
|
| 44 | 813 | psotfx | {
|
| 45 | 2349 | psotfx | $mark_read = ''; |
| 46 | 813 | psotfx | } |
| 47 | 813 | psotfx | |
| 48 | 646 | psotfx | //
|
| 49 | 1103 | psotfx | // Handle marking posts
|
| 50 | 1103 | psotfx | //
|
| 51 | 2349 | psotfx | if( $mark_read == 'forums' ) |
| 52 | 1103 | psotfx | {
|
| 53 | 1566 | psotfx | if( $userdata['session_logged_in'] ) |
| 54 | 1103 | psotfx | {
|
| 55 | 2349 | psotfx | setcookie($board_config['cookie_name'] . '_f_all', time(), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); |
| 56 | 1511 | psotfx | } |
| 57 | 1103 | psotfx | |
| 58 | 1511 | psotfx | $template->assign_vars(array( |
| 59 | 1511 | psotfx | "META" => '<meta http-equiv="refresh" content="3;url=' .append_sid("index.$phpEx") . '">') |
| 60 | 1511 | psotfx | ); |
| 61 | 1103 | psotfx | |
| 62 | 2349 | psotfx | $message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a> '); |
| 63 | 1103 | psotfx | |
| 64 | 1511 | psotfx | message_die(GENERAL_MESSAGE, $message); |
| 65 | 1103 | psotfx | } |
| 66 | 1103 | psotfx | //
|
| 67 | 1103 | psotfx | // End handle marking posts
|
| 68 | 1103 | psotfx | //
|
| 69 | 1103 | psotfx | |
| 70 | 2349 | psotfx | $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array(); |
| 71 | 2349 | psotfx | $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array(); |
| 72 | 1851 | psotfx | |
| 73 | 1103 | psotfx | //
|
| 74 | 2349 | psotfx | // If you don't use these stats on your index you may want to consider
|
| 75 | 2349 | psotfx | // removing them
|
| 76 | 646 | psotfx | //
|
| 77 | 189 | psotfx | $total_posts = get_db_stat('postcount'); |
| 78 | 189 | psotfx | $total_users = get_db_stat('usercount'); |
| 79 | 189 | psotfx | $newest_userdata = get_db_stat('newestuser'); |
| 80 | 646 | psotfx | $newest_user = $newest_userdata['username']; |
| 81 | 646 | psotfx | $newest_uid = $newest_userdata['user_id']; |
| 82 | 2 | thefinn | |
| 83 | 1702 | psotfx | if( $total_posts == 0 ) |
| 84 | 1702 | psotfx | {
|
| 85 | 1702 | psotfx | $l_total_post_s = $lang['Posted_articles_zero_total']; |
| 86 | 1702 | psotfx | } |
| 87 | 1702 | psotfx | else if( $total_posts == 1 ) |
| 88 | 1702 | psotfx | {
|
| 89 | 1702 | psotfx | $l_total_post_s = $lang['Posted_article_total']; |
| 90 | 1702 | psotfx | } |
| 91 | 1702 | psotfx | else
|
| 92 | 1702 | psotfx | {
|
| 93 | 1702 | psotfx | $l_total_post_s = $lang['Posted_articles_total']; |
| 94 | 1702 | psotfx | } |
| 95 | 1702 | psotfx | |
| 96 | 1702 | psotfx | if( $total_users == 0 ) |
| 97 | 1702 | psotfx | {
|
| 98 | 1702 | psotfx | $l_total_user_s = $lang['Registered_users_zero_total']; |
| 99 | 1702 | psotfx | } |
| 100 | 1702 | psotfx | else if( $total_users == 1 ) |
| 101 | 1702 | psotfx | {
|
| 102 | 1702 | psotfx | $l_total_user_s = $lang['Registered_user_total']; |
| 103 | 1702 | psotfx | } |
| 104 | 1702 | psotfx | else
|
| 105 | 1702 | psotfx | {
|
| 106 | 1702 | psotfx | $l_total_user_s = $lang['Registered_users_total']; |
| 107 | 1702 | psotfx | } |
| 108 | 1702 | psotfx | |
| 109 | 1702 | psotfx | |
| 110 | 311 | psotfx | //
|
| 111 | 646 | psotfx | // Start page proper
|
| 112 | 431 | psotfx | //
|
| 113 | 281 | psotfx | $sql = "SELECT c.cat_id, c.cat_title, c.cat_order |
| 114 | 1958 | psotfx | FROM " . CATEGORIES_TABLE . " c |
| 115 | 45 | psotfx | ORDER BY c.cat_order";
|
| 116 | 1958 | psotfx | if( !($result = $db->sql_query($sql)) ) |
| 117 | 13 | thefinn | {
|
| 118 | 2349 | psotfx | message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql); |
| 119 | 13 | thefinn | } |
| 120 | 27 | psotfx | |
| 121 | 1958 | psotfx | while( $category_rows[] = $db->sql_fetchrow($result) ); |
| 122 | 45 | psotfx | |
| 123 | 1958 | psotfx | if( ( $total_categories = count($category_rows) ) ) |
| 124 | 1958 | psotfx | {
|
| 125 | 299 | psotfx | //
|
| 126 | 436 | thefinn | // Define appropriate SQL
|
| 127 | 299 | psotfx | //
|
| 128 | 299 | psotfx | switch(SQL_LAYER) |
| 129 | 45 | psotfx | {
|
| 130 | 299 | psotfx | case 'postgresql': |
| 131 | 1247 | psotfx | $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id |
| 132 | 1068 | psotfx | FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u |
| 133 | 1068 | psotfx | WHERE p.post_id = f.forum_last_post_id |
| 134 | 1068 | psotfx | AND u.user_id = p.poster_id |
| 135 | 299 | psotfx | UNION ( |
| 136 | 1247 | psotfx | SELECT f.*, NULL, NULL, NULL, NULL |
| 137 | 512 | psotfx | FROM " . FORUMS_TABLE . " f |
| 138 | 299 | psotfx | WHERE NOT EXISTS ( |
| 139 | 436 | thefinn | SELECT p.post_time |
| 140 | 512 | psotfx | FROM " . POSTS_TABLE . " p |
| 141 | 1068 | psotfx | WHERE p.post_id = f.forum_last_post_id |
| 142 | 299 | psotfx | ) |
| 143 | 1733 | the_systech | ) |
| 144 | 1736 | the_systech | ORDER BY cat_id, forum_order";
|
| 145 | 299 | psotfx | break;
|
| 146 | 299 | psotfx | |
| 147 | 299 | psotfx | case 'oracle': |
| 148 | 1247 | psotfx | $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id |
| 149 | 1068 | psotfx | FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u |
| 150 | 1068 | psotfx | WHERE p.post_id = f.forum_last_post_id(+) |
| 151 | 1068 | psotfx | AND u.user_id = p.poster_id(+) |
| 152 | 299 | psotfx | ORDER BY f.cat_id, f.forum_order";
|
| 153 | 299 | psotfx | break;
|
| 154 | 299 | psotfx | |
| 155 | 299 | psotfx | default:
|
| 156 | 1247 | psotfx | $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id |
| 157 | 1068 | psotfx | FROM (( " . FORUMS_TABLE . " f |
| 158 | 1068 | psotfx | LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id ) |
| 159 | 1068 | psotfx | LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) |
| 160 | 430 | psotfx | ORDER BY f.cat_id, f.forum_order";
|
| 161 | 299 | psotfx | break;
|
| 162 | 45 | psotfx | } |
| 163 | 2349 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 164 | 19 | psotfx | {
|
| 165 | 2349 | psotfx | message_die(GENERAL_ERROR, 'Could not query forums information', '', __LINE__, __FILE__, $sql); |
| 166 | 27 | psotfx | } |
| 167 | 1958 | psotfx | |
| 168 | 1958 | psotfx | $forum_data = array(); |
| 169 | 1958 | psotfx | while( $row = $db->sql_fetchrow($result) ) |
| 170 | 646 | psotfx | {
|
| 171 | 1958 | psotfx | $forum_data[] = $row; |
| 172 | 1958 | psotfx | } |
| 173 | 1958 | psotfx | |
| 174 | 2349 | psotfx | if ( !($total_forums = count($forum_data)) ) |
| 175 | 1958 | psotfx | {
|
| 176 | 646 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_forums']); |
| 177 | 646 | psotfx | } |
| 178 | 13 | thefinn | |
| 179 | 1958 | psotfx | //
|
| 180 | 1958 | psotfx | // Obtain a list of topic ids which contain
|
| 181 | 1958 | psotfx | // posts made since user last visited
|
| 182 | 1958 | psotfx | //
|
| 183 | 2349 | psotfx | if ( $userdata['session_logged_in'] ) |
| 184 | 813 | psotfx | {
|
| 185 | 1958 | psotfx | $sql = "SELECT t.forum_id, t.topic_id, p.post_time |
| 186 | 1958 | psotfx | FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p |
| 187 | 1958 | psotfx | WHERE p.post_id = t.topic_last_post_id |
| 188 | 1588 | psotfx | AND p.post_time > " . $userdata['user_lastvisit'] . " |
| 189 | 1958 | psotfx | AND t.topic_moved_id = 0";
|
| 190 | 2349 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 191 | 1566 | psotfx | {
|
| 192 | 2349 | psotfx | message_die(GENERAL_ERROR, 'Could not query new topic information', '', __LINE__, __FILE__, $sql); |
| 193 | 1566 | psotfx | } |
| 194 | 813 | psotfx | |
| 195 | 1997 | psotfx | $new_topic_data = array(); |
| 196 | 1958 | psotfx | while( $topic_data = $db->sql_fetchrow($result) ) |
| 197 | 1566 | psotfx | {
|
| 198 | 1566 | psotfx | $new_topic_data[$topic_data['forum_id']][$topic_data['topic_id']] = $topic_data['post_time']; |
| 199 | 1566 | psotfx | } |
| 200 | 813 | psotfx | } |
| 201 | 813 | psotfx | |
| 202 | 398 | psotfx | //
|
| 203 | 646 | psotfx | // Obtain list of moderators of each forum
|
| 204 | 1958 | psotfx | // First users, then groups ... broken into two queries
|
| 205 | 398 | psotfx | //
|
| 206 | 1958 | psotfx | $sql = "SELECT aa.forum_id, u.user_id, u.username |
| 207 | 943 | thefinn | FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u |
| 208 | 1958 | psotfx | WHERE aa.auth_mod = " . TRUE . " |
| 209 | 2349 | psotfx | AND g.group_single_user = 1 |
| 210 | 1851 | psotfx | AND ug.group_id = aa.group_id |
| 211 | 1851 | psotfx | AND g.group_id = aa.group_id |
| 212 | 1851 | psotfx | AND u.user_id = ug.user_id |
| 213 | 1958 | psotfx | GROUP BY u.user_id, u.username, aa.forum_id |
| 214 | 1958 | psotfx | ORDER BY aa.forum_id, u.user_id";
|
| 215 | 2349 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 216 | 646 | psotfx | {
|
| 217 | 2349 | psotfx | message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql); |
| 218 | 646 | psotfx | } |
| 219 | 646 | psotfx | |
| 220 | 1958 | psotfx | $forum_moderators = array(); |
| 221 | 1958 | psotfx | while( $row = $db->sql_fetchrow($result) ) |
| 222 | 646 | psotfx | {
|
| 223 | 1958 | psotfx | $forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>'; |
| 224 | 1958 | psotfx | } |
| 225 | 646 | psotfx | |
| 226 | 1958 | psotfx | $sql = "SELECT aa.forum_id, g.group_id, g.group_name |
| 227 | 1958 | psotfx | FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g |
| 228 | 1958 | psotfx | WHERE aa.auth_mod = " . TRUE . " |
| 229 | 2349 | psotfx | AND g.group_single_user = 0 |
| 230 | 2169 | bartvb | AND g.group_type <> " . GROUP_HIDDEN . " |
| 231 | 1958 | psotfx | AND ug.group_id = aa.group_id |
| 232 | 1958 | psotfx | AND g.group_id = aa.group_id |
| 233 | 1958 | psotfx | GROUP BY g.group_id, g.group_name, aa.forum_id |
| 234 | 1958 | psotfx | ORDER BY aa.forum_id, g.group_id";
|
| 235 | 2349 | psotfx | if ( !($result = $db->sql_query($sql)) ) |
| 236 | 1958 | psotfx | {
|
| 237 | 2349 | psotfx | message_die(GENERAL_ERROR, 'Could not query forum moderator information', '', __LINE__, __FILE__, $sql); |
| 238 | 1958 | psotfx | } |
| 239 | 744 | psotfx | |
| 240 | 1958 | psotfx | while( $row = $db->sql_fetchrow($result) ) |
| 241 | 1958 | psotfx | {
|
| 242 | 1958 | psotfx | $forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>'; |
| 243 | 658 | psotfx | } |
| 244 | 646 | psotfx | |
| 245 | 402 | psotfx | //
|
| 246 | 646 | psotfx | // Find which forums are visible for this user
|
| 247 | 402 | psotfx | //
|
| 248 | 1147 | psotfx | $is_auth_ary = array(); |
| 249 | 1958 | psotfx | $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data); |
| 250 | 402 | psotfx | |
| 251 | 1958 | psotfx | //
|
| 252 | 1958 | psotfx | // Start output of page
|
| 253 | 1958 | psotfx | //
|
| 254 | 1958 | psotfx | $page_title = $lang['Index']; |
| 255 | 1958 | psotfx | include($phpbb_root_path . 'includes/page_header.'.$phpEx); |
| 256 | 1958 | psotfx | |
| 257 | 646 | psotfx | $template->set_filenames(array( |
| 258 | 2349 | psotfx | 'body' => 'index_body.tpl') |
| 259 | 646 | psotfx | ); |
| 260 | 646 | psotfx | |
| 261 | 646 | psotfx | $template->assign_vars(array( |
| 262 | 2349 | psotfx | 'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts), |
| 263 | 2349 | psotfx | 'TOTAL_USERS' => sprintf($l_total_user_s, $total_users), |
| 264 | 2349 | psotfx | 'NEWEST_USER' => sprintf($lang['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'), |
| 265 | 646 | psotfx | |
| 266 | 2349 | psotfx | 'FORUM_IMG' => $images['forum'], |
| 267 | 2349 | psotfx | 'FORUM_NEW_IMG' => $images['forum_new'], |
| 268 | 2349 | psotfx | 'FORUM_LOCKED_IMG' => $images['forum_locked'], |
| 269 | 1566 | psotfx | |
| 270 | 2448 | psotfx | 'L_FORUM' => $lang['Forum'], |
| 271 | 2448 | psotfx | 'L_TOPICS' => $lang['Topics'], |
| 272 | 2448 | psotfx | 'L_REPLIES' => $lang['Replies'], |
| 273 | 2448 | psotfx | 'L_VIEWS' => $lang['Views'], |
| 274 | 2448 | psotfx | 'L_POSTS' => $lang['Posts'], |
| 275 | 2448 | psotfx | 'L_LASTPOST' => $lang['Last_Post'], |
| 276 | 2448 | psotfx | 'L_NO_NEW_POSTS' => $lang['No_new_posts'], |
| 277 | 2448 | psotfx | 'L_NEW_POSTS' => $lang['New_posts'], |
| 278 | 2448 | psotfx | 'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'], |
| 279 | 2448 | psotfx | 'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'], |
| 280 | 2453 | psotfx | 'L_ONLINE_EXPLAIN' => $lang['Online_explain'], |
| 281 | 2448 | psotfx | |
| 282 | 2349 | psotfx | 'L_MODERATOR' => $lang['Moderators'], |
| 283 | 2349 | psotfx | 'L_FORUM_LOCKED' => $lang['Forum_is_locked'], |
| 284 | 2349 | psotfx | 'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'], |
| 285 | 747 | psotfx | |
| 286 | 2349 | psotfx | 'U_MARK_READ' => append_sid("index.$phpEx?mark=forums")) |
| 287 | 646 | psotfx | ); |
| 288 | 646 | psotfx | |
| 289 | 646 | psotfx | //
|
| 290 | 402 | psotfx | // Okay, let's build the index
|
| 291 | 402 | psotfx | //
|
| 292 | 27 | psotfx | for($i = 0; $i < $total_categories; $i++) |
| 293 | 27 | psotfx | {
|
| 294 | 458 | psotfx | $cat_id = $category_rows[$i]['cat_id']; |
| 295 | 458 | psotfx | |
| 296 | 1958 | psotfx | //
|
| 297 | 1958 | psotfx | // Should we display this category/forum set?
|
| 298 | 1958 | psotfx | //
|
| 299 | 1958 | psotfx | $display_forums = false; |
| 300 | 27 | psotfx | for($j = 0; $j < $total_forums; $j++) |
| 301 | 27 | psotfx | {
|
| 302 | 2349 | psotfx | if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'] && $forum_data[$j]['cat_id'] == $cat_id ) |
| 303 | 1958 | psotfx | {
|
| 304 | 1958 | psotfx | $display_forums = true; |
| 305 | 1958 | psotfx | } |
| 306 | 1958 | psotfx | } |
| 307 | 458 | psotfx | |
| 308 | 1958 | psotfx | //
|
| 309 | 1958 | psotfx | // Yes, we should, so first dump out the category
|
| 310 | 1958 | psotfx | // title, then, if appropriate the forum list
|
| 311 | 1958 | psotfx | //
|
| 312 | 2349 | psotfx | if ( $display_forums ) |
| 313 | 1958 | psotfx | {
|
| 314 | 2448 | psotfx | $template->assign_block_vars('catrow', array( |
| 315 | 2448 | psotfx | 'CAT_ID' => $cat_id, |
| 316 | 2448 | psotfx | 'CAT_DESC' => $category_rows[$i]['cat_title'], |
| 317 | 2448 | psotfx | 'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id")) |
| 318 | 1958 | psotfx | ); |
| 319 | 1958 | psotfx | |
| 320 | 2349 | psotfx | if ( $viewcat == $cat_id || $viewcat == -1 ) |
| 321 | 27 | psotfx | {
|
| 322 | 1958 | psotfx | for($j = 0; $j < $total_forums; $j++) |
| 323 | 458 | psotfx | {
|
| 324 | 2349 | psotfx | if ( $forum_data[$j]['cat_id'] == $cat_id ) |
| 325 | 813 | psotfx | {
|
| 326 | 1958 | psotfx | $forum_id = $forum_data[$j]['forum_id']; |
| 327 | 1511 | psotfx | |
| 328 | 2349 | psotfx | if ( $is_auth_ary[$forum_id]['auth_view'] ) |
| 329 | 1958 | psotfx | {
|
| 330 | 2349 | psotfx | if ( $forum_data[$j]['forum_status'] == FORUM_LOCKED ) |
| 331 | 912 | psotfx | {
|
| 332 | 2448 | psotfx | $folder_image = $images['forum_locked']; |
| 333 | 2448 | psotfx | $folder_alt = $lang['Forum_locked']; |
| 334 | 912 | psotfx | } |
| 335 | 1958 | psotfx | else
|
| 336 | 1511 | psotfx | {
|
| 337 | 1958 | psotfx | $unread_topics = false; |
| 338 | 2349 | psotfx | if ( $userdata['session_logged_in'] ) |
| 339 | 1566 | psotfx | {
|
| 340 | 2349 | psotfx | if ( !empty($new_topic_data[$forum_id]) ) |
| 341 | 1958 | psotfx | {
|
| 342 | 1958 | psotfx | $forum_last_post_time = 0; |
| 343 | 1511 | psotfx | |
| 344 | 1958 | psotfx | while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) ) |
| 345 | 1958 | psotfx | {
|
| 346 | 2349 | psotfx | if ( empty($tracking_topics[$check_topic_id]) ) |
| 347 | 1958 | psotfx | {
|
| 348 | 1958 | psotfx | $unread_topics = true; |
| 349 | 1958 | psotfx | $forum_last_post_time = max($check_post_time, $forum_last_post_time); |
| 350 | 1566 | psotfx | |
| 351 | 1958 | psotfx | } |
| 352 | 1958 | psotfx | else
|
| 353 | 1958 | psotfx | {
|
| 354 | 2349 | psotfx | if ( $tracking_topics[$check_topic_id] < $check_post_time ) |
| 355 | 1958 | psotfx | {
|
| 356 | 1958 | psotfx | $unread_topics = true; |
| 357 | 1958 | psotfx | $forum_last_post_time = max($check_post_time, $forum_last_post_time); |
| 358 | 1958 | psotfx | } |
| 359 | 1958 | psotfx | } |
| 360 | 1958 | psotfx | } |
| 361 | 813 | psotfx | |
| 362 | 2349 | psotfx | if ( !empty($tracking_forums[$forum_id]) ) |
| 363 | 1958 | psotfx | {
|
| 364 | 2349 | psotfx | if ( $tracking_forums[$forum_id] > $forum_last_post_time ) |
| 365 | 1958 | psotfx | {
|
| 366 | 1958 | psotfx | $unread_topics = false; |
| 367 | 1958 | psotfx | } |
| 368 | 1958 | psotfx | } |
| 369 | 430 | psotfx | |
| 370 | 2349 | psotfx | if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) |
| 371 | 1958 | psotfx | {
|
| 372 | 2349 | psotfx | if ( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] > $forum_last_post_time ) |
| 373 | 1958 | psotfx | {
|
| 374 | 1958 | psotfx | $unread_topics = false; |
| 375 | 1958 | psotfx | } |
| 376 | 1958 | psotfx | } |
| 377 | 458 | psotfx | |
| 378 | 1958 | psotfx | } |
| 379 | 1958 | psotfx | } |
| 380 | 306 | psotfx | |
| 381 | 2448 | psotfx | $folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum']; |
| 382 | 2448 | psotfx | $folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts']; |
| 383 | 1958 | psotfx | } |
| 384 | 306 | psotfx | |
| 385 | 1958 | psotfx | $posts = $forum_data[$j]['forum_posts']; |
| 386 | 1958 | psotfx | $topics = $forum_data[$j]['forum_topics']; |
| 387 | 45 | psotfx | |
| 388 | 2349 | psotfx | if ( $forum_data[$j]['forum_last_post_id'] ) |
| 389 | 1958 | psotfx | {
|
| 390 | 1958 | psotfx | $last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']); |
| 391 | 646 | psotfx | |
| 392 | 2349 | psotfx | $last_post = $last_post_time . '<br />'; |
| 393 | 646 | psotfx | |
| 394 | 2448 | psotfx | $last_post .= ( $forum_data[$j]['user_id'] == ANONYMOUS ) ? ( ($forum_data[$j]['post_username'] != '' ) ? $forum_data[$j]['post_username'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $forum_data[$j]['user_id']) . '">' . $forum_data[$j]['username'] . '</a> '; |
| 395 | 1958 | psotfx | |
| 396 | 2448 | psotfx | $last_post .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $forum_data[$j]['forum_last_post_id']) . '#' . $forum_data[$j]['forum_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" border="0" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" /></a>'; |
| 397 | 1958 | psotfx | } |
| 398 | 1958 | psotfx | else
|
| 399 | 1958 | psotfx | {
|
| 400 | 1958 | psotfx | $last_post = $lang['No_Posts']; |
| 401 | 1958 | psotfx | } |
| 402 | 912 | psotfx | |
| 403 | 2349 | psotfx | if ( count($forum_moderators[$forum_id]) > 0 ) |
| 404 | 1958 | psotfx | {
|
| 405 | 1958 | psotfx | $l_moderators = ( count($forum_moderators[$forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators']; |
| 406 | 2349 | psotfx | $moderator_list = implode(', ', $forum_moderators[$forum_id]); |
| 407 | 1958 | psotfx | } |
| 408 | 1958 | psotfx | else
|
| 409 | 1958 | psotfx | {
|
| 410 | 2349 | psotfx | $l_moderators = ' '; |
| 411 | 2349 | psotfx | $moderator_list = ' '; |
| 412 | 1958 | psotfx | } |
| 413 | 45 | psotfx | |
| 414 | 1958 | psotfx | $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; |
| 415 | 1958 | psotfx | $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; |
| 416 | 1611 | psotfx | |
| 417 | 2448 | psotfx | $template->assign_block_vars('catrow.forumrow', array( |
| 418 | 2448 | psotfx | 'ROW_COLOR' => '#' . $row_color, |
| 419 | 2448 | psotfx | 'ROW_CLASS' => $row_class, |
| 420 | 2448 | psotfx | 'FORUM_FOLDER_IMG' => $folder_image, |
| 421 | 2448 | psotfx | 'FORUM_NAME' => $forum_data[$j]['forum_name'], |
| 422 | 2448 | psotfx | 'FORUM_DESC' => $forum_data[$j]['forum_desc'], |
| 423 | 2448 | psotfx | 'POSTS' => $forum_data[$j]['forum_posts'], |
| 424 | 2448 | psotfx | 'TOPICS' => $forum_data[$j]['forum_topics'], |
| 425 | 2448 | psotfx | 'LAST_POST' => $last_post, |
| 426 | 2448 | psotfx | 'MODERATORS' => $moderator_list, |
| 427 | 402 | psotfx | |
| 428 | 2448 | psotfx | 'L_MODERATOR' => $l_moderators, |
| 429 | 2448 | psotfx | 'L_FORUM_FOLDER_ALT' => $folder_alt, |
| 430 | 213 | psotfx | |
| 431 | 2448 | psotfx | 'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id")) |
| 432 | 1958 | psotfx | ); |
| 433 | 1958 | psotfx | } |
| 434 | 1958 | psotfx | } |
| 435 | 402 | psotfx | } |
| 436 | 45 | psotfx | } |
| 437 | 45 | psotfx | } |
| 438 | 27 | psotfx | } // for ... categories
|
| 439 | 27 | psotfx | |
| 440 | 27 | psotfx | }// if ... total_categories
|
| 441 | 56 | thefinn | else
|
| 442 | 56 | thefinn | {
|
| 443 | 744 | psotfx | message_die(GENERAL_MESSAGE, $lang['No_forums']); |
| 444 | 56 | thefinn | } |
| 445 | 646 | psotfx | |
| 446 | 646 | psotfx | //
|
| 447 | 646 | psotfx | // Generate the page
|
| 448 | 646 | psotfx | //
|
| 449 | 2349 | psotfx | $template->pparse('body'); |
| 450 | 13 | thefinn | |
| 451 | 646 | psotfx | include($phpbb_root_path . 'includes/page_tail.'.$phpEx); |
| 452 | 458 | psotfx | |
| 453 | 2349 | psotfx | ?> |

