[外掛]Last Visit Mod 1.2.5

MODs Released by Other phpbb Sites
非官方認證通過之 MOD ,或許有安全性之疑慮,所有問題由原發表者回覆!

版主: 版主管理群

主題已鎖定
頭像
godbless
竹貓忠實會員
竹貓忠實會員
文章: 647
註冊時間: 2002-05-17 06:02
來自: 台北市南京東路4段
聯繫:

[外掛]Last Visit Mod 1.2.5

文章 godbless »

這個模組可以讓論壇上的人清楚的看到今天的論壇人氣,同時也能夠讓論壇管理員清楚的藉由會員列表看到會員的再次拜訪狀況!
作者首頁:
http://mods.db9.dk
下載點:
http://mods.db9.dk/contrib/last_visit.zip
竹貓相關討論:
http://phpbb-tw.net/phpbb/viewtopic.php?t=10522

這個模組的安裝分為四個部分:
其中我也會附上我修正的部分在這邊!
第一部份:

[php]<?php
########################################################
## Mod Title: Last Visit Mod
## Mod Version: 1.2.5
## Author: Niels Chr. R鷣 Denmark < ncr@db9.dk > http://mods.db9.dk
##
## This mod is for phpBB2 ver 2.0.2
##
## Description: This mod will enable logning of the users last visit time,
## after this mod, users can see when another user have last visited
## the board, this is shown in the correspondings users profile.
## This mod support, user level and hidden users
## Admin will always be able to see other users last visit, regardless of the settings
## if board config is "off", then only admin can see the information
## if board is "on", then all users kan se other users last visit
## except hidden users, who will still be "hidden"
## This mod, will also display the number of reg/hidden and guest users today on the index page
##
##
##
## Installation Level: Easy
## Installation Time: 10-15 Minutes
## Files To Edit: 6
## language/subsilver/lang_main.php
## includes/usercp_viewprofile.php
## includes/sessions.php
## index.php
## templates/subsilver/index_body.tpl
## templates/subsilver/profile_view_body.tpl
## Include files: 1
## db_update.php
##
## History:
## 0.9.0. - initial BETA for RC-2
## 1.0.0. - initial release for RC-2
## 1.0.10. - History started, change in how timezones are handled
## 1.0.11. - corrected a typo in how timezones are handled
## 1.0.12. - corection to follow phpBB2 coding guidelines
## 1.0.13. - Now includes the number of users witch have visited the board the last hour
## 1.0.14. - fixed that the language part was missing from the last hour addition
## 1.0.15. - added extra feature, that how meny guest visited the board today are also countet
## 1.0.16. - missed something in the page_header.php file
## 1.0.17. - moved some changes from page_header.php over to index.php, for incresed performance
## 1.0.18. - fixed session.php that guest users are reset from the "today list"
## 1.0.19. - guest was still beeing reset, new change to session.php $dato
## 1.2.0. - BETA for phpBB2 version 2.0.2.
## 1.2.1. - typo, missed a comma in session.php
## 1.2.2. - fixed that guest users was not counted rigth if mixed timezones
## 1.2.3. - removed som added code in session.php
## 1.2.4. - add, posibilty to log guest users time
## 1.2.5. - change the code in index.php - minor speed different
##
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Authors Notes:
##
## Instead of runing the SQL commands your self, I have also included a db_update.php file
## if you are loged in as ADMIN, you can run this file, witch will do the neasessary changes to the DB
## the file will by it self put prefix on your tables, else
## if you are using a prefix to you DB tabels then you have to add this to
## the [ADD SQL] commands, e.g. "phpbb_users" instead of just "users" - ONLY
## in the initial [ADD SQL] commands, not in the php code !
##
##
## The most important thing to keep in mind is, take your time, make
## sure you are finding the correct lines to modify, then take care to paste the new code.
## Please also keep in mind, if you are using more than one language file or theme at your
## site, you will need to edit the corrosponding files for each occurrence. Good Luck!
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
## and the Database
#################################################################


#
#-----[ ADD SQL ]------------------------------------------
#
SQL-query:
ALTER TABLE phpbb_users ADD user_lastlogon INT (11) DEFAULT '0'

#
#-----[ ADD SQL ]------------------------------------------
#
SQL-query:
UPDATE phpbb_users SET user_lastlogon=user_lastvisit

