Meow 的改良版邪惡快速回覆(prosilver)

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

版主: 版主管理群譯文組

版面規則
請注意!您的提問必須遵守發問格式,違者砍文。
主題已鎖定
Meowmeow
星球公民
星球公民
文章: 221
註冊時間: 2006-03-01 17:03
來自: 台北
聯繫:

Meow 的改良版邪惡快速回覆(prosilver)

文章 Meowmeow »

只有輸入文字欄與預覽、送出按鈕,相當簡潔。

開啟:viewtopic.php

尋找(於 1572 行)

代碼: 選擇全部

page_footer();
上行加入

代碼: 選擇全部

include($phpbb_root_path . 'includes/functions_quick_reply.' . $phpEx);
quick_reply($topic_id, $forum_id, $topic_data);
新增:includes/functions_quick_reply.php

內容

代碼: 選擇全部

<?php
/**
 * Evil quick reply
 *
 * @package	phpBB3
 * @version 1.0.1
 * @copyright (c) 2007 eviL3
 * @license	http://opensource.org/licenses/gpl-license.php GNU Public License
 *
 */

/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
	exit;
}

/**
 * This function will load everything needed for the evil quick reply
 *
 * @param int $topic_id
 * @param int $forum_id
 * @param array $topic_data
 */
function quick_reply($topic_id, $forum_id, &$topic_data)
{
	global $template, $user, $auth, $db;
	global $phpbb_root_path, $phpEx, $config;

	// Some little config for the quick reply, allows the admin to change these default values through the database.
	$qr_config = array(
		'enabled'			=> true, 	// Disable it easily
		'display_subject'	=> false,	// Do you want the subject line to be displayed
		'hide_box'			=> true,	// Shall the box be hidden on pageload?
		'resize'			=> true,	// Display the buttons to resize the textarea?
	);

	// do evil_qr_ prefixed of the config values exist in $config
	// /me slaps highway of life
	foreach (array_keys($qr_config) as $key)
	{
		if (isset($config['evil_qr_' . $key]))
		{
			$qr_config[$key] = $config['evil_qr_' . $key];
		}
	}

	// Check if user has reply permissions for this forum or the topic is locked (thanks damnian)
	if (!$auth->acl_get('f_reply', $forum_id) || ($topic_data['topic_status'] == ITEM_LOCKED && !$auth->acl_get('m_lock', $forum_id)) || !$qr_config['enabled'])
	{
		return;
	}

	// Hidden fields
	$s_hidden_fields = array(
		't'			=> $topic_id,
		'f'			=> $forum_id,
		'mode'		=> 'reply',
		'lastclick'	=> time(),
		'icon'		=> 0,
	);

	// Set preferences such as allow smilies, bbcode, attachsig
	$reply_prefs = array(
		'disable_bbcode'	=> ($config['allow_bbcode'] && $user->optionget('bbcode')) ? false : true,
		'disable_smilies'	=> ($config['allow_smilies'] && $user->optionget('smilies')) ? false : true,
		'disable_magic_url'	=> false,
		'attach_sig'		=> ($config['allow_sig'] && $user->optionget('attachsig')) ? true: false,
		'notify'			=> ($config['allow_topic_notify'] && ($user->data['user_notify'] || isset($topic_data['notify_status']))) ? true : false,
		'lock_topic'		=> ($topic_data['topic_status'] == ITEM_LOCKED && $auth->acl_get('m_lock', $forum_id)) ? true : false,
	);

	foreach ($reply_prefs as $name => $value)
	{
		if ($value)
		{
			$s_hidden_fields[$name] = 1;
		}
	}

	$subject = ((strpos($topic_data['topic_title'], 'Re: ') !== 0) ? 'Re: ' : '') . censor_text($topic_data['topic_title']);

	if (!$qr_config['display_subject'])
	{
		// /me is a show-off
		list($s_hidden_fields['subject'], $subject) = array($subject, '');
	}

	// Confirmation code handling (stolen from posting.php)
	if ($config['enable_post_confirm'] && !$user->data['is_registered'])
	{
		// Show confirm image
		$sql = 'DELETE FROM ' . CONFIRM_TABLE . "
			WHERE session_id = '" . $db->sql_escape($user->session_id) . "'
				AND confirm_type = " . CONFIRM_POST;
		$db->sql_query($sql);

		// Generate code
		$code = gen_rand_string(mt_rand(5, 8));
		$confirm_id = md5(unique_id($user->ip));
		$seed = hexdec(substr(unique_id(), 4, 10));

		// compute $seed % 0x7fffffff
		$seed -= 0x7fffffff * floor($seed / 0x7fffffff);

		$sql = 'INSERT INTO ' . CONFIRM_TABLE . ' ' . $db->sql_build_array('INSERT', array(
			'confirm_id'	=> (string) $confirm_id,
			'session_id'	=> (string) $user->session_id,
			'confirm_type'	=> (int) CONFIRM_POST,
			'code'			=> (string) $code,
			'seed'			=> (int) $seed,
		));

		$db->sql_query($sql);

		$template->assign_vars(array(
			'S_CONFIRM_CODE'	=> true,
			'CONFIRM_ID'		=> $confirm_id,
			'CONFIRM_IMAGE'		=> '<img src="' . append_sid("{$phpbb_root_path}ucp.$phpEx", 'mode=confirm&id=' . $confirm_id . '&type=' . CONFIRM_POST) . '" alt="" title="" />',
		));
	}

	// new RC6/RC7 stuff
	add_form_key('posting');

	// Page title & action URL, include session_id for security purpose
	$s_action = append_sid("{$phpbb_root_path}posting.$phpEx", false, true, $user->session_id);

	// Assign template variables
	$template->assign_vars(array(
		'QR_SUBJECT'			=> $subject,

		'S_QR_HIDDEN_FIELDS'	=> build_hidden_fields($s_hidden_fields),
		'S_QR_POST_ACTION'		=> $s_action,

		'S_QR_ENABLED'			=> $qr_config['enabled'], // this is true anyway :P
		'S_QR_SUBJECT'			=> $qr_config['display_subject'],
		'S_QR_HIDE_BOX'			=> $qr_config['hide_box'],
		'S_QR_RESIZE'			=> $qr_config['resize'],
	));
}

