Fixed SpecialAdmin setting theme and style way too late (thanks Andrew Kohnken)
authorDan
Fri, 17 Oct 2008 21:21:55 -0400
changeset 716 d9533bb07563
parent 715 29663506e85c
child 717 236360cf79a0
Fixed SpecialAdmin setting theme and style way too late (thanks Andrew Kohnken)
plugins/SpecialAdmin.php
--- a/plugins/SpecialAdmin.php	Mon Sep 29 08:26:49 2008 -0400
+++ b/plugins/SpecialAdmin.php	Fri Oct 17 21:21:55 2008 -0400
@@ -44,8 +44,26 @@
     ));
 }
 
+$plugins->attachHook('session_started', 'SpecialAdmin_theme_init();');
 $plugins->attachHook('common_post', 'SpecialAdmin_include();');
 
+function SpecialAdmin_theme_init()
+{
+  global $db, $session, $paths, $template, $plugins; // Common objects
+  
+  // Admin pages that were too enormous to be in this file were split off into the plugins/admin/ directory in 1.0.1.
+  // Only load these files if we're looking to load the admin panel
+  list($pid, $ns) = RenderMan::strToPageID($paths->get_pageid_from_url());
+  if ( $ns == 'Admin' || ( $pid == 'Administration' && $ns == 'Special' ) )
+  {
+    // Set the theme
+    $session->theme = 'admin';
+    $session->style = 'default';
+    
+    $template->add_header('<script type="text/javascript" src="' . cdnPath . '/includes/clientside/static/admin-menu.js"></script>');
+  }
+}
+
 function SpecialAdmin_include()
 {
   global $db, $session, $paths, $template, $plugins; // Common objects
@@ -66,12 +84,6 @@
     require(ENANO_ROOT . '/plugins/admin/ThemeManager.php');
     require(ENANO_ROOT . '/plugins/admin/PluginManager.php');
     require(ENANO_ROOT . '/plugins/admin/CacheManager.php');
-    
-    // Set the theme
-    $session->theme = 'admin';
-    $session->style = 'default';
-    
-    $template->add_header('<script type="text/javascript" src="' . cdnPath . '/includes/clientside/static/admin-menu.js"></script>');
   }
 }