Adds an optional robots.txt for development working copies (introduces the 'restricte...
authorVincent Zanotti <vincent.zanotti@polytechnique.org>
Wed, 21 May 2008 09:27:54 +0000 (11:27 +0200)
committerVincent Zanotti <vincent.zanotti@polytechnique.org>
Wed, 21 May 2008 09:30:39 +0000 (11:30 +0200)
Signed-off-by: Vincent Zanotti <vincent.zanotti@polytechnique.org>
ChangeLog
configs/platal.ini
modules/core.php

index be6932f..6e5c53c 100644 (file)
--- 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:
index b1aaf00..3923847 100644 (file)
@@ -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"
index 031032d..f044d9b 100644 (file)
@@ -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';