Fixed redirects before $session init not working; fixed failure to load system plugins
authorDan
Fri, 15 May 2009 13:31:12 -0400
changeset 979 aafb9f6806c9
parent 978 ed84b24b8e07
child 980 d13fad911955
Fixed redirects before $session init not working; fixed failure to load system plugins
includes/namespaces/default.php
includes/paths.php
includes/plugins.php
--- a/includes/namespaces/default.php	Thu May 14 11:34:24 2009 -0400
+++ b/includes/namespaces/default.php	Fri May 15 13:31:12 2009 -0400
@@ -782,6 +782,33 @@
     if ( !$this->perms )
       $this->perms = $session->fetch_page_acl($this->page_id, $this->namespace);
     
+    if ( !$this->perms )
+    {
+      // We're trying to send a page WAY too early (session hasn't been started yet), such as for a redirect. Send a default set of conds because
+      // there's NO way to get permissions to determine anything otherwise. Yes, starting $session here might be dangerous.
+      $this->conds = array(
+          'article' => true,
+          'comments' => false,
+          'edit' => false,
+          'viewsource' => false,
+          'history' => false,
+          'rename' => false,
+          'delvote' => false,
+          'resetvotes' => false,
+          'delete' => false,
+          'printable' => false,
+          'protect' => false,
+          'setwikimode' => false,
+          'clearlogs' => false,
+          'password' => false,
+          'acledit' => false,
+          'adminpage' => false
+        );
+      return $this->conds;
+    }
+    
+    // die('have perms: <pre>' . print_r($this->perms, true) . "\n---------------------------------\nBacktrace:\n" . enano_debug_print_backtrace(true));
+    
     $enforce_protection = ( $this->page_protected && ( ( $session->check_acl_scope('even_when_protected', $this->namespace) && !$this->perms->get_permissions('even_when_protected') ) || !$session->check_acl_scope('even_when_protected', $this->namespace) ) );
     
     $conds = array();
--- a/includes/paths.php	Thu May 14 11:34:24 2009 -0400
+++ b/includes/paths.php	Fri May 15 13:31:12 2009 -0400
@@ -210,7 +210,9 @@
       {
         $title = basename($_SERVER['SCRIPT_NAME']);
       }
-      $base_uri = str_replace( scriptPath . '/', '', $_SERVER['SCRIPT_NAME'] );
+      if ( scriptPath != '' )
+        $base_uri = str_replace( scriptPath . '/', '', $_SERVER['SCRIPT_NAME'] );
+      
       $this->page = $this->nslist['API'] . sanitize_page_id($base_uri);
       $this->fullpage = $this->nslist['API'] . sanitize_page_id($base_uri);
       $this->namespace = 'API';
--- a/includes/plugins.php	Thu May 14 11:34:24 2009 -0400
+++ b/includes/plugins.php	Fri May 15 13:31:12 2009 -0400
@@ -80,7 +80,7 @@
     
     foreach ( $plugin_list as $filename => $data )
     {
-      if ( $data['status'] & PLUGIN_OUTOFDATE || $data['status'] & PLUGIN_DISABLED )
+      if ( $data['status'] & PLUGIN_OUTOFDATE || $data['status'] & PLUGIN_DISABLED || ( !$data['installed'] && !$data['system plugin'] ) )
         continue;
       
       $this->load_list[] = $filename;