│ 外掛名稱 │ 直覺式發文外掛 │
├──────┼───────────────┤\r
│ 外掛版本 │ 0.3.6 │
└──────────────────────┘
我真神經!
2月5日補上:
載點:http://www.phpbb.com/phpBB/viewtopic.php?t=332772
modx格式:
代碼: 選擇全部
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<?xml-stylesheet type="text/xsl" href="modx.subsilver.en.xsl"?>
<!--For security purposes, please check: http://www.phpbb.com/mods/ for the latest version of this MOD. Although MODs are checked before being allowed in the MODs Database there is no guarantee that there are no security problems within the MOD. No support will be given for MODs not found within the MODs Database which can be found at http://www.phpbb.com/mods/-->
<mod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.phpbb.com/mods/xml/modx-1.0.xsd">
<header>
<license></license>
<title lang="en-gb">WYSIWYG Mod</title>
<description lang="en-gb"><![CDATA[]]></description>
<author-notes><![CDATA[]]></author-notes>
<author-group>
</author-group>
<mod-version>
<major>0</major>
<minor>0</minor>
<revision></revision>
</mod-version>
<installation>
<level></level>
<time>0</time>
<target-version>
<target-primary>2.0</target-primary>
<target-major allow="exact">2</target-major>
<target-minor allow="exact">0</target-minor>
</target-version>
</installation>
<history>
</history>
</header>
<action-group>
<sql><![CDATA[
ALTER TABLE `phpbb_users` ADD `user_wysiwyg` TINYINT( 1 ) DEFAULT '0' NOT NULL ;
]]></sql>
<sql><![CDATA[
INSERT INTO `phpbb_config` ( `config_name` , `config_value` )
VALUES (
'allow_wysiwyg', '1'
);
]]></sql>
<copy>
<file from="root/templates/subSilver/postingw_body.tpl" to="templates/subSilver/postingw_body.tpl" />
<file from="root/templates/subSilver/postingw_smilies.tpl" to="templates/subSilver/postingw_smilies.tpl" />
<file from="root/images/wysiwyg/*.*" to="images/wysiwyg/" />
</copy>
<open src="includes/usercp_register.php">
<edit>
<find><![CDATA[
$attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $board_config['allow_sig'];
]]></find>
<action type="after-add"><![CDATA[
$wysiwyg = ( isset($HTTP_POST_VARS['wysiwyg']) ) ? ( ($HTTP_POST_VARS['wysiwyg']) ? TRUE : 0 ) : 0;
]]></action>
</edit>
<edit>
<find><![CDATA[
$attachsig = ( isset($HTTP_POST_VARS['attachsig']) ) ? ( ($HTTP_POST_VARS['attachsig']) ? TRUE : 0 ) : $userdata['user_attachsig'];
]]></find>
<action type="after-add"><![CDATA[
$wysiwyg = ( isset($HTTP_POST_VARS['wysiwyg']) ) ? ( ($HTTP_POST_VARS['wysiwyg']) ? TRUE : 0 ) : $userdata['user_wysiwyg'];
]]></action>
</edit>
<edit>
<find><![CDATA[
SET " . $username_sql . $passwd_sql . "user_email = '" . str_replace("'", "''", $email) ."',
]]></find>
<inline-edit>
<inline-find><![CDATA[ user_attachsig = $attachsig, ]]></inline-find>
<inline-action type="after-add"><![CDATA[ user_wysiwyg = $wysiwyg, ]]></inline-action>
</inline-edit>
</edit>
<edit>
<find><![CDATA[
$attachsig = $userdata['user_attachsig'];
]]></find>
<action type="after-add"><![CDATA[
$wysiwyg = $userdata['user_wysiwyg'];
]]></action>
</edit>
<edit>
<find><![CDATA[
display_avatar_gallery($mode, $avatar_category,
]]></find>
<inline-edit>
<inline-find><![CDATA[ $attachsig, ]]></inline-find>
<inline-action type="after-add"><![CDATA[ $wysiwyg, ]]></inline-action>
</inline-edit>
</edit>
<edit>
<find><![CDATA[
'ALWAYS_ADD_SIGNATURE_YES' => ( $attachsig ) ? 'checked="checked"' : '',
'ALWAYS_ADD_SIGNATURE_NO' => ( !$attachsig ) ? 'checked="checked"' : '',
]]></find>
<action type="after-add"><![CDATA[
'WYSIWYG_YES' => ( $wysiwyg ) ? 'checked="checked"' : '',
'WYSIWYG_NO' => ( !$wysiwyg ) ? 'checked="checked"' : '',
]]></action>
</edit>
<edit>
<find><![CDATA[
'L_ALWAYS_ADD_SIGNATURE' => $lang['Always_add_sig'],
]]></find>
<action type="after-add"><![CDATA[
'L_USE_WYSIWYG' => $lang['use_wysiwyg'],
]]></action>
</edit>
</open>
<open src="includes/bbcode.php">
<edit>
<find><![CDATA[
// [i] and [/i] for italicizing text.
$text = str_replace("[i:$uid]", $bbcode_tpl['i_open'], $text);
$text = str_replace("[/i:$uid]", $bbcode_tpl['i_close'], $text);
]]></find>
<action type="after-add"><![CDATA[
// [br] for new lines (WYSIWYG Mod by DeViAnThans3)
$text = str_replace("[br]", "<br>", $text);
]]></action>
</edit>
</open>
<open src="includes/functions_post.php">
<edit>
<find><![CDATA[
$unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#');
$unhtml_specialchars_replace = array('>', '<', '"', '&');
]]></find>
<action type="after-add"><![CDATA[
//
// Functions added with WYSIWYG Mod by DeViAnThans3
//
function wysiwyg_r2w($string)
{
//
// Function convert RGB values to websave colours
// This function is because Firefox posts in RGB values ...
// (C) DeViAnThans3 - 2005
//
$string = str_replace("rgb(139, 0, 0)", "darkred", $string); // Darkred
$string = str_replace("rgb(255, 0, 0)", "red", $string); // Red
$string = str_replace('rgb(255, 165, 0)', 'orange', $string); // Orange
$string = str_replace('rgb(165, 42, 42)', 'brown', $string); // Brown
$string = str_replace('rgb(255, 255, 0)', 'yellow', $string); // Yellow
$string = str_replace('rgb(0, 128, 0)', 'green', $string); // Green
$string = str_replace('rgb(128, 128, 0)', 'olive', $string); // Olive
$string = str_replace('rgb(0, 255, 255)', 'cyan', $string); // Cyan
$string = str_replace('rgb(0, 0, 255)', 'blue', $string); // Blue
$string = str_replace('rgb(0, 0, 139)', 'darkblue', $string); // Dark blue
$string = str_replace('rgb(75, 0, 130)', 'indigo', $string); // Indigo
$string = str_replace('rgb(238, 130, 238)', 'violet', $string); // Violet
$string = str_replace('rgb(255, 255, 255)', 'white', $string); // White
$string = str_replace('rgb(0, 0, 0)', 'black', $string); // Black
return $string;
}
function wysiwyg_con2bb($string, $uid)
{
//
// Function convert HTML to BBCode
// (C) DeViAnThans3 - 2005
//
// Strip slashes !
$string = stripslashes($string);
$from[] = '~<i>(.*?)</i>~is';
$from[] = '~<span.*?font-style: italic.*?>(.*?)</span>~is';
$from[] = '~<span.*?text-decoration: underline.*?>(.*?)</span>~is';
$from[] = '~<em>(.*?)</em>~is';
$from[] = '~<b>(.*?)</b>~is';
$from[] = '~<strong>(.*?)</strong>~is';
$from[] = '~<span.*?font-weight: bold.*?>(.*?)</span>~is';
$from[] = '~<u>(.*?)</u>~is';
$from[] = '~<del>(.*?)</del>~is';
$from[] = '~<div.*?>(.*?)</div>~is';
$from[] = '~<div.*?>(.*?)</div>~is';
$from[] = '~<IMG.*?src="(.*?)".*?>~is';
$from[] = '~<a.*?href="(.*?)".*?>(.*?)</a>~is';
$from[] = '~<font.*?size="(.*?)".*?>(.*?)</font>~is';
$from[] = '~<font.*?size=(.*?) .*?>(.*?)</font>~is';
$from[] = '~<font.*?color="(.*?)".*?>(.*?)</font>~is';
$from[] = '~<font.*?color=(.*?)>(.*?)</font>~is';
$from[] = '~<font.*?color=(.*?) .*?>(.*?)</font>~is';
$from[] = '~<span.*?color: (.*?);.*?>(.*?)</span>~is';
$from[] = '~<font.*?>(.*?)</font>~is';
$from[] = '~<p.*?>(.*?)</p>~is';
$from[] = "~<br.*?>~is";
$from[] = '~<li.*?>(.*?)</li>~is';
$from[] = '~<ul.*?>(.*?)</ul>~is';
$from[] = '~<ol.*?>(.*?)</ol>~is';
$to[] = '[i:' . $uid . ']1[/i:' . $uid . ']';
$to[] = '[i:' . $uid . ']1[/i:' . $uid . ']';
$to[] = '[u:' . $uid . ']1[/u:' . $uid . ']';
$to[] = '[i:' . $uid . ']1[/i:' . $uid . ']';
$to[] = '[b:' . $uid . ']1[/b:' . $uid . ']';
$to[] = '[b:' . $uid . ']1[/b:' . $uid . ']';
$to[] = '[b:' . $uid . ']1[/b:' . $uid . ']';
$to[] = '[u:' . $uid . ']1[/u:' . $uid . ']';
$to[] = '[s:' . $uid . ']1[/s:' . $uid . ']';
$to[] = '[quote:' . $uid . ']1[/quote:' . $uid . ']';
$to[] = '[quote:' . $uid . ']1[/quote:' . $uid . ']';
$to[] = '[img:' . $uid . ']1[/img:' . $uid . ']';
$to[] = '[url=1]2[/url]';
$to[] = '[size=1:' . $uid . ']2[/size:' . $uid . ']';
$to[] = '[size=1:' . $uid . ']2[/size:' . $uid . ']';
$to[] = '[color=1:' . $uid . ']2[/color:' . $uid . ']';
$to[] = '[color=1:' . $uid . ']2[/color:' . $uid . ']';
$to[] = '[color=1:' . $uid . ']2[/color:' . $uid . ']';
$to[] = '[color=1:' . $uid . ']2[/color:' . $uid . ']';
$to[] = '1';
$to[] = '1[br][br]';
$to[] = "[br]";
$to[] = 'n[*:' . $uid . ']1';
$to[] = '[list:' . $uid . ']1[/list:u:' . $uid . ']';
$to[] = '[list=1:' . $uid . ']1[/list:o:' . $uid . ']';
// Let's fix the bbcodes
$string = preg_replace($from, $to, $string);
// Oh ow! Firefox posted? Let's fix some colour issues!
$string = wysiwyg_r2w($string);
// Remove that stupid BR tags!
$string = str_replace("<BR>", "[br]", $string);
// Making sure everything is worthy easy for n00bs ...
$string = str_replace(" ", " ", $string);
// Fine ... Now make sure the post is secure!
$string = htmlspecialchars($string);
// Unprepare some things
$string = str_replace("<", "<", $string);
$string = str_replace(">", ">", $string);
$string = str_replace("<", "<", $string);
$string = str_replace(">", ">", $string);
$string = str_replace(""", """, $string);
$string = str_replace("&", "&", $string);
return $string;
}
function wysiwyg_con2html($string, $uid) {
// Bold text
$bbcode_initial[0] = "/([[Bb]:$uid])(.+)([/[Bb]:$uid])/"; // Initial BB code find
$bbcode_replacements[0] = "<STRONG>2</STRONG>"; // BB code replace
// Italic text
$bbcode_initial[1] = "/([[Ii]:$uid])(.+)([/[Ii]:$uid])/"; // Initial BB code find
$bbcode_replacements[1] = "<EM>2</EM>"; // BB code replace
// Underlined text
$bbcode_initial[2] = "/([[Uu]:$uid])(.+)([/[Uu]:$uid])/"; // Initial BB code find
$bbcode_replacements[2] = "<U>2</U>"; // BB code replace
// HR
$string = str_replace("[hr]", "<HR>", $string);
// BR
$string = str_replace("[br]", "<BR>", $string);
// Links with alternative text
$bbcode_initial[3] = "/([url=)(.+)(])(.+)([/url])/";
$bbcode_replacements[3] = "<a href="2" target="_blank">4</a>"; // You get the picture with these
// Links (for the web)
$bbcode_initial[4] = "/([url])(.+)([/url])/";
$bbcode_replacements[4] = "<a href="2" target="_blank">2</a>";
// Images (from the web)
$bbcode_initial[5] = "/([img:$uid])(.+)([/img:$uid])/";
$bbcode_replacements[5] = "<img src="2" alt="2" />";
// Quote (with authour)
$bbcode_initial[6] = "/([quote:$uid=")(.+)("])(.+)([/quote:$uid])/";
$bbcode_replacements[6] = "2 post: <div style="background-color: #757575; color: #FFFFFF; border-style: solid; border-width: 1px; border-color: #FFFFFF; text-indent: 20px;">4</div>";
// Normal quote without author
$bbcode_initial[7] = "/([quote:$uid])(.+)([/quote:$uid])/";
$bbcode_replacements[7] = "Quote: <div style="background-color: #757575; color: #FFFFFF; border-style: solid; border-width: 1px; border-color: #FFFFFF; text-indent: 20px;">2</div>";
// Code Block
$bbcode_initial[8] = "/([code:[0-9]:$uid])(.+)([/code:[0-9]:$uid])/";
$bbcode_replacements[8] = "Code: <div style="font-family: 'Courier New', Tahoma, sans-serif; background-color: #757575; color: #00FF10; border-style: solid; border-width: 1px; border-color: #FFFFFF; text-indent: 20px;">2</div>";
// Font size
$bbcode_initial[9] = "/([size=)([0-9|][0-9])(:$uid])(.+)([/size:$uid])/";
$bbcode_replacements[9] = "<span style="font-size: 2px;">4</span>";
// Font colour
$bbcode_initial[10] = "/([color=)(.+)(:$uid])(.+)([/color:$uid])/";
$bbcode_replacements[10] = "<span style="color: 2">4</span>";
// List Parser
$string = str_replace("[list:$uid]", "<ul>", $string);
$string = str_replace("[*:$uid]", "<li>", $string);
$string = str_replace("[/list:u:$uid]", "</ul>", $string);
$string = str_replace("[/list:o:$uid]", "</ol>", $string);
$bbcode_initial[11] = "/[list=([a1]):$uid]/si";
$bbcode_replacements[11] = "<ol type="1">";
// Sorts out the HTML using regular expressions
$string = preg_replace($bbcode_initial, $bbcode_replacements, $string);
// remove any carriage returns (mysql)
$string = str_replace("n", '<br />', $string);
$string = str_replace("r", '', $string);
// replace any newlines that aren't preceded by a > with a <br />
$string = preg_replace('/(?<!>)n/', "<br />n", $string);
// Safe postings
$string = safe_post($string);
return $string;
}
function safe_post($string) {
global $userdata, $board_config;
$tmpString = $string;
if($userdata['user_wysiwyg'] && $board_config['allow_wysiwyg']) {
$tmpString = trim($string);
//convert all types of single quotes
$tmpString = str_replace(chr(145), chr(39), $tmpString);
$tmpString = str_replace(chr(146), chr(39), $tmpString);
$tmpString = str_replace("'", "'", $tmpString);
//convert all types of double quotes
$tmpString = str_replace(chr(147), chr(34), $tmpString);
$tmpString = str_replace(chr(148), chr(34), $tmpString);
//replace carriage returns & line feeds
$tmpString = str_replace(chr(10), " ", $tmpString);
$tmpString = str_replace(chr(13), " ", $tmpString);
}
return $tmpString;
}
]]></action>
</edit>
<edit>
<find><![CDATA[
function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0)
{
global $board_config, $html_entities_match, $html_entities_replace;
]]></find>
<action type="replace-with"><![CDATA[
function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid = 0)
{
global $board_config, $html_entities_match, $html_entities_replace, $userdata;
if($bbcode_uid != '' AND $userdata['user_wysiwyg']) {
//$message = addslashes($message);
$message = wysiwyg_con2bb($message, $bbcode_uid);
}
//
// Secure the WYSIWYG entries
//
$message = safe_post($message);
]]></action>
</edit>
<edit>
<find><![CDATA[
$template->set_filenames(array(
'smiliesbody' => 'posting_smilies.tpl')
);
]]></find>
<action type="replace-with"><![CDATA[
$wysiwyg = $userdata['user_wysiwyg'];
if($wysiwyg && $board_config['allow_wysiwyg']){
$template->set_filenames(array(
'smiliesbody' => 'postingw_smilies.tpl')
);
}else{
$template->set_filenames(array(
'smiliesbody' => 'posting_smilies.tpl')
);
}
]]></action>
</edit>
</open>
<open src="language/lang_english/lang_admin.php">
<edit>
<find><![CDATA[
//
// That's all Folks!
// -------------------------------------------------
]]></find>
<action type="before-add"><![CDATA[
// WYSIWYG MOD by DeViAnThans3
$lang['wys_allow'] = "Allow the use of rich text editor";
$lang['wys_allow_explain'] = "If yes, users are allowed to post using a extended visual editor.";
]]></action>
</edit>
</open>
<open src="language/lang_english/lang_main.php">
<edit>
<find><![CDATA[
//
// That's all, Folks!
// -------------------------------------------------
]]></find>
<action type="before-add"><![CDATA[
$lang['use_wysiwyg'] = 'Use visual editor for posting';
$lang['wys_size'] = 'Font size';
$lang['wys_b'] = 'Bold';
$lang['wys_i'] = 'Italic';
$lang['wys_u'] = 'Underline';
$lang['wys_order'] = 'Ordered list';
$lang['wys_unorder'] = 'Unordered list';
$lang['wys_textcolor'] = 'Color';
$lang['wys_linkcolor'] = 'Link';
$lang['wys_img'] = 'Image';
$lang['wysiwyg_OFF'] = 'Rich text editor is <u>OFF</u>';
$lang['wysiwyg_ON'] = 'Rich text editor is <u>ON</u>';
$lang['wys_enter_img'] = 'Enter image URL';
$lang['wys_enter_url'] = 'Enter URL please';
// Added in 0.3.5
$lang['wys_print'] = 'Print';
$lang['wys_cut'] = 'Paste';
$lang['wys_copy'] = 'Copy';
$lang['wys_paste'] = 'Paste';
$lang['wys_quote'] = 'Quote';
$lang['wys_quote_desc'] = 'Enter quote here';
$lang['wys_about'] = 'Info';
$lang['wys_bbwarning'] = 'If BBCode is turned off, your post will probably not be shown correctly';
]]></action>
</edit>
</open>
<open src="language/lang_chinese_traditional_taiwan/lang_admin.php">
<edit>
<find><![CDATA[
//
// That's all Folks!
// -------------------------------------------------
]]></find>
<action type="before-add"><![CDATA[
// WYSIWYG MOD by DeViAnThans3
$lang['wys_allow'] = "允許使用者使用所見即所得編輯器";
$lang['wys_allow_explain'] = "若選是, 允許使用者自行決定是否使用.";
]]></action>
</edit>
</open>
<open src="language/lang_chinese_traditional_taiwan/lang_main.php">
<edit>
<find><![CDATA[
//
// That's all, Folks!
// -------------------------------------------------
]]></find>
<action type="before-add"><![CDATA[
$lang['use_wysiwyg'] = '使用所見即所得發表';
$lang['wys_size'] = '字型大小';
$lang['wys_b'] = '粗體';
$lang['wys_i'] = '斜體';
$lang['wys_u'] = '底線';
$lang['wys_order'] = '序數列表';
$lang['wys_unorder'] = '點列列表';
$lang['wys_textcolor'] = '文字顏色';
$lang['wys_linkcolor'] = '超連結';
$lang['wys_img'] = '圖片';
$lang['wysiwyg_OFF'] = '所見即所得 <u>關閉</u>';
$lang['wysiwyg_ON'] = '所見即所得 <u>開啟</u>';
$lang['wys_enter_img'] = '請輸入圖片網址:';
$lang['wys_enter_url'] = '請輸入網址:';
// Added in 0.3.5
$lang['wys_print'] = '列印';
$lang['wys_cut'] = '剪下';
$lang['wys_copy'] = '複製';
$lang['wys_paste'] = '貼上';
$lang['wys_quote'] = '引言回覆';
$lang['wys_quote_desc'] = '在這邊輸入引言';
$lang['wys_about'] = '版權資訊';
$lang['wys_bbwarning'] = '若關閉BBCode,將無法正常發表';
]]></action>
</edit>
</open>
<open src="templates/subSilver/profile_add_body.tpl">
<edit>
<find><![CDATA[
<tr>
<td class="row1"><span class="gen">{L_ALWAYS_ADD_SIGNATURE}:</span></td>
<td class="row2">
<input type="radio" name="attachsig" value="1" {ALWAYS_ADD_SIGNATURE_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="attachsig" value="0" {ALWAYS_ADD_SIGNATURE_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
]]></find>
<action type="after-add"><![CDATA[
<tr>
<td class="row1"><span class="gen">{L_USE_WYSIWYG}:</span></td>
<td class="row2">
<input type="radio" name="wysiwyg" value="1" {WYSIWYG_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="wysiwyg" value="0" {WYSIWYG_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
]]></action>
</edit>
</open>
<open src="templates/subSilver/posting_body.tpl">
<edit>
<find><![CDATA[
<td class="row1" valign="top"><span class="gen"><b>{L_OPTIONS}</b></span><br /><span class="gensmall">{HTML_STATUS}<br />{BBCODE_STATUS}<br />{SMILIES_STATUS}</span></td>
]]></find>
<inline-edit>
<inline-find><![CDATA[ <br />{SMILIES_STATUS} ]]></inline-find>
<inline-action type="after-add"><![CDATA[ <br />{WYSIWYG_STATUS} ]]></inline-action>
</inline-edit>
</edit>
</open>
<open src="templates/subSilver/admin/user_edit_body.tpl">
<edit>
<find><![CDATA[ <tr>
<td class="row1"><span class="gen">{L_ALWAYS_ADD_SIGNATURE}</span></td>
<td class="row2">
<input type="radio" name="attachsig" value="1" {ALWAYS_ADD_SIGNATURE_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="attachsig" value="0" {ALWAYS_ADD_SIGNATURE_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
]]></find>
<action type="after-add"><![CDATA[
<tr>
<td class="row1"><span class="gen">{L_USE_WYSIWYG}</span></td>
<td class="row2">
<input type="radio" name="wysiwyg" value="1" {WYSIWYG_YES} />
<span class="gen">{L_YES}</span>
<input type="radio" name="wysiwyg" value="0" {WYSIWYG_NO} />
<span class="gen">{L_NO}</span></td>
</tr>
]]></action>
</edit>
</open>
<open src="templates/subSilver/admin/board_config_body.tpl">
<edit>
<find><![CDATA[
<tr>
<td class="row1">{L_VISUAL_CONFIRM}<br /><span class="gensmall">{L_VISUAL_CONFIRM_EXPLAIN}</span></td>
<td class="row2"><input type="radio" name="enable_confirm" value="1" {CONFIRM_ENABLE} />{L_YES} <input type="radio" name="enable_confirm" value="0" {CONFIRM_DISABLE} />{L_NO}</td>
</tr>
]]></find>
<action type="after-add"><![CDATA[ <tr>
<td class="row1">{L_WYS_ALLOW}<br /><span class="gensmall">{L_WYS_ALLOW_EXPLAIN}</span></td>
<td class="row2"><input type="radio" name="allow_wysiwyg" value="1" {WYS_ENABLE} />{L_YES} <input type="radio" name="allow_wysiwyg" value="0" {WYS_DISABLE} />{L_NO}</td>
</tr>
]]></action>
</edit>
</open>
<open src="posting.php">
<edit>
<find><![CDATA[
if ( !$board_config['allow_html'] )
]]></find>
<action type="replace-with"><![CDATA[
$wysiwyg = $userdata['user_wysiwyg'];
if ( !$board_config['allow_html'] && !$wysiwyg)
]]></action>
</edit>
<edit>
<find><![CDATA[
$html_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
]]></find>
<action type="replace-with"><![CDATA[
if($wysiwyg && $board_config['allow_wysiwyg']){
$html_on = 1;
}else{
$html_on = ( $submit || $refresh ) ? ( ( !empty($HTTP_POST_VARS['disable_html']) ) ? 0 : TRUE ) : ( ( $userdata['user_id'] == ANONYMOUS ) ? $board_config['allow_html'] : $userdata['user_allowhtml'] );
}
]]></action>
</edit>
<edit>
<find><![CDATA[
$message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';
]]></find>
<action type="replace-with"><![CDATA[
if(!$wysiwyg && !$board_config['allow_wysiwyg'])
{
$message = ( !empty($HTTP_POST_VARS['message']) ) ? htmlspecialchars(trim(stripslashes($HTTP_POST_VARS['message']))) : '';
}else{
$message = ( !empty($HTTP_POST_VARS['message']) ) ? trim(stripslashes($HTTP_POST_VARS['message'])) : '';
}
]]></action>
</edit>
<edit>
<find><![CDATA[
$bbcode_uid = ( $bbcode_on ) ? make_bbcode_uid() : '';
$preview_message = stripslashes(prepare_message(addslashes(unprepare_message($message)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid));
]]></find>
<action type="replace-with"><![CDATA[
if($wysiwyg && $board_config['allow_wysiwyg']){
$message = wysiwyg_con2html($message, $bbcode_uid);
$preview_message = $message;
}else{
$preview_message = stripslashes(prepare_message(addslashes(unprepare_message($message)), $html_on, $bbcode_on, $smilies_on, $bbcode_uid));
}]]></action>
</edit>
<edit>
<find><![CDATA[
else if ( $mode == 'quote' || $mode == 'editpost' )
{
$subject = ( $post_data['first_post'] ) ? $post_info['topic_title'] : $post_info['post_subject'];
$message = $post_info['post_text'];
]]></find>
<action type="after-add"><![CDATA[
if($wysiwyg && $board_config['allow_wysiwyg']){
$message = wysiwyg_con2html($message, $post_info['bbcode_uid']);
}
]]></action>
</edit>
<edit>
<find><![CDATA[ $message = str_replace('<', '<', $message);
$message = str_replace('>', '>', $message);
$message = str_replace('<br />', "n", $message);
]]></find>
<action type="replace-with"><![CDATA[
if ($wysiwyg && $board_config['allow_wysiwyg']) {
// Do nothing
}else{
$message = str_replace('<', '<', $message);
$message = str_replace('>', '>', $message);
$message = str_replace('<br />', "n", $message);
}
]]></action>
</edit>
<edit>
<find><![CDATA[
$message = '[quote="' . $quote_username . '"]' . $message . '[/quote]';
]]></find>
<action type="replace-with"><![CDATA[
if($wysiwyg && $board_config['allow_wysiwyg']) {
$message = '<div class="quote">' . $message . '</div><br />' . $lang['wys_quote_desc'] . '';
}else{
$message = '[quote="' . $quote_username . '"]' . $message . '[/quote]';
}
]]></action>
</edit>
<edit>
<find><![CDATA[
//
// Smilies toggle selection
//
if ( $board_config['allow_smilies'] )
{
$smilies_status = $lang['Smilies_are_ON'];
$template->assign_block_vars('switch_smilies_checkbox', array());
]]></find>
<action type="before-add"><![CDATA[
//
// WYSIWYG MOD by DeViAnThans3
//
if ( $userdata['user_wysiwyg'] && $board_config['allow_wysiwyg'] )
{
$wysiwyg_status = $lang['wysiwyg_ON'];
}
else
{
$wysiwyg_status = $lang['wysiwyg_OFF'];
}
// Find style name
if($userdata['user_id'] == "-1"){
$style = $board_config['default_style'];
}else{
$style = $userdata['user_style'];
}
$sql = "SELECT *
FROM " . THEMES_TABLE . "
WHERE themes_id = $style";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not query database for theme info');
}
if ( !($row = $db->sql_fetchrow($result)) )
{
message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
}
$stemplate = $row['template_name'];
]]></action>
</edit>
<edit>
<find><![CDATA[
$template->set_filenames(array(
'body' => 'posting_body.tpl',
'pollbody' => 'posting_poll_body.tpl',
'reviewbody' => 'posting_topic_review.tpl')
);
]]></find>
<action type="replace-with"><![CDATA[
if($wysiwyg && $board_config['allow_wysiwyg']) {
$template->set_filenames(array(
'body' => 'postingw_body.tpl',
'pollbody' => 'posting_poll_body.tpl',
'reviewbody' => 'posting_topic_review.tpl')
);
}else{
$template->set_filenames(array(
'body' => 'posting_body.tpl',
'pollbody' => 'posting_poll_body.tpl',
'reviewbody' => 'posting_topic_review.tpl')
);
}
]]></action>
</edit>
<edit>
<find><![CDATA[
'L_BBCODE_B_HELP' => $lang['bbcode_b_help'],
]]></find>
<action type="before-add"><![CDATA[
'L_STEMPLATE' => $stemplate,
'L_WYS_SIZE' => $lang['wys_size'],
'L_WYS_B' => $lang['wys_b'],
'L_WYS_I' => $lang['wys_i'],
'L_WYS_U' => $lang['wys_u'],
'L_WYS_ORDER' => $lang['wys_order'],
'L_WYS_UNORDER' => $lang['wys_unorder'],
'L_WYS_TEXTCOLOR' => $lang['wys_textcolor'],
'L_WYS_LINKCOLOR' => $lang['wys_linkcolor'],
'L_WYS_IMG' => $lang['wys_img'],
'WYSIWYG_STATUS' => $wysiwyg_status,
'L_WYS_ENTER_IMG' => $lang['wys_enter_img'],
'L_WYS_ENTER_URL' => $lang['wys_enter_url'],
'L_WYS_PRINT' => $lang['wys_print'],
'L_WYS_CUT' => $lang['wys_cut'],
'L_WYS_COPY' => $lang['wys_copy'],
'L_WYS_PASTE' => $lang['wys_paste'],
'L_WYS_QUOTE' => $lang['wys_quote'],
'L_WYS_QUOTE_DESC' => $lang['wys_quote_desc'],
'L_WYS_ABOUT' => $lang['wys_about'],
'L_WYS_BBWARNING' => $lang['wys_bbwarning'],]]></action>
</edit>
</open>
<open src="viewtopic.php">
<edit>
<find><![CDATA[
$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
]]></find>
<inline-edit>
<inline-find><![CDATA[ u.user_allowsmile, ]]></inline-find>
<inline-action type="after-add"><![CDATA[ u.user_wysiwyg, ]]></inline-action>
</inline-edit>
</edit>
<edit>
<find><![CDATA[
if ( $postrow[$i]['enable_html'] )
]]></find>
<action type="replace-with"><![CDATA[
if ( !$postrow[$i]['enable_html'])
]]></action>
</edit>
</open>
<open src="privmsg.php">
<edit>
<find><![CDATA[
if ( $privmsg['privmsgs_enable_html'] )
]]></find>
<action type="replace-with"><![CDATA[
if ( !$privmsg['privmsgs_enable_html'] )
]]></action>
</edit>
<edit>
<find><![CDATA[
if ( !$board_config['allow_html'] )
]]></find>
<action type="replace-with"><![CDATA[
$wysiwyg = $userdata['user_wysiwyg'];
if ( !$board_config['allow_html'] && !$wysiwyg)
]]></action>
</edit>
<edit>
<find><![CDATA[
$privmsg_subject = ( isset($HTTP_POST_VARS['subject']) ) ? trim(strip_tags(stripslashes($HTTP_POST_VARS['subject']))) : '';
$privmsg_message = ( isset($HTTP_POST_VARS['message']) ) ? trim($HTTP_POST_VARS['message']) : '';
]]></find>
<action type="after-add"><![CDATA[
if($wysiwyg)
{
$privmsg_message = wysiwyg_con2html($privmsg_message, $bbcode_uid);
}
]]></action>
</edit>
<edit>
<find><![CDATA[
if ( !($privmsg = $db->sql_fetchrow($result)) )
{
redirect(append_sid("privmsg.$phpEx?folder=$folder", true));
}
$privmsg_subject = $privmsg['privmsgs_subject'];
$privmsg_message = $privmsg['privmsgs_text'];
$privmsg_bbcode_uid = $privmsg['privmsgs_bbcode_uid'];
]]></find>
<action type="after-add"><![CDATA[
if($wysiwyg && $board_config['allow_wysiwyg']){
$privmsg_message = wysiwyg_con2html($privmsg_message, $privmsg_bbcode_uid);
}
]]></action>
</edit>
<edit>
<find><![CDATA[
$privmsg_message = str_replace('<br />', "n", $privmsg_message);
$privmsg_message = preg_replace('#</textarea>#si', '</textarea>', $privmsg_message);
]]></find>
<action type="after-add"><![CDATA[
if($wysiwyg && $board_config['allow_wysiwyg']) {
$privmsg_message = wysiwyg_con2html($privmsg_message, $privmsg['privmsgs_bbcode_uid']);
}
]]></action>
</edit>
<edit>
<find><![CDATA[
$privmsg_message = preg_replace("/:(([a-z0-9]:)?)$privmsg_bbcode_uid/si", '', $privmsg_message);
$privmsg_message = str_replace('<br />', "n", $privmsg_message);
$privmsg_message = preg_replace('#</textarea>#si', '</textarea>', $privmsg_message);
]]></find>
<action type="before-add"><![CDATA[
if($wysiwyg) {
$privmsg_message = wysiwyg_con2html($privmsg_message, $privmsg['privmsgs_bbcode_uid']);
}
]]></action>
</edit>
<edit>
<find><![CDATA[
$privmsg_message = '[quote="' . $to_username . '"]' . $privmsg_message . '[/quote]';
]]></find>
<action type="replace-with"><![CDATA[
if($wysiwyg && $board_config['allow_wysiwyg']) {
$privmsg_message = $to_username . ' quote: <div class="quote">' . $privmsg_message . '</div><br />';
}else{
$privmsg_message = '[quote="' . $to_username . '"]' . $privmsg_message . '[/quote]';
}
]]></action>
</edit>
<edit>
<find><![CDATA[
$privmsg_message = stripslashes(preg_replace($html_entities_match, $html_entities_replace, $privmsg_message));
]]></find>
<action type="replace-with"><![CDATA[
if($wysiwyg && $board_config['allow_wysiwyg']) {
$privmsg_message = stripslashes($privmsg_message);
}else{
$privmsg_message = stripslashes(preg_replace($html_entities_match, $html_entities_replace, $privmsg_message));
}
]]></action>
</edit>
<edit>
<find><![CDATA[
//
// Load templates
//
$template->set_filenames(array(
'body' => 'posting_body.tpl')
);
]]></find>
<action type="replace-with"><![CDATA[
//
// Load templates
//
if($wysiwyg && $board_config['allow_wysiwyg']) {
$template->set_filenames(array(
'body' => 'postingw_body.tpl')
);
}else{
$template->set_filenames(array(
'body' => 'posting_body.tpl')
);
}
if ( $userdata['user_wysiwyg'] && $board_config['allow_wysiwyg'] )
{
$wysiwyg_status = $lang['wysiwyg_ON'];
}else{
$wysiwyg_status = $lang['wysiwyg_OFF'];
}
// Find style name
$style = $userdata['user_style'];
$sql = "SELECT *
FROM " . THEMES_TABLE . "
WHERE themes_id = $style";
if ( !($result = $db->sql_query($sql)) )
{
message_die(CRITICAL_ERROR, 'Could not query database for theme info');
}
if ( !($row = $db->sql_fetchrow($result)) )
{
message_die(CRITICAL_ERROR, "Could not get theme data for themes_id [$style]");
}
$stemplate = $row['template_name'];
]]></action>
</edit>
<edit>
<find><![CDATA[
'L_BBCODE_B_HELP' => $lang['bbcode_b_help'],
]]></find>
<action type="before-add"><![CDATA[
'L_STEMPLATE' => $stemplate,
'L_WYS_SIZE' => $lang['wys_size'],
'L_WYS_B' => $lang['wys_b'],
'L_WYS_I' => $lang['wys_i'],
'L_WYS_U' => $lang['wys_u'],
'L_WYS_ORDER' => $lang['wys_order'],
'L_WYS_UNORDER' => $lang['wys_unorder'],
'L_WYS_TEXTCOLOR' => $lang['wys_textcolor'],
'L_WYS_LINKCOLOR' => $lang['wys_linkcolor'],
'L_WYS_IMG' => $lang['wys_img'],
'WYSIWYG_STATUS' => $wysiwyg_status,
'L_WYS_ENTER_IMG' => $lang['wys_enter_img'],
'L_WYS_ENTER_URL' => $lang['wys_enter_url'],
'L_WYS_PRINT' => $lang['wys_print'],
'L_WYS_CUT' => $lang['wys_cut'],
'L_WYS_COPY' => $lang['wys_copy'],
'L_WYS_PASTE' => $lang['wys_paste'],
'L_WYS_QUOTE' => $lang['wys_quote'],
'L_WYS_QUOTE_DESC' => $lang['wys_quote_desc'],
'L_WYS_ABOUT' => $lang['wys_about'],
'L_WYS_BBWARNING' => $lang['wys_bbwarning'],
]]></action>
</edit>
</open>
<open src="admin/admin_users.php">
<edit>
<find><![CDATA[
$attachsig = ( isset( $HTTP_POST_VARS['attachsig']) ) ? ( ( $HTTP_POST_VARS['attachsig'] ) ? TRUE : 0 ) : 0;
]]></find>
<action type="after-add"><![CDATA[
$wysiwyg = ( isset( $HTTP_POST_VARS['wysiwyg']) ) ? ( ( $HTTP_POST_VARS['wysiwyg'] ) ? TRUE : 0 ) : 0;
]]></action>
</edit>
<edit>
<find><![CDATA[
SET " . $username_sql . $passwd_sql .
]]></find>
<inline-edit>
<inline-find><![CDATA[ user_attachsig = $attachsig, ]]></inline-find>
<inline-action type="after-add"><![CDATA[ user_wysiwyg = $wysiwyg, ]]></inline-action>
</inline-edit>
</edit>
<edit>
<find><![CDATA[
$attachsig = $this_userdata['user_attachsig'];
]]></find>
<action type="after-add"><![CDATA[
$wysiwyg = $this_userdata['user_wysiwyg'];
]]></action>
</edit>
<edit>
<find><![CDATA[
$user_allowpm = $this_userdata['user_allow_pm'];
]]></find>
<action type="after-add"><![CDATA[
$user_wysiwyg = $this_userdata['user_wysiwyg'];
]]></action>
</edit>
<edit>
<find><![CDATA[
$s_hidden_fields .= '<input type="hidden" name="popup_pm" value="' . $popuppm . '" />';
]]></find>
<action type="after-add"><![CDATA[
$s_hidden_fields .= '<input type="hidden" name="wysiwyg" value="' . $wysiwyg . '" />';
]]></action>
</edit>
<edit>
<find><![CDATA[
'POPUP_PM_YES' => ($popuppm) ? 'checked="checked"' : '',
'POPUP_PM_NO' => (!$popuppm) ? 'checked="checked"' : '',
]]></find>
<action type="after-add"><![CDATA[
'WYSIWYG_YES' => ( $wysiwyg ) ? 'checked="checked"' : '',
'WYSIWYG_NO' => ( !$wysiwyg ) ? 'checked="checked"' : '',
]]></action>
</edit>
<edit>
<find><![CDATA[
'L_POPUP_ON_PRIVMSG' => $lang['Popup_on_privmsg'],
]]></find>
<action type="after-add"><![CDATA[
'L_USE_WYSIWYG' => $lang['use_wysiwyg'],
]]></action>
</edit>
</open>
<open src="admin/admin_board.php">
<edit>
<find><![CDATA[
$confirm_yes = ($new['enable_confirm']) ? 'checked="checked"' : '';
$confirm_no = (!$new['enable_confirm']) ? 'checked="checked"' : '';
]]></find>
<action type="after-add"><![CDATA[
$wys_yes = ($new['allow_wysiwyg']) ? 'checked="checked"' : '';
$wys_no = (!$new['allow_wysiwyg']) ? 'checked="checked"' : '';
]]></action>
</edit>
<edit>
<find><![CDATA[ "L_VISUAL_CONFIRM" => $lang['Visual_confirm'],
"L_VISUAL_CONFIRM_EXPLAIN" => $lang['Visual_confirm_explain'],
]]></find>
<action type="after-add"><![CDATA[ "L_WYS_ALLOW" => $lang['wys_allow'],
"L_WYS_ALLOW_EXPLAIN" => $lang['wys_allow_explain'],
]]></action>
</edit>
<edit>
<find><![CDATA[ "CONFIRM_ENABLE" => $confirm_yes,
"CONFIRM_DISABLE" => $confirm_no,
]]></find>
<action type="after-add"><![CDATA[ "WYS_ENABLE" => $wys_yes,
"WYS_DISABLE" => $wys_no,
]]></action>
</edit>
</open>
</action-group>
</mod>
代碼: 選擇全部
##############################################################
## MOD Title: WYSIWYG Mod
## MOD Author: DeViAnThans3 < hansvdp@gmail.com > http://www.devianthans3.be
## MOD Description: Adds a Rich Text Editor feature to your phpBB.
## MOD Version: 0.3.6
##
## Installation Level: Intermediate
## Installation Time: ~25 Minutes
## Files To Edit: admin/admin_users.php,
## admin/admin_board.php,
## includes/usercp_register.php,
## includes/bbcode.php,
## includes/functions_post.php,
## language/lang_english/lang_admin.php,
## language/lang_english/lang_main.php,
## templates/subSilver/profile_add_body.tpl,
## templates/subSilver/posting_body.tpl,
## templates/subSilver/admin/user_edit_body.tpl,
## templates/subSilver/admin/board_config_body.tpl,
## posting.php,
## viewtopic.php,
## privmsg.php
## Included Files: templates/subSilver/postingw_body.tpl,
## templates/subSilver/postingw_smilies.tpl,
## images/wysiwyg/*
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################
## For security purposes, please check: http://www.phpbb.com/mods/
## for the latest version of this MOD. Although MODs are checked
## before being allowed in the MODs Database there is no guarantee
## that there are no security problems within the MOD. No support
## will be given for MODs not found within the MODs Database which
## can be found at http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## Since this is a alpha release, its recommended to NOT use this Mod on other boards
## than testing boards. In any case, always take a backup!
##
## This MOD could be installed with EasyMOD (tested)
## Tested on phpBB 2.0.18
##
##############################################################
## MOD History:
##
## 2005-12-25 - Version 0.3.6
## - Bugfixes & code replacements
## - Added the WYSIWYG function toggler to ACP
## - Allow or disallow users to use the WYSIWYG function
##
## 2005-11-04 - Version 0.3.5
## - Major HTML Bug solved (no more HTML has to be turned on!)
## - Removed indenting/outdenting/aligning/horizontal rule
## - Second public alpha release (alpha2)
## - Quote additions
## - (17) Bugfixes & code replacements
## - Earlier versions are NOT used/supported anymore!
## - Updated images
## - Added print/cut-copy-paste/info box
##
## 2005-10-15 - Version 0.3.1
## - Minor bug with bbcode solved
##
## 2005-10-15 - Version 0.3.0
## - Alpha version (first release of MOD)
## - Private messages supported by WYSIWYG Mod
##
## 2005-10-15 - Version 0.2.1
## - Pre-alpha version
## - Smilies enabled
## - Quote/edit files enabled
##
## 2005-10-13 - Version 0.2.0
## - Major programming
##
## 2005-10-10 - Version 0.1.0
## - Major programming
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
代碼: 選擇全部
#
#-----[ OPEN ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_admin.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all Folks!
// -------------------------------------------------
#
#-----[ BEFORE, ADD ]------------------------------------------
#
// WYSIWYG MOD by DeViAnThans3
$lang['wys_allow'] = "允許使用者使用所見即所得編輯器";
$lang['wys_allow_explain'] = "若選是, 允許使用者自行決定是否使用.";
#
#-----[ OPEN ]------------------------------------------
#
language/lang_chinese_traditional_taiwan/lang_main.php
#
#-----[ FIND ]------------------------------------------
#
//
// That's all, Folks!
// -------------------------------------------------
#
#-----[ BEFORE, ADD ]------------------------------------------
#
$lang['use_wysiwyg'] = '使用所見即所得發表';
$lang['wys_size'] = '字型大小';
$lang['wys_b'] = '粗體';
$lang['wys_i'] = '斜體';
$lang['wys_u'] = '底線';
$lang['wys_order'] = '序數列表';
$lang['wys_unorder'] = '點列列表';
$lang['wys_textcolor'] = '文字顏色';
$lang['wys_linkcolor'] = '超連結';
$lang['wys_img'] = '圖片';
$lang['wysiwyg_OFF'] = '所見即所得 <u>關閉</u>';
$lang['wysiwyg_ON'] = '所見即所得 <u>開啟</u>';
$lang['wys_enter_img'] = '請輸入圖片網址:';
$lang['wys_enter_url'] = '請輸入網址:';
// Added in 0.3.5
$lang['wys_print'] = '列印';
$lang['wys_cut'] = '剪下';
$lang['wys_copy'] = '複製';
$lang['wys_paste'] = '貼上';
$lang['wys_quote'] = '引言回覆';
$lang['wys_quote_desc'] = '在這邊輸入引言';
$lang['wys_about'] = '版權資訊';
$lang['wys_bbwarning'] = '若關閉BBCode,將無法正常發表';
代碼: 選擇全部
function safe_post($string) {
global $userdata, $board_config;
$tmpString = $string;
if($userdata['user_wysiwyg'] && $board_config['allow_wysiwyg']) {
$tmpString = trim($string);
//convert all types of single quotes
$tmpString = str_replace(chr(145), chr(39), $tmpString);
$tmpString = str_replace(chr(146), chr(39), $tmpString);
$tmpString = str_replace("'", "'", $tmpString);
//convert all types of double quotes
$tmpString = str_replace(chr(147), chr(34), $tmpString);
$tmpString = str_replace(chr(148), chr(34), $tmpString);
//replace carriage returns & line feeds
$tmpString = str_replace(chr(10), " ", $tmpString);
$tmpString = str_replace(chr(13), " ", $tmpString);
}
代碼: 選擇全部
function safe_post(){}