Last year I've submitted this MOD (V.2) here##############################################
## MOD Title: WYSIWYG - Rich Text Editor 3.0 for Post and Private Message
## MOD Author: Jimbo Hong http://www.HotEditor.com
## MOD Description: Format your post or private message like you working with FrontPage
##
## MOD Version: 3.0
##
## Installation Level: Intermediate
## Installation Time: ~20 minutes
##
## Files To Edit (6) :
## phpbb/viewtopic.php + posting.php + privmsg.php
## phpbb/includes/topic_review.php
## phpbb/templates/subSilver/overall_header.tpl + posting_body.tpl
##
## Included Files (2) :
## phpbb/templates/subSilver/posting_body_ie.tpl
## phpbb/get_vars.php
## Included new Folder (1) : richedit
##
###############################################
http://www.phpbb.com/phpBB/viewtopic.ph ... highlight=
Today, I came back with the new version, I've rewritten the code to make the Editor runs better than before. You can see it runs on my site here
http://HotEditor.com/
http://HotEditor.com/phpbb/index.php
Download and try it out here
http://www.hoteditor.com/how_to_phpbb2.php
Demosunu görmek isterseniz buradan
bakabilirsiniz...
Kurulumu:
Kod: Tümünü seç
################################################################################################
##
## FOR phpBB VERSION 2.0.17 - 2.0.18
##
## MOD Title: WYSIWYG - Rich Text Editor 3.0 for Post and Private Message
## MOD Author: Jimbo Hong http://www.HotEditor.com
## MOD Description: It's time to turn <textarea> into a powerful Rich Text HTML Editor.
## Don't force your users to learn another set of markup tags.
## With this MOD you can format your posts or Private message
## just like you would in MS. FrontPage!
##
## MOD Version: 3.0
##
## Installation Level: Intermediate
## Installation Time: 20 minutes
##
## Files To Edit (7) :
## viewtopic.php + posting.php + privmsg.php + search
## includes/topic_review.php
## templates/subSilver/overall_header.tpl + posting_body.tpl
##
## Included Files (2) : + templates/subSilver/posting_body_ie.tpl
## + get_vars.php
##
## Included new Folder (1) : richedit
##
################################################################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
################################################################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
################################################################################################
#
#-----[ OPEN ]------------------------------------------
#
viewtopic.php
#
#-----[ FIND around line number 1156 ]------------------------------------------
#
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
$message =str_replace ("#ed_op#","<",$message);
$message =str_replace ("#ed_cl#",">",$message);
$message =str_replace ("&","&",$message);
$message =str_replace (""","\"",$message);
$message =str_replace ("<br />","<br>",$message);
// Clear all onClick onMouseOver onMouseOut onMouseDown onMouseUp onMouseMove onBlur cursor
// position absolute visibility visible z-index
// Example <span onClick=alert('BOOOO')>Click here</span>
// will be replaced to <span =alert('BOOOO')>Click here</span>
// in this way your board won't mess up. Hope this will help.
$message = str_replace("<","\n<",$message);
$message = str_replace(">",">\n",$message);
$array_mess = explode ("\n",$message);
$message = "";
foreach ($array_mess as $val){
if (preg_match("/</",$val) ){
$val = preg_replace("/onclick/si", "", $val);
$val = preg_replace("/onmouseover/si", "", $val);
$val = preg_replace("/onmouseout/si", "", $val);
$val = preg_replace("/onmousedown/si", "", $val);
$val = preg_replace("/onmouseup/si", "", $val);
$val = preg_replace("/onmousemove/si", "", $val);
$val = preg_replace("/onblur/si", "", $val);
$val = preg_replace("/cursor/si", "", $val);
$val = preg_replace("/position/si", "", $val);
$val = preg_replace("/absolute/si", "", $val);
$val = preg_replace("/visibility/si", "", $val);
$val = preg_replace("/visible/si", "", $val);
$val = preg_replace("/z-index/si", "", $val);
$val = preg_replace("/script/si", "", $val);
}
$message .=$val;
}
//EDITOR END HERE
#
#-----[ SAVE/CLOSE FILE ]------------------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
posting.php
#
#-----[ FIND around line number 14 ]------------------------------------------
#
/***************************************************************************
*
* 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.
*
***************************************************************************/
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
require_once "getvars.php";
$richedit = get_global_var("richedit");
$message2 = get_global_var("message2");
if ($richedit == "0"){$message = $message2;}
//EDITOR END HERE
#
#-----[ FIND around line number 709 ]------------------------------------------
#
template->set_filenames(array(
'preview' => 'posting_preview.tpl')
);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
$preview_message =str_replace ("#ed_op#","<",$preview_message);
$preview_message =str_replace ("#ed_cl#",">",$preview_message);
$preview_message =str_replace ("&","&",$preview_message);
$preview_message =str_replace (""","\"",$preview_message);
$ua = get_global_var("user_agent");
if ($richedit == "0" ){
$preview_message = str_replace("<br />", "", $preview_message);
}
$editor_off = get_global_var("editor_off");
if ($editor_off == "0" && strpos($ua,"Gecko") ){
$preview_message = str_replace("<br />", "", $preview_message);
}
$preview_message = str_replace("<br />", "<br>", $preview_message);
//EDITOR END HERE
#
#-----[ FIND around line number 977 ]------------------------------------------
#
$template->set_filenames(array(
'body' => 'posting_body.tpl',
'pollbody' => 'posting_poll_body.tpl',
'reviewbody' => 'posting_topic_review.tpl')
);
#
#-------[COMMENT THE CODE LIKE THIS] ---------------------------------------------
#
//$template->set_filenames(array(
// 'body' => 'posting_body.tpl',
// 'pollbody' => 'posting_poll_body.tpl',
// 'reviewbody' => 'posting_topic_review.tpl')
//);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
$richedit = get_global_var("richedit");
$ua = get_global_var("user_agent");
$cookie_editor =get_global_var("cookie_editor");
if ($richedit != "0" && strpos($ua,"Windows") && strpos($ua,"MSIE") && !strpos($ua,"Opera") && $cookie_editor !="off" || strpos($ua,"Gecko") && $richedit != "0" && !strpos($ua,"Safari") && $cookie_editor !="off") {
$display_editor_option = "<span class=gen>\n";
$display_editor_option .= "<input type=radio value=1 checked name=richedit onClick='set_cookie(\"on\")'>Click here to set Rich Text Editor as your default<br>\n";
$display_editor_option .= "<input type=radio value=0 name=richedit onClick='set_cookie(\"off\")'>Click here to set normal Text Area as your default\n";
$display_editor_option .= "</span>\n";
$display_editor_option .= "<script language=javascript>\n";
$display_editor_option .= "function set_cookie(data){\n";
$display_editor_option .= "popup=window.open('getvars.php?step=set_default&editor=' + data, 'hoteditor', 'height=300,width=300,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');\n";
$display_editor_option .= "popup.focus();\n";
$display_editor_option .= "}\n";
$display_editor_option .= "</script>\n";
$template->set_filenames(array(
'body' => 'posting_body_ie.tpl',
'pollbody' => 'posting_poll_body.tpl',
'reviewbody' => 'posting_topic_review.tpl')
);
}
else{
$display_editor_option = "<span class=gen>\n";
$display_editor_option .= "<input type=radio value=1 name=richedit onClick='set_cookie(\"on\")'>Click here to set Rich Text Editor as your default<br>\n";
$display_editor_option .= "<input type=radio value=0 checked name=richedit onClick='set_cookie(\"off\")'>Click here to set normal Text Area as your default\n";
$display_editor_option .= "</span>\n";
$display_editor_option .= "<script language=javascript>\n";
$display_editor_option .= "function set_cookie(data){\n";
$display_editor_option .= "popup=window.open('getvars.php?step=set_default&editor=' + data, 'hoteditor', 'height=300,width=300,status=no,toolbar=no,menubar=no,location=no,scrollbars=no')\n";
$display_editor_option .= "popup.focus();\n";
$display_editor_option .= "}\n";
$display_editor_option .= "</script>\n";
$template->set_filenames(array(
'body' => 'posting_body.tpl',
'pollbody' => 'posting_poll_body.tpl',
'reviewbody' => 'posting_topic_review.tpl')
);
}
if (strpos($ua,"Opera") || strpos($ua,"Safari")) {
$display_editor_option="";
}
//EDITOR END HERE
#
#-----[ FIND around line number 1046 ]------------------------------------------
#
$template->assign_block_vars('switch_not_privmsg', array());
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
$message = str_replace ("#ed_op#","<",$message);
$message = str_replace ("#ed_cl#",">",$message);
$message = str_replace ("&","&",$message);
$message = str_replace('"',""",$message);
$message = str_replace('\\',"&bkfls;",$message);
$message = str_replace ("<br />","",$message);
$editor_off = get_global_var("editor_off");
$richedit = get_global_var("richedit");
$ua = get_global_var("user_agent");
if ($richedit != "0") {
$message = str_replace("\r\n","<br />",$message);
$message = str_replace("<br><br />","<br>",$message);
}
if ($editor_off == "0" && strpos($ua,"Gecko") ){
$message = str_replace("<br />", "", $message);
}
//EDITOR END HERE
#
#-----[ FIND around line number 1070 ]------------------------------------------
#
//
// Output the data to the template
//
$template->assign_vars(array(
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
'DISPLAY_EDITOR_OPTION' => $display_editor_option,
//EDITOR END HERE
#
#-----[ SAVE/CLOSE FILE ]------------------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
privmsg.php
#
#-----[ FIND around line number 14 ]------------------------------------------
#
/***************************************************************************
*
* 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.
*
***************************************************************************/
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
require_once "getvars.php";
$richedit = get_global_var("richedit");
$message2 = get_global_var("message2");
if ($richedit == "0"){$message = $message2;}
//EDITOR END HERE
#
#-----[ FIND around line number 620 ]------------------------------------------
#
$private_message = str_replace("\n", '<br />', $private_message);
//
// Dump it to the templating engine
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
$private_message =str_replace ("#ed_op#","<",$private_message);
$private_message =str_replace ("#ed_cl#",">",$private_message);
$private_message =str_replace ("&","&",$private_message);
$private_message =str_replace (""","\"",$private_message);
$private_message = str_replace("<br />", "<br>", $private_message);
//EDITOR END HERE
#
#-----[ FIND around line number 1598 ]------------------------------------------
#
$template->set_filenames(array(
"preview" => 'privmsgs_preview.tpl')
);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
$preview_message =str_replace ("#ed_op#","<",$preview_message);
$preview_message =str_replace ("#ed_cl#",">",$preview_message);
$preview_message =str_replace ("&","&",$preview_message);
$preview_message =str_replace (""","\"",$preview_message);
if ($richedit == "0"){$preview_message = str_replace("<br />", "", $preview_message);}
$editor_off = get_global_var("editor_off");
if ($editor_off == "0" && strpos($ua,"Gecko") ){$preview_message = str_replace("<br />", "", $preview_message);}
$preview_message = str_replace("<br />", "<br>", $preview_message);
//EDITOR END HERE
#
#-----[ FIND around line number 1655 ]------------------------------------------
#
$template->set_filenames(array(
'body' => 'posting_body.tpl')
);
#
#-------[COMMENT THE CODE LIKE THIS] ---------------------------------------------
#
//$template->set_filenames(array(
//'body' => 'posting_body.tpl')
//);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
$richedit = get_global_var("richedit");
$ua = get_global_var("user_agent");
$cookie_editor =get_global_var("cookie_editor");
if ($richedit != "0" && strpos($ua,"Windows") && strpos($ua,"MSIE") && !strpos($ua,"Opera") && $cookie_editor !="off" || strpos($ua,"Gecko") && $richedit != "0" && !strpos($ua,"Safari") && $cookie_editor !="off") {
$display_editor_option = "<span class=gen>\n";
$display_editor_option .= "<input type=radio value=1 checked name=richedit onClick='set_cookie(on)'>Click here to set Rich Text Editor as your default<br>\n";
$display_editor_option .= "<input type=radio value=0 name=richedit onClick='set_cookie(off)'>Click here to set normal Text Area as your default\n";
$display_editor_option .= "</span>\n";
$display_editor_option .= "<script language=javascript>\n";
$display_editor_option .= "function set_cookie(data){\n";
$display_editor_option .= "popup=window.open('getvars.php?step=set_default&editor=' + data, 'hoteditor', 'height=300,width=300,status=no,toolbar=no,menubar=no,location=no,scrollbars=no');\n";
$display_editor_option .= "popup.focus();\n";
$display_editor_option .= "}\n";
$display_editor_option .= "</script>\n";
$template->set_filenames(array(
'body' => 'posting_body_ie.tpl')
);
}
else{
$display_editor_option = "<span class=gen>\n";
$display_editor_option .= "<input type=radio value=1 name=richedit onClick='set_cookie(on)'>Click here to set Rich Text Editor as your default<br>\n";
$display_editor_option .= "<input type=radio value=0 checked name=richedit onClick='set_cookie(off)'>Click here to set normal Text Area as your default\n";
$display_editor_option .= "</span>\n";
$display_editor_option .= "<script language=javascript>\n";
$display_editor_option .= "function set_cookie(data){\n";
$display_editor_option .= "popup=window.open('getvars.php?step=set_default&editor=' + data, 'hoteditor', 'height=300,width=300,status=no,toolbar=no,menubar=no,location=no,scrollbars=no')\n";
$display_editor_option .= "popup.focus();\n";
$display_editor_option .= "}\n";
$display_editor_option .= "</script>\n";
$template->set_filenames(array(
'body' => 'posting_body.tpl')
);
}
if (strpos($ua,"Opera") || strpos($ua,"Safari")) {
$display_editor_option="";
}
//EDITOR END HERE
#
#-----[ FIND around line number 1785 ]------------------------------------------
#
privmsg_subject = preg_replace($html_entities_match, $html_entities_replace, $privmsg_subject);
$privmsg_subject = str_replace('"', '"', $privmsg_subject);
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
$privmsg_message = str_replace ("#ed_op#","<",$privmsg_message);
$privmsg_message = str_replace ("#ed_cl#",">",$privmsg_message);
$privmsg_message = str_replace ("&","&",$privmsg_message);
$privmsg_message = str_replace('"',""",$privmsg_message);
$privmsg_message = str_replace('\\',"&bkfls;",$privmsg_message);
$privmsg_message = str_replace ("<br />","",$privmsg_message);
$editor_off = get_global_var("editor_off");
$richedit = get_global_var("richedit");
$ua = get_global_var("user_agent");
if ($richedit != "0") {
$privmsg_message = str_replace("\r\n","<br />",$privmsg_message);
$privmsg_message = str_replace("<br><br />","<br>",$privmsg_message);
}
if ($editor_off == "0" && strpos($ua,"Gecko") ){
$privmsg_message = str_replace("<br />", "", $privmsg_message);
}
//EDITOR END HERE
#
#-----[ NEXT 2 LINE FIND ]------------------------------------------
#
$template->assign_vars(array(
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
'DISPLAY_EDITOR_OPTION' => $display_editor_option,
//EDITOR END HERE
#
#-----[ SAVE/CLOSE FILE ]------------------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
search.php
#
#-----[ FIND around line number 868 ]------------------------------------------
#
$message = ( strlen($message) > $return_chars ) ? substr($message, 0, $return_chars) . ' ...' : $message;
#
#-------[COMMENT THE CODE LIKE THIS] ---------------------------------------------
#
//$message = ( strlen($message) > $return_chars ) ? substr($message, 0, $return_chars) . ' ...' : $message;
#
#-----[ FIND around line number 1016 ]------------------------------------------
#
$template->assign_block_vars("searchresults", array(
#
#-----[ BEFORE, ADD ]------------------------------------------
#
//EDITOR START HERE
$message =str_replace ("#ed_op#","<",$message);
$message =str_replace ("#ed_cl#",">",$message);
$message =str_replace ("&","&",$message);
$message =str_replace (""","\"",$message);
$message =str_replace ("<br />","<br>",$message);
// Clear all onClick onMouseOver onMouseOut onMouseDown onMouseUp onMouseMove onBlur cursor
// position absolute visibility visible z-index
// Example <span onClick=alert('BOOOO')>Click here</span>
// will be replaced to <span =alert('BOOOO')>Click here</span>
// in this way your board won't mess up. Hope this will help.
$message = str_replace("<","\n<",$message);
$message = str_replace(">",">\n",$message);
$array_mess = explode ("\n",$message);
$message = "";
foreach ($array_mess as $val){
if (preg_match("/</",$val) ){
$val = preg_replace("/onclick/si", "", $val);
$val = preg_replace("/onmouseover/si", "", $val);
$val = preg_replace("/onmouseout/si", "", $val);
$val = preg_replace("/onmousedown/si", "", $val);
$val = preg_replace("/onmouseup/si", "", $val);
$val = preg_replace("/onmousemove/si", "", $val);
$val = preg_replace("/onblur/si", "", $val);
$val = preg_replace("/cursor/si", "", $val);
$val = preg_replace("/position/si", "", $val);
$val = preg_replace("/absolute/si", "", $val);
$val = preg_replace("/visibility/si", "", $val);
$val = preg_replace("/visible/si", "", $val);
$val = preg_replace("/z-index/si", "", $val);
$val = preg_replace("/script/si", "", $val);
}
$message .=$val;
}
//EDITOR END HERE
#
#-----[ SAVE/CLOSE FILE ]------------------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
includes/topic_review.php
#
#-----[ FIND around line number 187 ]------------------------------------------
#
row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
$message =str_replace ("#ed_op#","<",$message);
$message =str_replace ("#ed_cl#",">",$message);
$message =str_replace ("&","&",$message);
$message =str_replace (""","\"",$message);
$message =str_replace ("<br />","<br>",$message);
// Clear all onClick onMouseOver onMouseOut onMouseDown onMouseUp onMouseMove onBlur cursor
// position absolute visibility visible z-index
// Example <span onClick=alert('BOOOO')>Click here</span>
// will be replaced to <span =alert('BOOOO')>Click here</span>
// in this way your board won't mess up. Hope this will help.
$message = str_replace("<","\n<",$message);
$message = str_replace(">",">\n",$message);
$array_mess = explode ("\n",$message);
$message = "";
foreach ($array_mess as $val){
if (preg_match("/</",$val) ){
$val = preg_replace("/onclick/si", "", $val);
$val = preg_replace("/onmouseover/si", "", $val);
$val = preg_replace("/onmouseout/si", "", $val);
$val = preg_replace("/onmousedown/si", "", $val);
$val = preg_replace("/onmouseup/si", "", $val);
$val = preg_replace("/onmousemove/si", "", $val);
$val = preg_replace("/onblur/si", "", $val);
$val = preg_replace("/cursor/si", "", $val);
$val = preg_replace("/position/si", "", $val);
$val = preg_replace("/absolute/si", "", $val);
$val = preg_replace("/visibility/si", "", $val);
$val = preg_replace("/visible/si", "", $val);
$val = preg_replace("/z-index/si", "", $val);
$val = preg_replace("/script/si", "", $val);
}
$message .=$val;
}
//EDITOR END HERE
#
#-----[ SAVE/CLOSE FILE ]------------------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/overall_header.tpl
#
#-----[ FIND around line number 35 ]------------------------------------------
#
font,th,td,p { font-family: {T_FONTFACE1} }
#
#-----[ REPLACE WITH ]------------------------------------------
#
th,td,p { font-family: {T_FONTFACE1} }
#
#-----[ FIND around line number 146 ]------------------------------------------
#
.postbody { font-size : {T_FONTSIZE3}px; line-height: 18px}
#
#-----[ REPLACE WITH ]------------------------------------------
#
.postbody { font-size : {T_FONTSIZE3}px; line-height: 24px}
#
#-----[ SAVE/CLOSE FILE ]------------------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
templates/subSilver/posting_body.tpl
#
#-----[ FIND around line number 75 ]------------------------------------------
#
function checkForm() {
#
#-----[ AFTER, ADD ]------------------------------------------
#
//EDITOR START HERE
var MESS_EDITOR = document.post.message.value;
MESS_EDITOR = MESS_EDITOR.replace(/#ed_op#/ig,"<");
MESS_EDITOR = MESS_EDITOR.replace(/#ed_cl#/ig,">");
MESS_EDITOR = MESS_EDITOR.replace(/\n/ig,"#ed_op#br /#ed_cl#");
document.post.message2.value= MESS_EDITOR;
//EDITOR END HERE
#
#-----[ FIND around line number 268 ]------------------------------------------
#
<form action="{S_POST_ACTION}" method="post" name="post" onsubmit="return checkForm(this)">
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- //EDITOR HERE -->
<input type=hidden name=message2 value ="">
<!-- //EDITOR HERE -->
#
#-----[ FIND around line number 409 ]------------------------------------------
#
<textarea name="message" rows="15" cols="35" wrap="virtual" style="width:450px" tabindex="3" class="post" onselect="storeCaret(this);" onclick="storeCaret(this);" onkeyup="storeCaret(this);">{MESSAGE}</textarea>
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- //EDITOR HERE -->
{DISPLAY_EDITOR_OPTION}
<!-- //EDITOR HERE -->
#
#-----[ FIND around line number 500 ]------------------------------------------
#
{TOPIC_REVIEW_BOX}
#
#-----[ AFTER, ADD ]------------------------------------------
#
<!-- //EDITOR ADD JAVASCRIPT CODE HERE -->
<script language=javascript>
var MESS_EDITOR = document.post.message.value;
MESS_EDITOR = MESS_EDITOR.replace(/<br>/ig,"\n");
document.post.message.value = MESS_EDITOR;
</script>
<!-- //EDITOR ADD JAVASCRIPT CODE HERE -->
#
#-----[ SAVE/CLOSE FILE ]------------------------------------------
#
[USE FTP TO UPLOAD FILE getvars.php TO FOLDER phpbb (SAME LOCATION WITH FILE posting.php)]
[USE FTP TO UPLOAD FILE posting_body_ie.tpl TO FOLDER phpbb/templates/subSilver/posting_body_ie.tpl]
# EoM - END OF MOD