From ab59f05ccdc196731444f87ebb0828bd01cd6494 Mon Sep 17 00:00:00 2001 From: JamesRezo <jamesrezo@noreply.git.spip.net> Date: Wed, 26 Jan 2022 15:39:39 +0100 Subject: [PATCH] feat(header_silencieux) : ajout et application du filtre |header_silencieux (#5010) feat(header_silencieux) : ajout et application du filtre |header_silencieux Co-authored-by: JamesRezo <james@rezo.net> Reviewed-on: https://git.spip.net/spip/spip/pulls/5010 Co-authored-by: JamesRezo <jamesrezo@noreply.git.spip.net> Co-committed-by: JamesRezo <jamesrezo@noreply.git.spip.net> --- ecrire/inc/filtres.php | 16 ++++++++++++++++ ecrire/public/balises.php | 2 +- prive/login.html | 4 ++-- prive/spip_pass.html | 4 ++-- 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ecrire/inc/filtres.php b/ecrire/inc/filtres.php index 43d4b80ec8..2240338ee6 100644 --- a/ecrire/inc/filtres.php +++ b/ecrire/inc/filtres.php @@ -203,6 +203,22 @@ function spip_version() { return $version; } +/** + * Masque la version de SPIP si la globale spip_header_silencieux le demande. + * + * @global spip_header_silencieux permet de rendre le header minimal pour raisons de securité + * + * @param string $version + * @return void + */ +function header_silencieux($version) { + if (isset($GLOBALS['spip_header_silencieux']) && (bool) $GLOBALS['spip_header_silencieux']) { + $version = ''; + } + + return $version; +} + /** * Retourne une courte description d’une révision VCS d’un répertoire * diff --git a/ecrire/public/balises.php b/ecrire/public/balises.php index e7305d56c0..e36315817f 100644 --- a/ecrire/public/balises.php +++ b/ecrire/public/balises.php @@ -390,7 +390,7 @@ function balise_SQUELETTE_dist($p) { * @see spip_version() * @example * ``` - * <meta name="generator" content="SPIP[ (#SPIP_VERSION)]" /> + * [<meta name="generator" content="SPIP (#SPIP_VERSION|header_silencieux)" />] * ``` * * @param Champ $p diff --git a/prive/login.html b/prive/login.html index 2bfacf507e..bab5461129 100644 --- a/prive/login.html +++ b/prive/login.html @@ -18,8 +18,8 @@ #INSERT_HEAD <script type='text/javascript'> jQuery(function(){jQuery('a#spip_pass').click(function(){window.open(this.href, 'spip_pass', 'scrollbars=yes, resizable=yes, width=480, height=380'); return false;});}); -</script> -<meta name="generator" content="SPIP[ (#SPIP_VERSION)]" /> +</script>[ +<meta name="generator" content="SPIP (#SPIP_VERSION|header_silencieux)" />] #SET{logo,#CHEMIN_IMAGE{#CONST{_DIR_IMG}|concat{spip_fond_login.jpg}}} [(#CONFIG{couleur_login}|oui) #SET{hs,#CONFIG{couleur_login}|couleur_hex_to_hsl{"h, s"}} diff --git a/prive/spip_pass.html b/prive/spip_pass.html index f651754bdc..ce5649ce60 100644 --- a/prive/spip_pass.html +++ b/prive/spip_pass.html @@ -12,8 +12,8 @@ <link rel="stylesheet" href="[(#VAL{reset.css}|find_in_theme|direction_css)]" type="text/css" /> <link rel="stylesheet" href="[(#VAL{clear.css}|find_in_theme|direction_css)]" type="text/css" /> <link rel="stylesheet" href="[(#VAL{minipres.css}|find_in_theme|direction_css)]" type="text/css" /> -#INSERT_HEAD -<meta name="generator" content="SPIP[ (#SPIP_VERSION)]" /> +#INSERT_HEAD[ +<meta name="generator" content="SPIP (#SPIP_VERSION|header_silencieux)" />] </head> <body> -- GitLab