remove clear cache.
authorx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 8 Jul 2006 14:31:59 +0000 (14:31 +0000)
committerx2000habouzit <x2000habouzit@839d8a87-29fc-0310-9880-83ba4fa771e5>
Sat, 8 Jul 2006 14:31:59 +0000 (14:31 +0000)
remove index.php (test.php will replace next commit)

git-svn-id: svn+ssh://murphy/home/svn/platal/trunk@389 839d8a87-29fc-0310-9880-83ba4fa771e5

classes/Platal.php
hooks/tmp.inc.php
htdocs/.htaccess
htdocs/clear_all_cache.php [deleted file]
htdocs/index.php [deleted file]
modules/core.php

index d87b9f7..eb536b4 100644 (file)
@@ -92,9 +92,8 @@ class Platal
         new_skinned_page('index.tpl', AUTH_PUBLIC);
 
         if (empty($this->path)) {
-            $page->run();
-        }
-
+            $this->__mods['core']->handler_index($page);
+        } else
         switch ($this->call_hook($page)) {
           case PL_FORBIDDEN:
             $this->__mods['core']->handler_403($page);
index 9d44d0d..7763a86 100644 (file)
@@ -41,7 +41,7 @@ function tmp_menu()
 
     $globals->menu->addPrivateEntry(XOM_ADMIN,    00, 'Marketing',          'marketing');
     $globals->menu->addPrivateEntry(XOM_ADMIN,    10, 'Administration',     'admin/');
-    $globals->menu->addPrivateEntry(XOM_ADMIN,    20, 'Clear cache',        'clear_all_cache.php');
+    $globals->menu->addPrivateEntry(XOM_ADMIN,    20, 'Clear cache',        'purge_cache');
     $globals->menu->addPrivateEntry(XOM_ADMIN,    30, 'Trackers',           'http://trackers.polytechnique.org');
     $globals->menu->addPrivateEntry(XOM_ADMIN,    40, 'Support',            'http://support.polytechnique.org');
 
index 4c8f34b..73d78b6 100644 (file)
@@ -1,5 +1,3 @@
-DirectoryIndex test.php index.php
-
 Options +FollowSymLinks
 RewriteEngine on
 
@@ -12,4 +10,4 @@ RewriteRule ^([A-Z].*) wiki.php?n=$1 [L,QSA]
 # Rewrite URLs of the form 'index.php?q=x':
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
-RewriteRule ^(.*)$ test.php?p=$1 [L,QSA]
+RewriteRule ^(.*)$ index.php?p=$1 [L,QSA]
diff --git a/htdocs/clear_all_cache.php b/htdocs/clear_all_cache.php
deleted file mode 100644 (file)
index 187fad8..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-
-require_once("xorg.inc.php");
-require_once("wiki.inc.php");
-
-new_skinned_page('index.tpl', AUTH_COOKIE);
-$page->clear_compiled_tpl();
-wiki_clear_all_cache();
-
-redirect(empty($_SERVER['HTTP_REFERER']) ? 'index.php' : $_SERVER['HTTP_REFERER']);
-
-?>
diff --git a/htdocs/index.php b/htdocs/index.php
deleted file mode 100644 (file)
index 90b0807..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-/***************************************************************************
- *  Copyright (C) 2003-2006 Polytechnique.org                              *
- *  http://opensource.polytechnique.org/                                   *
- *                                                                         *
- *  This program is free software; you can redistribute it and/or modify   *
- *  it under the terms of the GNU General Public License as published by   *
- *  the Free Software Foundation; either version 2 of the License, or      *
- *  (at your option) any later version.                                    *
- *                                                                         *
- *  This program is distributed in the hope that it will be useful,        *
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
- *  GNU General Public License for more details.                           *
- *                                                                         *
- *  You should have received a copy of the GNU General Public License      *
- *  along with this program; if not, write to the Free Software            *
- *  Foundation, Inc.,                                                      *
- *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
- ***************************************************************************/
-require_once("xorg.inc.php");
-new_skinned_page('index.tpl', AUTH_PUBLIC);
-if (logged()) {
-    redirect("login.php");
-}
-$page->run();
-?>
index 618c0e5..a18d20c 100644 (file)
@@ -27,9 +27,19 @@ class CoreModule extends PLModule
             '403'  => $this->make_hook('403', AUTH_PUBLIC),
             '404'  => $this->make_hook('404', AUTH_PUBLIC),
             'exit' => $this->make_hook('exit', AUTH_PUBLIC),
+            'purge_cache' => $this->make_hook('purge_cache', AUTH_COOKIE, 'admin')
         );
     }
 
+    function handler_index(&$page)
+    {
+        if (logged()) {
+            redirect("login.php");
+        }
+
+        return PL_OK;
+    }
+
     function handler_exit(&$page, $level = null)
     {
         if (Session::has('suid')) {
@@ -88,6 +98,16 @@ class CoreModule extends PLModule
         $page->changeTpl('404.tpl');
         return PL_OK;
     }
+
+    function handler_purge_cache(&$page)
+    {
+        require_once 'wiki.inc.php';
+
+        $page->clear_compiled_tpl();
+        wiki_clear_all_cache();
+
+        redirect(empty($_SERVER['HTTP_REFERER']) ? './' : $_SERVER['HTTP_REFERER']);
+    }
 }
 
 ?>