我不知道我該如何描述\r
安裝的外掛如下:
線上人數限制\r
TOP5熱門話題
防止灌水註冊
人氣指數外掛
enterwin看板\r
票選系統管理
系統為下列所示:
WindowsXP Pro SP2
Apache Web Server Version 1.3.31
PHP Script Language Version 4.3.8
MySQL Database Version 4.0.20
Appserv 2.4.1
結果我在一切程式都安裝並覺得應該無誤後
使用了帳號登入論壇
發現最底下的那個正在瀏覽此區的會員均處在沒有的狀態
而線上人員統計也出了錯\r
能不能請各位高手告訴我
我應該要去哪修正這個錯誤?
我有找過index_body.tpl、overall_header.tpl
可是我不了解它的連結狀況
意思就是說裡頭的人數顯示統計不知道是哪個檔連過來的
所以根本無計可施\r
(我的php能力很弱>"<僅會使用html語法來修改)
能否請示各高手幫我解決這個問題
如不了解我在說什麼\r
請勞駕你轉到我的站內\r
http://starfox.pcadsl.net/
註冊test帳號試試看
看登入後 底下的人數顯示是不是有反應
ps:測試的註冊帳號煩請註明是測試用的
拜託拜託…我真的搞不定 >"< 很急\r
謝謝大家了
[問題]關於aqua人數顯示的問題
版主: 版主管理群
-
starfox0307
- 星球公民

- 文章: 43
- 註冊時間: 2004-12-07 23:18
[討論]你一語就說中了我的痛 >"<
嗚嗚嗚
我才剛要說這個問題而已\r
你就發現了 >"<
我也是剛剛才發現有這個問題存在\r
正想發問說\r
不知道這又是怎麼一回事
不過我只是試著更動enterwin公告的程式碼\r
(原始資料是要我加入以下程式碼於index.php內)
'ENTERWIN_LINKS' => '<a href="' . append_sid("viewforum.$phpEx?f=1") . '">', $lang['enterwin_links'], '</a>'),
可是我比對了一下index.php其它類似格式
發現上方程式碼好像有錯誤
於是自己再補一段程式碼進去測試\r
'ENTERWIN_LINKS' => sprintf($lang['Enterwin_links'], '<a href="' . append_sid("viewforum.$phpEx?f=1") . '">', $lang['enterwin_links'], '</a>'),
(紅色字為我補進的程式碼)
結果就變成登入條不會消失了 >"<
http://www.phpbb-tw.net/phpbb/viewtopic ... t=enterwin
這是原文出處
下面是我的index_body.tpl內容
再來是我的index.php
還有我的overall_header.tpl
我有試著去用原檔來替換測試
發現我的人數顯示的問題是出現在index.php內\r
可是登入條我就不知道要怎麼修正這個錯誤了
>"< 搞的頭好痛
拜託大家再幫我找找\r
謝謝…謝謝…
我才剛要說這個問題而已\r
你就發現了 >"<
我也是剛剛才發現有這個問題存在\r
正想發問說\r
不知道這又是怎麼一回事
不過我只是試著更動enterwin公告的程式碼\r
(原始資料是要我加入以下程式碼於index.php內)
'ENTERWIN_LINKS' => '<a href="' . append_sid("viewforum.$phpEx?f=1") . '">', $lang['enterwin_links'], '</a>'),
可是我比對了一下index.php其它類似格式
發現上方程式碼好像有錯誤
於是自己再補一段程式碼進去測試\r
'ENTERWIN_LINKS' => sprintf($lang['Enterwin_links'], '<a href="' . append_sid("viewforum.$phpEx?f=1") . '">', $lang['enterwin_links'], '</a>'),
(紅色字為我補進的程式碼)
結果就變成登入條不會消失了 >"<
http://www.phpbb-tw.net/phpbb/viewtopic ... t=enterwin
這是原文出處
下面是我的index_body.tpl內容
代碼: 選擇全部
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20%">
<span class="nav"><a href="{U_INDEX}" class="nav">{L_INDEX}</a></span>
</td>
<td width="80%" align="right">
<img src="templates/aqua/images/aqua_button01.gif" align="absmiddle">
<span class="gensmall">
<!-- BEGIN switch_user_logged_in -->
<a href="{U_SEARCH_NEW}" class="gensmall">{L_SEARCH_NEW}</a>
<a href="{U_SEARCH_SELF}" class="gensmall">{L_SEARCH_SELF}</a>
<!-- END switch_user_logged_in -->
<a href="{U_SEARCH_UNANSWERED}" class="gensmall">{L_SEARCH_UNANSWERED}</a>
<a href="{U_MARK_READ}" class="gensmall">{L_MARK_FORUMS_READ}</a>
</span>
</td>
</tr>
</table>
<table width="90%" align="center" cellpadding="1" cellspacing="1" border="0" class="forumline">
<!-- 公告條形式1開始 //-->
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td width="22" height="22" align="left"><img src="templates/aqua/images/aquatbl.gif" width="22" height="22"></td>
<td height="22" align="center" background="templates/aqua/images/aquatbm.gif"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">論 壇 公 告 系 統</a></span></td>
<td width="79" height="22" align="right"><img src="templates/aqua/images/aquatbr.gif" width="79" height="22"></td>
</tr>
</table>
<!-- 公告條形式1結束 //-->
<table width="90%" cellpadding="0" cellspacing="1" border="0" class="forumline" align="center">
<tr>
<td class="row1">{ENTERWIN}</a>
</tr>
<tr>
<td class="row2" align="center">{ENTERWIN_LINKS}</td>
</tr>
</table>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20" height="22"><img src="templates/aqua/images/aquatbdl.gif" width="20" height="22"></td>
<td background="templates/aqua/images/aquatbdm.gif"><img src="templates/aqua/images/aquatbdm.gif" width="1" height="22"></td>
<td width="20" height="22"><img src="templates/aqua/images/aquatbdr.gif" width="20" height="22"></td>
</tr>
</table>
<table width="90%" cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td height="18" valign="top"><span class="nav">{nav_links}</span></td>
</tr>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td width="22" height="22" align="left"><img src="templates/aqua/images/aquatbl.gif" width="22" height="22"></td>
<td height="22" align="center" background="templates/aqua/images/aquatbm.gif"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">熱 烘 烘 <font color=red>TOP5</font> 新 話 題</a></span></td>
<td width="79" height="22" align="right"><img src="templates/aqua/images/aquatbr.gif" width="79" height="22"></td>
</tr>
</table>
<tr>
<td valign="top" align="center">
<table width="90%" border="0" cellpadding="4" cellspacing="0" width="100%" class="forumline" align="center">
<tr>
<th align="center" class="thCornerL" width="11%"> {L_FORUM} </th>
<th align="center" class="thTop"> {L_TOPICS} </th>
<th align="center" class="thTop" nowrap width="13%"> {L_AUTHOR} </th>
<th align="center" class="thTop" nowrap width="4%"> {L_REPLIES} </th>
<th align="center" class="thTop" nowrap width="4%"> {L_VIEWS} </th>
<th align="center" class="thCornerR" nowrap width="28%"> {L_LASTPOST} </th>
</tr>
<!-- BEGIN toprow -->
<tr>
<td class="row1" nowrap align="center"><span class="forumlink"><a href="{toprow.forum_url}" target="_top" class="forumlink">{toprow.forum_name}</a></span></td>
<td class="row2" nowrap><span class="topictitle"><a href="{toprow.topic_url}" target="_top" class="topictitle">{toprow.topic}</a></span></td>
<td class="row1" align="center" nowrap><span class="name">{toprow.poster_url}</span></td>
<td class="row2" align="center" nowrap><span class="postdetails">{toprow.topic_replies}</span></td>
<td class="row1" align="center" nowrap><span class="postdetails">{toprow.topic_views}</span></td>
<td class="row2" align="center" nowrap><span class="postdetails">{toprow.post_time} {toprow.replier_url} <a href="{toprow.last_post_url}" target="_top"><img src="{icon_url}" border="0" alt="{icon_alt}" /></a></span></td>
</tr>
<!-- END toprow -->
</table>
</td>
</tr>
</table>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20" height="22"><img src="templates/aqua/images/aquatbdl.gif" width="20" height="22"></td>
<td background="templates/aqua/images/aquatbdm.gif"><img src="templates/aqua/images/aquatbdm.gif" width="1" height="22"></td>
<td width="20" height="22"><img src="templates/aqua/images/aquatbdr.gif" width="20" height="22"></td>
</tr>
</table>
<p>
<!-- BEGIN catrow -->
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr align="center">
<td width="22" height="22" align="left"><img src="templates/aqua/images/aquatbl.gif" width="22" height="22"></td>
<td height="22" align="center" background="templates/aqua/images/aquatbm.gif"><span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span></td>
<td width="79" height="22" align="right"><img src="templates/aqua/images/aquatbr.gif" width="79" height="22"></td>
</tr>
</table>
<table width="90%" border="0" align="center" cellpadding="2" cellspacing="0" class="forumline">
<tr>
<th height="22" colspan="2" align="left" nowrap="nowrap"> {L_FORUM} </th>
<th width="50" height="22" nowrap="nowrap"> {L_TOPICS} </th>
<th width="50" height="22" nowrap="nowrap"> {L_POSTS} </th>
<th width="130" height="22" nowrap="nowrap"> {L_LASTPOST} </th>
</tr>
<!-- BEGIN forumrow -->
<tr>
<td class="row2" align="center" valign="middle" height="50"><img src="{catrow.forumrow.FORUM_FOLDER_IMG}" alt="{catrow.forumrow.L_FORUM_FOLDER_ALT}" title="{catrow.forumrow.L_FORUM_FOLDER_ALT}" /></td>
<td class="row2" width="100%" height="50"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br />
</span><span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
</span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.POSTS}</span></td>
<td width="200" height="50" align="center" valign="middle" nowrap="nowrap" class="row2"><span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>
</tr>
<!-- END forumrow -->
</table>
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20" height="22"><img src="templates/aqua/images/aquatbdl.gif" width="20" height="22"></td>
<td background="templates/aqua/images/aquatbdm.gif"><img src="templates/aqua/images/aquatbdm.gif" width="1" height="22"></td>
<td width="20" height="22"><img src="templates/aqua/images/aquatbdr.gif" width="20" height="22"></td>
</tr>
</table>
<br />
<!-- END catrow -->
<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="10"><img src="templates/aqua/images/aquawul.gif"></td>
<td background="templates/aqua/images/aquawum.gif"></td>
<td width="10"><img src="templates/aqua/images/aquawur.gif"></td>
</tr>
<tr>
<td width="10" background="templates/aqua/images/aquawml.gif"></td>
<td background="templates/aqua/images/aquawmm.gif"><p><a href="{U_VIEWONLINE}"><img src="templates/aqua/images/whosonline.gif" alt="{L_WHO_IS_ONLINE}" border="0" /></a></p>
<blockquote><p>
<span class="gensmall">{S_TIMEZONE}</span><br />
<!-- BEGIN switch_user_logged_in -->
<span class="gensmall">{LAST_VISIT_DATE}</span><br />
<!-- END switch_user_logged_in -->
<span class="gensmall">{CURRENT_TIME}</span><br />
<!-- 人數顯示控制碼開始 //-->
<span class="gensmall">{TOTAL_POSTS}<br />
{TOTAL_USERS}<br />
{NEWEST_USER}<br />
{TOTAL_USERS_ONLINE} [ {L_WHOSONLINE_ADMIN} ] [ {L_WHOSONLINE_MOD} ]<br />
{RECORD_USERS}<br />
{LOGGED_IN_USER_LIST}<br />
{L_ONLINE_EXPLAIN}
</span>
<!-- 人數顯示控制碼結束 //-->
</p></blockquote></td>
<td width="10" background="templates/aqua/images/aquawmr.gif"></td>
</tr>
<tr>
<td width="10"><img src="templates/aqua/images/aquawdl.gif"></td>
<td background="templates/aqua/images/aquawdm.gif"></td>
<td width="10"><img src="templates/aqua/images/aquawdr.gif"></td>
</tr>
</table>
<br clear="all" />
<!-- 使用者登錄系統開始 -->
<div align="center">
<div style="width:90%">
<form method="post" action="{S_LOGIN_ACTION}">
<table width="90%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20"><img src="templates/aqua/images/loingl.gif"><a name="login"></a></td>
<td align="center" background="templates/aqua/images/loingm.gif"><span class="cattitle">{L_LOGIN_LOGOUT}</span><br>
<span class="gensmall">{L_USERNAME}: <input class="post" type="text" name="username" size="10" />
{L_PASSWORD}: <input class="post" type="password" name="password" size="10" maxlength="32" />
\n {L_AUTO_LOGIN} <input class="text" type="checkbox" name="autologin" />
<input type="submit" class="mainoption" name="login" value="{L_LOGIN}" />
</span></td>
<td width="20" align="right"><img src="templates/aqua/images/loingr.gif"></td>
</tr>
</table>
</form></div>
</div>
<!-- 使用者登錄系統結束 -->
<table border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<td align="center"><img src="templates/aqua/images/folder_new_big.gif" alt="{L_NEW_POSTS}"/></td>
<td align="center"><img src="templates/aqua/images/folder_big.gif" alt="{L_NO_NEW_POSTS}" /></td>
<td align="center"><img src="templates/aqua/images/folder_locked_big.gif" alt="{L_FORUM_LOCKED}"/></td>
</tr>
<tr>
<td align="center"><span class="gensmall">{L_NEW_POSTS}</span></td>
<td align="center"><span class="gensmall">{L_NO_NEW_POSTS}</span></td>
<td align="center"><span class="gensmall">{L_FORUM_LOCKED}</span></td>
</tr>
</table>
代碼: 選擇全部
<?php
/***************************************************************************
* index.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: index.php,v 1.99.2.3 2004/07/11 16:46:15 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" => '<meta http-equiv="refresh" content="3;url=' .append_sid("index.$phpEx") . '">')
);
$message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a> ');
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( $category_rows[] = $db->sql_fetchrow($result) );
$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 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['No_forums']);
}
//
// Obtain a list of topic ids which contain
// posts made since user last visited
//
if ( $userdata['session_logged_in'] )
{
$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['user_lastvisit'] . "
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['forum_id']][$topic_data['topic_id']] = $topic_data['post_time'];
}
$db->sql_freeresult($result);
}
//
// Obtain list of moderators of each forum
// First users, then groups ... broken into two queries
//
$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[$row['forum_id']][] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</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[$row['forum_id']][] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
}
$db->sql_freeresult($result);
//
// Find which forums are visible for this user
//
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);
//
// Integrated Top5 V3 by bu Based on OOHOO's ADV-TOP5 (20041202)
//
// This work is licensed under the Creative Commons Attribution-ShareAlike License.
// To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/
//
// MOD START
// Topics text length
$MAX_STR_LEN = 60;
// Topics to display
$MAX_TOPICS = 5;
// 0 => users can see all topics including authorized issue(but they cant read the posts)
// 1 => users can see only authorized topics
$AUTH_SECRUITY = 1;
// Order by
// topic_last_post_id (Default)
// topic_replies
// topic_views
$sortby="topic_last_post_id";
function cutStr($str) {
global $MAX_STR_LEN;
$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
return $str;
}
// Find which forums are visible for this user
$is_auth_ary_top5 = array();
$is_auth_ary_top5 = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
$auth_forum_ary_top5 = array();
// Get forum info
$sql = "SELECT forum_id FROM " . FORUMS_TABLE;
if( !$q_forums = $db->sql_query($sql) )
{
message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD ERROR!!');
}
// Authorized forums info
while( $forum_row = $db->sql_fetchrow($q_forums) )
{
$forum_id = $forum_row['forum_id'];
if( $is_auth_ary_top5[$forum_id]['auth_read'] == 1)
{
array_push($auth_forum_ary_top5, $forum_id);
}
}
if( sizeOf($auth_forum_ary_top5) == 0 || !$AUTH_SECRUITY )
{
$auth_forums_top5 = "";
}
else
{
$auth_forums_top5 = 'AND f.forum_id IN(';
if(sizeOf($auth_forum_ary_top5) > 1)
{
$auth_forums_top5 .= implode (',', $auth_forum_ary_top5);
}
else
{
$auth_forums_top5 .= $auth_forum_ary_top5[0];
}
$auth_forums_top5 .= ')';
}
// query
$sql = "SELECT topic_id, topic_title, topic_poster, topic_views, topic_replies, topic_last_post_id, f.forum_id, forum_name
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.forum_id = f.forum_id
AND topic_moved_id = '0'
$auth_forums_top5
ORDER BY $sortby DESC LIMIT 0, $MAX_TOPICS";
if( !$result = $db->sql_query($sql) )
{
echo '<p align="center"><font color="red"><b>ADV_TOPN_MOD TOPICS QUERY ERROR!!</b></font></p>';
exit;
}
// fetch rows
while( $rows = $db->sql_fetchrow($result) )
{
$topic_url = append_sid("viewtopic.$phpEx?t=" . $rows['topic_id']);
$forum_url = append_sid("viewforum.$phpEx?f=" . $rows['forum_id']);
$topic_poster = $rows['topic_poster'];
$topic_last_post_id = $rows['topic_last_post_id'];
// Grab topic poster and last replier data
$sql = "SELECT post_username, user_id, username
FROM " . POSTS_TABLE . ", " . USERS_TABLE . "
WHERE topic_id = '" . $rows['topic_id'] . "'
AND poster_id = user_id
ORDER BY post_id LIMIT 0, 1";
if( !$p_result = $db->sql_query($sql) )
{
message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD TOPIC_POSTER QUERY ERROR!!');
}
$p_row = $db->sql_fetchrow($p_result);
$poster_name = ( $topic_poster != ANONYMOUS ) ? $p_row['username'] : ( !$p_row['post_username'] ? $lang['Guest'] : $p_row['post_username']);
$poster_url = ( $topic_poster != ANONYMOUS && !$p_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$topic_poster") . '" target="_top">' . "$poster_name</a>") : $poster_name;
$sql = "SELECT post_username, user_id, username, post_time
FROM " . POSTS_TABLE . ", " . USERS_TABLE . "
WHERE post_id = '$topic_last_post_id'
AND poster_id = user_id";
if( !$r_result = $db->sql_query($sql) )
{
message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD LAST_REPLIER QUERY ERROR!!');
}
$r_row = $db->sql_fetchrow($r_result);
$replier_id = $r_row['user_id'];
$replier_name = ( $replier_id != ANONYMOUS ) ? $r_row['username'] : ( !$r_row['post_username'] ? $lang['Guest'] : $r_row['post_username']);
$replier_url = ( $replier_id != ANONYMOUS && !$r_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$replier_id") . '" target="_top">' . "$replier_name</a>") : $replier_name;
$last_post_url = append_sid("viewtopic.$phpEx?p=$topic_last_post_id#$topic_last_post_id");
$template->assign_block_vars("toprow", array(
"forum_name" => $rows['forum_name'],
"forum_url" => $forum_url,
"topic" => cutStr($rows['topic_title']),
"topic_url" => $topic_url,
"topic_views" => $rows['topic_views'],
"topic_replies" => $rows['topic_replies'],
"post_time" => create_date($board_config['default_dateformat'], $r_row['post_time'], $board_config['board_timezone']),
"poster_url" => $poster_url,
"replier_url" => $replier_url,
"last_post_url" => $last_post_url
));
}
// MOD END
//
// Integrated Top5 V3 by bu Based on OOHOO's ADV-TOP5 (20041202)
//
//
// Start output of page
//
define('SHOW_ONLINE', true);
$page_title = $lang['Index'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'index_body.tpl',
'enterwin' => 'enterwin_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['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
'ENTERWIN_LINKS' => [color=red]sprintf($lang['Enterwin_links'],[/color]'<a href="' . append_sid("viewforum.$phpEx?f=1") . '">', $lang['enterwin_links'], '</a>'),
'FORUM_IMG' => $images['forum'],
'FORUM_NEW_IMG' => $images['forum_new'],
'FORUM_LOCKED_IMG' => $images['forum_locked'],
'L_FORUM' => $lang['Forum'],
'L_TOPICS' => $lang['Topics'],
'L_REPLIES' => $lang['Replies'],
'L_VIEWS' => $lang['Views'],
'L_POSTS' => $lang['Posts'],
'icon_url' => $images['icon_latest_reply'],
'icon_alt' => $lang['View_latest_post'],
'L_AUTHOR' => $lang['Author'],
'L_LASTPOST' => $lang['Last_Post'],
'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_ONLINE_EXPLAIN' => $lang['Online_explain'],
'L_MODERATOR' => $lang['Moderators'],
'L_FORUM_LOCKED' => $lang['Forum_is_locked'],
'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'],
'U_MARK_READ' => append_sid("index.$phpEx?mark=forums"))
);
$template->assign_var_from_handle('ENTERWIN', 'enterwin');
//
// Okay, let's build the index
//
for($i = 0; $i < $total_categories; $i++)
{
$cat_id = $category_rows[$i]['cat_id'];
//
// Should we display this category/forum set?
//
$display_forums = false;
for($j = 0; $j < $total_forums; $j++)
{
if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'] && $forum_data[$j]['cat_id'] == $cat_id )
{
$display_forums = true;
}
}
//
// Yes, we should, so first dump out the category
// title, then, if appropriate the forum list
//
if ( $display_forums )
{
$template->assign_block_vars('catrow', array(
'CAT_ID' => $cat_id,
'CAT_DESC' => $category_rows[$i]['cat_title'],
'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[$j]['cat_id'] == $cat_id )
{
$forum_id = $forum_data[$j]['forum_id'];
if ( $is_auth_ary[$forum_id]['auth_view'] )
{
if ( $forum_data[$j]['forum_status'] == FORUM_LOCKED )
{
$folder_image = $images['forum_locked'];
$folder_alt = $lang['Forum_locked'];
}
else
{
$unread_topics = false;
if ( $userdata['session_logged_in'] )
{
if ( !empty($new_topic_data[$forum_id]) )
{
$forum_last_post_time = 0;
while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) )
{
if ( empty($tracking_topics[$check_topic_id]) )
{
$unread_topics = true;
$forum_last_post_time = max($check_post_time, $forum_last_post_time);
}
else
{
if ( $tracking_topics[$check_topic_id] < $check_post_time )
{
$unread_topics = true;
$forum_last_post_time = max($check_post_time, $forum_last_post_time);
}
}
}
if ( !empty($tracking_forums[$forum_id]) )
{
if ( $tracking_forums[$forum_id] > $forum_last_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'] > $forum_last_post_time )
{
$unread_topics = false;
}
}
}
}
$folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum'];
$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts'];
}
$posts = $forum_data[$j]['forum_posts'];
$topics = $forum_data[$j]['forum_topics'];
if ( $forum_data[$j]['forum_last_post_id'] )
{
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
$last_post = $last_post_time . '<br />';
$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> ';
$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>';
}
else
{
$last_post = $lang['No_Posts'];
}
if ( count($forum_moderators[$forum_id]) > 0 )
{
$l_moderators = ( count($forum_moderators[$forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
$moderator_list = implode(', ', $forum_moderators[$forum_id]);
}
else
{
$l_moderators = ' ';
$moderator_list = ' ';
}
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('catrow.forumrow', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'FORUM_FOLDER_IMG' => $folder_image,
'FORUM_NAME' => $forum_data[$j]['forum_name'],
'FORUM_DESC' => $forum_data[$j]['forum_desc'],
'POSTS' => $forum_data[$j]['forum_posts'],
'TOPICS' => $forum_data[$j]['forum_topics'],
'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"))
);
}
}
}
}
}
} // for ... categories
}// if ... total_categories
else
{
message_die(GENERAL_MESSAGE, $lang['No_forums']);
}
//
// Generate the page
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
代碼: 選擇全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html dir="{S_CONTENT_DIRECTION}">
<head>
<meta http-equiv="Content-Type" content="text/html; charset={S_CONTENT_ENCODING}">
<meta http-equiv="Content-Style-Type" content="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
{META}
{NAV_LINKS}
<title>{SITENAME} {PAGE_TITLE}</title>
<link rel="stylesheet" href="templates/aqua/{T_HEAD_STYLESHEET}" type="text/css" />
<style type="text/css">
<!--
TH { background-image: url(templates/aqua/images/{T_TH_CLASS2}) }
TD.rowpic { background-image: url(templates/aqua/images/{T_TH_CLASS3}); background-repeat: repeat-y }
TD.cat, TD.catHead,TD.catSides,TD.catLeft,TD.catRight,TD.catBottom { background-image: url(templates/aqua/images/{T_TH_CLASS1}) }
body {
background-color: #FFFFFF;
background-image: url(templates/aqua/images/background1.gif);
background-attachment : fixed;
}
-->
</style>
<!-- BEGIN switch_enable_pm_popup -->
<script language="Javascript" type="text/javascript">
<!--
if ( {PRIVATE_MESSAGE_NEW_FLAG} )
{
window.open('{U_PRIVATEMSGS_POPUP}', '_phpbbprivmsg', 'HEIGHT=225,resizable=yes,WIDTH=400');;
}
//-->
</script>
<!-- END switch_enable_pm_popup -->
</head>
<body text="{T_BODY_TEXT}" link="{T_BODY_LINK}" vlink="{T_BODY_VLINK}">
<div id="Layer1" style="position:absolute; left:0px; top:0px; width:80px; height:60px; z-index:1">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="80" height="60" id="ball" align="middle">
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="templates/aqua/images/ball.swf" />
<param name="quality" value="high" />
<param name="wmode" value="transparent" />
<param name="bgcolor" value="#ffffff" />
<embed src="templates/aqua/images/ball.swf" quality="high" wmode="transparent" bgcolor="#ffffff" width="80" height="60" name="ball" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="templates/aqua/images/aqua_bg02.gif">
<tr>
<td align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><a href="{U_INDEX}" class="aquamenu"><img src="templates/aqua/images/obj_head.jpg" alt="{SITENAME}" width="330" height="51" border="0"></a></td>
<td align="center"><a name="top"></a><span class="loslogosbig">{SITENAME}</span><br /><span class="loslogos">{SITE_DESCRIPTION}</span></td>
<td align="right"><a href="{U_INDEX}" class="aquamenu"><img src="templates/aqua/images/obj_head1.jpg" alt="{SITENAME}" width="330" height="51" border="0"></a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td background="templates/aqua/images/obj_menu_01.gif" align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="6"><img src="templates/aqua/images/obj_menu_02.gif" width="6" height="22"></td>
<td><img src="templates/aqua/images/icon_mini.gif" width="12" height="12" border="0" alt="{L_FAQ}" hspace="3" align="absmiddle" /><span class="aquamenu"><a href=/race/race.php class="aquamenu">賽馬遊戲</a></a> </span></td>
<td width="6"><img src="templates/aqua/images/obj_menu_02.gif" width="6" height="22"></td>
<td><span class="aquamenu"><a href="{U_FAQ}" class="aquamenu"><img src="templates/aqua/images/icon_mini.gif" width="12" height="12" border="0" alt="{L_FAQ}" hspace="3" align="absmiddle" />{L_FAQ}</a> </span></td>
<td width="6"><img src="templates/aqua/images/obj_menu_02.gif" width="6" height="22"></td>
<td><span class="aquamenu"><a href="{U_SEARCH}" class="aquamenu"><img src="templates/aqua/images/icon_mini.gif" width="12" height="12" border="0" alt="{L_SEARCH}" hspace="3" align="absmiddle" />{L_SEARCH}</a> </span></td>
<!-- BEGIN switch_user_logged_out -->
<td width="6"><img src="templates/aqua/images/obj_menu_02.gif" width="6" height="22"></td>
<td><span class="aquamenu"><a href="{U_REGISTER}" class="aquamenu"><img src="templates/aqua/images/icon_mini.gif" width="12" height="12" border="0" alt="{L_REGISTER}" hspace="3" align="absmiddle" />{L_REGISTER}</a> </span></td>
<!-- END switch_user_logged_out -->
<td width="6"><img src="templates/aqua/images/obj_menu_02.gif" width="6" height="22"></td>
<td><span class="aquamenu"><a href="{U_PROFILE}" class="aquamenu"><img src="templates/aqua/images/icon_mini.gif" width="12" height="12" border="0" alt="{L_PROFILE}" hspace="3" align="absmiddle" />{L_PROFILE}</a> </span></td>
<td width="6"><img src="templates/aqua/images/obj_menu_02.gif" width="6" height="22"></td>
<td><span class="aquamenu"><a href="{U_MEMBERLIST}" class="aquamenu"><img src="templates/aqua/images/icon_mini.gif" width="12" height="12" border="0" alt="{L_MEMBERLIST}" hspace="3" align="absmiddle" />{L_MEMBERLIST}</a> </span></td>
<td width="6"><img src="templates/aqua/images/obj_menu_02.gif" width="6" height="22"></td>
<td><span class="aquamenu"><a href="{U_GROUP_CP}" class="aquamenu"><img src="templates/aqua/images/icon_mini.gif" width="12" height="12" border="0" alt="{L_USERGROUPS}" hspace="3" align="absmiddle" />{L_USERGROUPS}</a> </span></td>
<td width="6"><img src="templates/aqua/images/obj_menu_02.gif" width="6" height="22"></td>
<td><span class="aquamenu"><a href="{U_PRIVATEMSGS}" class="aquamenu"><img src="templates//aqua/images/icon_mini.gif" width="12" height="12" border="0" alt="{PRIVATE_MESSAGE_INFO}" hspace="3" align="absmiddle" />{PRIVATE_MESSAGE_INFO}</a> </span></td>
<td width="6"><img src="templates/aqua/images/obj_menu_02.gif" width="6" height="22"></td>
<td><span class="aquamenu"><a href="{U_LOGIN_LOGOUT}" class="aquamenu"><img src="templates//aqua/images/icon_mini.gif" width="12" height="12" border="0" alt="{L_LOGIN_LOGOUT}" hspace="3" align="absmiddle" />{L_LOGIN_LOGOUT}</a> </span></td>
<td width="6"><img src="templates/aqua/images/obj_menu_02.gif" width="6" height="22"></td>
</tr>
</table>
</td>
</tr>
</table>
</br>
發現我的人數顯示的問題是出現在index.php內\r
可是登入條我就不知道要怎麼修正這個錯誤了
>"< 搞的頭好痛
拜託大家再幫我找找\r
謝謝…謝謝…
最後由 starfox0307 於 2004-12-10 09:53 編輯,總共編輯了 1 次。
-
starfox0307
- 星球公民

- 文章: 43
- 註冊時間: 2004-12-07 23:18
[討論]我已聽從上面那位大大的建議
聽從上面那位大大的建議
我已開通了一個test帳號
密碼也是test
希望大家可以幫我找出問題點所在\r
我已經試到快崩潰了
>"<
感激不盡了
我已開通了一個test帳號
密碼也是test
希望大家可以幫我找出問題點所在\r
我已經試到快崩潰了
>"<
感激不盡了
-
starfox0307
- 星球公民

- 文章: 43
- 註冊時間: 2004-12-07 23:18
[問題]@@" 就這麼簡單??
請問一下上面的大大
<!-- xxxx --> ←這個符號不是註解嗎?
照理說中間的xxxx應該不會被執行才對啊
怎麼我改掉中間的字之後
它就會出問題了??
真是奇怪啊~~~
總之 還是很感謝你
<(_ _)>
<!-- xxxx --> ←這個符號不是註解嗎?
照理說中間的xxxx應該不會被執行才對啊
怎麼我改掉中間的字之後
它就會出問題了??
真是奇怪啊~~~
總之 還是很感謝你
<(_ _)>
-
starfox0307
- 星球公民

- 文章: 43
- 註冊時間: 2004-12-07 23:18
[問題]忘了再問
那麼請問我的人數顯示的問題是要在哪解決呢?
目前的登錄條已經解決
請指點迷津給小弟吧
感謝 <(_ _)>
目前的登錄條已經解決
請指點迷津給小弟吧
感謝 <(_ _)>
-
starfox0307
- 星球公民

- 文章: 43
- 註冊時間: 2004-12-07 23:18
[討論]問題已慢慢明朗化
目前正交叉執行程式
似乎在index.php部份的top5話題系統有點出錯\r
正逐步反向操作並測試中
感謝大大的回覆
我再繼續努力
如果再遇到問題
還請各大大們不吝指教
謝謝囉
似乎在index.php部份的top5話題系統有點出錯\r
正逐步反向操作並測試中
感謝大大的回覆
我再繼續努力
如果再遇到問題
還請各大大們不吝指教
謝謝囉
-
starfox0307
- 星球公民

- 文章: 43
- 註冊時間: 2004-12-07 23:18
[討論]找到問題點了
我找到問題點了
可是\r
我沒辦法解決
還是上來向大家請益了
以下是我的index.php後來搬新的檔覆蓋原檔
然後執行 TOP5 V3 的安裝
我只要新增紅色段進去\r
人數顯示就動不了了
我有查過竹貓的文章
似乎也有人遇到跟我一樣的問題
不過都沒人能解決\r
所以\r
我還是上來再請教一次大家\r
這個問題應該要怎麼解決?
還是只有放棄一途?
可是\r
我沒辦法解決
還是上來向大家請益了
以下是我的index.php後來搬新的檔覆蓋原檔
然後執行 TOP5 V3 的安裝
我只要新增紅色段進去\r
人數顯示就動不了了
代碼: 選擇全部
<?php
/***************************************************************************
* index.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: index.php,v 1.99.2.3 2004/07/11 16:46:15 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" => '<meta http-equiv="refresh" content="3;url=' .append_sid("index.$phpEx") . '">')
);
$message = $lang['Forums_marked_read'] . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . append_sid("index.$phpEx") . '">', '</a> ');
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( $category_rows[] = $db->sql_fetchrow($result) );
$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 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['No_forums']);
}
//
// Obtain a list of topic ids which contain
// posts made since user last visited
//
if ( $userdata['session_logged_in'] )
{
$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['user_lastvisit'] . "
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['forum_id']][$topic_data['topic_id']] = $topic_data['post_time'];
}
$db->sql_freeresult($result);
}
//
// Obtain list of moderators of each forum
// First users, then groups ... broken into two queries
//
$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[$row['forum_id']][] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</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[$row['forum_id']][] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
}
$db->sql_freeresult($result);
//
// Find which forums are visible for this user
//
$is_auth_ary = array();
$is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $forum_data);
[color=red] // TOP5 最新話題開始
//
// Integrated Top5 V3 by bu Based on OOHOO's ADV-TOP5 (20041202)
//
// This work is licensed under the Creative Commons Attribution-ShareAlike License.
// To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/2.0/
//
// MOD START
// Topics text length
$MAX_STR_LEN = 60;
// Topics to display
$MAX_TOPICS = 5;
// 0 => users can see all topics including authorized issue(but they cant read the posts)
// 1 => users can see only authorized topics
$AUTH_SECRUITY = 1;
// Order by
// topic_last_post_id (Default)
// topic_replies
// topic_views
$sortby="topic_last_post_id";
function cutStr($str) {
global $MAX_STR_LEN;
$str = (strlen($str) > $MAX_STR_LEN) ? (substr($str, 0, $MAX_STR_LEN - 1) . "...") : $str;
return $str;
}
// Find which forums are visible for this user
$is_auth_ary_top5 = array();
$is_auth_ary_top5 = auth(AUTH_READ, AUTH_LIST_ALL, $userdata);
$auth_forum_ary_top5 = array();
// Get forum info
$sql = "SELECT forum_id FROM " . FORUMS_TABLE;
if( !$q_forums = $db->sql_query($sql) )
{
message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD ERROR!!');
}
// Authorized forums info
while( $forum_row = $db->sql_fetchrow($q_forums) )
{
$forum_id = $forum_row['forum_id'];
if( $is_auth_ary_top5[$forum_id]['auth_read'] == 1)
{
array_push($auth_forum_ary_top5, $forum_id);
}
}
if( sizeOf($auth_forum_ary_top5) == 0 || !$AUTH_SECRUITY )
{
$auth_forums_top5 = "";
}
else
{
$auth_forums_top5 = 'AND f.forum_id IN(';
if(sizeOf($auth_forum_ary_top5) > 1)
{
$auth_forums_top5 .= implode (',', $auth_forum_ary_top5);
}
else
{
$auth_forums_top5 .= $auth_forum_ary_top5[0];
}
$auth_forums_top5 .= ')';
}
// query
$sql = "SELECT topic_id, topic_title, topic_poster, topic_views, topic_replies, topic_last_post_id, f.forum_id, forum_name
FROM " . TOPICS_TABLE . " t, " . FORUMS_TABLE . " f
WHERE t.forum_id = f.forum_id
AND topic_moved_id = '0'
$auth_forums_top5
ORDER BY $sortby DESC LIMIT 0, $MAX_TOPICS";
if( !$result = $db->sql_query($sql) )
{
echo '<p align="center"><font color="red"><b>ADV_TOPN_MOD TOPICS QUERY ERROR!!</b></font></p>';
exit;
}
// fetch rows
while( $rows = $db->sql_fetchrow($result) )
{
$topic_url = append_sid("viewtopic.$phpEx?t=" . $rows['topic_id']);
$forum_url = append_sid("viewforum.$phpEx?f=" . $rows['forum_id']);
$topic_poster = $rows['topic_poster'];
$topic_last_post_id = $rows['topic_last_post_id'];
// Grab topic poster and last replier data
$sql = "SELECT post_username, user_id, username
FROM " . POSTS_TABLE . ", " . USERS_TABLE . "
WHERE topic_id = '" . $rows['topic_id'] . "'
AND poster_id = user_id
ORDER BY post_id LIMIT 0, 1";
if( !$p_result = $db->sql_query($sql) )
{
message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD TOPIC_POSTER QUERY ERROR!!');
}
$p_row = $db->sql_fetchrow($p_result);
$poster_name = ( $topic_poster != ANONYMOUS ) ? $p_row['username'] : ( !$p_row['post_username'] ? $lang['Guest'] : $p_row['post_username']);
$poster_url = ( $topic_poster != ANONYMOUS && !$p_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$topic_poster") . '" target="_top">' . "$poster_name</a>") : $poster_name;
$sql = "SELECT post_username, user_id, username, post_time
FROM " . POSTS_TABLE . ", " . USERS_TABLE . "
WHERE post_id = '$topic_last_post_id'
AND poster_id = user_id";
if( !$r_result = $db->sql_query($sql) )
{
message_die(GENERAL_MESSAGE, 'ADV_TOP5 MOD LAST_REPLIER QUERY ERROR!!');
}
$r_row = $db->sql_fetchrow($r_result);
$replier_id = $r_row['user_id'];
$replier_name = ( $replier_id != ANONYMOUS ) ? $r_row['username'] : ( !$r_row['post_username'] ? $lang['Guest'] : $r_row['post_username']);
$replier_url = ( $replier_id != ANONYMOUS && !$r_row['post_username'] ) ? ('<a href="' . append_sid("profile.$phpEx?mode=viewprofile&u=$replier_id") . '" target="_top">' . "$replier_name</a>") : $replier_name;
$last_post_url = append_sid("viewtopic.$phpEx?p=$topic_last_post_id#$topic_last_post_id");
$template->assign_block_vars("toprow", array(
"forum_name" => $rows['forum_name'],
"forum_url" => $forum_url,
"topic" => cutStr($rows['topic_title']),
"topic_url" => $topic_url,
"topic_views" => $rows['topic_views'],
"topic_replies" => $rows['topic_replies'],
"post_time" => create_date($board_config['default_dateformat'], $r_row['post_time'], $board_config['board_timezone']),
"poster_url" => $poster_url,
"replier_url" => $replier_url,
"last_post_url" => $last_post_url
));
}
// MOD END
//
// Integrated Top5 V3 by bu Based on OOHOO's ADV-TOP5 (20041202)
//
// TOP5 最新話題結束 [/color]
//
// Start output of page
//
define('SHOW_ONLINE', true);
$page_title = $lang['Index'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array(
'body' => 'index_body.tpl',
'enterwin' => 'enterwin_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['Newest_user'], '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$newest_uid") . '">', $newest_user, '</a>'),
'ENTERWIN_LINKS' => sprintf($lang['Enterwin_links'], '<a href="' . append_sid("viewforum.$phpEx?f=1") . '">', $lang['enterwin_links'], '</a>'),
'FORUM_IMG' => $images['forum'],
'FORUM_NEW_IMG' => $images['forum_new'],
'FORUM_LOCKED_IMG' => $images['forum_locked'],
'L_FORUM' => $lang['Forum'],
'L_TOPICS' => $lang['Topics'],
'L_REPLIES' => $lang['Replies'],
'L_VIEWS' => $lang['Views'],
'L_POSTS' => $lang['Posts'],
// TOP5 程式段開始
'icon_url' => $images['icon_latest_reply'],
'icon_alt' => $lang['View_latest_post'],
'L_AUTHOR' => $lang['Author'],
// TOP5 程式段結束
'L_LASTPOST' => $lang['Last_Post'],
'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_ONLINE_EXPLAIN' => $lang['Online_explain'],
'L_MODERATOR' => $lang['Moderators'],
\n 'L_FORUM_LOCKED' => $lang['Forum_is_locked'],
'L_MARK_FORUMS_READ' => $lang['Mark_all_forums'],
'U_MARK_READ' => append_sid("index.$phpEx?mark=forums"))
);
$template->assign_var_from_handle('ENTERWIN', 'enterwin');
//
// Okay, let's build the index
//
for($i = 0; $i < $total_categories; $i++)
{
$cat_id = $category_rows[$i]['cat_id'];
//
// Should we display this category/forum set?
//
$display_forums = false;
for($j = 0; $j < $total_forums; $j++)
{
if ( $is_auth_ary[$forum_data[$j]['forum_id']]['auth_view'] && $forum_data[$j]['cat_id'] == $cat_id )
{
$display_forums = true;
}
}
//
// Yes, we should, so first dump out the category
// title, then, if appropriate the forum list
//
if ( $display_forums )
{
$template->assign_block_vars('catrow', array(
'CAT_ID' => $cat_id,
'CAT_DESC' => $category_rows[$i]['cat_title'],
'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[$j]['cat_id'] == $cat_id )
{
$forum_id = $forum_data[$j]['forum_id'];
if ( $is_auth_ary[$forum_id]['auth_view'] )
{
if ( $forum_data[$j]['forum_status'] == FORUM_LOCKED )
{
$folder_image = $images['forum_locked'];
$folder_alt = $lang['Forum_locked'];
}
else
{
$unread_topics = false;
if ( $userdata['session_logged_in'] )
{
if ( !empty($new_topic_data[$forum_id]) )
{
$forum_last_post_time = 0;
while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) )
{
if ( empty($tracking_topics[$check_topic_id]) )
{
$unread_topics = true;
$forum_last_post_time = max($check_post_time, $forum_last_post_time);
}
else
{
if ( $tracking_topics[$check_topic_id] < $check_post_time )
{
$unread_topics = true;
$forum_last_post_time = max($check_post_time, $forum_last_post_time);
}
}
}
if ( !empty($tracking_forums[$forum_id]) )
{
if ( $tracking_forums[$forum_id] > $forum_last_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'] > $forum_last_post_time )
{
$unread_topics = false;\r
}
}
}
}
$folder_image = ( $unread_topics ) ? $images['forum_new'] : $images['forum'];
$folder_alt = ( $unread_topics ) ? $lang['New_posts'] : $lang['No_new_posts'];
}
$posts = $forum_data[$j]['forum_posts'];
$topics = $forum_data[$j]['forum_topics'];
if ( $forum_data[$j]['forum_last_post_id'] )
{
$last_post_time = create_date($board_config['default_dateformat'], $forum_data[$j]['post_time'], $board_config['board_timezone']);
$last_post = $last_post_time . '<br />';
$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> ';
$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>';
}
else
{
$last_post = $lang['No_Posts'];
}
if ( count($forum_moderators[$forum_id]) > 0 )
{
$l_moderators = ( count($forum_moderators[$forum_id]) == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
$moderator_list = implode(', ', $forum_moderators[$forum_id]);
}
else
{
$l_moderators = ' ';
$moderator_list = ' ';
}
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
$template->assign_block_vars('catrow.forumrow', array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'FORUM_FOLDER_IMG' => $folder_image,
'FORUM_NAME' => $forum_data[$j]['forum_name'],
'FORUM_DESC' => $forum_data[$j]['forum_desc'],
'POSTS' => $forum_data[$j]['forum_posts'],
'TOPICS' => $forum_data[$j]['forum_topics'],
'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"))
);
}
}
}
}
}
} // for ... categories
}// if ... total_categories
else
{
message_die(GENERAL_MESSAGE, $lang['No_forums']);
}
//
// Generate the page
//
$template->pparse('body');
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
?>
似乎也有人遇到跟我一樣的問題
不過都沒人能解決\r
所以\r
我還是上來再請教一次大家\r
這個問題應該要怎麼解決?
還是只有放棄一途?


