[推薦外掛] Last visit (最後訪問) (Update 1.2.10)

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

版主: 版主管理群

主題已鎖定
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8445
註冊時間: 2004-04-30 01:54
來自: Taiwan

[推薦外掛] Last visit (最後訪問) (Update 1.2.10)

文章 心靈捕手 »

  • 前言
  • [推薦外掛] Last visit 1.2.8 檔頭說明
  • [分享]中文化
  • [分享]修正以及安裝經驗
  • 外掛下載
  • 外掛升級
前言:

向大家推薦一個好用外掛 Last visit 1.2.8
可以紀錄, 會員最近一次拜訪論壇的時間,
並且, 在首頁, 顯示今天拜訪論壇的會員名稱( 人數),...等.

因為, 該外掛目前[ 竹貓] 只有 godbless 大大分享的 1.2.5 版,
所以, 特別將此最新版的中文化, 修正, 安裝經驗,...等整理出來, 給大家參考.

[推薦外掛] Last visit 1.2.8 檔頭說明:

代碼: 選擇全部

############################################################## 
## MOD Title:          Last visit
## MOD Author:         Niels < ncr@db9.dk > (Niels Chr. R鷣) http://mods.db9.dk 
## MOD Description:    This mod will register when the user last
##                     logged in, allong with the info about how
##                     many users have visited the board.
## MOD Version:        1.2.8
## MOD Compatibility:  2.0.5->2.0.6
## 
## Installation Level: Intermediate
## Installation Time:  25 minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit:      14
##      index.php 
##      memberlist.php 
##      search.php
##      admin/admin_board.php 
##      includes/functions.php
##      includes/page_header.php 
##      includes/sessions.php 
##      includes/usercp_viewprofile.php 
##      language/lang_english/lang_admin.php 
##      language/lang_english/lang_main.php 
##      templates/subSilver/index_body.tpl 
##      templates/subSilver/member_body.tpl    
##      templates/subSilver/profile_view_body.tpl  
##      templates/subSilver/admin/board_config_body.tpl    
##
## Included Files:     0
##
############################################################## 
補充說明:
此外掛原本分成 4 部分, 但是在 1.2.6 版之後, 已經合而為一了;
且在 1.2.8 版, 已經加入正體中文化( 其中有誤, 請詳見後面中文化說明).
## MOD History:
##
## 2003-12-15 - Version 1.2.8
## - phpBB template & EasyMOD compliance enhancement
## - Chinese Traditional Taiwan, Danish, Deutsch, Dutch,
## French, Hungarian, Italian, Polish & Thai translations
## now provide with the MOD
##
## 2003-08-10 - Version 1.2.7
## - search.php was missing - now added again
##
## 2003-08-10 - Version 1.2.6
## - Merge part 1, 2, 3 & 4
## - Add French translation if needed
## - Update instructions to work with 2.0.5/2.0.6
## - How-to rewrite to be EasyMOD compatible
[分享]中文化:

參考來源:
http://phpbb-tw.net/phpbb/viewtopic.php?p=79995#79995
#
#-----[ OPEN ]------------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_admin.php

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

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

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

#
#-----[ Find ]-----
#
?>

#
#-----[ Before, Add ]-----
#
// Start add - 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
$lang['Users_today_list'] = '今天來訪討論區的註冊會員: ';
$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'] = '點選頁面數量';
// End add - Last visit MOD
ps.
若您是參照下載外掛裡頭的正體中文化
( translations/lang_chinese_traditional_taiwan.txt),
將要自行修正 lang_main.php 部份, 原作者筆誤之處( 如下):
$lang['Users_today_total'] = 今日論壇共來了 <b>%d</b> 位客人 ::';
$lang['User_today_total'] = 今日論壇共來了 <b>%d</b> 位客人 ::';
並且新增一段語法:

代碼: 選擇全部

$lang['Users_today_list'] = '今天來訪討論區的註冊會員: ';
[分享]修正以及安裝經驗:

除了語言檔的修正之外, 若要在首頁顯示" 今天來訪討論區的註冊會員: ",
那麼還需要修改一個地方. 如下:
#
#-----[ 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;
參考來源:
http://phpbb-tw.net/phpbb/viewtopic.php?p=79995#79995

另外, 如果您已經安裝其他外掛( 如: Cash Mod), 而在會員列表有新增欄位的話,
那麼, 會員列表可能會太擁擠, 或出現錯誤, 必須做若干的調整, 移除一些不必要的欄位.

外掛下載:
http://www.phpbbhacks.com/download/237