#
#-----[ ADD SQL ]------------------------------------------
#
SQL-query:
INSERT INTO phpbb_config (config_name, config_value) VALUES ('hidde_last_logon', '0')

####################################################################

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
# AT THE BOTTOM OF THE PAGE
//
// That's all Folks!
// -------------------------------------------------

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//add to last visit mod
$lang['Last_logon'] = 'Last Visit';
$lang['Hidde_last_logon'] = 'Hidden';
$lang['Never_last_logon'] = 'Never';
$lang['Users_today_zero_total'] = 'In total <b>0</b> users have visited this site today :: ';
$lang['Users_today_total'] = 'In total <b>%d</b> user have visited this site today :: ';
$lang['User_today_total'] = 'In total <b>%d</b> users have visited this site today :: ';
$lang['Users_lasthour_explain'] = ', %d of them within the last hour.';
$lang['Users_lasthour_none_explain'] = ''; //showen of none have visited the last hour, fill if you like
#
#-----[ OPEN ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
# AT THE BOTTOM OF THE PAGE
//
// That's all Folks!
// -------------------------------------------------

#
#-----[ BEFORE, ADD ]------------------------------------------
#

//add to last visit mod
$lang['Last_logon'] = '最後訪問';
$lang['Hidde_last_logon'] = '隱形';
$lang['Never_last_logon'] = '從未';
$lang['Users_today_zero_total'] = '今日論壇共來了 <b>0</b> 位客人 ::';
$lang['Users_today_total'] = '今日論壇共來了 <b>%d</b> 位客人 ::';
$lang['User_today_total'] = '今日論壇共來了 <b>%d</b> 位客人 ::';
$lang['Users_lasthour_explain'] = ',最近1小時內共有 %d 位來訪.';
$lang['Users_lasthour_none_explain'] = ''; //showen of none have visited the last hour, fill if you like

#
#-----[ OPEN ]------------------------------------------
#
index.php

#
#-----[ FIND ]------------------------------------------
#
//
// Start output of page

#
#-----[ BEFORE, ADD ]------------------------------------------
#
//show dayly users mod
$time_now=time();
$time1Hour=$time_now-3600;
$minutes = date('is', $time_now);
$hour_now = $time_now - (60*($minutes[0].$minutes[1])) - ($minutes[2].$minutes[3]);
$dato=create_date('H', $time_now,$board_config['board_timezone']);
$timetoday = $hour_now - (3600*$dato);
$sql = 'SELECT session_ip, MAX(session_time) as session_time FROM '.SESSIONS_TABLE.' WHERE session_user_id="'.ANONYMOUS.'" AND session_time >= '.$timetoday.' AND session_time< '.($timetoday+86399).' GROUP BY session_ip';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve guest user today data", "", __LINE__, __FILE__, $sql);
while( $guest_list = $db->sql_fetchrow($result))
{
if ($guest_list['session_time'] >$time1Hour) $users_lasthour++;
}
$guests_today = $db->sql_numrows($result);
$sql = 'SELECT user_id,username,user_allow_viewonline,user_level,user_lastlogon FROM ' . USERS_TABLE . ' WHERE user_id!="'.ANONYMOUS.'" AND user_session_time >= '.$timetoday.' AND user_session_time< '.($timetoday+86399).' ORDER BY username';
if (!$result = $db->sql_query($sql)) message_die(GENERAL_ERROR, "Couldn't retrieve user today data", "", __LINE__, __FILE__, $sql);
while( $todayrow = $db->sql_fetchrow($result))
{
$style_color = "";
if ($todayrow['user_lastlogon']>=$time1Hour)
{
$users_lasthour++;
}
switch ($todayrow['user_level'])
{
case ADMIN :
$todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor3'] . '"';
break;
case MOD :
$todayrow['username'] = '<b>' . $todayrow['username'] . '</b>';
$style_color = 'style="color:#' . $theme['fontcolor2'] . '"';
break;
}
$users_today_list.=( $todayrow['user_allow_viewonline'])?' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'>' . $todayrow['username'] . '</a>,' : (($userdata[user_level]==ADMIN) ? ' <a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $todayrow['user_id']) . '"' . $style_color .'><i>' . $todayrow['username'] . '</i></a>,' : '');
\n if (!$todayrow['user_allow_viewonline']) $logged_hidden_today++;
else $logged_visible_today++;
}
if ($users_today_list)
{
$users_today_list[ strlen( $users_today_list)-1] = ' ';
} else
{
$users_today_list = $lang['None'];
}
$total_users_today = $db->sql_numrows($result)+$guests_today;

