[外掛]生日外掛 Birthdays 2.0.1

Officially Approved MODs
由 phpBB Group 官方發展小組認證的 MOD!

版主: 版主管理群

版面規則
請注意!只有發表在 [2.0.x] MOD Database Releases 的外掛,才算是官方認證的外掛。
主題已鎖定
taicomjp
星球公民
星球公民
文章: 32
註冊時間: 2004-08-19 00:00

[外掛]生日外掛 Birthdays 2.0.1

文章 taicomjp »

[2.0.20] Birthdays

代碼: 選擇全部

############################################################## 
## MOD Title: Birthdays
## MOD Author: TerraFrost < terrafrost@phpbb.com > (Jim Wigginton) http://www.frostjedi.com/terra/wordpress/
## MOD Description: Adds a Birthday field to the user profile.
## MOD Version: 2.0.1
##
## Installation Level: moderate
## Installation Time: 30 Minutes
##
## Files To Edit: 15
##      language/lang_english/lang_main.php
##      language/lang_english/lang_admin.php
##      includes/functions_selects.php
##      includes/template.php
##      includes/usercp_register.php
##      includes/usercp_avatar.php
##      templates/subSilver/profile_add_body.tpl
##      admin/admin_users.php
##      templates/subSilver/admin/user_edit_body.tpl
##      index.php
##      templates/subSilver/index_body.tpl
##      includes/usercp_viewprofile.php
##      templates/subSilver/profile_view_body.tpl
##      admin/admin_board.php
##      templates/subSilver/admin/board_config_body.tpl
##
## Included Files: 1
##      templates/subSilver/images/icon_birthday.gif
## 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:
##
##   Although Niels Chr. Denmark's ever-popular Birthday Hack already does that
##   which this MOD attempts to do, it does have a number of problems that this
##   MOD seeks to remedy.
##
##     1. It isn't validated and hasn't been subjected to a security audit by the
##        phpBB MOD Team.
##     2. It saves the birthdate by saving the number of seconds that have elapsed
##        since January 1, 1970 to the date in question.  This is an inefficient use
##        of memory and of storage.
##     3. As a consequence of (2), members *must* specify a birth year, thereby
##        effectively telling the world how old they are.  This will probably 
##        disuade some members from using the feature when they might have otherwise
##        done so.
##
##   Niels MOD can be found here:
##   http://www.phpbbhacks.com/download/187
##
##   The current Birthday Icon is from Ptirhiik's Profile Control Panel.  The full
##   set of PSDs can be found here (doing a search for "graphics" will yield the exact
##   location):
##   http://rpgnet.clanmckeen.com/demo/download.php
##
##   Here's the direct link:
##   http://rpgnet.clanmckeen.com/mod/mod-profilcp/mod-profilcp%20-%20GIF_src.zip
##
##   The Birthday Icon in the contrib subdirectory is from David Vignoni's LGPL-Licensed
##   Nuvola Icon Theme for KDE 3.x.  The full set of PNGs can be found here (the exact
##   filename / location is nuvola/*/apps/cookie.png):
##   http://icon-king.com/?p=15
##
##   Here's a direct link to the individual PNG:
##   http://en.wikipedia.org/wiki/Image:Nuvola_apps_cookie.png
##
##   LGPL and GPL code can be combined per this:
##   http://groups.google.com/group/netscape.public.mozilla.license/msg/7807049753cfbad6
##
##   The latest version of this mod can be found here:
##   http://www.frostjedi.com/terra/scripts/phpbb/birthdays.zip
##
##   For support / comments / whatever, visit the following URL:
##   http://www.phpbb.com/phpBB/viewtopic.php?t=342028
##
############################################################## 
## MOD History: 
##
##   XXXX-XX-XX - Version 2.0.1
##      - revamped the documentation (Acyd Burn's Attachment MOD documentation inspired me)
##      - the birthday interface now displays in a manner dependant upon $lang['DATE_FORMAT'].
##      - 'yyyy' no longer needs to be inputted to reset birthdays.
##      - fixed a bug whereby dates would show up incorrectly (thanks, Eddy Kiprich!)
##   2005-12-30 - Version 2.0.0
##      - added a new birthday icon (thanks, Ptirhiik!)
##      - added the ability to require dates of birth
##      - added the ability to require years
##      - added the ability to make dates of birth "read-only"
##      - added the ability to make the birthday panel on the main index appear all the time
##      - added the ability to display birthdays that are x days away (where x is definable
##           in the ACP)
##      - added the ability to specify valid age ranges
##   2005-12-05 - Version 1.0.1
##      - added a new birthday icon (thanks, cback!)
##      - removed a superfluous rowspan="2" attribute (thanks, tony44!)
##      - fixed a bug whereby certain birthdates wouldn't be accepted in the ACP (thanks, duena!)
##      - fixed a bug whereby birthdates showed up a day early (thanks, 3Di and Scorpiuscat1!)
##      - fixed a bug whereby avatar galleries would reset birthdates (thanks, 3Di!)
##   2005-11-16 - Version 1.0.0
##      - initial release
############################################################## 
Demo