?>
開啟:includes/acp/acp_language.php

尋找(於 842 行)

代碼: 選擇全部

'icon_back_top', 'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply',
替換成

代碼: 選擇全部

'icon_back_top', 'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply', 'button_quick_reply',
開啟:includes/acp/acp_styles.php

尋找(於 101 行)

代碼: 選擇全部

'icon_back_top', 'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply',
替換成

代碼: 選擇全部

'icon_back_top', 'icon_contact_aim', 'icon_contact_email', 'icon_contact_icq', 'icon_contact_jabber', 'icon_contact_msnm', 'icon_contact_pm', 'icon_contact_yahoo', 'icon_contact_www', 'icon_post_delete', 'icon_post_edit', 'icon_post_info', 'icon_post_quote', 'icon_post_report', 'icon_user_online', 'icon_user_offline', 'icon_user_profile', 'icon_user_search', 'icon_user_warn', 'button_pm_forward', 'button_pm_new', 'button_pm_reply', 'button_topic_locked', 'button_topic_new', 'button_topic_reply', 'button_quick_reply',
開啟:language/en/common.php

尋找(於 419 行)

代碼: 選擇全部

	'POST_REPLY'			=> 'Post a reply',
下行加入

代碼: 選擇全部

	'QUICK_REPLY'			=> 'Quick reply',
開啟:styles/prosilver/template/viewtopic_body.html

尋找(於 255 行)

代碼: 選擇全部

<!-- INCLUDE jumpbox.html -->
上行加入

代碼: 選擇全部

<!-- IF S_QR_ENABLED -->
	<!-- INCLUDE posting_qr_body.html -->
<!-- ENDIF -->
新增:styles/prosilver/template/posting_qr_body.html

內容

代碼: 選擇全部

<div id="quick_reply">
	<form action="{S_QR_POST_ACTION}" method="post" id="postform">
		<div class="panel" id="postingbox">
			<div class="inner"><span class="corners-top"><span></span></span>
			<h3>{L_QUICK_REPLY}</h3>
			<fieldset class="submit-buttons">
				<textarea name="message" id="message" rows="5" cols="60" tabindex="3" class="inputbox"></textarea>
			</fieldset>
			<fieldset class="submit-buttons">
				{S_QR_HIDDEN_FIELDS}
				<input type="submit" name="preview" tabindex="6" value="{L_PREVIEW}" class="button1" onclick="document.getElementById('postform').action += '#preview';" />&nbsp; 
				<input type="submit" name="post" tabindex="5" value="{L_SUBMIT}" class="button1" accesskey="s" />
			</fieldset>
			<span class="corners-bottom"><span></span></span></div>
		</div>
		<!-- IF not S_USER_LOGGED_IN -->
		<div class="panel bg2">
			<div class="inner"><span class="corners-top"><span></span></span>
			<fieldset class="fields1">
				<div class="column1">
				<dl>
					<dl>
						<dt><label for="username">{L_USERNAME}:</label></dt>
						<dd><input type="text" tabindex="3" name="username" id="username" size="25" maxlength="30" class="inputbox" /></dd>
					</dl>
					<!-- IF S_CONFIRM_CODE -->
					<dl>
						<dt><label for="confirm_code">{L_CONFIRM_CODE}:</label></dt>
							<dd><input type="hidden" name="confirm_id" value="{CONFIRM_ID}" />{CONFIRM_IMAGE}</dd>
							<dd><input type="text" name="confirm_code" id="confirm_code" size="8" maxlength="8" tabindex="4" class="inputbox narrow" title="{L_CONFIRM_CODE}" /></dd>
					</dl>
					<!-- ENDIF -->
				</dl>
				</div>
			</fieldset>
			<span class="corners-bottom"><span></span></span></div>
		</div>
		<!-- ENDIF -->
	{S_FORM_TOKEN}
	</form>
</div>
使用正體中文,開啟:language/zh_cmn_hant/common.php

尋找(於 419 行)

代碼: 選擇全部

	'POST_REPLY'	=> '發表回覆',
下行加入

代碼: 選擇全部

	'QUICK_REPLY'	=> '快速回覆',
使用簡體中文,開啟:language/zh_cmn_hans/common.php

尋找(於 419 行)

代碼: 選擇全部

	'POST_REPLY'			=> '发表回复',
下行加入

代碼: 選擇全部

	'QUICK_REPLY'			=> '快速回复',
儲存與關閉所有檔案
Chita,一個野性獸圖聖殿。

主題已鎖定

回到「[3.0.x] 外掛問題討論」