Elxis CMS Forum

Support => Technical support => Topic started by: Amigamerlin on February 10, 2012, 16:11:40

Title: Content comment probelm with "italian" Language
Post by: Amigamerlin on February 10, 2012, 16:11:40
Hello to all,
I noticed that writing content comments some char like % or ' inside content will be removed once published.
Is this normal? How to overcome this problem since in my language (italian) there are some chars like ' that are greatly used.
Can anyone help me ?

Thank you
Title: Re: Content comment probelm with "italian" Language
Post by: webgift on February 10, 2012, 16:40:59
Try to avoid writing these kind of symbols. By using these characters you create html invalid source code at your website.
Title: Re: Content comment probelm with "italian" Language
Post by: Amigamerlin on February 10, 2012, 18:53:49
Try to avoid writing these kind of symbols. By using these characters you create html invalid source code at your website.

maybe I can use the word percent instead % but for the ' Is not possible because this will generate a grammatical error.
Is there any modification to let using the ' ?
Let me know
Title: Re: Content comment probelm with "italian" Language
Post by: datahell on February 11, 2012, 10:59:02
Enter the special characters as [http://webdesign.about.com/od/localization/l/blhtmlcodes-punc.htm]html entities[/url].
Use the numerical value for XHTML compliance.

So, for single quote: '

Title: Re: Content comment probelm with "italian" Language
Post by: Amigamerlin on February 11, 2012, 11:15:53
Enter the special characters as [http://webdesign.about.com/od/localization/l/blhtmlcodes-punc.htm]html entities[/url].
Use the numerical value for XHTML compliance.

So, for single quote: '


Thank you Datahell for the suggestion but unfortunately the comments are wrote by a largest part of users that don't know nothing about using code for special char.
I think a workaround should be coded inside the comment component code just like the content. In fact inserting special char inside the content is not a problem.

Datahell I know you are really really busy but please let me know if something can be done otherwise I have to disable the comment because are useless for italian users  :-[.

Thank you .
Title: Re: Content comment probelm with "italian" Language
Post by: datahell on February 11, 2012, 13:53:58
Ooooops, you wrote this for comments, I didn't noticed that before, sorry.
To allow the quote char you must remove it from the replacements pattern.

File components/com_content/content.php
line 2201 (for Elxis 2009.3 - for other versions look somewhere near that)
Replace this:
Code: [Select]
$pat = "/([\']|[\"]|[\$]|[\#]|[\<]|[\>]|[\*]|[\%]|[\~]|[\`]|[\^]|[\|]|[\\\])/";With this:
Code: [Select]
$pat = "/([\"]|[\$]|[\#]|[\<]|[\>]|[\*]|[\%]|[\~]|[\`]|[\^]|[\|]|[\\\])/";
The above change is for the content comments (not for eBlog).
You might need to run the addslashes function (depending on the magic quotes settings on your site) on the fial string before insert it into the database.
Else you might face SQL injection issues and errors.

$commessage = addslashes($commessage); //only if magic quotes are off
Title: Re: Content comment probelm with "italian" Language
Post by: Amigamerlin on February 11, 2012, 15:00:25
Ooooops, you wrote this for comments, I didn't noticed that before, sorry.
To allow the quote char you must remove it from the replacements pattern.

File components/com_content/content.php
line 2201 (for Elxis 2009.3 - for other versions look somewhere near that)
Replace this:
Code: [Select]
$pat = "/([\']|[\"]|[\$]|[\#]|[\<]|[\>]|[\*]|[\%]|[\~]|[\`]|[\^]|[\|]|[\\\])/";With this:
Code: [Select]
$pat = "/([\"]|[\$]|[\#]|[\<]|[\>]|[\*]|[\%]|[\~]|[\`]|[\^]|[\|]|[\\\])/";
The above change is for the content comments (not for eBlog).
You might need to run the addslashes function (depending on the magic quotes settings on your site) on the fial string before insert it into the database.
Else you might face SQL injection issues and errors.

$commessage = addslashes($commessage); //only if magic quotes are off

Really thank you my friend !!!

Where to add:

$commessage = addslashes($commessage);

since in my site the magic_quotes_gpc is off ?

Title: Re: Content comment probelm with "italian" Language
Post by: Amigamerlin on February 12, 2012, 10:28:21
Ciao datahell !!!

is this correct?

Code: [Select]

$pat = "/([\$]|[\#]|[\<]|[\>]|[\*]|[\%]|[\~]|[\`]|[\^]|[\|]|[\\\])/";
$commessage = preg_replace($pat, '', $commessage);     
$commessage = addslashes($commessage); //magic quotes are off on my site

Let me know.
Thank you !!!
Title: Re: Content comment probelm with "italian" Language
Post by: datahell on February 12, 2012, 19:22:28
Yes