Page 1 of 1

cmsms and greek

Posted: Wed May 09, 2007 8:32 pm
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.

Re: cmsms and greek

Posted: Wed May 09, 2007 10:36 pm
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.

Re: cmsms and greek

Posted: Thu May 10, 2007 6:15 am
by samplist
thanks, if i can do anything to help i'll be glad to.

Re: cmsms and greek

Posted: Thu Jul 05, 2007 5:03 pm
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

Re: cmsms and greek

Posted: Wed Jul 25, 2007 11:54 am
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.