作者小修正

代碼: 選擇全部

Addon
圖檔

代碼: 選擇全部

############################################################## 
## MOD Title:          Birthdays by TerraFrost 2.0.x- User's Age ADD-ON 
## MOD Author: 3Di < 3d AT phpbb2italia DOT za DOT net > (Marco) http://phpbb2italia.za.net/phpbb2/index.php 
## MOD Description:    Adds a field that displays the current age of your users, just in view topic. 
## MOD Version:        0.2.0 
## 
## Installation Level: (Easy) 
## Installation Time:  5 Minutes 
## Files To Edit: 
##      viewtopic.php, 
##      language/lang_english/lang_main.php, 
##      templates/subSilver/viewtopic_body.tpl 
## Included Files: 
##      N/A 
## 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: 
## 
############################################################## 
## MOD History: 
## 
##   2006-01-27 - Version 0.2.0 
##      - Added the N/A bit when an user hides his own Birthday in profile 
## 
##   2006-01-27 - Version 0.1.0 
##      - first public release 
##      - tested on a fresh 2.0.19 
##      - not tested on EM 
## 
############################################################## 
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD 
############################################################## 
# 
#-----[ OPEN ]------------------------------------------------ 
# 
viewtopic.php 
# 
#-----[ FIND ]------------------------------------------------ 
#the line is longer... 
$sql = "SELECT u.username, u.user_id, u.user_posts 
# 
#-----[ IN-LINE FIND ]---------------------------------------- 
# 
u.user_allowsmile 
# 
#-----[ IN-LINE AFTER, ADD ]---------------------------------- 
# 
, u.user_birthday 
# 
#-----[ FIND ]------------------------------------------------ 
# the line is longer... 
      $yim = ( $postrow[$i]['user_yim'] ) ? 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
      $bday_month_day = floor($postrow[$i]['user_birthday'] / 10000); 
      $bday_year = $postrow[$i]['user_birthday'] - 10000*$bday_month_day; 
      $fudge = ( gmdate('md') < $bday_month_day ) ? 1 : 0; 
      $age = ( $bday_year ) ? ' ('.(gmdate('Y')-$bday_year-$fudge).')' : ''; 
      $lang_bd = ( $bday_year ) ? $lang['bd_user'] : $lang['bd_user_none'];
# 
#-----[ FIND ]------------------------------------------------ 
# 
      'EDITED_MESSAGE' => $l_edited_by, 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
      'POSTER_AGE' => $lang_bd . $age, 
# 
#-----[ OPEN ]------------------------------------------------ 
# 
language/lang_english/lang_main.php 
# 
#-----[ FIND ]------------------------------------------------ 
# 
$lang['bd_user'] = 'User\'s Age: '; 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
$lang['bd_user_none'] = 'User\'s Age: N/A'; 
# 
#-----[ OPEN ]------------------------------------------------ 
# 
language/lang_english/lang_main.php 
# 
#-----[ FIND ]------------------------------------------------ 
# 
$lang['View_Birthdays'] = 'Happy Birthday!'; 
# 
#-----[ AFTER, ADD ]------------------------------------------ 
# 
$lang['bd_user'] = 'User\'s Age: '; 
# 
#-----[ OPEN ]------------------------------------------------ 
# 
templates/subSilver/viewtopic_body.tpl 
# 
#-----[ FIND ]------------------------------------------------ 
# 
   <!-- BEGIN postrow --> 
   <tr> 
# 
#-----[ FIND ]------------------------------------------------ 
# the line is longer... 
      <td width="150" 
# 
#-----[ IN-LINE FIND ]------------------------------------------------ 
# 
{postrow.POSTER_JOINED}<br /> 
# 
#-----[ IN-LINE AFTER, ADD ]------------------------------------------------ 
# 
{postrow.POSTER_AGE}<br /> 
# 
#-----[ SAVE/CLOSE ALL FILES ]-------------------------------- 
# 
# EoM
lang_main.php
$lang['Birthday_range'] = '生日年份必須在 %d 和 %d 之間';
$lang['No_birthdays'] = '今天無會員生日';
$lang['Congratulations'] = '恭喜: <b>%s</b>';
$lang['Upcoming_birthdays'] = '接下來 %d 天生日的會員: <b>%s</b>';
$lang['No_upcoming'] = '在接下來的%d天內,沒有會員生日';
$lang['Birthday'] = '出生日期';
$lang['Month'] = '月';
$lang['Day'] = '日';
$lang['Year'] = '年';
$lang['Clear'] = '清除';
$lang['Year_Optional'] = '年 <i>(選項)</i>';
$lang['Optional'] = '<i>(選項)</i>';
$lang['Default_Month'] = '[ 選擇月份 ]';
$lang['Default_Day'] = 'dd';
$lang['Default_Year'] = 'yyyy';
$lang['Birthday_invalid'] = '你還沒有設定生日';
$lang['Todays_Birthdays'] = '今天生日';
$lang['View_Birthdays'] = '生日快樂!';
lang_admin.php

