includes/pageprocess.php
changeset 793 c0724bf6039b
parent 741 a216e412c439
child 800 9cdfe82c56cd
--- a/includes/pageprocess.php	Mon Dec 22 21:25:14 2008 -0500
+++ b/includes/pageprocess.php	Mon Dec 22 21:26:19 2008 -0500
@@ -202,6 +202,7 @@
     
     $pathskey = $paths->nslist[ $this->namespace ] . $this->page_id;
     $strict_no_headers = false;
+    $admin_fail = false;
     if ( $this->namespace == 'Admin' && strstr($this->page_id, '/') )
     {
       if ( $this->send_headers )
@@ -238,6 +239,32 @@
           }
         }
       }
+      if ( isset($paths->pages[$pathskey]['require_admin']) && $paths->pages[$pathskey]['require_admin'] )
+      {
+        if ( $session->auth_level < USER_LEVEL_ADMIN )
+        {
+          $admin_fail = true;
+        }
+      }
+    }
+    else if ( $this->namespace === $paths->namespace && $this->page_id == $paths->page_id )
+    {
+      if ( isset($paths->cpage['require_admin']) && $paths->cpage['require_admin'] )
+      {
+        if ( $session->auth_level < USER_LEVEL_ADMIN )
+        {
+          $admin_fail = true;
+        }
+      }
+    }
+    if ( $admin_fail )
+    {
+      header('Content-type: text/javascript');
+      echo enano_json_encode(array(
+          'mode' => 'error',
+          'error' => 'need_auth_to_admin'
+        ));
+      return true;
     }
     if ( $this->page_exists && $this->namespace != 'Special' && $this->namespace != 'Admin' && $do_stats )
     {