منتديات كويك لووك
(نسخة قابلة للطباعة من الموضوع)
https://www.quicklook4u.com/vb/t7475
أنقر هنا لمشاهدة الموضوع بهيئته الأصلية

لحل مشكلة اللغة في سكربت 4images 1.7.4
Galal Hasanin 06-01-2010 12:40 مساءً
السلام عليكم ورحمة الله وبركاته،،
لحل مشكلة استخدام اللغة العربية في التسجيل والتعليق واسماء الصور قي سكربت 4images 1.7.4

في ملف global.php ابحث عن

CODE

function clean_array($array) {
  $search = array(
    // Remove any attribute starting with "on" or xmlns
    #(<[^>]+[x00-x20"])(on|xmlns)[^>]*>#iUu,
    // Remove java***: and vb***: 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(**(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=$2nojava***...,
    $1=$2novb***...,
    "$1>",
    "$1>",
    "$1>"
  );
  // Remove all control (i.e. with ASCII value lower than 0x20 (space),
  // except of 0x0A (line feed) and 0x09 (tabulator)
  $search2 =
 "x00x01x02x03x04x05x06x07x08x0Bx0Cx0Ex0Fx10x11x12x13x14x15x16x17x18x19x1Ax1Bx1Cx1Dx1Ex1F";
  $replace2 = //str_repeat("r", strlen($search2));
 "x0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0D";
  foreach ($array as $key => $val) {
    if (is_array($val)) {
 $val = clean_array($val);
    } else {
 $val = preg_replace($search, $replace, $val);
 $val = str_replace("rn", "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|***|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i, "", $val);
 } while ($oldval != $val);
    }
    $array[$key] = $val;
  }
  return $array;
}


استبدلها بــــ

CODE

function clean_string($string) {
  $canCheckUTF8Error = defined(PREG_BAD_UTF8_ERROR) && function_exists(preg_last_error);
  // Remove any attribute starting with "on" or xmlns
  $tmp = preg_replace(#(<[^>]+[x00-x20"])(on|xmlns)[^>]*>#iUu,"$1>",$string);
  if ($canCheckUTF8Error && (PREG_BAD_UTF8_ERROR == preg_last_error())) {
 $tmp = preg_replace(#(<[^>]+[x00-x20"])(on|xmlns)[^>]*>#iU,"$1>",$string);
  }
  $string = $tmp;
  // Remove java***: and vb***: protocol
  $tmp = preg_replace(#([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,$1=$2nojava***...,$string);
  if ($canCheckUTF8Error && (PREG_BAD_UTF8_ERROR == preg_last_error())) {
 $tmp = preg_replace(#([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]*:#iU,$1=$2nojava***...,$string);
  }
  $string = $tmp;
  $tmp = preg_replace(#([a-z]*)[x00-x20]*=[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,$1=$2novb***...,$string);
  if ($canCheckUTF8Error && (PREG_BAD_UTF8_ERROR == preg_last_error())) {
 $tmp = preg_replace(#([a-z]*)[x00-x20]*=[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]*:#iU,$1=$2novb***...,$string);
  }
  $string = $tmp;
  // <span style="width: expression(**(Ping!));"></span>
  // only works in ie...
  $string = preg_replace(#(<[^>]+)style[x00-x20]*=[x00-x20]*([`"]*).*expression[x00-x20]*([^>]*>#iU,"$1>",$string);
  $string = preg_replace(#(<[^>]+)style[x00-x20]*=[x00-x20]*([`"]*).*behaviour[x00-x20]*([^>]*>#iU,"$1>",$string);
  $tmp = preg_replace(#(<[^>]+)style[x00-x20]*=[x00-x20]*([`"]*).*s[x00-x20]*c[x00-x20]*r[x00-x20]*i[x00-x20]*p[x00-x20]*t[x00-x20]*:*[^>]*>#iUu,"$1>",$string);
  if ($canCheckUTF8Error && (PREG_BAD_UTF8_ERROR == preg_last_error())) {
 $tmp = preg_replace(#(<[^>]+)style[x00-x20]*=[x00-x20]*([`"]*).*s[x00-x20]*c[x00-x20]*r[x00-x20]*i[x00-x20]*p[x00-x20]*t[x00-x20]*:*[^>]*>#iU,"$1>",$string);
  }
  $string = $tmp;
  // Remove namespaced elements (we do not need them...)
  $string = preg_replace(#</*w+:w[^>]*>#i,"",$string);
  // Remove all control (i.e. with ASCII value lower than 0x20 (space),
  // except of 0x0A (line feed) and 0x09 (tabulator)
  $search =
    "x00x01x02x03x04x05x06x07x08x0Bx0Cx0Ex0Fx10x11x12x13x14x15x16x17x18x19x1Ax1Bx1Cx1Dx1Ex1F";
  $replace = //str_repeat("r", strlen($search2));
    "x0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0Dx0D";
  $string = str_replace("rn", "n", $string);
  $string = str_replace("r",   "n", $string);
  $string = strtr($string, $search, $replace);
  $string = str_replace("r", , $string);  // r === x0D
  // Remove really unwanted tags
  do {
    $oldstring = $string;
    $string = preg_replace(#</*(applet|meta|xml|blink|link|style|***|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i,"",$string);
  } while ($oldstring != $string);
  return $string;
}
function clean_array($array) {
  foreach ($array as $key => $val) {
    $key = clean_string($key);
    if (is_array($val)) {
 $val = clean_array($val);
    } else {
 $val = clean_string($val);
    }
    $array[$key] = $val;
  }
  return $array;
}


الملف جاهز في المرفقات
وبالتوفيق
منتديات كويك لووك

Copyright © 2009-2024 PBBoard® Solutions. All Rights Reserved