diff --git a/ecrire/inc/utils.php b/ecrire/inc/utils.php index 1af21b94425b21b31e9271a1022355402383c076..1e5375f1b9eb23726f87c90c96820e413bffb837 100644 --- a/ecrire/inc/utils.php +++ b/ecrire/inc/utils.php @@ -1881,7 +1881,7 @@ function url_de_base($profondeur = null) { } // note : HTTP_HOST contient le :port si necessaire - $host = $_SERVER['HTTP_HOST']; + $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null; // si on n'a pas trouvé d'hôte du tout, en dernier recours on utilise adresse_site comme fallback if (is_null($host) and isset($GLOBALS['meta']['adresse_site'])) { $host = $GLOBALS['meta']['adresse_site']; @@ -1912,8 +1912,8 @@ function url_de_base($profondeur = null) { if (isset($_SERVER['REQUEST_URI'])) { $GLOBALS['REQUEST_URI'] = $_SERVER['REQUEST_URI']; } else { - $GLOBALS['REQUEST_URI'] = $_SERVER['PHP_SELF']; - if ($_SERVER['QUERY_STRING'] + $GLOBALS['REQUEST_URI'] = (php_sapi_name() !== 'cli') ? $_SERVER['PHP_SELF'] : ''; + if (!empty($_SERVER['QUERY_STRING']) and !strpos($_SERVER['REQUEST_URI'], '?') ) { $GLOBALS['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING']; @@ -2521,7 +2521,7 @@ function spip_initialisation_core($pi = null, $pa = null, $ti = null, $ta = null if (isset($_SERVER['REQUEST_URI'])) { $GLOBALS['REQUEST_URI'] = $_SERVER['REQUEST_URI']; } else { - $GLOBALS['REQUEST_URI'] = $_SERVER['PHP_SELF']; + $GLOBALS['REQUEST_URI'] = (php_sapi_name() !== 'cli') ? $_SERVER['PHP_SELF'] : ''; if (!empty($_SERVER['QUERY_STRING']) and !strpos($_SERVER['REQUEST_URI'], '?') ) { diff --git a/ecrire/public/assembler.php b/ecrire/public/assembler.php index c4855cfef04c6fe48a230497fe134a2520f79b26..46d519e89d4efbe22062e9f85b1ffb312ce50a07 100644 --- a/ecrire/public/assembler.php +++ b/ecrire/public/assembler.php @@ -215,7 +215,7 @@ function calculer_contexte_implicite() { } $contexte_implicite = array( 'squelettes' => $GLOBALS['dossier_squelettes'], // devrait etre 'chemin' => $GLOBALS['path_sig'], ? - 'host' => $_SERVER['HTTP_HOST'], + 'host' => (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : null), 'https' => (isset($_SERVER['HTTPS']) ? $_SERVER['HTTPS'] : ''), 'espace' => test_espace_prive(), 'marqueur' => (isset($GLOBALS['marqueur']) ? $GLOBALS['marqueur'] : ''),