×
Kunena 5.1.14 Released - Security release (13 Aug 2019)

The Kunena team is proud to announce the arrival of Kunena 5.1.14 [K5.1.14] which is now available for download as a native Joomla extension for Joomla 3.9.x. This version addresses most of the issues that were discovered in K 5.1 and issues discovered during the development stages of K 5.1.14. This update fixed 1 security issue.

× 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.

Question ckeditor, TinyMCE and any html editor for kunena. hoteditor (bbcode) integration in progess...

More
8 years 9 months ago #1 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.
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)
	function escape($string) {
		return htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
	}
}

change it to:
	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:
defined ( '_JEXEC' ) or die ();
 
class CKunenaPost {
	public $allow = 0;

change it to:
defined ( '_JEXEC' ) or die ();
 
 
include_once('/htmLawed/htmLawed.php');
 
class CKunenaPost {
	public $allow = 0;

b- find this 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:
 
		$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:
$script = ob_get_contents();
ob_end_clean();
 
CKunenaTools::addScript(KUNENA_DIRECTURL . 'template/default/js/editor-min.js');
$document->addScriptDeclaration( "// <![CDATA[
{$script}

change it to:
$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:
 
	<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:
 
	<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:
$script = ob_get_contents();
ob_end_clean();
 
CKunenaTools::addScript(KUNENA_DIRECTURL . 'template/default/js/editor-min.js');
$document->addScriptDeclaration( "// <![CDATA[
{$script}

change it to:
$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( "// <![CDATA[
{$script}


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.
The following user(s) said Thank You: ChaosHead

Please Log in or Create an account to join the conversation.

More
8 years 9 months ago #2 by alhoseany
hi again.
i choose ckeditor as the editor of choice. the integration of the editor reach %90. there is only 2 problems need to be solved.

1- i have to click the send button (post form submit button) twice to submit the post. i think this is because the editor uses the 1st click to update the text area with the content. or because there is a validation process that stopped on the 1st click and continue on the next.

anyone can help with this?

2- i delete all the code for the inclusion of the original bbcode editor and i alter the poll code to keep the poll div always show and rename the bbcode toolbar section to create a poll section.

the problem is that the attachment is not working anymore. i try to read the code again to find that attachment has 2 functions :

newAttachment() and bindAttachment()

i dont try to call the newAttachment() function on page load and the attachments work but the tooltip stuck and the attachment procedure is not smooth anymore.

anyone knows how to split the attachment code to be completely alone or unaffected with the bbcode editor??

thanks

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #3 by Stéphane
Hello
Did you manage to integrate kceditor into kunena ???

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #4 by alhoseany
hi, yes i integrate it completely.
i also add a 5 stars voting system.
integrated the alphauserpoints points summary with the kunena profile.
i actually did a lot of modification.
you can watch these modifications here(in arabic language)

main forum page
www.menssilver-rings.info/win3/index.php...tmenu=178&Itemid=187

the regular alphauserpoint profile here
www.menssilver-rings.info/win3/index.php...w=account&Itemid=192

the integrated alphauserpoints in kunena profile here
www.menssilver-rings.info/win3/index.php...c=profile&Itemid=183

you can make a new post here to try the editor
www.menssilver-rings.info/win3/index.php...w&catid=3&Itemid=180

you will need to login try this
username trial1
pass RUlkx1QM

also you can watch the voting system here
category view
www.menssilver-rings.info/win3/index.php...t&catid=2&Itemid=177

post view
www.menssilver-rings.info/win3/index.php...id=2&id=1&Itemid=177

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #5 by Stéphane
Good job :cheer:

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

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #6 by Stéphane
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

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #7 by guerilla

Please Log in or Create an account to join the conversation.

More
8 years 6 months ago #8 by alhoseany
sorry for the late replay. i am very busy now. working on a new website.

about the links. i remove it completely from server side(php) and i use a jQuery plugin linkify. which converts any text link into active link on client side. it is something like the one facebook uses.
here is the link:
github.com/maranomynet/linkify/

i also managed to add all bbcode functions to the ckeditor. so you can use bbcode too in the editor.

so ya i think we should have good editor in kunena

Please Log in or Create an account to join the conversation.

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Time to create page: 0.100 seconds