/** * Collect all data and put it in one array * @return array $params */ function parseParams(){ $params = array(); if(ini_get('magic_quotes_gpc') == 1){ //$_POST if(!empty($_POST)) $params = array_merge($params, stripSlashesDeep($_POST)); //$_GET if(!empty($_GET)) $params = array_merge($params, stripSlashesDeep($_GET)); //$_FILES if(!empty($_FILES)) $params = array_merge($params, stripSlashesDeep($_FILES)); }else{ //$_POST if(!empty($_POST)) $params = array_merge($params, $_POST); //$_GET if(!empty($_GET)) $params = array_merge($params, $_GET); //$_FILES if(!empty($_FILES)) $params = array_merge($params, $_FILES); } return $params; }
function removeMagicQuotes() { if(get_magic_quotes_gpc()) { $_GET = stripSlashesDeep($_GET); $_POST = stripSlashesDeep($_POST); $_COOKIE = stripSlashesDeep($_COOKIE); } }
} } } if (DO_NOT_START_SESSION != 1) { session_start(); } function stripSlashesDeep($value) { $value = is_array($value) ? array_map('stripSlashesDeep', $value) : stripslashes($value); return $value; } if (get_magic_quotes_gpc() || defined('FORCE_MAGIC_QUOTES') && FORCE_MAGIC_QUOTES == 1) { $_GET = stripSlashesDeep($_GET); $_POST = stripSlashesDeep($_POST); $_REQUEST = stripSlashesDeep($_REQUEST); $_COOKIE = stripSlashesDeep($_COOKIE); } if (CROSS_DOMAIN == 1) { if (!empty($_REQUEST)) { foreach ($_REQUEST as $param => $value) { if (substr($param, 0, 7) == 'cookie_') { if ($value != 'null') { $_COOKIE[substr($param, 7)] = $value; } } } } } if (get_magic_quotes_runtime()) { set_magic_quotes_runtime(false); }
/** * Check for Magic Quotes and remove them */ public static function removeMagicQuotes() { function stripSlashesDeep($value) { return is_array($value) ? array_map("stripSlashesDeep", $value) : stripslashes($value); } if (get_magic_quotes_gpc()) { if (isset($_GET)) { $_GET = stripSlashesDeep($_GET); } if (isset($_POST)) { $_POST = stripSlashesDeep($_POST); } if (isset($_COOKIE)) { $_COOKIE = stripSlashesDeep($_COOKIE); } if (isset($_SESSION)) { $_SESSION = stripSlashesDeep($_SESSION); } } }
function removeMagicQuotes() { $_GET = stripSlashesDeep($_GET); $_POST = stripSlashesDeep($_POST); $_COOKIE = stripSlashesDeep($_COOKIE); }
<?php //Current URI $url = $_SERVER['REQUEST_URI']; $url = substr_replace($url, '', 0, 1); $params = array(); $breadcrumb = ''; //Add start page //$_POST if(!empty($_POST)) $params = array_merge($params, (ini_get('magic_quotes_gpc') == 1 ? stripSlashesDeep($_POST) : $_POST)); //$_GET if(!empty($_GET)) $params = array_merge($params, (ini_get('magic_quotes_gpc') == 1 ? stripSlashesDeep($_GET) : $_GET)); //$_FILES if(!empty($_FILES)) $params = array_merge($params, (ini_get('magic_quotes_gpc') == 1 ? stripSlashesDeep($_FILES) : $_FILES)); //Remove ?elements $url = str_replace('?'.$_SERVER['QUERY_STRING'], '', $url); $foundRoute = false; $page = null; include_once 'routing.php'; foreach($routes as $route) { if(@preg_match($route['alias'], $url, $matches)) { $params = array_merge($params, $matches); $layout = $route['layout']; $folder = $route['folder']; $page = $route['file'];