Commend User
即註冊時輸入推薦者名稱\r
而這推薦者就會獲得某些獎勵\r
我在論壇找到關於Commend User phpbb 下載的文章~
但是沒有載點......
[外掛] 求....Commend User phpbb 載點>///<
版主: 版主管理群
我這有耶...
代碼: 選擇全部
#######################################################
## Title/名稱: Commend User/推薦會員制\r
## Version/版本: 1.1.5
## Author/原創: yuan < yuan@hibo.idv.tw >
## WebSite/網站: http://www.angeleyes.idv.tw , http://www.hibo.idv.tw
## Description/簡介:
## commend new user join your board and active them by registered user
## 由已註冊的會員推薦新會員?#91;入你的網站並且?#123;證他們的帳號
##
## Phpbb Version/適用版本: phpbb 2.0.8
##
## Install Level/安裝等級: Easy/簡單\r
## Install Time/安裝時間: 5 Min/5 分鐘
## Edit Files/編輯檔案:
## language/lang_chinese_traditional_taiwan/lang_main.php
## language/lang_english/lang_main.php
## includes/constants.php
## admin/admin_board.php
## templates/subsilver/admin/board_config_body.tpl
## includes/usercp_register.php
## includes/usercp_activate.php
## templates/subSilver/profile_add_body.tpl
## viewtopic.php
## templates/subSilver/viewtopic_body.tpl
## Create Files/建立檔案:
## language/lang_chinese_traditional_taiwan/email/commend_welcome_inactive.tpl
## language/lang_english/email/commend_welcome_inactive.tpl
#######################################################
## Before Adding This MOD To Your Forum,
## You Should Back Up All Files Related To This MOD
## 在安裝本外掛到你的討論區前,請記得先備份\r
#######################################################
## You can show this mod`s description on your board, but you can`t post it
## before you have my Permission or post to your web by myself
## 你可以在您的網站上介紹本外掛,但不可以發佈本外掛部份或完整資訊
## 除非你得到我的許可或是由我本人發表在你的站上
#######################################################
## You can download this mod on my board
## 你可以在我的站上下載此外掛
## http://www.angeleyes.idv.tw/phpbb/dload.php?action=file&file_id=2
#######################################################
## History/改版歷?#123;:
## 1.0.0 - 2004/05/01 - creat on phpbb 2.0.8/建立於 phpbb 2.0.8
## 1.1.0 - 2004/05/05 - add commend description and viewtopic/?#91;入自我介紹資訊及顯示
## 1.1.2 - 2004/05/06 - add close window and fix error/?#91;入關閉視窗及修正錯誤
## 1.1.3 - 2004/05/06 - fix viewtopic/修正顯示問題
## 1.1.4 - 2004/05/09 - fix profile edit/修正個人資料編輯問題
## 1.1.5 - 2004/05/09 - fix usercp_activate/修正會員已?#123;證問題
#######################################################
#
#------------------[ SQL ]------------------
#
ALTER TABLE phpbb_users ADD presenter varchar(25) NOT NULL;
#
#------------------[ OPEN ]------------------
#
language/lang_chinese_traditional_taiwan/lang_main.php
#
#------------------[ FIND ]------------------
#
//
// That's all, Folks!
// -------------------------------------------------
?>
#
#------------------[ BEFORE, ADD ]------------------
#
// Start Commend Mod
$lang['Commend'] = '推薦制';
$lang['commend_subject'] = '來自於您所推薦的會員 %s 的訊息';
$lang['commend_messages'] = '<br /><br />別忘了<br />您是我的推薦人, 記得要幫我 [url=%s] ?#123;證 [/url] 這樣我才能進入這裡喲~ <br /><br />謝謝您~ 我的好朋友.';
$lang['commend_account_active'] = '感謝您的推薦,讓本站人氣更旺';
$lang['account_inactive_commend'] = '您的帳號已經建立. 然而, 您的帳號還得請您的推薦人給予?#123;證才能夠啟用.<br />當您的帳號通過推薦人的?#123;證後將會寄一封通知信給您知悉.';
$lang['already_commended'] = '您已完成?#123;證過該會員';
$lang['presenter'] = '推薦人';
$lang['presenter_not_true'] = '您所選擇的推薦人並不存在';
$lang['presenter_not_active'] = '您所選擇的推薦人的帳號已被停用';
$lang['commend_description'] = '給推薦人的訊息(最少需 %s 字元)';
$lang['commend_description_length'] = '給推薦人的訊息資訊不夠';
// End Commend Mod
#
#------------------[ OPEN ]------------------
#
language/lang_english/lang_main.php
#
#------------------[ FIND ]------------------
#
//
// That's all, Folks!
// -------------------------------------------------
?>
#
#------------------[ BEFORE, ADD ]------------------
#
// Start Commend Mod
$lang['Commend'] = 'Commend';
$lang['commend_subject'] = 'From your presentee %s message';
$lang['commend_messages'] = '<br /><br />Don`t forget ~!<br />You are my presenter, please [url=%s]check here[/url] to let me join. <br /><br />Thank You~ My Friend.';
$lang['commend_account_active'] = 'Thank you for commend';
$lang['account_inactive_commend'] = 'Your account has been created. But, you must waiting for your Presenter to check you message than you can login to forum.';
$lang['already_commended'] = 'You already check this presentee';
$lang['presenter'] = 'Presenter';
$lang['presenter_not_true'] = 'Your Presenter is not true';
$lang['presenter_not_active'] = 'Your Presenter is not active';
$lang['commend_description'] = 'Description by yourself(limit char %s )';
$lang['commend_description_length'] = 'Your description char length not enough';
// End Commend Mod
#
#------------------[ OPEN ]------------------
#
includes/constants.php
#
#------------------[ FIND ]------------------
#
define('USER_ACTIVATION_SELF', 1);
#
#------------------[ AFTER, ADD ]------------------
#
// Start Commend Mod
define('USER_ACTIVATION_COMMEND', 3);
// End Commend Mod
#
#------------------[ OPEN ]------------------
#
admin/admin_board.php
#
#------------------[ FIND ]------------------
#
$activation_user = ( $new['require_activation'] == USER_ACTIVATION_SELF ) ? "checked=\"checked\"" : "";
#
#------------------[ AFTER, ADD ]------------------
#
// Start Commend Mod
$activation_commend = ( $new['require_activation'] == USER_ACTIVATION_COMMEND ) ? "checked=\"checked\"" : "";
// End Commend Mod
#
#------------------[ FIND ]------------------
#
"ACTIVATION_USER_CHECKED" => $activation_user,
#
#------------------[ AFTER, ADD ]------------------
#
// Start Commend Mod
"ACTIVATION_COMMEND" => USER_ACTIVATION_COMMEND,
"ACTIVATION_COMMEND_CHECKED" => $activation_commend,
"L_COMMEND" => $lang['Commend'],
// End Commend Mod
#
#------------------[ OPEN ]------------------
#
templates/subsilver/admin/board_config_body.tpl
#
#------------------[ FIND ]------------------
#
<input type="radio" name="require_activation" value="{ACTIVATION_USER}" {ACTIVATION_USER_CHECKED} />{L_USER}
#
#------------------[ AFTER, ADD ]------------------
#
<input type="radio" name="require_activation" value="{ACTIVATION_COMMEND}" {ACTIVATION_COMMEND_CHECKED} />{L_COMMEND}
#
#------------------[ OPEN ]------------------
#
includes/usercp_register.php
#
#------------------[ FIND ]------------------
#
$page_title = ( $mode == 'editprofile' ) ? $lang['Edit_profile'] : $lang['Register'];
#
#------------------[ AFTER, ADD ]------------------
#
// Start Commend Mod
$commend_description_limit = '20';
// End Commend Mod
#
#------------------[ FIND ]------------------
#
if ( (isset($HTTP_POST_VARS['avatargallery']) || isset($HTTP_POST_VARS['submitavatar']) || isset($HTTP_POST_VARS['cancelavatar'])) && (!isset($HTTP_POST_VARS['submit'])) )
{
$username = stripslashes($username);
#
#------------------[ AFTER, ADD ]------------------
#
// Start Commend Mod
$presenter = stripslashes($presenter);
$commend_description = stripslashes($commend_description);
// End Commend Mod
#
#------------------[ FIND ]------------------
#
else if ( $mode == 'register' )
{
if ( empty($username)
#
#------------------[ AFTER, ADD ]------------------
#
|| ( ( empty($presenter) || empty($commend_description) ) && ( $board_config['require_activation'] == USER_ACTIVATION_COMMEND ) )
#
#------------------[ FIND ]------------------
#
$passwd_sql = '';
if ( !empty($new_password) && !empty($password_confirm) )
#
#------------------[ BEFORE, ADD ]------------------
#
// Start Commend Mod
if ( $board_config['require_activation'] == USER_ACTIVATION_COMMEND && !($mode == 'editprofile') )
{
if ( !empty($presenter) )
{
$sql = "SELECT user_id, user_active
FROM " . USERS_TABLE . "
WHERE username = '" . $presenter . "'";
if (!$result = $db->sql_query($sql))
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['presenter_not_true'];
}
$row = $db->sql_fetchrow($result);
$presenter_user_id = $row['user_id'];
$presenter_user_active = $row['user_active'];
if ( $presenter_user_id == '' )
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['presenter_not_true'];
} else if ( !$presenter_user_active )
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['presenter_not_active'];
}
}
if ( !empty($commend_description) )
{
if ( strlen($commend_description) < $commend_description_limit )
{
$error = TRUE;
$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['commend_description_length'];
}
}
}
// End Commend Mod
#
#------------------[ FIND ]------------------
#
//
// Get current date
//
$sql = "INSERT INTO " . USERS_TABLE . " (user_id, username,
#
#------------------[ AFTER, ADD ]------------------
#
presenter,
#
#------------------[ FIND ]------------------
#
VALUES ($user_id, '" . str_replace("\'", "''", $username) . "',
#
#------------------[ AFTER, ADD ]------------------
#
'" . str_replace("\'", "''", $presenter) . "',
#
#------------------[ FIND ]------------------
#
if ( $board_config['require_activation'] == USER_ACTIVATION_SELF
#
#------------------[ AFTER, ADD ]------------------
#
|| $board_config['require_activation'] == USER_ACTIVATION_COMMEND
#
#------------------[ FIND ]------------------
#
if ( !($result = $db->sql_query($sql, BEGIN_TRANSACTION)) )
{
message_die(GENERAL_ERROR, 'Could not insert data into users table', '', __LINE__, __FILE__, $sql);
}
#
#------------------[ AFTER, ADD ]------------------
#
// Start Commend Mod
if ( $board_config['require_activation'] == USER_ACTIVATION_COMMEND && $presenter_user_id != '' )
{
$sql = "UPDATE " . USERS_TABLE . "
SET user_new_privmsg = '1', user_last_privmsg = '9999999999'
WHERE user_id = $presenter_user_id";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update users table', '', __LINE__, __FILE__, $sql);
}
$commend_subject = $lang['commend_subject'];
$commend_messages = $commend_description;
$commend_messages .= $lang['commend_messages'];
$commend_date = date("U");
$sql = "INSERT INTO " . PRIVMSGS_TABLE . " (privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_enable_html, privmsgs_enable_bbcode, privmsgs_enable_smilies, privmsgs_attach_sig) VALUES ('0', '" . str_replace("\'", "''", addslashes(sprintf($commend_subject,$username))) . "', " . $user_id . ", " . $presenter_user_id . ", " . $commend_date . ", '0', '1', '1', '0')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not insert commend message and sent', '', __LINE__, __FILE__, $sql);
}
$get_privmsgs_next_id = $db->sql_nextid();
$commend_active_key = $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey;
$sql = "INSERT INTO " . PRIVMSGS_TEXT_TABLE . " (privmsgs_text_id, privmsgs_text) VALUES ($get_privmsgs_next_id, '" . str_replace("\'", "''", addslashes(sprintf($commend_messages,$commend_active_key,$commend_active_key))) . "')";
if ( !$db->sql_query($sql) )
{
message_die(GENERAL_ERROR, 'Could not insert commend message and sent', '', __LINE__, __FILE__, $sql);
}
}
// End Commend Mod
#
#------------------[ FIND ]------------------
#
else if ( $board_config['require_activation'] == USER_ACTIVATION_SELF )
{
$message = $lang['Account_inactive'];
$email_template = 'user_welcome_inactive';
}
#
#------------------[ AFTER, ADD ]------------------
#
// Start Commend Mod
else if ( $board_config['require_activation'] == USER_ACTIVATION_COMMEND )
{
$message = $lang['account_inactive_commend'];
$email_template = 'commend_welcome_inactive';
}
// End Commend Mod
#
#------------------[ FIND ]------------------
#
//
// If an error occured we need to stripslashes on returned data
//
$username = stripslashes($username);
#
#------------------[ AFTER, ADD ]------------------
#
// Start Commend Mod
$presenter = stripslashes($presenter);
$commend_description = stripslashes($commend_description);
// End Commend Mod
#
#------------------[ FIND ]------------------
#
$template->assign_vars(array(
'USERNAME' => $username,
#
#------------------[ AFTER, ADD ]------------------
#
// Start Commend Mod
'L_PRESENTER' => $lang['presenter'],
'L_COMMEND_DESCRIPTION' => sprintf($lang['commend_description'], $commend_description_limit),
'COMMEND_ACTIVE' => ( ( $board_config['require_activation'] == USER_ACTIVATION_COMMEND && !($mode == 'editprofile') ) ? '*':''),
'COMMEND_INPUT' => ( ( $board_config['require_activation'] == USER_ACTIVATION_COMMEND && !($mode == 'editprofile') ) ? '<input type="text" class="post" style="width:200px" name="presenter" size="25" maxlength="25" value="'. $presenter . '" />':''),
'COMMEND_INPUTD' => ( ( $board_config['require_activation'] == USER_ACTIVATION_COMMEND && !($mode == 'editprofile') ) ? '<input type="text" class="post" style="width:200px" name="commend_description" size="25" maxlength="60" value="'. $commend_description . '" />':''),
// End Commend Mod
#
#------------------[ OPEN ]------------------
#
includes/usercp_activate.php
#
#------------------[ FIND ]------------------
#
$lang['Already_activated']
#
#------------------[ REPLACE ]------------------
#
(( $board_config['require_activation'] == USER_ACTIVATION_COMMEND ) ? $lang['already_commended'] . '<br /><br /><a href="javascript:window.close();" class="genmed">' . $lang['Close_window'] . '</a>' : $lang['Already_activated'] )
#
#------------------[ FIND ]------------------
#
$lang['Account_active']
#
#------------------[ REPLACE ]------------------
#
(( $board_config['require_activation'] == USER_ACTIVATION_COMMEND ) ? $lang['commend_account_active'] . '<br /><br /><a href="javascript:window.close();" class="genmed">' . $lang['Close_window'] . '</a>' : $lang['Account_active'] )
#
#------------------[ OPEN ]------------------
#
templates/subSilver/profile_add_body.tpl
#
#------------------[ FIND ]------------------
#
<!-- BEGIN switch_namechange_allowed -->
<tr>
<td class="row1" width="38%"><span class="gen">{L_USERNAME}: *</span></td>
<td class="row2"><input type="text" class="post" style="width:200px" name="username" size="25" maxlength="25" value="{USERNAME}" /></td>
</tr>
<!-- END switch_namechange_allowed -->
#
#------------------[ AFTER, ADD ]------------------
#
<tr>
<td class="row1" width="38%"><span class="gen">{L_PRESENTER}: {COMMEND_ACTIVE}</span></td>
<td class="row2">{COMMEND_INPUT}</td>
</tr>
<tr>
<td class="row1" width="38%"><span class="gen">{L_COMMEND_DESCRIPTION}: {COMMEND_ACTIVE}</span></td>
<td class="row2">{COMMEND_INPUTD}</td>
</tr>
#
#------------------[ OPEN ]------------------
#
viewtopic.php
#
#------------------[ FIND ]------------------
#
$sql = "SELECT u.username, u.user_id, u.user_posts, u.user_from, u.user_website, u.user_email, u.user_icq, u.user_aim, u.user_yim, u.user_regdate, u.user_msnm, u.user_viewemail, u.user_rank, u.user_sig, u.user_sig_bbcode_uid, u.user_avatar, u.user_avatar_type, u.user_allowavatar, u.user_allowsmile, p.*, pt.post_text, pt.post_subject, pt.bbcode_uid
#
#------------------[ REPLACE ]------------------
#
// Start Commend Mod
$sql = "SELECT u.*, p.*, pt.*
#
#------------------[ FIND ]------------------
#
$poster_id = $postrow[$i]['user_id'];
#
#------------------[ AFTER, ADD ]------------------
#
// Start Commend Mod
$presenter = $postrow[$i]['presenter'];
// End Commend Mod
#
#------------------[ FIND ]------------------
#
'EDITED_MESSAGE' => $l_edited_by,
#
#------------------[ AFTER, ADD ]------------------
#
// Start Commend Mod
'POSTER_PRESENTER' => $presenter,
// End Commend Mod
#
#------------------[ OPEN ]------------------
#
templates/subSilver/viewtopic_body.tpl
#
#------------------[ FIND ]------------------
#
{postrow.POSTER_JOINED}
#
#------------------[ BEFORE, ADD ]------------------\r
#
{postrow.POSTER_PRESENTER}<br />
#
#------------------[ CREATE NEW FILE ]------------------
#
language/lang_chinese_traditional_taiwan/email/commend_welcome_inactive.tpl
#
#------------------[ TEXT ]------------------
#
Subject: 歡迎光?#123; {SITENAME} 討論區
Charset: big5
{WELCOME_MSG}
請妥善保留這封電子郵件. 您的帳號資料如下:
----------------------------
帳號: {USERNAME}
密碼: {PASSWORD}
----------------------------
您的帳號尚未啟用, 您必須等待您的推薦人給予?#123;證後才許可登入本站
請不要忘記您的密碼, ?#93;為所有密碼均經過?#91;密處理, 就連系統管理員?#93;無法取得. 然而, 如果您忘記了密碼, 您可以重新申請一組新的密碼, 系統將會寄發新的密碼給您.
感謝您的註冊.
{EMAIL_SIG}
#
#------------------[ CREATE NEW FILE ]------------------
#
language/lang_english/email/commend_welcome_inactive.tpl
#
#------------------[ TEXT ]------------------
#
Subject: Welcome to {SITENAME} Forums
Charset: iso-8859-1
{WELCOME_MSG}
Please keep this email for your records. Your account information is as follows:
----------------------------
Username: {USERNAME}
Password: {PASSWORD}
----------------------------
Your account is currently inactive, but you must waiting for your presenter to check then you can login to forum.
Please do not forget your password as it has been encrypted in our database and we cannot retrieve it for you. However, should you forget your password you can request a new one which will be activated in the same way as this account.
Thank you for registering.
{EMAIL_SIG}
#
#------------------[ SAVE AND CLOSE ALL FILES ]------------------
#不是不支援, 而是當初寫這mod時是用全域變數在傳資料
推測應該是作者當時的開發環境是register_globals為on
試看看底下的修正, 我稍微測了一下是ok的
(沒有測試實際寫入資料庫、發信及帳號啟用的部份)
#
#--------[ OPEN ]----------------
#
includes/usercp_register.php
#
#--------[ FIND ]----------------
#
#
#--------[ IN-LINE FIND ]----------------
#
#
#--------[ IN-LINE AFTER, ADD ]----------------
#
#
#--------[ FIND ]----------------
#
#
#--------[ AFTER, ADD ]----------------
#
#
#--------[ CLOSE/SAVE ALL FILES]----------------
#
# EoM
推測應該是作者當時的開發環境是register_globals為on
試看看底下的修正, 我稍微測了一下是ok的
(沒有測試實際寫入資料庫、發信及帳號啟用的部份)
#
#--------[ OPEN ]----------------
#
includes/usercp_register.php
#
#--------[ FIND ]----------------
#
代碼: 選擇全部
$strip_var_list = array('email' => 'email',#--------[ IN-LINE FIND ]----------------
#
代碼: 選擇全部
'confirm_code' => 'confirm_code'#--------[ IN-LINE AFTER, ADD ]----------------
#
代碼: 選擇全部
, 'commend_description' => 'commend_description'#--------[ FIND ]----------------
#
代碼: 選擇全部
$username = ( !empty($HTTP_POST_VARS['username']) ) ? phpbb_clean_username($HTTP_POST_VARS['username']) : '';#--------[ AFTER, ADD ]----------------
#
代碼: 選擇全部
$presenter = ( !empty($HTTP_POST_VARS['presenter']) ) ? phpbb_clean_username($HTTP_POST_VARS['presenter']) : '';#--------[ CLOSE/SAVE ALL FILES]----------------
#
# EoM
謝絕所有私人訊息詢問外掛相關問題
有問題請直接於版上發表, 集思廣議絕對比專挑特定人士詢問來的好
竹貓禁止發表含破解相關的軟體, 違者砍文
不要跟我講別的地方都可以發, 為什麼竹貓就不行
免費不等於破解, 傻傻的搞不清楚
有問題請直接於版上發表, 集思廣議絕對比專挑特定人士詢問來的好
竹貓禁止發表含破解相關的軟體, 違者砍文
不要跟我講別的地方都可以發, 為什麼竹貓就不行
免費不等於破解, 傻傻的搞不清楚


