- Posts: 5
- Thank you received: 1
Kunena 7.0.8 Released
The Kunena team has announce the arrival of Kunena 7.0.8 [K 7.0.8] in stable which is now available for download as a native Joomla extension for J! 5.4.x/6.0.x./6.1.x. This version addresses most of the issues that were discovered in K 6.2 / K 6.3 / K 6.4 and issues discovered during the last development stages of K 7.0
This category contains miscellaneous, uncategorised user contributions, (templates, modules, plugins and hacks) relating to older versions of Kunena that are no longer supported.
This category may also contain a few topics relating to K 1.6 that may have been moved here possibly by mistake.
The topics in this category are for historical interest only. Owing to the structural differences between K 1.6 and K 1.7, these ideas in these topics will not work with later versions and, for that reason, the topics are locked.
This category may also contain a few topics relating to K 1.6 that may have been moved here possibly by mistake.
The topics in this category are for historical interest only. Owing to the structural differences between K 1.6 and K 1.7, these ideas in these topics will not work with later versions and, for that reason, the topics are locked.
Question ckeditor, TinyMCE and any html editor for kunena. hoteditor (bbcode) integration in progess...
15 years 8 months ago #73416
by alhoseany
ckeditor, TinyMCE and any html editor for kunena. hoteditor (bbcode) integration in progess... was created by alhoseany
hi, everyone.
1st thanks to kunena developer for this great piece of art.
i am not against the bbcode editor of kunena but more than one of my clients wanted an editor like the vb bbcode editor. so i choose to stay with kunena and try to integrate other editors until the bbcode editor of kunena is developed well enough to satisfy my clients.
this is a very big warning and in red. i am not a professional php developer. and i do not grantee any of these hacks or scripts. there will be errors and risks and it is all on you. i will help as much as i can.
1st (bbcode editors integration)
i didn't find good open source bbcode editors out there. the best was hoteditor. and i am working on its integration in kunena now. will add all the integration info once it is done here.
please if you find any good open source or free bbcode, send it to me so i can integrate it into kunena.
2nd (HTML editors)
all HTML editors will have the same steps to integrate them. it only differs a little:
step1- download editor files and add javascrip code to initialize the editor.
step2- prevent kunena from filtering the html tags while showing the posts.
step3- add HTML filtering and purifying code that filter all malicious code sent by the html editor.
step4- customize css and editor styling.
*step 2 and 3 are the same in most HTML editors, so we will cover them 1st here:
step2- prevent kunena from filtering the HTML tags while showing the posts.
files to edit: joomlaDir\administrator\components\com_kunena\libraries\html\parser.php
look for this code:(at the end of the document)
change it to:
step3- add HTML filtering and purifying code that filter all malicious code sent by the HTML editor.
-there is a lot of these filtering code out there, i used htmLawed php script.
1- download htmLawed php script from here
www.bioinformatics.org/phplabware/internal_utilities/htmLawed/
2- extract files into a folder named "htmLawed".
3- copy the whole htmLawed folder into this path:
joomlaDir\components\com_kunena\funcs
4- edit this file:
joomlaDir\components\com_kunena\funcs\post.php
a- find this code:
change it to:
b- find this code:
change it to:
that is it, we move now into step 1
step1- download editor files and add javascrip code to initialize the editor.
a- ckeditor:
1- download from here
ckeditor.com/
2- extract files to this path
joomlaDir\components\com_kunena\template\ckeditor
3- edit these files:
a- file to edit:
joomlaDir\components\com_kunena\lib\kunena.bbcode.js.php
find this code:
change it to:
b- file to edit:
joomlaDir\components\com_kunena\template\default\editor\bbcode.php
find this code:
change it to:
that it is it. now you can try the ckeditor when you write a new post.
warning: this is not yet a complete tested integration. there is errors and security risks. so do it on your own risk.
- don't forget to remove unnecessary buttons from ckeditor.
- removal of kunena bbcode editor is easy but i left it until i have reliable final editor choice.
b- TinyMCE:
1- download the files from here:
tinymce.moxiecode.com/
2- extract files to this path:
joomlaDir\components\com_kunena\template\tinymce
3- files to edit
a- find this file
joomlaDir\components\com_kunena\lib\kunena.bbcode.js.php
find this code:
change it to:
last step which styling and optimizing the editor for your template:
1- ckeditor will not need any changes, it will blend will with your template automatically.
2- tinymce will need a lot of styling work if your kunena template is designed by tables. because the editor too uses table for design.
the best shot i have got in styling tinymce with kunena default template was by removing the styles from the table that contain the editor.
i did this by removing all styles from <tr> , <td> and <table> tags in these files
joomlaDir\components\com_kunena\template\default\editor\bbcode.php
joomlaDir\components\com_kunena\template\default\editor\form.php
i hope that may help anyone out there. this is not yet a complete work. use it on your own risk.
i will post here if i have more info.
1st thanks to kunena developer for this great piece of art.
i am not against the bbcode editor of kunena but more than one of my clients wanted an editor like the vb bbcode editor. so i choose to stay with kunena and try to integrate other editors until the bbcode editor of kunena is developed well enough to satisfy my clients.
warning :
this is a very big warning and in red. i am not a professional php developer. and i do not grantee any of these hacks or scripts. there will be errors and risks and it is all on you. i will help as much as i can.
1st (bbcode editors integration)
i didn't find good open source bbcode editors out there. the best was hoteditor. and i am working on its integration in kunena now. will add all the integration info once it is done here.
please if you find any good open source or free bbcode, send it to me so i can integrate it into kunena.
2nd (HTML editors)
all HTML editors will have the same steps to integrate them. it only differs a little:
step1- download editor files and add javascrip code to initialize the editor.
step2- prevent kunena from filtering the html tags while showing the posts.
step3- add HTML filtering and purifying code that filter all malicious code sent by the html editor.
step4- customize css and editor styling.
*step 2 and 3 are the same in most HTML editors, so we will cover them 1st here:
step2- prevent kunena from filtering the HTML tags while showing the posts.
files to edit: joomlaDir\administrator\components\com_kunena\libraries\html\parser.php
look for this code:(at the end of the document)
Code:
function escape($string) {
return htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
}
}
change it to:
Code:
function escape($string) {
return $string ;
}
}
step3- add HTML filtering and purifying code that filter all malicious code sent by the HTML editor.
-there is a lot of these filtering code out there, i used htmLawed php script.
1- download htmLawed php script from here
www.bioinformatics.org/phplabware/internal_utilities/htmLawed/
2- extract files into a folder named "htmLawed".
3- copy the whole htmLawed folder into this path:
joomlaDir\components\com_kunena\funcs
4- edit this file:
joomlaDir\components\com_kunena\funcs\post.php
a- find this code:
Code:
defined ( '_JEXEC' ) or die ();
class CKunenaPost {
public $allow = 0;
change it to:
Code:
defined ( '_JEXEC' ) or die ();
include_once('/htmLawed/htmLawed.php');
class CKunenaPost {
public $allow = 0;
b- find this code:
Code:
$fields ['name'] = JRequest::getString ( 'authorname', $this->getAuthorName () );
$fields ['email'] = JRequest::getString ( 'email', null );
$fields ['subject'] = JRequest::getVar ( 'subject', null, 'POST', 'string', JREQUEST_ALLOWRAW );
$fields ['message'] = JRequest::getVar ( 'message', null, 'POST', 'string', JREQUEST_ALLOWRAW );
$fields ['topic_emoticon'] = JRequest::getInt ( 'topic_emoticon', null );
$options ['attachments'] = 1;
$options ['anonymous'] = JRequest::getInt ( 'anonymous', 0 );
$contentURL = JRequest::getVar ( 'contentURL', '' );
require_once (KUNENA_PATH_LIB . DS . 'kunena.posting.class.php');
change it to:
Code:
$fields ['name'] = JRequest::getString ( 'authorname', $this->getAuthorName () );
$fields ['email'] = JRequest::getString ( 'email', null );
$fields ['subject'] = JRequest::getVar ( 'subject', null, 'POST', 'string', JREQUEST_ALLOWRAW );
$fields ['message'] = JRequest::getVar ( 'message', null, 'POST', 'string', JREQUEST_ALLOWRAW );
$kiko = $fields ['message'] ;
$kiko2 = htmLawed($kiko);
$fields ['message'] = $kiko2 ;
$fields ['topic_emoticon'] = JRequest::getInt ( 'topic_emoticon', null );
$options ['attachments'] = 1;
$options ['anonymous'] = JRequest::getInt ( 'anonymous', 0 );
$contentURL = JRequest::getVar ( 'contentURL', '' );
require_once (KUNENA_PATH_LIB . DS . 'kunena.posting.class.php');
that is it, we move now into step 1
step1- download editor files and add javascrip code to initialize the editor.
a- ckeditor:
1- download from here
ckeditor.com/
2- extract files to this path
joomlaDir\components\com_kunena\template\ckeditor
3- edit these files:
a- file to edit:
joomlaDir\components\com_kunena\lib\kunena.bbcode.js.php
find this code:
Code:
$script = ob_get_contents();
ob_end_clean();
CKunenaTools::addScript(KUNENA_DIRECTURL . 'template/default/js/editor-min.js');
$document->addScriptDeclaration( "// <![CDATA[
{$script}
change it to:
Code:
$script = ob_get_contents();
ob_end_clean();
CKunenaTools::addScript(KUNENA_DIRECTURL . 'template/default/js/editor-min.js');
CKunenaTools::addScript(KUNENA_DIRECTURL . 'template/ckeditor/ckeditor.js');
$document->addScriptDeclaration( "// <![CDATA[
{$script}
b- file to edit:
joomlaDir\components\com_kunena\template\default\editor\bbcode.php
find this code:
Code:
<td class="kcol-last kcol-editor-field">
<textarea class="ktxtarea required" name="message" id="kbbcode-message" rows="10" cols="50"><?php echo $this->escape($this->message_text); ?></textarea>
<?php
change it to:
Code:
<td class="kcol-last kcol-editor-field">
<textarea class="ktxtarea required" name="message" id="kbbcode-message" rows="10" cols="50"><?php echo $this->escape($this->message_text); ?></textarea>
<script type="text/javascript">
CKEDITOR.replace( 'message',
{
language : 'en',
skin : 'v2',
uiColor : '#9AB8F3'
});
</script>
<?php
that it is it. now you can try the ckeditor when you write a new post.
warning: this is not yet a complete tested integration. there is errors and security risks. so do it on your own risk.
- don't forget to remove unnecessary buttons from ckeditor.
- removal of kunena bbcode editor is easy but i left it until i have reliable final editor choice.
b- TinyMCE:
1- download the files from here:
tinymce.moxiecode.com/
2- extract files to this path:
joomlaDir\components\com_kunena\template\tinymce
3- files to edit
a- find this file
joomlaDir\components\com_kunena\lib\kunena.bbcode.js.php
find this code:
Code:
$script = ob_get_contents();
ob_end_clean();
CKunenaTools::addScript(KUNENA_DIRECTURL . 'template/default/js/editor-min.js');
$document->addScriptDeclaration( "// <![CDATA[
{$script}
change it to:
Code:
$script = ob_get_contents();
ob_end_clean();
CKunenaTools::addScript(KUNENA_DIRECTURL . 'template/default/js/editor-min.js');
CKunenaTools::addScript(KUNENA_DIRECTURL . 'template/tinymce/jscripts/tiny_mce/tiny_mce.js');
?>
<script type="text/javascript">
tinyMCE.init({
// General options
language : "en", // change language here
mode : "textareas",
theme : "advanced",
plugins : "style,table,advhr,advimage,advlink,emotions,inlinepopups,insertdatetime,preview,media,contextmenu,paste,directionality,visualchars,nonbreaking,xhtmlxtras,template,wordcount,advlist,autosave",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect,cut,copy,paste,pastetext,pasteword,|,search,replace",
theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,|,forecolor,backcolor",
theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,media,advhr,ltr,rtl",
theme_advanced_buttons4 : "cleanup,code,|,insertdate,inserttime,preview,cite,abbr,acronym,del,ins,attribs,|,nonbreaking",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "right",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
// Example content CSS (should be your site CSS)
content_css : "css/content.css",
// Drop lists for link/image/media/template dialogs
template_external_list_url : "lists/template_list.js",
external_link_list_url : "lists/link_list.js",
external_image_list_url : "lists/image_list.js",
media_external_list_url : "lists/media_list.js",
// Style formats
style_formats : [
{title : 'Bold text', inline : 'b'},
{title : 'Red text', inline : 'span', styles : {color : '#ff0000'}},
{title : 'Red header', block : 'h1', styles : {color : '#ff0000'}},
{title : 'Example 1', inline : 'span', classes : 'example1'},
{title : 'Example 2', inline : 'span', classes : 'example2'},
{title : 'Table styles'},
{title : 'Table row 1', selector : 'tr', classes : 'tablerow1'}
],
// Replace values for the template plugin
template_replace_values : {
username : "Some User",
staffid : "991234"
}
});
</script>
<?php
$document->addScriptDeclaration( "// <
I applied the changes you wrote in your first post, but I have trouble with links, for example. the preview is good but after the validation that does not give the expected result. I'll check all the points. Soon you update your post to change. If you do not mind
. Thank you
I applied the changes you wrote in your first post, but I have trouble with links, for example. the preview is good but after the validation that does not give the expected result. I'll check all the points. Soon you update your post to change. If you do not mind
Please Log in or Create an account to join the conversation.
15 years 5 months ago #88562
by Stéphane
Replied by Stéphane on topic Re: ckeditor, TinyMCE and any html editor for kunena. hoteditor (bbcode) integration in progess...
on step 3
I change
include_once('/htmLawed/htmLawed.php');
in
include_once('components/com_kunena/funcs/htmLawed/htmLawed.php');
without it I had an error
I change
include_once('/htmLawed/htmLawed.php');
in
include_once('components/com_kunena/funcs/htmLawed/htmLawed.php');
without it I had an error
Please Log in or Create an account to join the conversation.
Time to create page: 0.273 seconds