/***************************************************************************\
* SPIP, Systeme de publication pour l'internet *
* *
- * Copyright (c) 2001-2017 *
+ * Copyright (c) 2001-2019 *
* Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James *
* *
* Ce programme est un logiciel libre distribue sous licence GNU/GPL. *
// ne pas laisser passer n'importe quoi dans l'url
$url = str_replace(array('<', '"'), array('<', '"'), $url);
+ $url = str_replace(array("\r", "\n", ' '), array('%0D', '%0A', '%20'), $url);
+ while (strpos($url, '%0A') !== false) {
+ $url = str_replace('%0A', '', $url);
+ }
// interdire les url inline avec des pseudo-protocoles :
if (
(preg_match(",data:,i", $url) and preg_match("/base64\s*,/i", $url))
// Il n'y a que sous Apache que setcookie puis redirection fonctionne
include_spip('inc/cookie');
- if ((!$equiv and !spip_cookie_envoye()) or ((strncmp("Apache", $_SERVER['SERVER_SOFTWARE'],
- 6) == 0) or defined('_SERVER_APACHE'))
+ if ((!$equiv and !spip_cookie_envoye()) or (
+ (strncmp("Apache", $_SERVER['SERVER_SOFTWARE'], 6) == 0)
+ or (stripos($_SERVER['SERVER_SIGNATURE'], 'Apache') !== false)
+ or function_exists('apache_getenv')
+ or defined('_SERVER_APACHE')
+ )
) {
@header("Location: " . $url);
$equiv = "";