[問題] Forum Information 時間計算錯誤

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

主題已鎖定
雪曼
星球普通子民
星球普通子民
文章: 7
註冊時間: 2005-09-03 12:07
來自: 雪曼星

[問題] Forum Information 時間計算錯誤

文章 雪曼 »

問題外掛:Forum Information
參考連結:http://www.phpbb-tw.net/phpbb/viewtopic.php?t=33832
使用版本:2.0.18
網站位置:恕無法提供
狀況描述:

如圖:
圖檔

他的秒數飆到300.... :-o
以前在0.17的時候還OK
但到0.18就會這樣\r

以下為原文:

代碼: 選擇全部

############################################################## 
## MOD Title: Forum Information 
## MOD Author: lowjoel <webmaster@joelsplace.sg> Joel Low - http://joelsplace.sg/ 
## MOD Description: Displays the Number of script queries executed, GZIP 
## compression information and page execution time. 
## MOD Version: 1.0.0 
## 
## Installation Level: Easy 
## Installation Time: 3 Minutes 
## Files To Edit:  extension.inc, 
##                 language/lang_english/lang_main.php, 
##                 includes/page_tail.php, 
##                 templates/subSilver/overall_footer.tpl 
## 
############################################################## 
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ 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/ 
############################################################## 
## MOD History: 
## 
##     2005-03-17  - Version 1.0.1 
##          - Updated installation instructions 
##          - Created folder hierachy for easy extraction 
## 
##     2005-03-12  - Version 1.0.0 
##          - Original release 
## 
############################################################## 
## Author Notes: 
##  
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 

# 
#-----[ OPEN ]------------------------------------------ 
# 
extension.inc 

# 
#-----[ FIND ]------------------------------------------ 
# 
$starttime = 0; 
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
$starttime = time(); 
# 
#-----[ OPEN ]------------------------------------------ 
# 
language/lang_english/lang_main.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
// That's all, Folks! 

# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
//-------------------------- MOD: Forum Information MOD -------------------------- 
$lang['L_GZIP_ENABLED'] = 'GZIP: Enabled'; 
$lang['L_GZIP_DISABLED'] = 'GZIP: Disabled'; 
$lang['L_GENERATION_TIME'] = 'Generation Time: %s  Seconds'; 
$lang['L_MYSQL_QUERIES'] = 'Queries: %s'; 
//-------------------------- End MOD: Forum Information MOD -------------------------- 
# 
#-----[ OPEN ]------------------------------------------ 
# 
includes/page_tail.php 

# 
#-----[ FIND ]------------------------------------------ 
# 
$template->pparse('overall_footer'); 
# 
#-----[ REPLACE WITH ]------------------------------------------ 
# 
//-------------------------- MOD: Forum Information MOD -------------------------- 
//delete 
//$template->pparse('overall_footer'); 
//-------------------------- End MOD: Forum Information MOD -------------------------- 

# 
#-----[ FIND ]------------------------------------------ 
# 
echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; 
   echo $gzip_contents; 
   echo pack('V', $gzip_crc); 
   echo pack('V', $gzip_size); 
} 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 

//-------------------------- MOD: Forum Information MOD -------------------------- 
$endtime = microtime(); 
$endtime = explode(" ", microtime()); 
$endtime = $endtime[1] + $endtime[0]; 
$gentime = round(($endtime - $starttime), 5); 
$template->assign_vars(array( 
  'L_GENERATION_TIME' => sprintf($lang['L_GENERATION_TIME'], $gentime), 
  'L_NUMBER_QUERIES' => sprintf($lang['L_MYSQL_QUERIES'],  $db->num_queries), 
  'L_GZIP_ON' =>  ($board_config['gzip_compress']) ? $lang['L_GZIP_ENABLED'] : $lang['L_GZIP_DISABLED'], 
) 
); 
$template->pparse('overall_footer'); 
//-------------------------- End MOD: Forum Information MOD -------------------------- 

# 
#-----[ OPEN ]------------------------------------------ 
# 
templates/subSilver/overall_footer.tpl 

# 
#-----[ FIND ]------------------------------------------ 
# 
{TRANSLATION_INFO} 
# 
#-----[ BEFORE, ADD ]------------------------------------------ 
# 
<br /> {L_GZIP_ON}&nbsp;&nbsp; {L_NUMBER_QUERIES}&nbsp;&nbsp; {L_GENERATION_TIME} 
# 
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------ 
# 
# EoM 
竹貓點擊率最高的連結---->
雪曼
星球普通子民
星球普通子民
文章: 7
註冊時間: 2005-09-03 12:07
來自: 雪曼星

文章 雪曼 »

不好意思
我在http://www.phpbb.com/phpBB/viewtopic.ph ... 05#1685905這篇文章找到了解決方法

在此代貼

代碼: 選擇全部

#
#-----[ OPEN ]---------------------------------------------
#
extension.inc

#
#-----[ FIND ]---------------------------------------------
#
$starttime=time();

#
#-----[ REPLACE WITH ]---------------------------------------------
#
list($usec, $sec) = explode(" ", microtime()); 
$starttime= ((float)$usec + (float)$sec);
竹貓點擊率最高的連結---->
過山雲
竹貓忠實會員
竹貓忠實會員
文章: 390
註冊時間: 2002-09-05 20:11
來自: 東都.承天府.萬年縣治.拱辰門北
聯繫:

文章 過山雲 »

來源已不可考

搜尋沒找到\r
所以補上相關繁體中文語系部分

//-------------------------- MOD: Forum Information MOD --------------------------
$lang['L_GZIP_ENABLED'] = 'GZIP壓縮: 啟用';
$lang['L_GZIP_DISABLED'] = 'GZIP壓縮: 沒啟用';
$lang['L_GENERATION_TIME'] = '頁面產生速度: %s 秒';
$lang['L_MYSQL_QUERIES'] = '資料庫查詢: %s 次';
//-------------------------- End MOD: Forum Information MOD --------------------------
圖檔
主題已鎖定

回到「外掛問題討論」