/** * Обрезаем XSS "примочки" у массивов * @param string|array $arr "обрезаемый" массив * @return string|array "обрезанный" массив */ function xss_array_protect($arr) { if (!$arr) { return $arr; } if (!is_array($arr) && !is_numeric($arr)) { return display::o()->html_encode($arr); } else { foreach ($arr as $key => $value) { if (is_array($value)) { $arr[$key] = xss_array_protect($value); } elseif (!is_numeric($value)) { $arr[$key] = display::o()->html_encode($value); } } return $arr; } }
unset($input); unset($display); unset($blocks); unset($message); /// Конец /// Обнаруживаем IE if (preg_match("/MSIE\\s*([0-9]+)/siu", $_SERVER['HTTP_USER_AGENT'], $matches)) { lang::o()->get("ie_error"); // Выгоняем IE ниже 8 версии if ($matches[1] < 8) { tpl::o()->display('ie_error.tpl'); die; } tpl::o()->assign('MSIE', $matches[1]); } if (function_exists("get_magic_quotes_gpc") && get_magic_quotes_gpc()) { if (!empty($_GET)) { $_GET = strip_magic_quotes($_GET); } if (!empty($_POST)) { $_POST = strip_magic_quotes($_POST); } if (!empty($_COOKIE)) { $_COOKIE = strip_magic_quotes($_COOKIE); } } // INCLUDE BACK-END globals::s('POST', $_POST); $_POST = xss_array_protect($_POST); $_GET = xss_array_protect($_GET); $_REQUEST = $_POST + $_GET;