Citation :
<?php // Start standard define('IN_PHPBB', true); $phpbb_root_path = './'; include($phpbb_root_path . 'extension.inc'; include($phpbb_root_path . 'common.'.$phpEx); // End standard // Start session management $userdata = session_pagestart($user_ip, PAGE_VIEWONLINE); init_userprefs($userdata); // End session management // Start Output page header $page_title = $lang['Who_is_online']; include($phpbb_root_path . 'includes/page_header.'.$phpEx); $template->set_filenames(array( 'body' => 'portal_body.tpl' ); // End Output page header ###### start last_reg_users_##### $sql = "SELECT user_id, username, user_regdate FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS . " ORDER BY user_regdate DESC LIMIT 20"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $user_id=$row['user_id']; $template->assign_block_vars("last_registrations", array( 'USERNAME' => $row['username'], 'REG_DATE' => create_date($board_config['default_dateformat'], $row['user_regdate'], $board_config['board_timezone']), 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id" )) ); } ##### end last_reg_users_####### ###### start last visits_##### $sql = "SELECT user_id, username, user_lastvisit FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS . " ORDER BY user_lastvisit DESC LIMIT 10"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $user_id=$row['user_id']; $template->assign_block_vars("last_visits", array( 'USERNAME' => $row['username'], 'LAST_VISIT_DATE' => create_date($board_config['default_dateformat'], $row['user_lastvisit'], $board_config['board_timezone']), 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id" )) ); } ##### end last visits_####### ##### start ranks ##### $sql = "SELECT rank_title, rank_min FROM " . RANKS_TABLE . " WHERE rank_special !='1' ORDER BY rank_id"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $user_id=$row['user_id']; $template->assign_block_vars("ranks", array( 'RANK_TITLE' => $row['rank_title'], 'RANK_MIN' => $row['rank_min']) ); } ##### end ranks ##### ###### start most posts_##### $sql = "SELECT user_id, username, user_posts FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS . " ORDER BY user_posts DESC LIMIT 20"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $user_id=$row['user_id']; $template->assign_block_vars("most_posts", array( 'USERNAME' => $row['username'], 'POSTS' => $row['user_posts'], 'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id" )) ); } ##### end most posts_####### ##### start beste topics ##### $sql = "SELECT topic_id,topic_title,topic_replies FROM " . TOPICS_TABLE . " t LEFT JOIN " . FORUMS_TABLE . " f ON t.forum_id=f.forum_id WHERE f.auth_view < 2 ORDER BY topic_replies DESC LIMIT 21"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain user/online forums information', '', __LINE__, __FILE__, $sql); } while ($row = $db->sql_fetchrow($result)) { $topic_id=$row['topic_id']; $template->assign_block_vars("best_topics", array( 'TOPIC_TITLE' => $row['topic_title'], 'REPLIES' => $row['topic_replies'], 'VIEWTOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id" )) ); } ##### end best topics ##### ##### start last_topics ##### (z123-428) $template->assign_vars(array( 'FORUM_ID' => $forum_id, 'FORUM_NAME' => $forum_row['forum_name'], 'MODERATORS' => $forum_moderators, 'POST_IMG' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $images['post_locked'] : $images['post_new'], 'FOLDER_IMG' => $images['folder'], 'FOLDER_NEW_IMG' => $images['folder_new'], 'FOLDER_HOT_IMG' => $images['folder_hot'], 'FOLDER_HOT_NEW_IMG' => $images['folder_hot_new'], 'FOLDER_LOCKED_IMG' => $images['folder_locked'], 'FOLDER_LOCKED_NEW_IMG' => $images['folder_locked_new'], 'FOLDER_STICKY_IMG' => $images['folder_sticky'], 'FOLDER_STICKY_NEW_IMG' => $images['folder_sticky_new'], 'FOLDER_ANNOUNCE_IMG' => $images['folder_announce'], 'FOLDER_ANNOUNCE_NEW_IMG' => $images['folder_announce_new'], 'L_TOPICS' => $lang['Topics'], 'L_REPLIES' => $lang['Replies'], 'L_VIEWS' => $lang['Views'], 'L_POSTS' => $lang['Posts'], 'L_LASTPOST' => $lang['Last_Post'], 'L_MODERATOR' => $l_moderators, 'L_MARK_TOPICS_READ' => $lang['Mark_all_topics'], 'L_POST_NEW_TOPIC' => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'], 'L_NO_NEW_POSTS' => $lang['No_new_posts'], 'L_NEW_POSTS' => $lang['New_posts'], 'L_NO_NEW_POSTS_LOCKED' => $lang['No_new_posts_locked'], 'L_NEW_POSTS_LOCKED' => $lang['New_posts_locked'], 'L_NO_NEW_POSTS_HOT' => $lang['No_new_posts_hot'], 'L_NEW_POSTS_HOT' => $lang['New_posts_hot'], 'L_ANNOUNCEMENT' => $lang['Post_Announcement'], 'L_STICKY' => $lang['Post_Sticky'], 'L_POSTED' => $lang['Posted'], 'L_JOINED' => $lang['Joined'], 'L_AUTHOR' => $lang['Author'], 'S_AUTH_LIST' => $s_auth_can, 'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id" ), 'U_MARK_READ' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&mark=topics" )) ); $sql = "SELECT t.*, f.forum_name, forum_name, u.username, u.user_id, u2.username as user2, u2.user_id as id2, p.post_username, p2.post_username AS post_username2, p2.post_time FROM " . TOPICS_TABLE . " t, " . USERS_TABLE . " u, " . POSTS_TABLE . " p, " . POSTS_TABLE . " p2, " . USERS_TABLE . " u2 LEFT JOIN " . FORUMS_TABLE . " f ON t.forum_id=f.forum_id WHERE t.topic_poster = u.user_id AND p.post_id = t.topic_first_post_id AND p2.post_id = t.topic_last_post_id AND u2.user_id = p2.poster_id AND f.auth_view < 2 ORDER BY t.topic_last_post_id DESC LIMIT 27"; if ( !($result = $db->sql_query($sql)) ) { message_die(GENERAL_ERROR, 'Could not obtain topic information', '', __LINE__, __FILE__, $sql); } $total_topics = 0; while( $row = $db->sql_fetchrow($result) ) { $topic_rowset[] = $row; $total_topics++; } $db->sql_freeresult($result); // // Define censored word matches // $orig_word = array(); $replacement_word = array(); obtain_word_list($orig_word, $replacement_word); // // Post URL generation for templating vars // $template->assign_vars(array( 'L_DISPLAY_TOPICS' => $lang['Display_topics'], 'U_POST_NEW_TOPIC' => append_sid("posting.$phpEx?mode=newtopic&" . POST_FORUM_URL . "=$forum_id" ), 'S_SELECT_TOPIC_DAYS' => $select_topic_days, 'S_POST_DAYS_ACTION' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&start=$start" )) ); for($i = 0; $i < $total_topics; $i++) { $topic_id = $topic_rowset[$i]['topic_id'];
$forum_name = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $forums_rowset['forum_name']) : $forums_rowset['forum_name'];
$topic_title = ( count($orig_word) ) ? preg_replace($orig_word, $replacement_word, $topic_rowset[$i]['topic_title']) : $topic_rowset[$i]['topic_title']; $replies = $topic_rowset[$i]['topic_replies']; $topic_type = $topic_rowset[$i]['topic_type']; if ( $topic_rowset[$i]['topic_icon'] == 0 ) { $icon = "images/icon/icon1.gif"; } else { $icon = "images/icon/icon" . $topic_rowset[$i]['topic_icon'].".gif"; } if( $topic_type == POST_ANNOUNCE ) { $topic_type = $lang['Topic_Announcement'] . ' '; } else if( $topic_type == POST_STICKY ) { $topic_type = $lang['Topic_Sticky'] . ' '; } else { $topic_type = ''; } if( $topic_rowset[$i]['topic_vote'] ) { $topic_type .= $lang['Topic_Poll'] . ' '; } if( $topic_rowset[$i]['topic_status'] == TOPIC_MOVED ) { $topic_type = $lang['Topic_Moved'] . ' '; $topic_id = $topic_rowset[$i]['topic_moved_id']; $folder_image = $images['folder']; $folder_alt = $lang['Topic_Moved']; $newest_post_img = ''; } else { if( $topic_rowset[$i]['topic_type'] == POST_ANNOUNCE ) { $folder = $images['folder_announce']; $folder_new = $images['folder_announce_new']; } else if( $topic_rowset[$i]['topic_type'] == POST_STICKY ) { $folder = $images['folder_sticky']; $folder_new = $images['folder_sticky_new']; } else if( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) { $folder = $images['folder_locked']; $folder_new = $images['folder_locked_new']; } else { if($replies >= $board_config['hot_threshold']) { $folder = $images['folder_hot']; $folder_new = $images['folder_hot_new']; } else { $folder = $images['folder']; $folder_new = $images['folder_new']; } } $newest_post_img = ''; if( $userdata['session_logged_in'] ) { if( $topic_rowset[$i]['post_time'] > $userdata['user_lastvisit'] ) { if( !empty($tracking_topics) || !empty($tracking_forums) || isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) { $unread_topics = true; if( !empty($tracking_topics[$topic_id]) ) { if( $tracking_topics[$topic_id] >= $topic_rowset[$i]['post_time'] ) { $unread_topics = false; } } if( !empty($tracking_forums[$forum_id]) ) { if( $tracking_forums[$forum_id] >= $topic_rowset[$i]['post_time'] ) { $unread_topics = false; } } if( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all']) ) { if( $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_f_all'] >= $topic_rowset[$i]['post_time'] ) { $unread_topics = false; } } if( $unread_topics ) { $folder_image = $folder_new; $folder_alt = $lang['New_posts']; $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest" ) . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; } else { $folder_image = $folder; $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = ''; } } else { $folder_image = $folder_new; $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&view=newest" ) . '"><img src="' . $images['icon_newest_reply'] . '" alt="' . $lang['View_newest_post'] . '" title="' . $lang['View_newest_post'] . '" border="0" /></a> '; } } else { $folder_image = $folder; $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = ''; } } else { $folder_image = $folder; $folder_alt = ( $topic_rowset[$i]['topic_status'] == TOPIC_LOCKED ) ? $lang['Topic_locked'] : $lang['No_new_posts']; $newest_post_img = ''; } } if( ( $replies + 1 ) > $board_config['posts_per_page'] ) { $total_pages = ceil( ( $replies + 1 ) / $board_config['posts_per_page'] ); $goto_page = ' [ <img src="' . $images['icon_gotopost'] . '" alt="' . $lang['Goto_page'] . '" title="' . $lang['Goto_page'] . '" />' . $lang['Goto_page'] . ': '; $times = 1; for($j = 0; $j < $replies + 1; $j += $board_config['posts_per_page']) { $goto_page .= '<a href="' . append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=" . $topic_id . "&start=$j" ) . '">' . $times . '</a>'; if( $times == 1 && $total_pages > 4 ) { $goto_page .= ' ... '; $times = $total_pages - 3; $j += ( $total_pages - 4 ) * $board_config['posts_per_page']; } else if ( $times < $total_pages ) { $goto_page .= ', '; } $times++; } $goto_page .= ' ] '; } else { $goto_page = ''; } $view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id" ); $topic_author = ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $topic_rowset[$i]['user_id']) . '">' : ''; $topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? $topic_rowset[$i]['username'] : ( ( $topic_rowset[$i]['post_username'] != '' ) ? $topic_rowset[$i]['post_username'] : $lang['Guest'] ); $topic_author .= ( $topic_rowset[$i]['user_id'] != ANONYMOUS ) ? '</a>' : ''; $first_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['topic_time'], $board_config['board_timezone']); $last_post_time = create_date($board_config['default_dateformat'], $topic_rowset[$i]['post_time'], $board_config['board_timezone']); $last_post_author = ( $topic_rowset[$i]['id2'] == ANONYMOUS ) ? ( ($topic_rowset[$i]['post_username2'] != '' ) ? $topic_rowset[$i]['post_username2'] . ' ' : $lang['Guest'] . ' ' ) : '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . '=' . $topic_rowset[$i]['id2']) . '">' . $topic_rowset[$i]['user2'] . '</a>'; $last_post_url = '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $topic_rowset[$i]['topic_last_post_id']) . '#' . $topic_rowset[$i]['topic_last_post_id'] . '"><img src="' . $images['icon_latest_reply'] . '" alt="' . $lang['View_latest_post'] . '" title="' . $lang['View_latest_post'] . '" border="0" /></a>'; $views = $topic_rowset[$i]['topic_views']; $row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $template->assign_block_vars('topicrow', array( 'FORUM_NAME' => $forum_name,
'ICON' => $icon, 'ROW_COLOR' => $row_color, 'ROW_CLASS' => $row_class, 'FORUM_ID' => $forum_id, 'TOPIC_ID' => $topic_id, 'TOPIC_FOLDER_IMG' => $folder_image, 'TOPIC_AUTHOR' => $topic_author, 'GOTO_PAGE' => $goto_page, 'REPLIES' => $replies, 'NEWEST_POST_IMG' => $newest_post_img, 'TOPIC_TITLE' => $topic_title, 'TOPIC_TYPE' => $topic_type, 'VIEWS' => $views, 'FIRST_POST_TIME' => $first_post_time, 'LAST_POST_TIME' => $last_post_time, 'LAST_POST_AUTHOR' => $last_post_author, 'LAST_POST_IMG' => $last_post_url, 'L_TOPIC_FOLDER_ALT' => $folder_alt, 'U_VIEW_TOPIC' => $view_topic_url) ); } $template->assign_vars(array( 'PAGINATION' => generate_pagination("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id&topicdays=$topic_days", $topics_count, $board_config['topics_per_page'], $start), 'PAGE_NUMBER' => sprintf($lang['Page_of'], ( floor( $start / $board_config['topics_per_page'] ) + 1 ), ceil( $topics_count / $board_config['topics_per_page'] )), 'L_GOTO_PAGE' => $lang['Goto_page']) ); ##### end last topics ##### // Start Main Part and Footer $template->pparse('body'; include($phpbb_root_path . 'includes/page_tail.'.$phpEx); // End Main Part and Footer ?>
|