Better detection of admin pages vs public pages.
authorFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 1 Jun 2008 21:47:12 +0000 (23:47 +0200)
committerFlorent Bruneau <florent.bruneau@polytechnique.org>
Sun, 1 Jun 2008 21:47:12 +0000 (23:47 +0200)
Signed-off-by: Florent Bruneau <florent.bruneau@polytechnique.org>
_public.php
class.xorg.auth.php

index bb3e6b4..a962ea5 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-define('IS_PUBLIC_PAGE', 1);
 
 require_once dirname(__FILE__) . '/page.auth.php';
 require_once dirname(__FILE__) . '/widget.auth.php';
index e84a774..adba0c1 100644 (file)
@@ -212,7 +212,8 @@ class xorgAuth extends dcAuth {
 
   public function userID() {
     $this->buildFromSession();
-    if (defined('IS_PUBLIC_PAGE')) {
+    $isadmin = preg_match('@/admin/[^/]\.php$@i', $_SERVER['SCRIPT_FILENAME']);
+    if (!$isadmin) {
       return null;
     }
     return parent::userID();