[外掛]強制報到plus
發表於 : 2004-11-29 06:59
代碼: 選擇全部
##############################################################
## 外掛名稱: 強制報到plus
## 外掛作者: 御津闇慈 < zxery3@hotmail.com >
## 外掛簡介: 一個強制會員到指定版面完成報到手續的外掛
## 外掛版本: 0.0.1
##
## 安裝難度: 稍微困難\r
## 安裝時間: 30 分鐘
## 修改檔案: 9
## posting.php
## viewtopic.php
## includes/functions_post.php
## admin/admin_board.php
## admin/admin_users.php
## templates/subSilver/admin/board_config_body.tpl
## templates/subSilver/admin/user_edit_body.tpl
## language/lang_chinese_traditional_taiwan/lang_admin.php
## language/lang_chinese_traditional_taiwan/lang_main.php
##
## 加入檔案: 0
## 新增加資料庫數值: 2
##############################################################
## 作者之言:
## 這個外掛不支援 Advanced Quick Reply 與 Quick Reply(超懶惰!?)
## ,請自行加裝在 Advanced Quick Reply 與 Quick Reply 上。
##
## - ACP: 可從後台指定版面強制讓會員到該版面完成註冊手續(小白轟殺專用!?)
## - 版主無此限制\r
## - 管理員無此限制(U_U||假如有限制大概會被劈死)
##############################################################
## Version History
## v0.0.1
## - 版本釋出\r
##############################################################
## 安裝此外掛之前請先備份好你的論壇。
##############################################################
#
#-----[ SQL ADD ]------------------------------------------
#
ALTER TABLE phpbb_users ADD user_checkin TINYINT( 1 ) DEFAULT '0' NOT NULL ;
INSERT INTO phpbb_config (config_name , config_value) VALUES ('checkin_coden', '0');
#
#-----[ OPEN ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
$lang['User_allowavatar'] = '允許使用個人頭像';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$lang['User_checkin'] = '報到手續是否完成';
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Checkin'] = '強制報到指定版面';
$lang['Checkin_coden_explain'] = '這裡你可以設定指定報到的版面編號,0 為關閉。';
#
#-----[ OPEN ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['Checkin_Warning'] = '請先完成報到手續,謝謝<br\><B></BR><a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=%s") . '">點此</a>進入該版面報到</B>';
$lang['Checkin_Error'] = '報到手續沒完成';
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_board.php
#
#-----[ FIND ]------------------------------------------
#
"L_RESET" => $lang['Reset'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
"L_CHECKIN" => $lang['Checkin'],
"L_CHECKIN_CODEN_EXPLAIN" => $lang['Checkin_coden_explain'],
"CHECKIN_CODEN" => $new['checkin_coden'],
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND ]------------------------------------------
#
generate_smilies('inline', PAGE_POSTING);
#
#-----[ AFTER, ADD ]------------------------------------------
#
if($board_config['checkin_coden'] != 0)//起動條件後台的checkin_coden不等於0
{
if ((($mode == "newtopic" )||($mode == "reply" ))&& $forum_id != $board_config['checkin_coden'] && $userdata['user_level'] == 0 && $userdata['user_checkin'] == 0)//啟動條件:現在版面不等於指定版面,發表或回應,一般會員,checkin值等於0
{
message_die(GENERAL_MESSAGE, sprintf($lang['Checkin_Warning'], $board_config['checkin_coden']) , $lang['Checkin_Error']); // 顯示警告訊息
}
elseif (($mode == "reply" ) && $forum_id == $board_config['checkin_coden'] && $userdata['user_level'] == 0 && $userdata['user_checkin'] == 0)//啟動條件:現在版面等於指定版面,回應,一般會員,checkin值等於0
{
message_die(GENERAL_MESSAGE, sprintf($lang['Checkin_Warning'], $board_config['checkin_coden']) , $lang['Checkin_Error']); // 顯示警告訊息
}
}
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND ]------------------------------------------
#
//
// Go ahead and pull all data for this topic
//
$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
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
#
#-----[ IN-LINE, FIND ]--------------------------------------------
#
, u.user_allowsmile
#
#-----[ IN-LINE AFTER, ADD ]--------------------------------------------
#
, u.user_checkin
#
#-----[ FIND ]------------------------------------------
#
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
if($board_config['checkin_coden'] != 0)//起動條件後台的checkin_coden不等於0
{
if ($forum_id != $board_config['checkin_coden'] && $userdata['user_level'] == 0 && $userdata['user_checkin'] == 0)//啟動條件(一般會員,現在版面不等於後台指定版面,checkin值等於0)
{
message_die(GENERAL_MESSAGE, sprintf($lang['Checkin_Warning'], $board_config['checkin_coden']) , $lang['Checkin_Error']); // 顯示警告訊息
}
}
#-----[ OPEN ]------------------------------------------
#
includes/functions_post.php
#
#-----[ FIND ]------------------------------------------
#
function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$user_id)
{
global $db;
#
#-----[ REPLACE WITH ]------------------------------------------
#
function update_post_stats(&$mode, &$post_data, &$forum_id, &$topic_id, &$post_id, &$user_id)
{
global $db, $board_config;
global $userdata;
#
#-----[ FIND ]------------------------------------------
#
if ($topic_update_sql != '')
{
$sql = "UPDATE " . TOPICS_TABLE . " SET
$topic_update_sql
WHERE topic_id = $topic_id";
if (!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
}
}
if ($mode != 'poll_delete')
{
#
#-----[ AFTER, ADD ]------------------------------------------
#
if($board_config['checkin_coden'] != 0)//起動條件後台的checkin_coden不等於0
{
$config_checkin = $board_config['checkin_coden'];
if (( $mode == "newtopic" ) && $forum_id == $config_checkin && $userdata['user_level'] == 0 && $userdata['user_checkin'] == 0)//啟動條件(發表文章,一般會員,現在版面等於後台指定版面,checkin值等於0)
{
$checkin= ", user_checkin = 1"; // CHECKIN值等於1
}
}
#
#-----[ FIND ]------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts $sign
#
#-----[ REPLACE WITH ]------------------------------------------
#
$sql = "UPDATE " . USERS_TABLE . "
SET user_posts = user_posts $sign $checkin
#
#-----[ OPEN ]------------------------------------------
#
admin/admin_users.php
#
#-----[ FIND ]------------------------------------------
#
$user_allowavatar = ( !empty($HTTP_POST_VARS['user_allowavatar']) ) ? intval( $HTTP_POST_VARS['user_allowavatar'] ) : 0;
#
#-----[ AFTER, ADD ]------------------------------------------
#
$user_checkin = ( !empty($HTTP_POST_VARS['user_checkin']) ) ? intval( $HTTP_POST_VARS['user_checkin'] ) : 0;
#
#-----[ FIND ]------------------------------------------
#
//
// Update entry in DB
//
if( !$error )
{
$sql = "UPDATE " . USERS_TABLE . "
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("\'", "''", $email) . "', user_icq = '" . str_replace("\'", "''", $icq) . "', user_website = '" . str_replace("\'", "''", $website) . "', user_occ = '" . str_replace("\'", "''", $occupation) . "', user_from = '" . str_replace("\'", "''", $location) . "', user_interests = '" . str_replace("\'", "''", $interests) . "', user_sig = '" . str_replace("\'", "''", $signature) . "', user_viewemail = $viewemail, user_aim = '" . str_replace("\'", "''", $aim) . "', user_yim = '" . str_replace("\'", "''", $yim) . "', user_msnm = '" . str_replace("\'", "''", $msn) . "', user_attachsig = $attachsig, user_sig_bbcode_uid = '$signature_bbcode_uid', user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_notify = $notifyreply, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_popup_pm = $popuppm, user_lang = '" . str_replace("\'", "''", $user_lang) . "', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '" . str_replace("\'", "''", $user_dateformat) . "', user_active = $user_status, user_rank = $user_rank" . $avatar_sql . "
WHERE user_id = $user_id";
#
#-----[ IN-LINE, FIND ]--------------------------------------------
#
, user_allowavatar = $user_allowavatar
#
#-----[ IN-LINE AFTER, ADD ]--------------------------------------------
#
, user_checkin = $user_checkin
#
#-----[ FIND ]------------------------------------------
#
$user_allowavatar = $this_userdata['user_allowavatar'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
$user_checkin = $this_userdata['user_checkin'];
#
#-----[ FIND ]------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="user_allowavatar" value="' . $user_allowavatar . '" />';
#
#-----[ AFTER, ADD ]------------------------------------------
#
$s_hidden_fields .= '<input type="hidden" name="user_checkin" value="' . $user_checkin . '" />';
#
#-----[ FIND ]------------------------------------------
#
'L_ALLOW_AVATAR' => $lang['User_allowavatar'],
#
#-----[ AFTER, ADD ]------------------------------------------
#
'L_ALLOW_CHECKIN' => $lang['User_checkin'],
#
#-----[ FIND ]------------------------------------------
#
'ALLOW_AVATAR_YES' => ($user_allowavatar) ? 'checked="checked"' : '',
'ALLOW_AVATAR_NO' => (!$user_allowavatar) ? 'checked="checked"' : '',
#
#-----[ AFTER, ADD ]------------------------------------------
#
'ALLOW_CHECKIN_YES' => ($user_checkin) ? 'checked="checked"' : '',
'ALLOW_CHECKIN_NO' => (!$user_checkin) ? 'checked="checked"' : '',
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/board_config_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1">{L_HOT_THRESHOLD}</td>
<td class="row2"><input class="post" type="text" name="hot_threshold" size="3" maxlength="4" value="{HOT_TOPIC}" /></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1">{L_CHECKIN}<br />{L_CHECKIN_CODEN_EXPLAIN}</td>
<td class="row2"><input class="post" type="text" name="checkin_coden" size="3" maxlength="4" value="{CHECKIN_CODEN}" /></td>
</tr>
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/admin/user_edit_body.tpl
#
#-----[ FIND ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_ALLOW_AVATAR}</span></td>
<td class="row2">
<input type="radio" name="user_allowavatar" value="1" {ALLOW_AVATAR_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="user_allowavatar" value="0" {ALLOW_AVATAR_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<tr>
<td class="row1"><span class="gen">{L_ALLOW_CHECKIN}</span></td>
<td class="row2">
<input type="radio" name="user_checkin" value="1" {ALLOW_CHECKIN_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="user_checkin" value="0" {ALLOW_CHECKIN_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM