Re: piCal with FCKeditor HOWTO
List posts in the topic
Re: piCal with FCKeditor HOWTO
msg# 1.1.1.2.1.2.2
XSS issues aside, I wanted to be able to integrate FCKeditor into piCal. Here is how to get FCKeditor running for piCal. I used XOOPS 2.3.3, with FCKeditor 2.6.3 and piCal 0.92, but you can likely make this work with other versions.
The implementation requires two changes -- one for editing (piCal.php) and one for displaying (piCal_xoops.php), both in the module class directory.
In class/piCal.php around lines 2079-2084, find these:
ob_start();
$GLOBALS["description_text"] = $description;
xoopsCodeTarea("description_text",50,6);
$description_textarea = ob_get_contents();
ob_end_clean();
replace with:
if ( is_readable(XOOPS_ROOT_PATH . "/class/xoopseditor/fckeditor/formfckeditor.php") ) {
include_once(XOOPS_ROOT_PATH . "/class/xoopseditor/fckeditor/formfckeditor.php");
$editor_configs = array();
$editor_configs["name"] = "description_text";
$editor_configs["value"] = $description;
$editor_configs["rows"] = 35;
$editor_configs["cols"] = 60;
$editor_configs["width"] = "100%";
$editor_configs["height"] = "400px";
$editor = new XoopsFormFckeditor($editor_configs,true);
$description_textarea = $editor->render();
} else {
include_once( XOOPS_ROOT_PATH . "/include/xoopscodes.php" ) ;
ob_start();
$GLOBALS["description_text"] = $description;
xoopsCodeTarea("description_text",50,6);
$description_textarea = ob_get_contents();
ob_end_clean();
}
In class/piCal_xoops.php, around line 15 (in function textarea_sanitizer_for_show), find:
return $myts->displayTarea($data,0,1,1,1,1);
replace with:
if ( is_readable(XOOPS_ROOT_PATH . "/class/xoopseditor/fckeditor/formfckeditor.php") ) {
return $myts->displayTarea($data,1,1,1,1,0);
} else {
return $myts->displayTarea($data,0,1,1,1,1);
}
Note: you may need to edit the location of fckeditor depending on which version you have implemented, and you may want to change the size of the text box using the $editor_configs variables passed.
Many thanks for the Koivi instructions (from 2005) as they helped me get going for this. This solution "fails gracefully" in case you don't have FCKeditor installed or linked to the right FCKeditor file location.
Votes:17
Average:8.82
Posts tree