$users_today_list = $lang['Registered_users'].' ' . $users_today_list;
$l_today_user_s = ($total_users_today) ? ( ( $total_users_today == 1 )? $lang['User_today_total'] : $lang['Users_today_total'] ) : $lang['Users_today_zero_total'];
$l_today_r_user_s = ($logged_visible_today) ? ( ( $logged_visible_today == 1 ) ? $lang['Reg_user_total'] : $lang['Reg_users_total'] ) : $lang['Reg_users_zero_total'];
$l_today_h_user_s = ($logged_hidden_today) ? (($logged_hidden_today == 1) ? $lang['Hidden_user_total'] : $lang['Hidden_users_total'] ) : $lang['Hidden_users_zero_total'];
$l_today_g_user_s = ($guests_today) ? (($guests_today == 1) ? $lang['Guest_user_total'] : $lang['Guest_users_total']) : $lang['Guest_users_zero_total'];
$l_today_users = sprintf($l_today_user_s, $total_users_today);
$l_today_users .= sprintf($l_today_r_user_s, $logged_visible_today);
$l_today_users .= sprintf($l_today_h_user_s, $logged_hidden_today);
$l_today_users .= sprintf($l_today_g_user_s, $guests_today);

#
#-----[ FIND ]------------------------------------------
#
'FORUM_LOCKED_IMG' => $images['forum_locked'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
'USERS_TODAY_LIST' => $users_today_list,

'L_USERS_LASTHOUR' =>($users_lasthour)?sprintf($lang['Users_lasthour_explain'],$users_lasthour):$lang['Users_lasthour_none_explain'],
'L_USERS_TODAY' =>$l_today_users,

#
#-----[ OPEN ]------------------------------------------
#
includes/sessions.php

#
#-----[ FIND ]------------------------------------------
#
if ( !empty($session_id) )
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
$expiry_time = $current_time - $board_config['session_length'] ;

#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT u.*, s.*
FROM " . SESSIONS_TABLE . " s, " . USERS_TABLE . " u
WHERE s.session_id = '$session_id'
AND u.user_id = s.session_user_id";

#
#-----[ IN-LINE FIND ]------------------------------------------
#
";

#
#-----[ IN-LINE BEFORE, ADD ]------------------------------------------
#
AND session_time > $expiry_time

#
#-----[ FIND ]------------------------------------------
#
$sql = "DELETE FROM " . SESSIONS_TABLE . "
WHERE session_time < $expiry_time

#
#-----[ IN-LINE FIND ]------------------------------------------
#
session_time < $expiry_time
#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
UNIX_TIMESTAMP() - session_time >=172800

#
#-----[ FIND ]------------------------------------------
#
if ( $user_id != ANONYMOUS )
{
$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;
$sql = "UPDATE " . USERS_TABLE . "

#
#-----[ IN-LINE FIND ]------------------------------------------
#
, user_lastvisit = $last_visit

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_lastlogon = " . time() . "

#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php

#
#-----[ FIND ]------------------------------------------
#
'JOINED' => create_date($lang['DATE_FORMAT'], $profiledata['user_regdate'], $board_config['board_timezone']),

#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_LOGON' => $lang['Last_logon'],
'LAST_LOGON' => ($userdata['user_level'] == ADMIN || (!$board_config['hidde_last_logon'] && $profiledata['user_allow_viewonline'])) ? (($profiledata['user_lastlogon'])? create_date($board_config['default_dateformat'], $profiledata['user_lastlogon'], $board_config['board_timezone']):$lang['Never_last_logon']):$lang['Hidde_last_logon'],

#
#-----[ OPEN ]------------------------------------------
#
# (make sure to edit this file for every theme you use).
templates/subsilver/index_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<img src="templates/subSilver/images/whosonline.gif"

#
#-----[ IN-LINE FIND ]------------------------------------------
# if other mods installed the value could be different
rowspan="2"

#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
rowspan="3"

#
#-----[ FIND ]------------------------------------------
#
{NEWEST_USER}</span>
</td>
</tr>

# \r
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1" align="left"><span class="gensmall">{L_USERS_TODAY} {L_USERS_LASTHOUR}<br />{USERS_TODAY_LIST}</br></span></td>
</tr>

#
#-----[ OPEN ]------------------------------------------
# (make sure to edit this file for every theme you use).
templates/subsilver/profile_view_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<td width="100%"><b><span class="gen">{JOINED}</span></b></td>
</tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td valign="middle" align="right"><span class="gen">{L_LOGON}: </span></td>
<td width="100%"><b><span class="gen">{LAST_LOGON}</span></b></td>
</tr>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
?>[/php]

\n第二部分:修改會員列表查詢功能\r
[php]<?php
########################################################
## Mod Title: Last Visit Member list Mod (PART 2)
## Mod Version: 1.2.0
## Author: Niels Chr. R鷣 Denmark < ncr@db9.dk > http://mods.db9.dk
##
## This mod is for phpBB2 ver 2.0.2
##
## Description: This mod will enable users to see other users
## last visit in the memberlist, the information is stored already, but other users can not see
## it, after this mod, users can see when another user have last visited
## the board, this is shown in the memberlist.
## This feture support, user level and hidden users
## Admin will always be able to se all users last visit, regardless of the settings
## if board config is "off", then only admin can see the information
## if board is "on", then all users kan se other users last visit
## except hidden users, who always will be "hidden"
## only admin can sort by "last visit" since
##
##
##
## Installation Level: Easy
## Installation Time: 2-4 Minutes
## Files To Edit: 2
## memberlist.php
## templates/subsilver/member_body.tpl
##
## History:
## 1.0.10. - Last release for phpBB2 version 2.0.0.
## 1.2.0. - code updated for phpBB2 version 2.0.2.
##
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Authors Notes:
##
## This mod Asumes that "Last Visit PART 1" mod have already be made !
##
## The most important thing to keep in mind is, take your time, make
## sure you are finding the correct lines to modify, then take care to paste the new code.
## Please also keep in mind, if you are using more than one language file or theme at your
## site, you will need to edit the corrosponding files for each occurrence. Good Luck!
##
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
## and the Database
#################################################################

#
#-----[ OPEN ]------------------------------------------
#
memberlist.php

#
#-----[ FIND ]------------------------------------------
#
$order_by = "user_regdate ASC LIMIT $start, " . $board_config['topics_per_page'];
break;

\n#
#-----[ AFTER, ADD ]------------------------------------------
#
case 'lastlogon':
$order_by = ($userdata['user_level'] == ADMIN ) ? "user_lastlogon $sort_order LIMIT $start, " . $board_config['topics_per_page'] : "username $sort_order LIMIT $start, " . $board_config['topics_per_page'];
break;

#
#-----[ FIND ]------------------------------------------
#
$sql = "SELECT username, user_id

#
#-----[ IN-LINE FIND ]------------------------------------------
#
, user_regdate

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_lastlogon, user_allow_viewonline

#
#-----[ FIND ]------------------------------------------
#
$mode_types_text = array($lang

#
#-----[ IN-LINE FIND ]------------------------------------------
#
(

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
$lang['Last_logon'],

#
#-----[ FIND ]------------------------------------------
#
$mode_types = array(

#
#-----[ IN-LINE FIND ]------------------------------------------
#
(

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
'lastlogon',

#
#-----[ FIND ]------------------------------------------
#
for($i = 0

#
#-----[ IN-LINE FIND ]------------------------------------------
#
0

#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
($userdata['user_level'] == ADMIN ) ? 0:1

#
#-----[ FIND ]------------------------------------------
#
'L_ICQ' => $lang['ICQ'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_LOGON' => $lang['Last_logon'],

#
#-----[ FIND ]------------------------------------------
#
'JOINED' => $joined,

#
#-----[ AFTER, ADD ]------------------------------------------
#
'LAST_LOGON' => ($userdata['user_level'] == ADMIN || (!$board_config['hidde_last_logon'] && $row['user_allow_viewonline'])) ? (($row['user_lastlogon'])? create_date($board_config['default_dateformat'], $row['user_lastlogon'], $board_config['board_timezone']):$lang['Never_last_logon']):$lang['Hidde_last_logon'],
#
#-----[ OPEN ]------------------------------------------
#
# (make sure to edit this file for every theme you use).
templates/subsilver/memberlist_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<th class="thTop" nowrap="nowrap">{L_JOINED}</th>

#
#-----[ AFTER, ADD ]------------------------------------------
#
<th class="thTop" nowrap="nowrap">{L_LOGON}</th>

#
#-----[ FIND ]------------------------------------------
#
<span class="gensmall">{memberrow.JOINED}</span></td>

#
#-----[ AFTER, ADD ]------------------------------------------
#
<td class="{memberrow.ROW_CLASS}" align="center" valign="middle"><span class="gensmall">{memberrow.LAST_LOGON}</span></td>

#
#-----[ FIND ]------------------------------------------
#
<td class="catbottom" colspan="

#
#-----[ IN-LINE FIND ]------------------------------------------
# if other mods installed, the value can be different, increase it by one
colspan="8"

#
#-----[ IN-LINE REPLACE WITH ]------------------------------------------
#
colspan="9"

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
?>[/php]

第三部份:修改後端控制台基本組態選項
[php]<?php
########################################################
## Mod Title: Last Visit Admin Mod
## Mod Version: 1.2.1.
## Author: Niels Chr. Denmark < ncr@db9.dk > (Niels Chr. R鷣) HTTP://mods.db9.dk
##
## Description: This mod is part 3, of a Last visit mod.
## It will make it posible for a administrator to control if
## last visit are displayed to ordenary users or only admin
##
## This mod is for phpBB2 ver 2.0.2
##
##
## Installation Level: Easy
## Installation Time: 5-10 Minutes
## Files To Edit: 3
## admin/admin_board.php
## language/lang_english/lang_admin.php
## templates/subsilver/board_config_body.tpl
##
## History:
## 0.9.0. - initial release for phpBB2 RC-2
## 1.0.0. - initial release for phpBB2 ver 2.0.0.
## 1.0.1. - minor change to lang_admin.php
## 1.2.0. - now confirmed for phpBB2 version 2.0.2.
## 1.2.1. - change into the lang_admin.php, (spelling)
##
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Authors Notes:
## remember to include minimum PART 1 of the last visit mod before this PART 3
##
## The most important thing to keep in mind is, take your time, make
## sure you are finding the correct lines to modify, then take care to paste the new code.
## Please also keep in mind, if you are using more than one language file or theme at your
## site, you will need to edit the correct files for each occurrence. Good Luck!
########################################################

#
#-----[ OPEN ]------------------------------------------
#
# (make sure to edit this file for every language your admin uses).
language/lang_chinese_traditional_taiwan/lang_admin.php

#
#-----[ FIND ]------------------------------------------
#
# AT THE BOTTOM OF THE PAGE
//
// That's all Folks!
// -------------------------------------------------

#
#-----[ BEFORE, ADD ]------------------------------------------
#
//Added Last Visit mod
$lang['Hidde_last_logon'] = "隱藏最後到訪時間";
$lang['Hidde_last_logon_expain'] = "如果這個設成是, 使用者最後來訪的時間將被隱藏, 除了系統管理員可看到之外, 其餘使用者均看不到";

#
#-----[ OPEN ]------------------------------------------
#
admin/admin_board.php

#
#-----[ FIND ]------------------------------------------
#
$prune_no = ( !$new['prune_enable'] ) ? "checked=\"checked\"" : "";

#
#-----[ AFTER, ADD ]------------------------------------------
#
$hidde_last_logon_yes = ( $new['hidde_last_logon'] ) ? "checked=\"checked\"" : "";
$hidde_last_logon_no = ( !$new['hidde_last_logon'] ) ? "checked=\"checked\"" : "";

#
#-----[ FIND ]------------------------------------------
#
"L_ENABLE_PRUNE" => $lang['Enable_prune'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
"L_HIDDE_LAST_LOGON" => $lang['Hidde_last_logon'],
"L_HIDDE_LAST_LOGON_EXPLAIN" => $lang['Hidde_last_logon_expain'],

#
#-----[ FIND ]------------------------------------------
#
"PRUNE_NO" => $prune_no,

#
#-----[ AFTER, ADD ]------------------------------------------
#
"HIDDE_LAST_LOGON_YES" => $hidde_last_logon_yes,
"HIDDE_LAST_LOGON_NO" => $hidde_last_logon_no,

#
#-----[ OPEN ]------------------------------------------
#
# (make sure to edit this file for every theme your admin uses).
templates/subSilver/admin/board_config_body.tpl
\n
#
#-----[ FIND ]------------------------------------------
#
{PRUNE_NO} /> {L_NO}</td>
</tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1">{L_HIDDE_LAST_LOGON}<br /><span class="gensmall">{L_HIDDE_LAST_LOGON_EXPLAIN}</span></td>
<td class="row2"><input type="radio" name="hidde_last_logon" value="1" {HIDDE_LAST_LOGON_YES} /> {L_YES} <input type="radio" name="hidde_last_logon" value="0" {HIDDE_LAST_LOGON_NO} /> {L_NO}</td>
</tr>

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
?>[/php]

第四部分:額外的增加個人資料的觀看項目\r
這一部分就算沒修改也不影響這個模組的相關功能,況且修改這一部分的難度很高,建議在修改的時候能夠將備份做好!

[php]<?php
########################################################
## Mod Title: Last Visit Mod PART 4 (require part 1)
## Mod Version: 0.9.7
## Author: Niels Chr. R鷣 Denmark < ncr@db9.dk > http://mods.db9.dk
##
## This mod is for phpBB2 ver 2.0.2
##
## Description: Part 4, will add the information to the users profile, about how meny time the user have visited the site,
## and how long time the users have spend on the forum in total, and the last time he/she visited the site, and finaly how meny page hits he/she have had
##
## After this part 4 I have added a "switch" to the template "system", so you can use
## <!-- BEGIN switch_user_is_moderator --> and <!-- END switch_user_is_moderator -->
## or you can use <!-- BEGIN switch_user_is_not_moderator --> and <!-- END switch_user_is_not_moderator -->
## this can be used in any template, and together with any other information, NOT only this mod.
## This mod uses this, to hide the uses online information so it is only showen to ADMIN/MODERATORS in the users profile
##
## Installation Level: Easy
## Installation Time: 5-10 Minutes
## Files To Edit: 6
## language/lang_english/lang_main.php
## includes/usercp_viewprofile.php
## includes/sessions.php
## includes/page_header.php
## includes/functions.php
## templates/subsilver/profile_view_body.tpl
##
## History:
## 0.9.0. - Beta release of PART 4
## 0.9.1. - changed the initial SQL, so the starting time are 0 for all users
## 0.9.2. - changed the update SQL in session.php
## 0.9.3. - changed some code in usercp_viewprofile.php, causing wrong info
## 0.9.4. - changed the IN-LINE,FIND in session.php, causing a "error in your SQL syntax"
## 0.9.5. - now also include users PAGE HITS
## 0.9.6. - changed some code in usercp_viewprofile.php, causing wrong page hits
## 0.9.7. - add, guest users time can be logged
##
##############################################################
## This MOD is released under the GPL License.
## Intellectual Property is retained by the MOD Author(s) listed above
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/downloads/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/downloads/
##############################################################
## Authors Notes:
##
## PART 4 of this mod, require PART 1
## Instead of runing the SQL commands your self, I have also included a db_update.php file
## if you are loged in as ADMIN, you can run this file, witch will do the neasessary changes to the DB
## the file will by it self put prefix on your tables, else
## if you are using a prefix to you DB tabels then you have to add this to
## the [ADD SQL] commands, e.g. "phpbb_users" instead of just "users" - ONLY
## in the initial [ADD SQL] commands, not in the php code !
##
##
## The most important thing to keep in mind is, take your time, make
## sure you are finding the correct lines to modify, then take care to paste the new code.
## Please also keep in mind, if you are using more than one language file or theme at your
## site, you will need to edit the corrosponding files for each occurrence. Good Luck!
#################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
## and the Database
#################################################################


#
#-----[ ADD SQL ]------------------------------------------
#
ALTER TABLE phpbb_users ADD user_totaltime INT (11) DEFAULT '0'

#
#-----[ ADD SQL ]------------------------------------------
#
ALTER TABLE phpbb_users ADD user_totallogon SMALLINT (5) DEFAULT '0'

#
#-----[ ADD SQL ]------------------------------------------
#
ALTER TABLE phpbb_users ADD user_totalpages INT (11) not null

#
#-----[ ADD SQL ]------------------------------------------
#
UPDATE phpbb_users SET user_session_time = user_lastlogon

#
#-----[ ADD SQL ]------------------------------------------
#
UPDATE phpbb_users SET user_totallogon = 1 WHERE user_session_time<>0

####################################################################

#
#-----[ OPEN ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
//add to last visit mod

#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['Years'] = '年';
$lang['Year'] = '年';
$lang['Weeks'] = '週';
$lang['Week'] = '週';
$lang['Day'] = '天';
$lang['Total_online_time'] = '總共持續在論壇時間';
$lang['Last_online_time'] = '最後一次持續在論壇時間';
$lang['Number_of_visit'] = '拜訪論壇次數';
$lang['Number_of_pages'] = '點選頁面數量';

#
#-----[ OPEN ]------------------------------------------
#
includes/sessions.php

#
#-----[ FIND ]------------------------------------------
#
if ( $user_id != ANONYMOUS )
{
$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;
$sql = "UPDATE " . USERS_TABLE . "
SET user_session_time

#
#-----[ IN-LINE FIND ]------------------------------------------
#
time() . "

#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, user_totallogon=user_totallogon+1

#
#-----[ IN-LINE FIND ]------------------------------------------
#
if

#
#-----[ IN-LINE BEFORE ADD ]------------------------------------------
#
//

#
#-----[ IN-LINE FIND ]------------------------------------------
#
{

#
#-----[ IN-LINE BEFORE ADD ]------------------------------------------
#
//

#
#-----[ FIND ]------------------------------------------
#
$sessiondata['userid'] = $user_id;
}

#
#-----[ IN-LINE FIND ]------------------------------------------
#
}

#
#-----[ IN-LINE BEFORE ADD ]------------------------------------------
#
//

#
#-----[ FIND ]------------------------------------------
#
if ( $userdata['user_id'] != ANONYMOUS )
{
$sql = "UPDATE " . USERS_TABLE . "

#
#-----[ IN-LINE FIND ]------------------------------------------
#
if

#
#-----[ IN-LINE BEFORE ADD ]------------------------------------------
#
//

#
#-----[ IN-LINE FIND ]------------------------------------------
#
{

#
#-----[ IN-LINE BEFORE ADD ]------------------------------------------
#
//

#
#-----[ IN-LINE FIND ]------------------------------------------
#
SET

#
#-----[ IN-LINE AFTER ADD ]------------------------------------------
#
user_totalpages=user_totalpages+1, user_totaltime=user_totaltime+($current_time-".$userdata['session_time']."),


#
#-----[ FIND ]------------------------------------------
#
}

//
// Delete expired sessions


#
#-----[ IN-LINE FIND ]------------------------------------------
#
}

#
#-----[ IN-LINE BEFORE ADD ]------------------------------------------
#
//


#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php

#
#-----[ FIND ]------------------------------------------
#
'LAST_LOGON' => ($userdata['user_level'] == ADMIN || (!$board_config['hidde_last_logon'] && $profiledata['user_allow_viewonline'])) ? (($profiledata['user_lastlogon'])? create_date($board_config['default_dateformat'], $profiledata['user_lastlogon'], $board_config['board_timezone']):$lang['Never_last_logon']):$lang['Hidde_last_logon'],

#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_TOTAL_ONLINE_TIME' => $lang['Total_online_time'],
'TOTAL_ONLINE_TIME' => make_hours($profiledata['user_totaltime']),
'L_LAST_ONLINE_TIME' => $lang['Last_online_time'],
'LAST_ONLINE_TIME' => make_hours($profiledata['user_session_time']-$profiledata['user_lastlogon']),
'L_NUMBER_OF_VISIT' => $lang['Number_of_visit'],
'NUMBER_OF_VISIT' => ($profiledata['user_totallogon']>0) ? $profiledata['user_totallogon']: $lang['None'],
'L_NUMBER_OF_PAGES' => $lang['Number_of_pages'],
'NUMBER_OF_PAGES' => ($profiledata['user_totalpages']) ? $profiledata['user_totalpages']: $lang['None'],

#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php

#
#-----[ FIND ]------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------------
#

function make_hours($base_time)
{
global $lang;
$years = floor($base_time/31536000);
$base_time = $base_time - ($years*31536000);
$weeks = floor($base_time/604800);
$base_time = $base_time - ($weeks*604800);
$days = floor($base_time/86400);
$base_time = $base_time - ($days*86400);
$hours = floor($base_time/3600);
$base_time = $base_time - ($hours*3600);
$min = floor($base_time/60);
$sek = $base_time - ($min*60);
if ($sek<10) $sek ='0'.$sek;
if ($min<10) $min ='0'.$min;
if ($hours<10) $hours ='0'.$hours;
$result=(($years)?$years.' '.(($years==1)?$lang['Year']:$lang['Years']).', ':'').
(($years || $weeks)?$weeks.' '.(($weeks==1)?$lang['Week']:$lang['Weeks']).', ':'').
(($years || $weeks || $days) ? $days.' '.(($days==1)?$lang['Day']:$lang['Days']).', ':'').
(($hours)?$hours.':':'00:').(($min)?$min.':' :'00:').$sek;
return ($result)?$result:$lang['None'];
}

#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php

#
#-----[ FIND ]------------------------------------------
#
//
// Get basic (usernames + totals) online

#
#-----[ BEFORE, ADD ]------------------------------------------
#
if ( !$userdata['user_level']==MOD )
{
$template->assign_block_vars('switch_user_is_not_moderator', array());
} else
{
$template->assign_block_vars('switch_user_is_moderator', array());
}


#
#-----[ OPEN ]------------------------------------------
# (make sure to edit this file for every theme you use).
templates/subsilver/profile_view_body.tpl

#
#-----[ FIND ]------------------------------------------
#
<td width="100%"><b><span class="gen">{LAST_LOGON}</span></b></td>
</tr>

#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- BEGIN switch_user_is_moderator -->
<tr>
<td valign="middle" align="right"><span class="gen">{L_TOTAL_ONLINE_TIME}: </span></td>
<td width="100%"><b><span class="gen">{TOTAL_ONLINE_TIME}</span></b></td>
</tr>
<tr>
<td valign="middle" align="right"><span class="gen">{L_LAST_ONLINE_TIME}: </span></td>
<td width="100%"><b><span class="gen">{LAST_ONLINE_TIME}</span></b></td>
</tr>
<tr>
<td valign="middle" align="right"><span class="gen">{L_NUMBER_OF_VISIT}: </span></td>
<td width="100%"><b><span class="gen">{NUMBER_OF_VISIT}</span></b></td>
</tr>
<tr>
<td valign="middle" align="right"><span class="gen">{L_NUMBER_OF_PAGES}: </span></td>
<td width="100%"><b><span class="gen">{NUMBER_OF_PAGES}</span></b></td>
</tr>

<!-- END switch_user_is_moderator -->

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
?>[/php]

關於index.php頁面顯示部分的修正內容:

[php]<?php
#
#-----[ OPEN ]------------------------------------------
#

index.php

#
#-----[ FIND ]------------------------------------------
#

$users_today_list = $lang['Registered_users'].' ' . $users_today_list;

#
#-----[ Replace With]------------------------------------------
#

$users_today_list = $lang['users_today_list'].' ' . $users_today_list;

#
#-----[ OPEN ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_main.php

#
#-----[ FIND ]------------------------------------------
#

//add to last visit mod

#
#-----[ AFTER, ADD ]------------------------------------------
#

$lang['users_today_list'] = "今日來論壇拜訪的會員們 :: ";

#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
?>[/php]

這部分的問題已經回報給作者,同時附上修改方式,希望作者能夠採納!!
http://mods.db9.dk/viewtopic.php?t=1426
外掛問題區發問格式就在這裡,請務必一定照著格式來~!
你不照著規則來,就算是也搞不清楚你的問題在哪裡!
新手問問題不是罪惡
罪惡的是自己沒有先做好本分和功課,說話的口氣也不好,再加上態度有好像我們這群人欠你多少似的~~!!
竹貓星球發問規則:
http://phpbb-tw.net/phpbb/viewtopic.php?t=16149
發問比率最高的句子翻譯:
Please ensure both the install/ and contrib/ directories are deleted
請確認install和contrib資料夾已被刪除(奇怪,翻一下英漢字典有這麼困難嗎)
主題已鎖定

回到「非官方認證外掛」