|
論壇說明 |
歡迎您來到『史萊姆論壇』 ^___^ 您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的! 請點擊這裡:『註冊成為我們的一份子!』 |
|
主題工具 | 顯示模式 |
2005-06-21, 03:51 PM | #1 |
長老會員
|
多重簽名檔功能
#######################################################################
# # Multiple Signatures Hack # Allows for multiple signatures in vBulletin 3 (RC1) # # Hacked by Ethan Tan # ####################################################################### ####################################################################### # # WARNING: ####################################################################### # # Do a database backup and the follow files: # profile.php, includes/functions_showthread.php # # This hack is provided 'as-is'. No warranties. # ####################################################################### ####################################################################### # # Revision History: ####################################################################### 04 Jan 2004, 0400hrs (GMT+8) Initial Beta Release (for vB3 RC1) 04 Jan 2004, 0500hrs (GMT+8) Fixed: When editing signature with WYSIWYG editor, changing the selected signature does not update the WYSIWYG with the signature. 04 Jan 2004, 1200hrs (GMT+8) Fixed: Miscellanous typo in this document. Fixed: Empty signature shown in post/PM after user removed signature. Fixed: Disallow user from selecting an empty signature. Fixed: Removed hardcoded 'No' with $vbphrase[no]. Changed:Editing a post that has a empty signature now automatically remove the signature. New: Now remember user's last edited signature. 04 Jan 2004, 1630hrs (GMT+8) Fixed: Signature showing up only once per thread. New: Random Signatures. New: User may choose the default signature type (random/last edited) for new posts and private messages. 05 Jan 2004, 1400hrs (GMT+8) Changed:Order of installation to allow updates of default values. Changed:Loop instead of if/else statements for new default signature. Changed:Use $vbphrase[none] instead of $vbphrase[no]. Changed:Use of $vbphrase[sigopt_*] for template conditionals to allow changes to be made to the option titles without having to re-edit the templates. New: Use of signature titles instead of numbers. 06 Jan 2004, 1130hrs (GMT+8) Fixed: More typos: $vbphrase[signopt_none] to $vbphrase[sigopt_none] 'Random Signature' in pm_newpm to $vbphrase[sigopt_random] Changed:Renamed $vbphrase[none] --> $vbphrase[sig_none] Changed:Renamed $vbphrase[sigrand] --> $vbphrase[sig_random] Changed:User Profile Options to use a dropdown box Changed:Comments to delimits code changes in changed php files. New: Signature editor open with last edited signature. New: Phrase $vbphrase[sigopt_first] New: Now with option to allow user to use his/her first signature as the default signature. New: Tested with vB3 RC2 06 Jan 2004, 2200hrs (GMT+8) Fixed: Another typo in instruction. ####################################################################### # # Todo: ####################################################################### - Replace the same with numeric value in template conditionals. ####################################################################### # # AdminCP: 在 語言 & 管理 方面, 選擇短語管理並新增短語 ####################################################################### 短語類型: GLOBAL 變量名稱: sig_none Text: None 中文: 無 #### 短語類型: GLOBAL 變量名稱: sig_random Text: Random 中文: 隨機 #### 短語類型: GLOBAL 變量名稱: sigopt_first Text: First Signature 中文: 主要簽名 #### 短語類型: GLOBAL 變量名稱: sigopt_lastedited Text: Last Edited Signature 中文: 最後編輯的簽名 #### 短語類型: GLOBAL 變量名稱: sigopt_random Text: Random Signature 中文: 隨機顯示簽名 #### 短語類型: GLOBAL 變量名稱: sigopt_none Text: No Signature 中文: 不顯示簽名 ##### 短語類型: User tool (global) 變量名稱: sigopt_title Text: Signature Title 中文: 簽名標題 ####################################################################### # # AdminCP: 在 用戶資料設定方面,增加新用戶資料欄目 ####################################################################### ** Please note that the values entered under options should be the same ** as those entered in the previous section (Add Phrases). 資料欄目類型: 單選列表 標題: 預設簽名 描述: 您可以在您發表的每篇文章或私人訊息中顯示您的預設簽名。 選項: 顯示主要簽名 顯示隨機簽名 最後編輯簽名 不顯示簽名 設為預設: 是,但沒有第一個空白選項 顯示順序: 不用特別更改 必填欄目: 是 此欄目可以被用戶編輯: 是 此欄目在用戶資料頁中隱藏: 否 此欄目可以在會員列表中被搜尋: 否 在會員列表中顯示: 否 允許用戶在此選項中輸入自己的值: 否 允許用戶輸入的最大長度: 100 顯示大小: 25 正則表達式: Leave blank 哪一頁顯示此選項: 其他 ##### Take note of the 'Name' of the new field after saving. Please note that throughout the rest of this document, fieldX will refer to this name (without the quotes). |
__________________ 給自己看也給所有需要這些話鼓勵的人看! 認真不一定會得到美好的結果,但是不認真就一定沒有 想要有什麼結果,就秉持你的雙手 放手去做 總比什麼都沒付出最後失敗了才嘆氣來的好吧 沒努力的人.沒有資格說放棄 努力過的人.更要有勇氣繼續努力下去
|
|
送花文章: 1,
|
2005-06-21, 03:52 PM | #2 (permalink) |
長老會員
|
#######################################################################
# # AdminCP: 在 引入 & 維護選項, 執行 MySQL 查詢 升級資料庫 ####################################################################### ALTER TABLE userfield ADD lastsignatureid SMALLINT NOT NULL DEFAULT 0; ALTER TABLE usertextfield ADD signature1 MEDIUMTEXT NOT NULL DEFAULT ''; ALTER TABLE usertextfield ADD signature2 MEDIUMTEXT NOT NULL DEFAULT ''; ... ALTER TABLE usertextfield ADD signatureN MEDIUMTEXT NOT NULL DEFAULT ''; ALTER TABLE usertextfield ADD sig_title1 VARCHAR(50) NOT NULL DEFAULT 'Signature 1'; ALTER TABLE usertextfield ADD sig_title2 VARCHAR(50) NOT NULL DEFAULT 'Signature 2'; ... ALTER TABLE usertextfield ADD sig_titleN VARCHAR(50) NOT NULL DEFAULT 'Signature N'; UPDATE usertextfield SET signature1 = signature; UPDATE usertextfield SET signature2 = signature; ... UPDATE usertextfield SET signatureN = signature; UPDATE userfield,usertextfield SET lastsignatureid = 1 WHERE userfield.userid=usertextfield.userid AND usertextfield.signature <> ''; ** Please note that 'First Signature' should be exactly the same as that ** entered in the previous section (Add Phrases). ** Change this to 'Last Edited Signature' or 'Random Signature' to set ** the all users' default signature at installation. UPDATE userfield SET fieldX = '主要簽名'; ##### Note: N is the number of signatures per user. ####################################################################### # # AdminCP: 在 風格 & 模板, 風格管理中, |
送花文章: 1,
|
2005-06-21, 03:52 PM | #3 (permalink) |
長老會員
|
# 編輯模板 User Option Templates 模板組內的 modifysignature
####################################################################### 找到: <div class="panel"> <div style="width:$stylevar[formwidth_usercp]" align="$stylevar[left]"> <!-- message area --> <div class="smallfont">$vbphrase[your_signature]:</div> $messagearea <!-- / message area --> </div> </div> <div style="margin-top:$stylevar[cellpadding]px"> <input type="hidden" name="s" value="$session[sessionhash]" /> <input type="hidden" name="do" value="updatesignature" /> <input type="submit" class="button" value="$vbphrase[save_signature]" accesskey="s" tabindex="1" /> <input type="submit" class="button" value="$vbphrase[preview_signature]" name="preview" accesskey="p" tabindex="1" /> </div> 替換為: <div class="panel"> <div style="width:$stylevar[formwidth_usercp]" align="$stylevar[left]"> <!-- message area --> <div style="margin-bottom:$stylevar[cellpadding]px"> $vbphrase[signature_title]: <input type="text" name="signaturetitle" value="$signaturetitle" class="bginput" size="36" maxlength="32" /> </div> $messagearea <!-- / message area --> </div> </div> <div style="margin-top:$stylevar[cellpadding]px"> <input type="hidden" name="s" value="$session[sessionhash]" /> $vbphrase[signature] <select name="signatureid" tabindex="1" onchange="this.form.elements['do'].value='editsignature'; this.form.submit(); "> <option value="1" <if condition="$signatureid == 1">selected="selected"</if> >1</option> <option value="2" <if condition="$signatureid == 2">selected="selected"</if> >2</option> </select> <input type="hidden" name="do" value="updatesignature" /> <input type="submit" class="button" value="$vbphrase[save_signature]" accesskey="s" tabindex="1" /> <input type="submit" class="button" value="$vbphrase[preview_signature]" name="preview" accesskey="p" tabindex="1" /> </div> ####################################################################### # |
送花文章: 1,
|
2005-06-21, 03:53 PM | #4 (permalink) |
長老會員
|
# AdminCP: 在 風格 & 模版選項,選擇 在模版中搜尋
# 搜尋文本: cb_signature, 僅搜尋標題: 否 ####################################################################### 將所找到的字串(中文)內容替換為: <label for="cb_signature"><input type="checkbox" name="signature" value="1" id="cb_signature" tabindex="1" $checked[signature] />$vbphrase[show_your_signature]</label> ##### 編輯模板 editpost, 在適當的地方加上: <label for="cb_signature">$vbphrase[show_your_signature] <select name="signature" id="cb_signature" tabindex="1"> <option value="0">$vbphrase[sig_none]</option> <option value="127" <if condition="$postinfo[showsignature] == 127">selected="selected"</if>>$vbphrase[sig_random]</option> <if condition="$bbuserinfo[signature1] != ''"> <option value="1" <if condition="$postinfo[showsignature] == 1">selected="selected"</if>>$bbuserinfo[sig_title1]</option> </if> <if condition="$bbuserinfo[signature2] != ''"> <option value="2" <if condition="$postinfo[showsignature] == 2">selected="selected"</if>>$bbuserinfo[sig_title2]</option> </if> ... <if condition="$bbuserinfo[signatureN] != ''"> <option value="N" <if condition="$postinfo[showsignature] == N">selected="selected"</if>>$bbuserinfo[sig_titleN]</option> </if> </select> </label> |
送花文章: 1,
|
2005-06-21, 03:53 PM | #5 (permalink) |
長老會員
|
#####
編輯模板 newreply, newthread, showthread_quickreply, 在適當的地方加上: <label for="cb_signature">$vbphrase[show_your_signature] <select name="signature" id="cb_signature" tabindex="1"> <option value="0">$vbphrase[sig_none]</option> <option value="127" <if condition="$bbuserinfo[fieldX] == $vbphrase[sigopt_random]">selected="selected"</if>>$vbphrase[sig_random]</option> <if condition="$bbuserinfo[signature1] != ''"> <option value="1" <if condition="$bbuserinfo[lastsignatureid] == 1 AND ($bbuserinfo[fieldX] == $vbphrase[sigopt_lastedited]) OR $bbuserinfo[fieldX] == $vbphrase[sigopt_first]">selected="selected"</if>>$bbuserinfo[sig_title1]</option> </if> <if condition="$bbuserinfo[signature2] != ''"> <option value="2" <if condition="$bbuserinfo[lastsignatureid] == 2 AND $bbuserinfo[fieldX] == $vbphrase[sigopt_lastedited]">selected="selected"</if>>$bbuserinfo[sig_title2]</option> </if> ... <if condition="$bbuserinfo[signatureN] != ''"> <option value="N" <if condition="$bbuserinfo[lastsignatureid] == N AND $bbuserinfo[fieldX] == $vbphrase[sigopt_lastedited]">selected="selected"</if>>$bbuserinfo[sig_titleN]</option> </if> </select> </label> ##### 編輯模板 pm_newpm, 將此段: <div><label for="cb_savecopy"><input type="checkbox" name="savecopy" value="1" id="cb_savecopy" tabindex="1" $checked[savecopy] /><phrase 1="private.php?$session[sessionurl]folderid=-1">$vbphrase[save_copy_in_sent_items_folder]</phrase></label></div> <if condition="$bbuserinfo['signature']"><div><label for="cb_signature"><input type="checkbox" name="signature" value="1" id="cb_signature" tabindex="1" $checked[signature] />$vbphrase[show_your_signature]</label></div></if> 替換為: <if condition="$bbuserinfo['signature']"><div><label for="cb_signature">$vbphrase[show_your_signature] <select name="signature" id="cb_signature" tabindex="1"> <option value="0">$vbphrase[sig_none]</option> <option value="127" <if condition="$bbuserinfo[fieldX] == $vbphrase[sigopt_random]">selected="selected"</if>>$vbphrase[sig_random]</option> <if condition="$bbuserinfo[signature1] != ''"> <option value="1" <if condition="($bbuserinfo[lastsignatureid]== 1 AND $bbuserinfo[fieldX] == $vbphrase[sigopt_lastedited]) OR $bbuserinfo[fieldX] == $vbphrase[sigopt_first]">selected="selected"</if>>$bbuserinfo[sig_title1]</option> </if> <if condition="$bbuserinfo[signature2] != ''"> <option value="2" <if condition="$bbuserinfo[lastsignatureid]==2 AND $bbuserinfo[fieldX] == $vbphrase[sigopt_lastedited]">selected="selected"</if>>$bbuserinfo[sig_title2]</option> </if> ... <if condition="$bbuserinfo[signatureN] != ''"> <option value="N" <if condition="$bbuserinfo[lastsignatureid]==N AND $bbuserinfo[fieldX] == $vbphrase[sigopt_lastedited]">selected="selected"</if>>$bbuserinfo[sig_titleN]</option> </if> </select> </label></div> </if> <div><label for="cb_savecopy"><input type="checkbox" name="savecopy" value="1" id="cb_savecopy" tabindex="1" $checked[savecopy] /><phrase 1="private.php?$session[sessionurl]folderid=-1">$vbphrase[save_copy_in_sent_items_folder]</phrase></label></div> |
送花文章: 1,
|
2005-06-21, 03:54 PM | #6 (permalink) |
長老會員
|
#######################################################################
# # 編輯 ./profile.php: ####################################################################### 在這之後: if ($_POST['do'] == 'updatesignature') { globalize($_POST, array('WYSIWYG_HTML', 'message' => STR, 'preview')); 加上: // Multiple Signatures Hack by Ethan -- Start of Code Block $signatureid = intval($_POST['signatureid']); if ($signatureid < 1) $signatureid = 1; $signaturetitle = htmlspecialchars_uni(trim($_POST['signaturetitle'])); if ($signaturetitle == '') $signaturetitle = "$vbphrase[signature] $signatureid"; // Multiple Signatures Hack by Ethan -- End of Code Block ##### 修改: else { $DB_site->query(" UPDATE " . TABLE_PREFIX . "usertextfield SET signature = '" . addslashes($signature) . "' WHERE userid = $bbuserinfo[userid] "); 為: else { // Multiple Signatures Hack by Ethan -- Start of Code Block $DB_site->query(" UPDATE " . TABLE_PREFIX . "usertextfield SET signature" . $signatureid . " = '" . addslashes($signature) . "' , sig_title" . $signatureid . " = '" . addslashes(htmlspecialchars_uni($signaturetitle)) . "' WHERE userid = $bbuserinfo[userid] "); $lastsignatureid = $signatureid; // if user removed a signature, set the last edited signature to the first available signature if ($signature == '') { $lastsignatureid = 0; for ($i = 1; $lastsignatureid == 0 AND $i <= N; ++$i) { if ($signatureid != $i AND $bbuserinfo["signature$i"] != '') { $signature = $bbuserinfo["signature$i"]; $lastsignatureid = $i; } } } $DB_site->query(" UPDATE " . TABLE_PREFIX . "userfield SET lastsignatureid = $lastsignatureid WHERE userid = $bbuserinfo[userid] "); // Multiple Signatures Hack by Ethan -- End of Code Block $DB_site->query(" UPDATE " . TABLE_PREFIX . "usertextfield SET signature = '" . addslashes($signature) . "' WHERE userid = $bbuserinfo[userid] "); ###### 在這之後: $smilieson = iif($vboptions['allowsmilies'], $vbphrase['on'], $vbphrase['off']); 加上: // Multiple Signatures Hack by Ethan -- Start of Code Block $signatureid = intval($_POST['signatureid']); if ($signatureid < 1) $signatureid = $bbuserinfo['lastsignatureid']; if ($signatureid < 1) $signatureid = 1; $signaturetitle = htmlspecialchars_uni(trim($_POST['signaturetitle'])); if ($signaturetitle == '') $signaturetitle = "$vbphrase[signature] $signatureid"; // Multiple Signatures Hack by Ethan -- End of Code Block ####### 修改: if (!isset($preview)) { $signature = $bbuserinfo['signature']; } 為: if (!isset($preview)) { $signature = $bbuserinfo['signature']; // Multiple Signatures Hack by Ethan -- Start of Code Block $signature = $bbuserinfo['signature' . $signatureid]; $signaturetitle = $bbuserinfo['sig_title' . $signatureid]; unset($_POST['WYSIWYG_HTML']); // Multiple Signatures Hack by Ethan -- End of Code Block } ####################################################################### # # 編輯 ./includes/functions_showthread.php: ####################################################################### 修改: // get signature if ($post['showsignature'] AND $vboptions['allowsignatures'] AND trim($post['signature']) != '' AND (!$bbuserinfo['userid'] OR $bbuserinfo['showsignatures']) AND $sigperms[$post['userid']]) { if (!isset($sigcache["$post[userid]"])) { $parsed_postcache['skip'] = true; $post['signature'] = parse_bbcode($post['signature'], 'nonforum', $vboptions['allowsmilies']); $sigcache["$post[userid]"] = $post['signature']; } else { $post['signature'] = $sigcache["$post[userid]"]; } } 為: // Multiple Signatures Hack by Ethan -- Start of Code Block // choose a random signature if ($post['showsignature'] == 127) { $sigtries = N; $post['showsignature'] = rand(1, N); while (($post['signature' . $post['showsignature']] == '') AND ($sigtries> 0)) { $post['showsignature'] = ($post['showsignature'] % N) + 1; --$sigtries; } if ($sigtries == 0) $post['showsignature'] = 0; } $post['signature'] = $post['signature' . $post['showsignature']]; // Multiple Signatures Hack by Ethan -- End of Code Block // get signature if ($post['showsignature'] AND $vboptions['allowsignatures'] AND trim($post['signature']) != '' AND (!$bbuserinfo['userid'] OR $bbuserinfo['showsignatures']) AND $sigperms[$post['userid']]) { // Modified by Multiple Signature Hack, to uninstall change $sigcache["$post[userid]_$post[showsignature]"] to $sigcache["$post[userid]"] if (!isset($sigcache["$post[userid]_$post[showsignature]"])) { $parsed_postcache['skip'] = true; $post['signature'] = parse_bbcode($post['signature' . $post[showsignature], 'nonforum', $vboptions['allowsmilies']); // Modified by Multiple Signature Hack, to uninstall change $sigcache["$post[userid]_$post[showsignature]"] to $sigcache["$post[userid]"] $sigcache["$post[userid]_$post[showsignature]"] = $post['signature']; } else { // Modified by Multiple Signature Hack, to uninstall change $sigcache["$post[userid]_$post[showsignature]"] to $sigcache["$post[userid]"] $post['signature'] = $sigcache["$post[userid]_$post[showsignature]"]; } } ####################################################################### # # 安裝完成! ####################################################################### # # 你可能希望編輯短語 'show_your_signature' 來符合您所需的 # 相關選擇簽名標題. ####################################################################### |
送花文章: 1,
|