diff --git a/application/class/Caracter.php b/application/class/Caracter.php index 623f635..9eaf8e8 100644 --- a/application/class/Caracter.php +++ b/application/class/Caracter.php @@ -14,11 +14,11 @@ class Caracter public static function fp_stripslashes($str) { - if (get_magic_quotes_gpc() == 1) { + /*if (get_magic_quotes_gpc() == 1) { return stripslashes($str); - } else { + } else {*/ return $str; - } + /*}*/ } public static function normalise_ChaineDeCaracteresUpload($chaine) @@ -28,11 +28,11 @@ class Caracter public static function fp_addslashes($str) { - if (get_magic_quotes_gpc() == 1) { + /*if (get_magic_quotes_gpc() == 1) { return $str; - } else { + } else {*/ return addslashes($str); - } + /*}*/ } public static function remplacerAccents($chaine) diff --git a/application/class/Url.php b/application/class/Url.php index b746571..a96f5c2 100644 --- a/application/class/Url.php +++ b/application/class/Url.php @@ -184,18 +184,24 @@ class Url public static function absolute_link_rewrite($isControlPatern, $page, $params = array()) { - $url = $_SERVER['HTTP_HOST']; + if(isset($_SERVER['HTTP_HOST'])) { + $url = $_SERVER['HTTP_HOST']; + if (isset($_SERVER['REQUEST_SCHEME'])) { + $scheme = $_SERVER['REQUEST_SCHEME']; + } else { + $scheme = 'http'; + } + $base_url = $scheme . "://" . $url; + }else{ + $base_url = PATH_URL; + } if ($isControlPatern) { $uri = self::controlLink_rewrite($page, $params); } else { $uri = self::link_rewrite_slashParam($page, $params); } - if (isset($_SERVER['REQUEST_SCHEME'])) { - $scheme = $_SERVER['REQUEST_SCHEME']; - } else { - $scheme = 'http'; - } - return ($scheme . "://" . BASE_SERVER_DIRECTORY . $url . $uri); + + return ( $base_url . BASE_SERVER_DIRECTORY . $uri); } } diff --git a/application/config/app-parameters.php.skel b/application/config/app-parameters.php.skel index a36d59e..95e27fd 100644 --- a/application/config/app-parameters.php.skel +++ b/application/config/app-parameters.php.skel @@ -6,7 +6,8 @@ // ou : "my-app/dev/ define("BASE_SERVER_DIRECTORY", ""); -// Optionnel! il n'est nécessaire que si vous l'utilisez dans les fichiers de traitement -define('PATH_URL', $_SERVER['REQUEST_SCHEME'] . "://localhost.localdomain"); +// Optionnel! il n'est nécessaire que si vous l'utilisez dans les fichiers de traitement ou dans une commande console +// si vous l'utilisez dans les fichiers de traitement -> il est plus simple d'utiliser l'Objet page précédente +define('PATH_URL',"http://www.domain.org"); define('ENV', "DEV"); \ No newline at end of file