YouJoomla template removes special and non latin characters

More
30 Apr 2013 02:03 - 30 Apr 2013 02:33 #1 by Demis [Fox-Labs]
When you are using Fox Contact as module on a YouJoomla template, after submit a form, special characters like @ (at) and . (dot), as well as non latin characters (hebrew, arabic, cyrillic, cinese, japanese, etc.) disappear.

The problem is caused by YouJoomla templates, which intentionally removes such characters from $_GET and $_POST variables, as a weak kind of xss protection.

There are two different ways to fix this, depending on what template you are using.

On recent YouJoomla templates, edit the file /templates/template_name/yjsgcore/yjsg_validate.php
search for
function yjsg_validate_data (&$array)
{
    if (is_array($array))
        foreach ($array as $key => $value)
            yjsg_validate_data($array[$key]);
    else
        $array = preg_replace("|([^\w\s\'])|i",'',$array);
}
and replace with
define("yjsg_validate_data_fixed", 1);
function yjsg_validate_data($array) {}

On older YouJoomla templates, edit the file /templates/template_name/yjsgcore/yjsg_core.php file.
Search and remove the following code:
// XSS PROTECTION
$_GET = preg_replace("|([^\w\s\'])|i",'',$_GET);
$_POST = preg_replace("|([^\w\s\'])|i",'',$_POST);

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