TinyMCEを訪問者がQ&Aの作成時に使えるようにします。
1:File : save.php
Change the Line No 42:
Original:
$content = PMF_Filter::filterInput(INPUT_POST, ‘content’, FILTER_SANITIZE_STRIPPED);
Modified
$content = PMF_Filter::filterInput(INPUT_POST, ‘faqcontent’,FILTER_UNSAFE_RAW);
2:File : template/default/add.tpl
Change in Line No: 2
Original
<textarea class=”inputarea” cols=”37″ rows=”10″ name=”content” id=”content”></textarea><br /
Modified
<textarea class=”inputarea” cols=”37″ rows=”10″ name=”faqcontent” id=”faqcontent”></textarea><br />
- File template/default/add.tpl
最終追加
<!-- tinyMCE -->
<script type="text/javascript" src="admin/editor/tiny_mce.js"></script>
<script type="text/javascript">
/*<![CDATA[*/ //<!--
tinyMCE.init({
// General options
mode : "exact",
elements : "faqcontent",
width : "400",
height : "480",
theme : "advanced",
plugins : "spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,syntaxhl,phpmyfaq",
theme_advanced_blockformats : "p,div,h1,h2,h3,h4,h5,h6,blockquote,dt,dd,code,samp",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|styleselect,formatselect,fontselect,fontsizeselect",
theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,code,syntaxhl,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|fullscreen,help",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
relative_urls : false,
convert_urls : false,
remove_linebreaks : false,
use_native_selects : true,
extended_valid_elements : "code",
// Ajax-based file manager
file_browser_callback : "ajaxfilemanager",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "js/template_list.js"
});
function ajaxfilemanager(field_name, url, type, win)
{
var ajaxfilemanagerurl = "admin/editor/plugins/ajaxfilemanager/ajaxfilemanager.php";
switch (type) {
case "image":
case "media":
case "flash":
case "file":
break;
default:
return false;
}
tinyMCE.activeEditor.windowManager.open({
url : "admin/editor/plugins/ajaxfilemanager/ajaxfilemanager.php",
width : 782,
height : 440,
inline : "yes",
close_previous : "no"
},{
window : win,
input : field_name
});
}
// --> /*]]>*/
</script>
<!-- /tinyMCE -->