cmsms and greek

Talk about writing modules and plugins for CMS Made Simple, or about specific core functionality. This board is for PHP programmers that are contributing to CMSMS not for site developers
Post Reply
samplist
Forum Members
Forum Members
Posts: 38
Joined: Fri Sep 08, 2006 7:42 am

cmsms and greek

Post by samplist »

Thank you for providing such a great project to the internet community. I'm from greece my name is john and i'm using cmsms for a 6 months now building sites. I must say i find cmsms absolutely great. I myself have very good knowledge of xhtml-css mediocre php and little javascript. I'm contacting you about some problems that i have encountered and solved in cmsms when working with greek. Maybe the folowing problems exist also for languages other than English.

1)my site and my sql database are in utf-8 so in order for content to be inserted right in the database and be searchable
i added set names utf8. Otherwise the content inserts in the database like weird characters...

Line 109 include.php

Code: Select all

#Load them into the usual variables.  This'll go away a little later on.
global $DONT_LOAD_DB;
if (!isset($DONT_LOAD_DB))
{
    $cmsdb =& $gCms->GetDB();
	$cmsdb->Execute('set names utf8'); // database connection with utf-8
}
2)Search results in utf-8 (fix to show search results with greek searchwords) otherwise Search shows results only for English searchwords.

Line 21 action.dosearch.php

Code: Select all

#$searchphrase = implode(' OR ', array_fill(0, $nb_words, 'word = ?'));
		$ary = array();
		foreach ($words as $word)
		{
			$word = trim($word);
			$ary[] = "word = " . $db->qstr($word, ENT_COMPAT, 'UTF-8'); //query results in utf-8
		}
		$searchphrase = implode(' OR ', $ary);
	}
3)Even with the "set names utf8" added, fckeditor still inserted weird characters in the database (with no editor content inserted right in the database) so i switched to tinymce with

Code: Select all

mode : "exact"
in tinyconfig.php.

4)I don't know if this is a bug but when you put a searchword in the search box that has preceding spaces, some weird character results appear in the result page! The above change in code (trim) fixed it but i don't know what is causing it.

Line 6 action.dosearch.php

Code: Select all

// Fix to prevent XSS like behaviour. See: http://www.securityfocus.com/archive/1/455417/30/0/threaded
	$params['searchinput'] = htmlspecialchars(trim($params['searchinput'])); //trim added
	@$this->SendEvent('SearchInitiated', array(&$params['searchinput']));
Are the above changes correct to be implemented in cmsms core?
And if yes can they be implemented in the next release?
Thank you very much.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm
Location: Fernie British Columbia, Canada

Re: cmsms and greek

Post by calguy1000 »

I think that this is a good idea.... I'll take a look at it, and see what we can do for the 1.1 release.
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
samplist
Forum Members
Forum Members
Posts: 38
Joined: Fri Sep 08, 2006 7:42 am

Re: cmsms and greek

Post by samplist »

thanks, if i can do anything to help i'll be glad to.
KO
Power Poster
Power Poster
Posts: 562
Joined: Mon Nov 06, 2006 7:55 pm
Location: Helsinki, Finland

Re: cmsms and greek

Post by KO »

I found out that when I changed only following line in action.dosearch.php I started getting all results with öäå:

Line 21 action.dosearch.php
Code:

Code: Select all

#$searchphrase = implode(' OR ', array_fill(0, $nb_words, 'word = ?'));
		$ary = array();
		foreach ($words as $word)
		{
			$word = trim($word);
			[color=red]$ary[] = "word = " . $db->qstr($word, ENT_COMPAT, 'UTF-8'); //query results in utf-8[/color]
		}
		$searchphrase = implode(' OR ', $ary);
	}

Hope this helps!

Br, K
samplist
Forum Members
Forum Members
Posts: 38
Joined: Fri Sep 08, 2006 7:42 am

Re: cmsms and greek

Post by samplist »

the above was for cmsms 1.04... In 1.1 i saw that the changes i proposed were implemented, no need to edit action.dosearch.php anymore. Just uncomment the line $cmsdb->Execute('set names utf8'); in include.php and everything works fine. You must set your db to unicode in order to appear right. Thanks.
Post Reply

Return to “Developers Discussion”