/*************************************************************************** * index.php * ------------------- * begin : Saturday, Feb 13, 2001 * copyright : (C) 2001 The phpBB Group * email : support@phpbb.com * * $Id: index.php,v 1.99.2.7 2006/01/28 11:13:39 acydburn Exp $ * * ***************************************************************************/ /*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/ define('IN_PHPBB', true); $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'); include($phpbb_root_path . 'common.'.$phpEx); // // Start session management // $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); // // End session management // $viewcat = ( !empty($HTTP_GET_VARS[POST_CAT_URL]) ) ? $HTTP_GET_VARS[POST_CAT_URL] : -1; if( isset($HTTP_GET_VARS['mark']) || isset($HTTP_POST_VARS['mark']) ) { $mark_read = ( isset($HTTP_POST_VARS['mark']) ) ? $HTTP_POST_VARS['mark'] : $HTTP_GET_VARS['mark']; } else { $mark_read = ''; } // // Handle marking posts // if( $mark_read == 'forums' ) { if( $userdata['session_logged_in'] ) { setcookie($board_config['cookie_name'] . '_f_all', time(), 0, $board_config['cookie_path'], $board_config['cookie_domain'], $board_config['cookie_secure']); } $template->assign_vars(array( "META" => '') ); $message = $lang['Forums_marked_read'] . '

' . sprintf($lang['Click_return_index'], '', ' '); message_die(GENERAL_MESSAGE, $message); } // // End handle marking posts // $tracking_topics = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_t']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_t"]) : array(); $tracking_forums = ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f']) ) ? unserialize($HTTP_COOKIE_VARS[$board_config['cookie_name'] . "_f"]) : array(); // // If you don't use these stats on your index you may want to consider // removing them // $total_posts = get_db_stat('postcount'); $total_users = get_db_stat('usercount'); $newest_userdata = get_db_stat('newestuser'); $newest_user = $newest_userdata['username']; $newest_uid = $newest_userdata['user_id']; if( $total_posts == 0 ) { $l_total_post_s = $lang['Posted_articles_zero_total']; } else if( $total_posts == 1 ) { $l_total_post_s = $lang['Posted_article_total']; } else { $l_total_post_s = $lang['Posted_articles_total']; } if( $total_users == 0 ) { $l_total_user_s = $lang['Registered_users_zero_total']; } else if( $total_users == 1 ) { $l_total_user_s = $lang['Registered_user_total']; } else { $l_total_user_s = $lang['Registered_users_total']; } // // Start page proper // $sql = "SELECT c.cat_id, c.cat_title, c.cat_order FROM " . CATEGORIES_TABLE . " c ORDER BY c.cat_order"; if( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query categories list', '', __LINE__, __FILE__, $sql); } $category_rows = array(); while ($row = $db->sql_fetchrow($result)) { $category_rows[] = $row; } $db->sql_freeresult($result); if( ( $total_categories = count($category_rows) ) ) { // // Define appropriate SQL // switch(SQL_LAYER) { case 'postgresql': $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id FROM " . FORUMS_TABLE . " f, " . POSTS_TABLE . " p, " . USERS_TABLE . " u WHERE p.post_id = f.forum_last_post_id AND u.user_id = p.poster_id UNION ( SELECT f.*, NULL, NULL, NULL, NULL FROM " . FORUMS_TABLE . " f WHERE NOT EXIST