代碼: 選擇全部

$lang['Birthdays'] = 'Birthdays';
$lang['bday_show'] = 'Birthday Panel Visibility';
$lang['Unconditional'] = 'Unconditional';
$lang['Conditional'] = 'Conditional';
$lang['bday_show_explain'] = 'Determines whether or not the Birthday Panel on the main Index should be visible in the event that there are no birthdays or upcoming birthdays (unconditional = yes, conditional = no)';
$lang['bday_require'] = 'Require Date of Birth';
$lang['bday_require_explain'] = 'The year of birth will only be required if the "Require Year" option is selected';
$lang['bday_year'] = 'Require Year';
$lang['bday_year_explain'] = 'When this option is selected, users attempting to provide a date of birth will also need to provide a year of birth.';
$lang['bday_lock'] = 'Disallow Date of Birth Changes';
$lang['bday_lock_explain'] = 'Once entered, the date of birth cannot be changed, again.  Atleast when this option is selected.';
$lang['bday_lookahead'] = 'Number of Days to Look Ahead';
$lang['bday_lookahead_explain'] = 'Affects the Birthday Panel on the main Index.  Entering -1 will disable Birthday Lookahead';
$lang['bday_age_range'] = 'Allowable Age Range (in years)';
官方認證的生日外掛
雖然已經有Niels的生日外掛
不過Niels 的存在一些問題
並且Niels 並未通過官方認證
另外本外掛功能是更加強大

版本: 2.0.1 (Updated 05/16/06)
時間: ~ 30 分鐘
下載: birthdays2.0.0a.zip
大小: 125305 Bytes
最後由 taicomjp 於 2006-06-19 11:30 編輯,總共編輯了 1 次。
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8510
註冊時間: 2004-04-30 01:54
來自: Taiwan

[分享] 安裝經驗 + 修改 + 中文化

文章 心靈捕手 »

安裝經驗:

在測試論壇試裝, 結果發現:
此外掛的安裝難易度與 Niels 的不相上下, 在功能上也大同小異.
http://phpbb-tw.net/phpbb/viewtopic.php?t=27471

不過, 此外掛多了一些特色:

