[外掛] Advanced Quick Reply mod "最新版"

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

版主: 版主管理群

主題已鎖定
hihihihi
星球公民
星球公民
文章: 46
註冊時間: 2003-12-27 12:13

[外掛] Advanced Quick Reply mod "最新版"

文章 hihihihi »

這個外掛非常之厲害,我是從phpbb2_plus_1.53a拆下來加上一些修改... :lol: :lol:
現分享給大家.... :mrgreen:
注:我已對比過plus 1.53a 和Advanced Quick Reply mod 1.1.1,
plus的只是增加了後台的quick reply 開關、改變了"當有人回覆文章時通知我" 方塊預設選取的計算和template的樣式,除了樣板不同外基本上和原來的沒有什麼大分別,所以大家可以放心使用.......

圖檔

適合phpBB版本: 2.0.4 - 2.0.22
## This quick reply mod is copied from phpbb2_plus_1.53a
## Files To Edit: 3
## viewtopic.php,
## language/lang_english/lang_main.php
## language/lang_chinese_traditional_taiwan/lang_main.php
## templates/subSilver/viewtopic_body.tpl
##
## Included Files: quick_reply.php, quick_reply.tpl

#
#-----[ COPY ]------------------------------------------
#
copy quick_reply.php to /
copy quick_reply.tpl to templates/subSilver

#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php

#
#-----[ FIND ]------------------------------------------
#
$template->pparse('body');

include($phpbb_root_path . 'includes/page_tail.'.$phpEx);

#
#-----[ BEFORE, ADD ]------------------------------------
#
if (($userdata['user_id']!= -1) && $forum_topic_data['topic_status'] == TOPIC_UNLOCKED)
{
include($phpbb_root_path . 'quick_reply.'.$phpEx);
$template->assign_block_vars('switch_show_quickreply', array());
}

#
#-----[ OPEN ]------------------------------------------
#
language/lang_english/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------
#
// Start Quick Reply Mod
$lang['Quick_Reply'] = 'Quick Reply';
$lang['Quick_quote'] = 'Quote the last message';
$lang['Quick_add_smilies'] = 'Smilies';
$lang['QuoteSelelected'] = 'Quote selected';
$lang['QuoteSelelectedEmpty'] = 'Select a text anywhere on a page and try again';
$lang['Quick_Reply_smilies'] = 'all';
// End Quick Reply Mod

#
#-----[ OPEN ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_main.php

#
#-----[ FIND ]------------------------------------------
#
?>

#
#-----[ BEFORE, ADD ]------------------------------------
#
// Start Quick Reply Mod
$lang['Quick_Reply'] = '快速回覆';
$lang['Quick_quote'] = '引用最新的文章回覆';
$lang['Quick_add_smilies'] = '表情符號';
$lang['QuoteSelelected'] = '引用已選擇文章';
$lang['QuoteSelelectedEmpty'] = '請選擇頁面上的文字或是重試一次';
$lang['Quick_Reply_smilies'] = '所有';
// End Quick Reply Mod

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

#
#-----[ FIND ]------------------------------------------
#
<!-- END postrow -->

#
#-----[ AFTER, ADD ]------------------------------------
#
<!-- BEGIN switch_show_quickreply -->
<tr align="center">
<td class="row1" colspan="2" >
{QUICKREPLY_OUTPUT}
</td>
</tr>
<!-- END switch_show_quickreply -->

#
#-----[ SAVE/CLOSE ALL FILES ]--------------------------
#
#EoM
最後由 hihihihi 於 2006-12-26 22:26 編輯,總共編輯了 2 次。
hihihihi
星球公民
星球公民
文章: 46
註冊時間: 2003-12-27 12:13

quick_reply.php

文章 hihihihi »

<?php
/***************************************************************************
* quick_reply.php
* -------------------
* begin : Tuesday, Aug 20, 2002
* copyright : RustyDragon
* original work by : Smartor <smartor_xp@hotmail.com>
* contact : <dev@RustyDragon.com>, http://www.RustyDragon.com
* $Id: quick_reply.php,v 1.4.1.1 2002/11/18 13:35:54 RustyDragon Exp $
*
***************************************************************************/

/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/


//
// BEGIN OUTPUT
//

$phpbb_root_path = "./";

$mode = ( isset($_POST['mode']) ) ? $_POST['mode'] : ( ( isset($_GET['mode']) ) ? $_GET['mode']:'');

if ( $mode == 'smilies' )
{
define('IN_PHPBB', true);
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/functions_post.'.$phpEx);
generate_smilies('window', PAGE_POSTING);
exit;
}

if ( !defined('IN_PHPBB') )
{
die('Hacking attempt1');
}

