From: Vincent Zanotti Date: Wed, 21 May 2008 09:27:54 +0000 (+0200) Subject: Adds an optional robots.txt for development working copies (introduces the 'restricte... X-Git-Tag: core/1.0.0~176 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=f8eb84b77cc8c0df0105f63faa7544b12c758096;p=platal.git Adds an optional robots.txt for development working copies (introduces the 'restricted_platal' configuration element). Signed-off-by: Vincent Zanotti --- diff --git a/ChangeLog b/ChangeLog index be6932f..6e5c53c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -7,6 +7,7 @@ New: - Password strength checker -FRU - Show user picture on the mini-profile -FRU - Add an anti-XSRF framework, and add protection to most pages -VZA + - Add a 'disallow all' robots.txt in development working copies. -VZA Bug/Wish: * Core: diff --git a/configs/platal.ini b/configs/platal.ini index b1aaf00..3923847 100644 --- a/configs/platal.ini +++ b/configs/platal.ini @@ -3,6 +3,7 @@ locale = "fr_FR.UTF-8" timezone = "Europe/Paris" secure_domain = "" baseurl = "https://www.example.org/" +restricted_platal = 0 skin = "default" register_skin = "register" diff --git a/modules/core.php b/modules/core.php index 031032d..f044d9b 100644 --- a/modules/core.php +++ b/modules/core.php @@ -37,6 +37,7 @@ class CoreModule extends PLModule 'valid.html' => $this->make_hook('valid', AUTH_PUBLIC), 'favicon.ico' => $this->make_hook('favicon', AUTH_PUBLIC), + 'robots.txt' => $this->make_hook('robotstxt', AUTH_PUBLIC, 'user', NO_HTTPS), ); } @@ -77,6 +78,19 @@ class CoreModule extends PLModule exit; } + function handler_robotstxt(&$page) + { + global $globals; + if (!$globals->core->restricted_platal) { + return PL_NOT_FOUND; + } + + header('Content-Type: text/plain'); + echo "User-agent: *\n"; + echo "Disallow: /\n"; + exit; + } + function handler_purge_cache(&$page) { require_once 'wiki.inc.php';