Adds an optional robots.txt for development working copies (introduces the 'restricte...
[platal.git] / modules / core.php
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';