1. 記錄會員生日的方法不同;
例如, 您的生日若是 '1964-04-16'
那麼此外掛是紀錄 '4161964'
(而後者則紀錄 '-2086'
參考連結 http://phpbb-tw.net/phpbb/viewtopic.php?p=218333#218333 )

2. 由於記錄生日的方法不同,
所以可以設定, 生日是否為必填選項之外,
也可以設定, 生日年份是否為必填選項;

也就是說, 即使設定生日為必填選項,
也可以讓使用者, 自由選擇是否設定生日年份;

3. 可以設定, 是否允許會員變更生日的設定;

4. 可以設定, 是否顯示首頁生日訊息.

--
同時, 也發現幾個問題, 建議修改:
1. 控制台 -> 一般管理 -> 基本組態 -> 生日: 控制選項中, 跑出了一個 '收件人'?
那是因為在英語系的 $lang['To'] = 'To';
而中文語系是翻成 $lang['To'] = '收件人';
以下的修改, 提供您參考:
#
#-----[ OPEN ]-----
#
admin/admin_board.php

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

代碼: 選擇全部

	"L_TO" => $lang['To'],
#
#-----[ REPLACE WITH ]-----
#

代碼: 選擇全部

	//"L_TO" => $lang['To'],
	"L_TO" => $lang['to'],
#
#-----[ OPEN ]-----
#
language/lang_chinese_traditional_taiwan/lang_main.php

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

代碼: 選擇全部

$lang['To'] = '收件人';
#
#-----[ AFTER, ADD ]-----
#

代碼: 選擇全部

$lang['to'] = '到';
#
#-----[ SAVE & CLOSE ]-----
#
#EoM

2. 個人資料的新增語句, 預設比較符合西方人的用法?
以下的修改, 提供您參考:
#
#-----[ OPEN ]-----
#
templates/subSilver/birthday_interface.tpl

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

代碼: 選擇全部

		{BIRTHMONTH_SELECT}
		<input type="text" class="post" name="bday_day" size="2" maxlength="2" value="{BDAY_DAY}" onfocus="this.select()" />, <span class="gensmall">{L_OPTIONAL}</span> <input type="text" class="post" name="bday_year" size="4" maxlength="4" value="{BDAY_YEAR}" onfocus="this.select()" />
#
#-----[ REPLACE WITH ]-----
#

代碼: 選擇全部

		<span class="gen">西元</span> <input type="text" class="post" name="bday_year" size="4" maxlength="4" value="{BDAY_YEAR}" onfocus="this.select()" /> <span class="gen">年</span> <span class="gensmall">{L_OPTIONAL}</span> - {BIRTHMONTH_SELECT} - <input type="text" class="post" name="bday_day" size="2" maxlength="2" value="{BDAY_DAY}" onfocus="this.select()" /> <span class="gen">日</span>
#
#-----[ SAVE & CLOSE ]-----
#
#EoM

--
中文化參考:
#
#-----[ OPEN ]-----
#
language/lang_chinese_traditional_taiwan/lang_admin.php

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

代碼: 選擇全部

?>
#
#-----[ BEFORE, ADD]-----
#

代碼: 選擇全部

$lang['Birthdays'] = '生日';
$lang['bday_show'] = '生日訊息顯示';
$lang['Unconditional'] = '無條件';
$lang['Conditional'] = '有條件';
$lang['bday_show_explain'] = '假如今天沒有會員生日, 或未來幾天內, 沒有會員生日時, 是否仍然要顯示生日訊息? (無條件 = 是, 有條件 = 否)';
$lang['bday_require'] = '必須要填入生日';
$lang['bday_require_explain'] = '即使設定為 "是", 生日年份仍為非必填選項; 除非 "必須要填入年份" 這個選項設定為 "是".';
$lang['bday_year'] = '必須要填入年份';
$lang['bday_year_explain'] = '當這個選項設定為 "是" 時, 會員必須要填入生日年份.';
$lang['bday_lock'] = '不允許變更生日';
$lang['bday_lock_explain'] = '當這個選項設定為 "是" 時, 一旦會員填入生日送出後, 將無法再變更.';
$lang['bday_lookahead'] = '顯示未來幾天內的生日訊息';
$lang['bday_lookahead_explain'] = '在首頁顯示未來幾天內, 即將生日的會員訊息. 輸入 "-1", 將不會顯示這個訊息.';
$lang['bday_age_range'] = '允許的年齡層 (歲數)';
#
#-----[ OPEN ]-----
#
language/lang_chinese_traditional_taiwan/lang_main.php

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

代碼: 選擇全部

?>
#
#-----[ BEFORE, ADD]-----
#

代碼: 選擇全部

$lang['Birthday_range'] = '您的年齡必須在 (包含) %d 和 %d 之間'; 
$lang['No_birthdays'] = '今天沒有會員生日'; 
$lang['Congratulations'] = '恭喜: <b>%s</b>'; 
$lang['Upcoming_birthdays'] = '未來 %d 天內, 即將生日的會員: <b>%s</b>'; 
$lang['No_upcoming'] = '未來 %d 天內, 沒有會員生日'; 
$lang['Birthday'] = '生日'; 
$lang['Month'] = '月'; 
$lang['Day'] = '日'; 
$lang['Year'] = '年'; 
$lang['Clear'] = '清除'; 
$lang['Year_Optional'] = '年 <i>(非必填選項)</i>'; 
$lang['Optional'] = '<i>(非必填選項)</i>'; 
$lang['Default_Month'] = 'mm月'; 
$lang['Default_Day'] = 'dd'; 
$lang['Default_Year'] = 'yyyy'; 
$lang['Birthday_invalid'] = '您設定的生日是無效的'; 
$lang['Todays_Birthdays'] = '生日訊息'; 
$lang['View_Birthdays'] = '生日快樂!';
#
#-----[ SAVE & CLOSE ]-----
#
#EoM
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
頭像
心靈捕手
默默耕耘的老師
默默耕耘的老師
文章: 8510
註冊時間: 2004-04-30 01:54
來自: Taiwan

[教學] 將 '日' 也改為下拉式選單

文章 心靈捕手 »

原來此外掛, 已經有寫好 '日' 相關 (下拉式選單) 語法了.

以下的修改, 提供您參考:
#
#-----[ OPEN ]-----
#
templates/subSilver/birthday_interface.tpl

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

代碼: 選擇全部

<input type="text" class="post" name="bday_day" size="2" maxlength="2" value="{BDAY_DAY}" onfocus="this.select()" /> 
#
#-----[ REPLACE WITH ]-----
#

代碼: 選擇全部

{BIRTHDAY_SELECT} 
#
#-----[ SAVE & CLOSE ]-----
#
#EoM
施比受有福,祝福您好運! ^_^
歡迎光臨★★心靈捕手★★ :: 討論區
https://wang5555.dnsfor.me/phpBB3/
主題已鎖定

回到「官方認證外掛」