Author Topic: Russian language in image name, headline, comment ...  (Read 13798 times)

0 Members and 1 Guest are viewing this topic.

Offline Saas

  • Pre-Newbie
  • Posts: 3
    • View Profile
Russian language in image name, headline, comment ...
« on: June 27, 2007, 09:58:53 PM »
I have a problem with 4images image gallery v1.7.4.
When i filling out the fields of uploading image and adding comment (image name, headline, comment, name ...) on russian, it writing to me:
"Please fill out the Image Name field!
Please enter a name.
Please enter a headline.
Please add a comment."


But when i edit image from admin control panel all is ok: filling out all fields on russian and it works correctly.
What can i do to fix it?

p.s. sorry for my english :)

Offline DemanZ

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: Russian language in image name, headline, comment ...
« Reply #1 on: June 28, 2007, 05:45:51 PM »
Please help at me the same problem!

Offline Po4emu4Man

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Russian language in image name, headline, comment ...
« Reply #2 on: June 29, 2007, 04:13:03 PM »
Хм... странно, я подобных проблем не встречал.

Offline DemanZ

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: Russian language in image name, headline, comment ...
« Reply #3 on: June 29, 2007, 09:43:32 PM »
Я уже и базу полностью перевёл в кодировку cp1251 (соединение тоже поправил), пробовал функции некоторые отключать...
Нечего не помогло...
$_POST $_GET - после ввода русских символов пустые
$_REQUEST - нормально
капал дня 4, так не к чему и не пришёл...

P.s> может у тебя версия другая?

Offline DemanZ

  • Pre-Newbie
  • Posts: 3
    • View Profile
Re: Russian language in image name, headline, comment ...
« Reply #4 on: July 01, 2007, 03:54:43 PM »
Всё кажись нашёл...
в файле /includes/global.php есть такая функция как function clean_array($array)

Code: [Select]
function clean_array($array) {

  $search = array(
    // Remove any attribute starting with "on" or xmlns
    '#(<[^>]+[\x00-\x20\"\'])(on|xmlns)[^>]*>#iUu',
    // Remove javascript: and vbscript: protocol
    '#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*)[\\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu',
    '#([a-z]*)[\x00-\x20]*=([\'\"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu',
    //<span style="width: expression(alert('Ping!'));"></span>
    // Only works in ie...
    '#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*expression[\x00-\x20]*\([^>]*>#iU',
    '#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*behaviour[\x00-\x20]*\([^>]*>#iU',
    '#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*>#iUu'
  );

  $replace = array(
    "$1>",
    '$1=$2nojavascript...',
    '$1=$2novbscript...',
    "$1>",
    "$1>",
    "$1>"
  );

  // Remove all control (i.e. with ASCII value lower than 0x20 (space),
  // except of 0x0A (line feed) and 0x09 (tabulator)
  /*$search2 =
      "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x0B\x0C\x0E\x0F\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F";
  $replace2 = //str_repeat("\r", strlen($search2));
      "\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D\x0D";
*/
  foreach ($array as $key => $val) {
    if (is_array($val)) {
      $val = clean_array($val);
    } else {
      $val = preg_replace($search, $replace, $val);

      $val = str_replace("\r\n", "\n", $val);
      $val = str_replace("\r",   "\n", $val);
      $val = strtr($val, $search2, $replace2);
      $val = str_replace("\r", '', $val);  // \r === \x0D

      do {
        $oldval = $val;
        $val = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $val);
      } while ($oldval != $val);
    }

    $array[$key] = $val;
  }

  return $array;
}

if (!defined('IN_CP')) {
  $HTTP_GET_VARS    =clean_array($HTTP_GET_VARS);
  $HTTP_POST_VARS   =clean_array($HTTP_POST_VARS);
  $HTTP_COOKIE_VARS =clean_array($HTTP_COOKIE_VARS);
  $HTTP_POST_FILES  = clean_array($HTTP_POST_FILES);
}
Так вот если убрать в  функции срочку (или закоментировать) то получится следующее:

Code: [Select]
$search = array(
    // Remove any attribute starting with "on" or xmlns
    '#(<[^>]+[\x00-\x20\"\'])(on|xmlns)[^>]*>#iUu',
    // Remove javascript: and vbscript: protocol
    '#([a-z]*)[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*)[\\x00-\x20]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu',
    '#([a-z]*)[\x00-\x20]*=([\'\"]*)[\x00-\x20]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu',
    //<span style="width: expression(alert('Ping!'));"></span>
    // Only works in ie...
    '#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*expression[\x00-\x20]*\([^>]*>#iU',
    '#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*behaviour[\x00-\x20]*\([^>]*>#iU'
    //'#(<[^>]+)style[\x00-\x20]*=[\x00-\x20]*([\`\'\"]*).*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:*[^>]*>#iUu'
  );
Вуаля, наконец добрался до бага... Русский теперь пашет...

P.S> Please Admins fix this bug! ^-)

Offline Po4emu4Man

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: Russian language in image name, headline, comment ...
« Reply #5 on: July 03, 2007, 12:46:36 AM »
Только заметил ответы.
У меня подобная проблема возникала только после прикрутки 2-ого языка.
И то... все легко решилось с помошью шапки header.html.

P.S. Если что - пиши. Я вообще мало чего на уровне сложного програмирования знаю, но ставил много модов отсюда. Так что - милости просим :)

Offline 790511

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: Russian language in image name, headline, comment ...
« Reply #6 on: August 27, 2007, 06:34:38 PM »
Please, could you write this solution in English? I have learned Russian only one year long time ago, so I can understand nearly nothing. But I have the same problem in my gallery, when I try to upload image with name, containing some Czech letters (ě, š, č, ř...).

Offline 790511

  • Pre-Newbie
  • Posts: 4
    • View Profile
Re: Russian language in image name, headline, comment ...
« Reply #7 on: August 27, 2007, 08:33:24 PM »
So, I finally solve it  :D It needs to change original $search onto that second one, posted by DemanZ. Thank you guy, it works also for those Czech letters.

Offline mec

  • Pre-Newbie
  • Posts: 2
    • View Profile
Re: Russian language in image name, headline, comment ...
« Reply #8 on: November 07, 2007, 11:43:31 PM »
Kogda ya ubirayu etu strochku, to u menya voobshe nichego ne pashet, belaya stranica.

u menya fail global.php lejit v kornevoi papke , a ne v /includes/