$template->set_filenames(array(
'quick_reply_output' => 'quick_reply.tpl')
);


if ( !(((!$is_auth['auth_reply']) or
($forum_topic_data['forum_status'] == FORUM_LOCKED) or
($forum_topic_data['topic_status'] == TOPIC_LOCKED)) and ($userdata['user_level'] != ADMIN)))
{
$bbcode_uid = $postrow[$total_posts - 1]['bbcode_uid'];
$last_poster = $postrow[$total_posts - 1]['username'];
$last_msg = $postrow[$total_posts - 1]['post_text'];
$last_msg = str_replace(":1:$bbcode_uid", '', $last_msg);
$last_msg = str_replace(":$bbcode_uid", '', $last_msg);
$last_msg = str_replace("'", ''', $last_msg);
$last_msg = "[quote="$last_poster"]" . $last_msg . '[/quote]';
$attach_sig = ($userdata['session_logged_in'] && $userdata['user_attachsig']) ? "checked='checked'" : '';
if ($userdata['session_logged_in'])
{
if ($is_watching_topic)
{
$notify_user = 'checked="checked"';
}
else if ($is_watching_topic == 0 && $userdata['user_notify'])
{
$notify_user = 'checked="checked"';
}
else
{
$notify_user = '';
}
}
else
{
$notify_user = '';
}

$template->assign_block_vars('quick_reply', array(
'POST_ACTION' => append_sid("posting.$phpEx"),
'TOPIC_ID' => $topic_id,
'SID' => $userdata['session_id'],
'LAST_MESSAGE' => $last_msg)
);

if( $userdata['session_logged_in'])
{
$template->assign_block_vars('quick_reply.user_logged_in', array(
'ATTACH_SIGNATURE' => $attach_sig,
'NOTIFY_ON_REPLY' => $notify_user)
);
}else
{
$template->assign_block_vars('quick_reply.user_logged_out', array());
}


// generate_smilies_row();

$template->assign_vars(array(
'U_MORE_SMILIES' => append_sid("quick_reply.$phpEx?mode=smilies"),
'L_USERNAME' => $lang['Username'],
'L_PREVIEW' => $lang['Preview'],
'L_OPTIONS' => $lang['Options'],
'L_SUBMIT' => $lang['Submit'],
'L_CANCEL' => $lang['Cancel'],
'L_ATTACH_SIGNATURE' => $lang['Attach_signature'],
'L_NOTIFY_ON_REPLY' => $lang['Notify'],
'L_NOTIFY_ON_REPLY' => $lang['Notify'],
'L_ATTACH_SIGNATURE' => $lang['Attach_signature'],
'L_ALL_SMILIES' => $lang['Quick_Reply_smilies'],
'L_QUOTE_SELECTED' => $lang['QuoteSelelected'],
'L_NO_TEXT_SELECTED' => $lang['QuoteSelelectedEmpty'],
'L_EMPTY_MESSAGE' => $lang['Empty_message'],
'L_QUOTE_LAST_MESSAGE' => $lang['Quick_quote'],
'L_QUICK_REPLY' => $lang['Quick_Reply'],
'L_PREVIEW' => $lang['Preview'],
'L_SUBMIT' => $lang['Submit'],
'L_ADD_SMILIES' => $lang['Quick_add_smilies'])
);
}
$template->assign_var_from_handle('QUICKREPLY_OUTPUT', 'quick_reply_output');

function generate_smilies_row()
{
global $db, $board_config, $template;

$max_smilies = 24;

switch ( SQL_LAYER )
{
case 'mssql':
$sql = 'SELECT TOP ' . $max_smilies . ' min(emoticon) AS emoticon,
min(code) AS code, smile_url
FROM ' . SMILIES_TABLE . '
GROUP BY [smile_url]';
break;

default:
$sql = 'SELECT emoticon, code, smile_url
FROM ' . SMILIES_TABLE . '
GROUP BY smile_url
ORDER BY smilies_id LIMIT ' . $max_smilies;
break;
}
if (!$result = $db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't retrieve smilies list", '', __LINE__, __FILE__, $sql);
}
$smilies_count = $db->sql_numrows($result);
$smilies_data = $db->sql_fetchrowset($result);
for ($i = 0; $i < $smilies_count; $i++)
{
$template->assign_block_vars('quick_reply.smilies', array(
'CODE' => $smilies_data[$i]['code'],
'URL' => $board_config['smilies_path'] . '/' . $smilies_data[$i]['smile_url'],
'DESC' => $smilies_data[$i]['emoticon'])
);
}
}
?>
hihihihi
星球公民
星球公民
文章: 46
註冊時間: 2003-12-27 12:13

quick_reply.tpl

文章 hihihihi »

<!-- BEGIN quick_reply -->
<script language='JavaScript'>
function openAllSmiles(){
smiles = window.open('{U_MORE_SMILIES}', '_phpbbsmilies', 'HEIGHT=250,resizable=yes,scrollbars=yes,WIDTH=300');
smiles.focus();
return false;
}

function quoteSelection() {

theSelection = false;
if (window.getSelection)
{
theSelection = window.getSelection();
}
else if (document.getSelection)
{
theSelection = document.getSelection();
}
else if (document.selection)
{
theSelection = document.selection.createRange().text;
}

if (theSelection) {
// Add tags around selection
emoticon( '[quote]' + theSelection + '[/quote]\n');
document.post.message.focus();
theSelection = '';
return;
}
else
{
alert('{L_NO_TEXT_SELECTED}');
}
}

function storeCaret(textEl) {
if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}

function emoticon(text) {
if (document.post.message.createTextRange && document.post.message.caretPos) {
var caretPos = document.post.message.caretPos;
caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
document.post.message.focus();
} else {
document.post.message.value += text;
document.post.message.focus();
}
}

function checkForm() {
formErrors = false;
if (document.post.message.value.length < 2) {
formErrors = '{L_EMPTY_MESSAGE}';
}
if (formErrors) {
alert(formErrors);
return false;
} else {
if (document.post.quick_quote.checked) {
document.post.message.value = document.post.last_msg.value + document.post.message.value;
}
document.post.quick_quote.checked = false;
return true;
}
}
</script>
<form action='{quick_reply.POST_ACTION}' method='post' name='post' onsubmit='return checkForm(this)'>
<input type="hidden" name="sid" value="{quick_reply.SID}">
<tr>
<th>{L_OPTIONS}</th>
<th><b>{L_QUICK_REPLY}</b></th>
</tr>
<!-- BEGIN user_logged_out -->
<!-- END user_logged_out -->
<td class="row1" rowspan="1" align="left">&nbsp;<input type='checkbox' name='quick_quote'><span class="gensmall">{L_QUOTE_LAST_MESSAGE}</span><br>
<!-- BEGIN user_logged_in -->
&nbsp;<input type='checkbox' name='attach_sig' {quick_reply.user_logged_in.ATTACH_SIGNATURE}><span class="gensmall">{L_ATTACH_SIGNATURE}</span><br>
&nbsp;<input type='checkbox' name='notify' {quick_reply.user_logged_in.NOTIFY_ON_REPLY}><span class="gensmall">{L_NOTIFY_ON_REPLY}</span>
<!-- END user_logged_in -->
</td>
<input type='hidden' name='mode' value='reply'>
<input type='hidden' name='t' value='{quick_reply.TOPIC_ID}'>
<input type='hidden' name='last_msg' value='{quick_reply.LAST_MESSAGE}'>
<!--input type='hidden' name='message' value=''-->
<td class="row1" valign="top">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class='row1' valign='top'>
<textarea name='message' rows="6" cols="35" style="width:450px" wrap='virtual' tabindex='1' class='post' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'></textarea><br>
<INPUT TYPE='button' name='smiles_all' class='liteoption' VALUE='{L_ADD_SMILIES}' ONCLICK="openAllSmiles();">&nbsp;
<input type='button' name='quoteselected' class='liteoption' value='{L_QUOTE_SELECTED}' onclick='javascript:quoteSelection()'>&nbsp;
<input type='submit' name='preview' class='liteoption' value='{L_PREVIEW}'>&nbsp;
<input type='submit' accesskey='s' name='post' class='mainoption' value='{L_SUBMIT}'>

</tr>
</table>
</td>
</form>
<!-- END quick_reply -->
ghostx2
星球普通子民
星球普通子民
文章: 14
註冊時間: 2006-12-21 19:10

文章 ghostx2 »

使用過後
出現 error

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in D:\web\mentor\phpBB2\quick_reply.php on line 61
hihihihi
星球公民
星球公民
文章: 46
註冊時間: 2003-12-27 12:13

文章 hihihihi »

ghostx2 寫:使用過後
出現 error

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in D:\web\mentor\phpBB2\quick_reply.php on line 61
我已把檔案打包,請到此下載
http://rapidshare.com/files/9728688/qui ... y.zip.html
bland
星球普通子民
星球普通子民
文章: 21
註冊時間: 2003-10-21 19:17
來自: 新竹市

文章 bland »

[quote="ghostx2"]使用過後
出現 error

Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in D:\web\mentor\phpBB2\quick_reply.php on line 61[/quote]

找:
$last_msg = str_replace("'", ''', $last_msg);

改為:
$last_msg = str_replace("'", '', $last_msg);
主題已鎖定

回到「外掛問題討論」