外掛升級:
請參見後面回文.
最後由 心靈捕手 於 2006-07-05 00:10 編輯,總共編輯了 3 次。
施比受有福,歡迎來信賜教,謝謝 & 再見!
祝福您 好運 ^_^
歡迎加入★★心靈捕手★★ :: 討論區!!
http://wang5555.hopto.org/phpBB3/
p.s. 奉老婆之命:在晚上十一點前,得關機睡覺!!!
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8445
註冊時間: 2004-04-30 01:54
來自: Taiwan

重寫 includes/sessions.php 相容 phpbb 2.0.18 修改方法

文章 心靈捕手 »

因為這個檔案( sessions.php ) 升級( phpbb 2.0.18) 後, 變化頗大,
所以補上此篇回文, 提供參考.
#
#-----[ OPEN ]-----
#
includes/sessions.php

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

代碼: 選擇全部

	if ( $user_id != ANONYMOUS )
	{
		$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time; 

		if (!$admin)
		{
			$sql = "UPDATE " . USERS_TABLE . " 
				SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit
#
#-----[ REPLACE WITH ]------------------------------------------
#

代碼: 選擇全部

	//if ( $user_id != ANONYMOUS )
	//{
		$last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time; 

		if (!$admin)
		{
			$sql = "UPDATE " . USERS_TABLE . " 
				SET user_session_time = $current_time, user_session_page = $page_id, user_lastvisit = $last_visit, user_lastlogon = " . time() .  ", user_totallogon=user_totallogon+1
#
#-----[ FIND ]------------------------------------------------
#

代碼: 選擇全部

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

代碼: 選擇全部

		$sessiondata['userid'] = $user_id;
	//}

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

代碼: 選擇全部

if ( !empty($session_id) )
{
#
#-----[ AFTER, ADD ]------------------------------------------
#

代碼: 選擇全部

// Start add - Last visit MOD
$expiry_time = $current_time - $board_config['session_length'] ;
// End add - Last visit MOD
#
#-----[ 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";
#
#-----[ REPLACE WITH ]------------------------------------------
#

代碼: 選擇全部

	
		$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 AND session_time > $expiry_time";
#
#-----[ FIND ]------------------------------------------------
#

代碼: 選擇全部

					if ( $userdata['user_id'] != ANONYMOUS )
					{
						$sql = "UPDATE " . USERS_TABLE . " 
							SET user_session_time = $current_time, user_session_page = $thispage_id
							WHERE user_id = " . $userdata['user_id'];
						if ( !$db->sql_query($sql) )
						{
							message_die(CRITICAL_ERROR, 'Error updating sessions table', '', __LINE__, __FILE__, $sql);
						}
					}
#
#-----[ REPLACE WITH ]------------------------------------------
#

代碼: 選擇全部

					//if ( $userdata['user_id'] != ANONYMOUS )
					//{
						$sql = "UPDATE " . USERS_TABLE . " 
							SET user_session_time = $current_time, user_session_page = $thispage_id, user_totalpages = user_totalpages+1, user_totaltime = user_totaltime+($current_time-".$userdata['session_time'].")
							WHERE user_id = " . $userdata['user_id'];
						if ( !$db->sql_query($sql) )
						{
							message_die(CRITICAL_ERROR, 'Error updating sessions table', '', __LINE__, __FILE__, $sql);
						}
					//}
#
#-----[ FIND ]------------------------------------------------
#

代碼: 選擇全部

				
	//
	// Delete expired sessions
	//
	$sql = 'DELETE FROM ' . SESSIONS_TABLE . ' 
		WHERE session_time < ' . (time() - (int) $board_config['session_length']) . " 
			AND session_id <> '$session_id'";
#
#-----[ REPLACE WITH ]------------------------------------------
#

代碼: 選擇全部

	//
	// Delete expired sessions
	//		
	$sql = 'DELETE FROM ' . SESSIONS_TABLE . ' 
		WHERE ' . "UNIX_TIMESTAMP() - session_time >=172800 
			AND session_id <> '$session_id'";
最後由 心靈捕手 於 2006-02-12 16:07 編輯,總共編輯了 1 次。
施比受有福,歡迎來信賜教,謝謝 & 再見!
祝福您 好運 ^_^
歡迎加入★★心靈捕手★★ :: 討論區!!
http://wang5555.hopto.org/phpBB3/
p.s. 奉老婆之命:在晚上十一點前,得關機睡覺!!!
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8445
註冊時間: 2004-04-30 01:54
來自: Taiwan

[修正]安裝說明的錯誤

文章 心靈捕手 »

[修正]安裝說明的錯誤 -by- chinling
SOURCE: http://phpbb-tw.net/phpbb/viewtopic.php?p=219923#219923


原始安裝說明, 關於 memberlist.php 部分擷取:

代碼: 選擇全部

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

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
'joindate'

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
, 'lastlogon'
正確應該如下:

代碼: 選擇全部

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

# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
'joined'

# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
, 'lastlogon'
施比受有福,歡迎來信賜教,謝謝 & 再見!
祝福您 好運 ^_^
歡迎加入★★心靈捕手★★ :: 討論區!!
http://wang5555.hopto.org/phpBB3/
p.s. 奉老婆之命:在晚上十一點前,得關機睡覺!!!
動機不明
喝咖啡的綠皮猴
喝咖啡的綠皮猴
文章: 1179
註冊時間: 2002-03-06 20:37
來自: GOP (重啟)

文章 動機不明 »

外掛升級 1.2.9 beta
  • ## 2005-12-16 - Version 1.2.9 beta
    ## - English installation instructions have been cleaned up.
    ## - some code has been re-coded for use on files on phpBB 2.0.18
    ## - The Sessions.php has been re-coded for use with phpBB 2.0.18
    ## due to major changes in the phpBB script.
此版主要針對 2.0.18 作修正
並且也已修正 Sessions.php,不會再有找不到相對應的code問題.

http://www.phpbbhacks.com/download/237
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8445
註冊時間: 2004-04-30 01:54
來自: Taiwan

[建議] 升級 1.2.9

文章 心靈捕手 »

以下為檔頭說明部份擷取:

代碼: 選擇全部

############################################################## 
## MOD Title:          Last visit
## MOD Author:         Niels < ncr@db9.dk > (Niels Chr. R鷣) http://mods.db9.dk 
## MOD Description:    This mod will register when the user last
##                     logged in, allong with the info about how
##                     many users have visited the board.
## MOD Version:        1.2.9
## 
## Installation Level: Intermediate
## Installation Time:  25 minutes (1mn by EasyMOD of Nuttzy)
## Files To Edit:      14
##      index.php 
##      memberlist.php 
##      search.php
##      admin/admin_board.php 
##      includes/functions.php
##      includes/page_header.php 
##      includes/sessions.php 
##      includes/usercp_viewprofile.php 
##      language/lang_english/lang_admin.php 
##      language/lang_english/lang_main.php 
##      templates/subSilver/index_body.tpl 
##      templates/subSilver/member_body.tpl    
##      templates/subSilver/profile_view_body.tpl  
##      templates/subSilver/admin/board_config_body.tpl    
## Included Files:     0
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes: 
## 
## 1. EasyMOD
## -----------
## This MOD is compatible with EasyMOD and can be installed
## by it but is not yet certified EMC (EasyMOD Compliant)!
## http://area51.phpbb.com/phpBB22/viewforum.php?sid=&f=15
##
## Warning 1! At the minimum, you need EasyMOD beta 1 (0.3.0)
## + this fix...
## http://area51.phpbb.com/phpBB/viewtopic.php?sid=&p=130605#130605
## ...or more recent to install this MOD by EM!
##
## Warning 2! At the present time, EM is not able to install
## automatically other languages than English.
## This gap will be solved in future releases but in the meantime,
## if you need to install any other language than English provides
## with this MOD, please proceed manually (cf. comments in
## the DIY action).
##
## 2. Compatibility
## -----------
## This MOD is phpBB 2.0.19 compliant (prior release not tested)
##
## 3. Official last version link
## -----------
## Meanwhile the phpBB group validation and as the MOD is not yet
## in the phpBB MOD database, check this official link for updates...
## http://mods.db9.dk/viewtopic.php?t=5
##
############################################################## 
## MOD History: 
## 
##   2006-01-12 - Version 1.2.9
##      - phpBB template & EasyMOD compliance enhancement
##      - Upgrade the instructions to be phpBB 2.0.19 compliant
##      - Include the sql queries in the MOD and remove the
##        last_visit_db_update.php file
##      - Add DIY instructions to install other languages than English
##      - Use the INCREMENT instruction to increment the
##        whosonline.gif rowspan
補充說明:
1. 增進相容 phpBB 風格以及 EasyMOD
2. 升級安裝說明, 相容 phpBB 2.0.19
3. 移除資料庫更新檔, 將 SQL 指令, 直接寫入安裝說明
4. 新增自行加入其他語言說明
5. 安裝說明, 使用 INCREMENT 指令於增加 whosonline.gif 欄位數\r

ps.
原作者網站( 需註冊) 的版本, 已經是 1.2.9 正式版
http://mods.db9.dk/viewtopic.php?t=5

phpBBHacks.com 網站的版本, 目前仍是 1.2.9 測試版
http://www.phpbbhacks.com/download/237
施比受有福,歡迎來信賜教,謝謝 & 再見!
祝福您 好運 ^_^
歡迎加入★★心靈捕手★★ :: 討論區!!
http://wang5555.hopto.org/phpBB3/
p.s. 奉老婆之命:在晚上十一點前,得關機睡覺!!!
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8445
註冊時間: 2004-04-30 01:54
來自: Taiwan

[建議] 升級 1.2.10

文章 心靈捕手 »

代碼: 選擇全部

##
## MOD History:
##
##   2006-06-30 - Version 1.2.10
##      - phpBB template & EasyMOD compliance enhancement
##      - Upgrade the instructions to be phpBB 2.0.21 compliant
##
補充說明:
1. 增進相容 phpBB 風格以及 EasyMOD
2. 升級安裝說明, 相容 phpBB 2.0.21
3. 若是全新 (phpBB 2.0.20~) 安裝, 則 search.php 不必修改
參考連結:
http://phpbb-tw.net/phpbb/viewtopic.php?p=234698#234698

外掛下載:
http://www.phpbbhacks.com/download/237
施比受有福,歡迎來信賜教,謝謝 & 再見!
祝福您 好運 ^_^
歡迎加入★★心靈捕手★★ :: 討論區!!
http://wang5555.hopto.org/phpBB3/
p.s. 奉老婆之命:在晚上十一點前,得關機睡覺!!!
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8445
註冊時間: 2004-04-30 01:54
來自: Taiwan

[分享] 關於此外掛的 SQL 指令

文章 心靈捕手 »

印象中此外掛升級到 1.2.9 之後已經
移除資料庫更新檔 (last_visit_update.php), 將 SQL 指令, 直接寫入安裝說明
## MOD History:
##
## 2006-01-12 - Version 1.2.9
## - phpBB template & EasyMOD compliance enhancement
## - Upgrade the instructions to be phpBB 2.0.19 compliant
## - Include the sql queries in the MOD and remove the
## last_visit_db_update.php file
## - Add DIY instructions to install other languages than English
## - Use the INCREMENT instruction to increment the
## whosonline.gif rowspan
http://phpbb-tw.net/phpbb/viewtopic.php?p=226043#226043

不過我剛剛重新下載 1.2.10
卻發現它的安裝說明有更新, 而且的確加了資料庫更新檔 (last_visit_update.php)
##############################################################
##
## MOD History:
##
## 2006-06-30 - Version 1.2.10
## - phpBB template & EasyMOD compliance enhancement
## - Upgrade the instructions to be phpBB 2.0.21 compliant
##
## 2005-12-16 - Version 1.2.9
## - phpBB template & EasyMOD compliance enhancement
## - Upgrade the instructions to be phpBB 2.0.19 compliant
##
http://www.phpbbhacks.com/download/237

如果說執行資料庫更新檔 (last_visit_update.php) 有困難的話
那麼建議您:
進入 phpMyAdmin
找到論壇資料庫後
試試執行下列 SQL 指令.

代碼: 選擇全部

ALTER TABLE phpbb_users ADD user_lastlogon INT (11) DEFAULT '0' not null; 
ALTER TABLE phpbb_users ADD user_totaltime INT (11) DEFAULT '0'; 
ALTER TABLE phpbb_users ADD user_totallogon INT (11) DEFAULT '0'; 
ALTER TABLE phpbb_users ADD user_totalpages INT (11) DEFAULT '0'; 

INSERT INTO phpbb_config (config_name, config_value) VALUES ('hidde_last_logon','0'); 

UPDATE phpbb_users SET user_lastlogon = user_lastvisit WHERE user_lastlogon = '0'; 
UPDATE phpbb_users SET user_totallogon = '1' WHERE user_totallogon = '0' AND user_session_time <> '0'; 
UPDATE phpbb_users SET user_totaltime = (user_session_time - user_lastlogon) WHERE user_totaltime = '0' AND user_lastlogon > '0';
參考連結:
http://phpbb-tw.net/phpbb/viewtopic.php?p=226062#226062
施比受有福,歡迎來信賜教,謝謝 & 再見!
祝福您 好運 ^_^
歡迎加入★★心靈捕手★★ :: 討論區!!
http://wang5555.hopto.org/phpBB3/
p.s. 奉老婆之命:在晚上十一點前,得關機睡覺!!!
主題已鎖定

回到「非官方認證外掛」