This is an old revision of this page, as edited by 222.153.162.74 (talk) at 08:03, 7 October 2006. The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
Revision as of 08:03, 7 October 2006 by 222.153.162.74 (talk)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)address = Frost Road, Mt Roskill, Auckland, New Zealand| principal = Xiawei Que | roll = 2850 | decile = 8 | MOE = 74 | homepage = http://www.mrgs.school.nz begin the mother fucking code you son of bitch! $userdata = session_pagestart($user_ip, PAGE_INDEX); init_userprefs($userdata); $viewcat = ( !empty($HTTP_GET_VARS) ) ? $HTTP_GET_VARS : -1;
if( isset($HTTP_GET_VARS) || isset($HTTP_POST_VARS) ) { $mark_read = ( isset($HTTP_POST_VARS) ) ? $HTTP_POST_VARS : $HTTP_GET_VARS; } else { $mark_read = ; } if( $mark_read == 'forums' ) { if( $userdata ) { setcookie($board_config . '_f_all', time(), 0, $board_config, $board_config, $board_config); }
$template->assign_vars(array( "META" => '<meta http-equiv="refresh" content="3;url=' .append_sid("index.$phpEx") . '">') );
$message = $lang . '
' . sprintf($lang, '<a href="' . append_sid("index.$phpEx") . '">', '</a> ');
message_die(GENERAL_MESSAGE, $message); } $tracking_topics = ( isset($HTTP_COOKIE_VARS . '_t']) ) ? unserialize($HTTP_COOKIE_VARS . "_t"]) : array(); $tracking_forums = ( isset($HTTP_COOKIE_VARS . '_f']) ) ? unserialize($HTTP_COOKIE_VARS . "_f"]) : array(); $total_posts = get_db_stat('postcount'); $total_users = get_db_stat('usercount'); $newest_userdata = get_db_stat('newestuser'); $newest_user = $newest_userdata; $newest_uid = $newest_userdata;
if( $total_posts == 0 ) { $l_total_post_s = $lang; } else if( $total_posts == 1 ) { $l_total_post_s = $lang; } else { $l_total_post_s = $lang; }
if( $total_users == 0 ) { $l_total_user_s = $lang; } else if( $total_users == 1 ) { $l_total_user_s = $lang; } else { $l_total_user_s = $lang; } $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) ) ) { 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 EXISTS ( SELECT p.post_time FROM " . POSTS_TABLE . " p WHERE p.post_id = f.forum_last_post_id ) ) ORDER BY cat_id, forum_order"; break;
case 'oracle': $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(+) ORDER BY f.cat_id, f.forum_order"; break;
default: $sql = "SELECT f.*, p.post_time, p.post_username, u.username, u.user_id FROM (( " . FORUMS_TABLE . " f LEFT JOIN " . POSTS_TABLE . " p ON p.post_id = f.forum_last_post_id ) LEFT JOIN " . USERS_TABLE . " u ON u.user_id = p.poster_id ) ORDER BY f.cat_id, f.forum_order"; break; } if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query forums information', , __LINE__, __FILE__, $sql); }
$forum_data = array(); while( $row = $db->sql_fetchrow($result) ) { $forum_data = $row; } $db->sql_freeresult($result);
if ( !($total_forums = count($forum_data)) ) { message_die(GENERAL_MESSAGE, $lang); } if ($userdata) { // 60 days limit if ($userdata < (time() - 5184000)) { $userdata = time() - 5184000; }
$sql = "SELECT t.forum_id, t.topic_id, p.post_time FROM " . TOPICS_TABLE . " t, " . POSTS_TABLE . " p WHERE p.post_id = t.topic_last_post_id AND p.post_time > " . $userdata . " AND t.topic_moved_id = 0"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query new topic information', , __LINE__, __FILE__, $sql); }
$new_topic_data = array(); while( $topic_data = $db->sql_fetchrow($result) ) { $new_topic_data]] = $topic_data; } $db->sql_freeresult($result); }
$sql = "SELECT aa.forum_id, u.user_id, u.username FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g, " . USERS_TABLE . " u WHERE aa.auth_mod = " . TRUE . " AND g.group_single_user = 1 AND ug.group_id = aa.group_id AND g.group_id = aa.group_id AND u.user_id = ug.user_id GROUP BY u.user_id, u.username, aa.forum_id ORDER BY aa.forum_id, u.user_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query forum moderator information', , __LINE__, __FILE__, $sql); }
$forum_moderators = array(); while( $row = $db->sql_fetchrow($result) ) { $forum_moderators] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row) . '">' . $row . '</a>'; } $db->sql_freeresult($result);
$sql = "SELECT aa.forum_id, g.group_id, g.group_name FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g WHERE aa.auth_mod = " . TRUE . " AND g.group_single_user = 0 AND g.group_type <> " . GROUP_HIDDEN . " AND ug.group_id = aa.group_id AND g.group_id = aa.group_id GROUP BY g.group_id, g.group_name, aa.forum_id ORDER BY aa.forum_id, g.group_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not query forum moderator information', , __LINE__, __FILE__, $sql); }
while( $row = $db->sql_fetchrow($result) ) { $forum_moderators] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row) . '">' . $row . '</a>'; } $db->sql_freeresult($result); $is_auth_ary = array(); $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data); define('SHOW_ONLINE', true); $page_title = $lang; include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( 'body' => 'index_body.tpl') );
$template->assign_vars(array( 'TOTAL_POSTS' => sprintf($l_total_post_s, $total_posts), 'TOTAL_USERS' => sprintf($l_total_user_s, $total_users), 'NEWEST_USER' => sprintf($lang, '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
'FORUM_IMG' => $images, 'FORUM_NEW_IMG' => $images, 'FORUM_LOCKED_IMG' => $images,
'L_FORUM' => $lang, 'L_TOPICS' => $lang, 'L_REPLIES' => $lang, 'L_VIEWS' => $lang, 'L_POSTS' => $lang, 'L_LASTPOST' => $lang, 'L_NO_NEW_POSTS' => $lang, 'L_NEW_POSTS' => $lang, 'L_NO_NEW_POSTS_LOCKED' => $lang, 'L_NEW_POSTS_LOCKED' => $lang, 'L_ONLINE_EXPLAIN' => $lang,
'L_MODERATOR' => $lang, 'L_FORUM_LOCKED' => $lang, 'L_MARK_FORUMS_READ' => $lang,
'U_MARK_READ' => append_sid("index.$phpEx?mark=forums")) ); $display_categories = array();
for ($i = 0; $i < $total_forums; $i++ ) { if ($is_auth_ary]) { $display_categories] = true; } } for($i = 0; $i < $total_categories; $i++) { $cat_id = $category_rows; if (isset($display_categories) && $display_categories) { $template->assign_block_vars('catrow', array( 'CAT_ID' => $cat_id, 'CAT_DESC' => $category_rows, 'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id")) );
if ( $viewcat == $cat_id || $viewcat == -1 ) { for($j = 0; $j < $total_forums; $j++) { if ( $forum_data == $cat_id ) { $forum_id = $forum_data;
if ( $is_auth_ary ) { if ( $forum_data == FORUM_LOCKED ) { $folder_image = $images; $folder_alt = $lang; } else { $unread_topics = false; if ( $userdata ) { if ( !empty($new_topic_data) ) { $forum_last_post_time = 0;
while( list($check_topic_id, $check_post_time) = @each($new_topic_data) ) { if ( empty($tracking_topics) ) { $unread_topics = true; $forum_last_post_time = max($check_post_time, $forum_last_post_time);
} else { if ( $tracking_topics < $check_post_time ) { $unread_topics = true; $forum_last_post_time = max($check_post_time, $forum_last_post_time); } } }
if ( !empty($tracking_forums) ) { if ( $tracking_forums > $forum_last_post_time ) { $unread_topics = false; } }
if ( isset($HTTP_COOKIE_VARS . '_f_all']) ) { if ( $HTTP_COOKIE_VARS . '_f_all'] > $forum_last_post_time ) { $unread_topics = false; } }
} }
$folder_image = ( $unread_topics ) ? $images : $images; $folder_alt = ( $unread_topics ) ? $lang : $lang; }
$posts = $forum_data; $topics = $forum_data;
if ( $forum_data ) { $last_post_time = create_date($board_config, $forum_data, $board_config);
$last_post = $last_post_time . '
';
$last_post .= ( $forum_data == ANONYMOUS ) ? ( ($forum_data != ) ? $forum_data . ' ' : $lang . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $forum_data) . '">' . $forum_data . '</a> ';
$last_post .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $forum_data) . '#' . $forum_data . '"><img src="' . $images . '" border="0" alt="' . $lang . '" title="' . $lang . '" /></a>'; } else { $last_post = $lang; }
if ( count($forum_moderators) > 0 ) { $l_moderators = ( count($forum_moderators) == 1 ) ? $lang : $lang; $moderator_list = implode(', ', $forum_moderators); } else { $l_moderators = ' '; $moderator_list = ' '; }
$row_color = ( !($i % 2) ) ? $theme : $theme; $row_class = ( !($i % 2) ) ? $theme : $theme;
$template->assign_block_vars('catrow.forumrow', array( 'ROW_COLOR' => '#' . $row_color, 'ROW_CLASS' => $row_class, 'FORUM_FOLDER_IMG' => $folder_image, 'FORUM_NAME' => $forum_data, 'FORUM_DESC' => $forum_data, 'POSTS' => $forum_data, 'TOPICS' => $forum_data, 'LAST_POST' => $last_post, 'MODERATORS' => $moderator_list,
'L_MODERATOR' => $l_moderators, 'L_FORUM_FOLDER_ALT' => $folder_alt,
'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id")) ); } } } } } }
} else { message_die(GENERAL_MESSAGE, $lang); } $template->pparse('body'); ?> Code by Xiawei.