Index: inc/admin/class.dc.admincontext.php
===================================================================
--- inc/admin/class.dc.admincontext.php	(revision 2321)
+++ inc/admin/class.dc.admincontext.php	(revision 2654)
@@ -22,5 +22,5 @@
     /**
      * valuesToArray - converts a list of strings to an array having these strings as keys.
-     * 
+     *
      * @param mixed $val the list to convert.
      * @access protected
@@ -63,5 +63,5 @@
 		}
 	}
-	
+
 	public function __isset($name) {
 		if ($this->isAllowed($name,$this->attributes)) {
@@ -71,5 +71,5 @@
 		}
 	}
-	
+
 
 	public function __call($name,$args) {
@@ -112,12 +112,12 @@
 	protected $protected_globals = array();
 	protected $memory = array();
-	
+
 	public function __construct($core)
 	{
 		$this->core = $core;
-		
+
 		# Globals editable via context
 		$this->globals = array();
-		
+
 		# Globals not editable via context
 		$this->protected_globals = array(
@@ -128,20 +128,20 @@
 				'errors' => array()
 			),
-			
+
 			'page_title'	=> array(),
 			'page_global'	=> false,
-			
+
 			'admin_url' 	=> DC_ADMIN_URL,
 			'theme_url' 	=> '',
 			'plugin_url' 	=> DC_ADMIN_URL.'index.php?pf=',
-			
+
 			'version' 		=> DC_VERSION,
 			'vendor_name' 	=> DC_VENDOR_NAME,
-			
+
 			'safe_mode' 	=> isset($_SESSION['sess_safe_mode']) && $_SESSION['sess_safe_mode'],
 			'debug_mode'	=> DC_DEBUG
 		);
 	}
-	
+
 	/**
 	Prevent call crash from template on method that return this class
@@ -151,8 +151,8 @@
 		return '';
 	}
-	
+
 	/**
 	Test a global variable
-	
+
 	@param string $name Name of the variable to test
 	@return boolean
@@ -162,8 +162,8 @@
 		return isset($this->globals[$name]);
 	}
-	
+
 	/**
 	Add a global variable
-	
+
 	@param string $name Name of the variable
 	@param mixed $value Value of the variable
@@ -182,8 +182,8 @@
 		$this->globals[$name] = $value;
 	}
-	
+
 	/**
 	Get a global variable
-	
+
 	@param string $name Name of the variable
 	@return mixed Value of the variable or null
@@ -193,8 +193,8 @@
 		return isset($this->globals[$name]) ? $this->globals[$name] : null;
 	}
-	
+
 	/**
 	Returns a list of filters to add to the existing list.
-	
+
 	@return array An array of filters
 	*/
@@ -205,8 +205,8 @@
 		);
 	}
-	
+
 	/**
 	Returns a list of functions to add to the existing list.
-	
+
 	@return array An array of functions
 	*/
@@ -221,9 +221,9 @@
 		);
 	}
-	
+
 
     /**
      * Builds an url given a base, and parameters
-     * 
+     *
      * @param mixed $url    the base url as string
      * @param mixed $params the parameters.
@@ -252,22 +252,24 @@
 	/**
 	Returns a list of global variables to add to the existing list.
-	
+
 	This merges overloaded variables with defined variables.
-	
+
 	@return array An array of global variables
 	*/
 	public function getGlobals()
 	{
-		$this->getBlogs();
-		$this->getCurrentBlog();
-		$this->getCurrentUser();
-		$this->getMenus();
-		
-		# Additional globals
-		$p = path::info($_SERVER['REQUEST_URI']);
-		$this->protected_globals['current_page'] = $p['base'];
-		$this->protected_globals['blog_count'] = $this->core->auth->getBlogCount();
-		$this->protected_globals['rtl'] = l10n::getTextDirection(
-			$this->protected_globals['current_user']['lang']) == 'rtl';
+		if ($this->core->auth->userID()) {
+			$this->getBlogs();
+			$this->getCurrentBlog();
+			$this->getCurrentUser();
+			$this->getMenus();
+
+			# Additional globals
+			$p = path::info($_SERVER['REQUEST_URI']);
+			$this->protected_globals['current_page'] = $p['base'];
+			$this->protected_globals['blog_count'] = $this->core->auth->getBlogCount();
+			$this->protected_globals['rtl'] = l10n::getTextDirection(
+				$this->protected_globals['current_user']['lang']) == 'rtl';
+		}
 		$this->protected_globals['session'] = array(
 			'id' => session_id(),
@@ -278,8 +280,8 @@
 		return array_merge($this->globals,$this->protected_globals);
 	}
-	
+
 	/**
 	Returns the name of the extension.
-	
+
 	@return string The extension name
 	*/
@@ -288,9 +290,9 @@
 		return 'AdminContext';
 	}
-	
-	
+
+
 	/**
 	Add an informational message
-	
+
 	@param string $message A message
 	@return object self
@@ -301,8 +303,8 @@
 		return $this;
 	}
-	
+
 	/**
 	Add an informational message
-	
+
 	@param string $message A message
 	@return object self
@@ -313,8 +315,8 @@
 		return $this;
 	}
-	
+
 	/**
 	Add a list of informational messages
-	
+
 	@param string $message A title
 	@param array $message A list of messages
@@ -326,8 +328,8 @@
 		return $this;
 	}
-	
+
 	/**
 	Set an important message
-	
+
 	@param string $message A message
 	@return object self
@@ -338,8 +340,8 @@
 		return $this;
 	}
-	
+
 	/**
 	Add an error message
-	
+
 	@param string Error message
 	@return object self
@@ -350,8 +352,8 @@
 		return $this;
 	}
-	
+
 	/**
 	Check if there is an error message
-	
+
 	@return boolean
 	*/
@@ -360,13 +362,13 @@
 		return !empty($this->protected_globals['messages']['errors']);
 	}
-	
+
 	/**
 	Add a section to the breadcrumb
-	
-	$title can be: 
-	a string for page title part or 
+
+	$title can be:
+	a string for page title part or
 	TRUE to add blog name at the begining of title or
 	NULL to empty/reset title
-	
+
 	@param mixed $title A title part
 	@param boolean $url Link of the title part
@@ -381,13 +383,13 @@
 		);
 	}
-	
+
 	/**
 	Fill the page title
-	
-	$title can be: 
-	a string for page title part or 
+
+	$title can be:
+	a string for page title part or
 	TRUE to add blog name at the begining of title or
 	NULL to empty/reset title
-	
+
 	@param mixed $title A title part
 	@param boolean $url Link of the title part
@@ -411,5 +413,5 @@
 		return $this;
 	}
-	
+
 	/**
 	Check if a page title is set
@@ -419,5 +421,5 @@
 		return !empty($this->protected_globals['page_title']);
 	}
-	
+
 	/**
 	Get list of blogs
@@ -426,5 +428,5 @@
 	{
 		$blog_id = '';
-		
+
 		# Blogs list
 		$blogs = array();
@@ -435,10 +437,10 @@
 			while ($rs_blogs->fetch()) {
 				$blogs[$rs_blogs->blog_id] = $rs_blogs->blog_name.' - '.$rs_blogs->blog_url;
-				$this->protected_globals['blogs'][$rs_blogs->blog_id] = 
+				$this->protected_globals['blogs'][$rs_blogs->blog_id] =
 				new dcArrayProxy($rs_blogs, array(
 					'blog_id','blog_name','blog_desc','blog_url','blog_creadt','blog_upddt'));
 			}
 		}
-		
+
 		# Switch blog form
 		$form = new dcForm($this->core,'switchblog_menu','index.php');
@@ -463,5 +465,5 @@
 			->setup();
 	}
-	
+
 	/**
 	Get current blog information
@@ -482,5 +484,5 @@
 			);
 	}
-	
+
 	/**
 	Get current user information
@@ -493,5 +495,5 @@
 			'post_status','creadt','upddt','cn'
 		);
-		
+
 		$user = array(
 			'id' => '',
@@ -504,11 +506,11 @@
 			)
 		);
-		
+
 		foreach($infos as $i) {
 			$user[$i] = '';
 		}
-		
+
 		if ($this->core->auth->userID()) {
-		
+
 			$user = array(
 				'id' => $this->core->auth->userID(),
@@ -519,17 +521,17 @@
 				)
 			);
-			
+
 			foreach($infos as $i) {
 				$user[$i] = $this->core->auth->getInfo('user_'.$i);
 			}
-			
+
 			foreach($this->core->auth->user_prefs->dumpWorkspaces() as $ws => $prefs) {
 				$user['prefs'][$ws] = $prefs->dumpPrefs();
 			}
 		}
-		
+
 		$this->protected_globals['current_user'] = $user;
 	}
-	
+
 	/**
 	Get sidebar menus
@@ -538,11 +540,11 @@
 	{
 		global $_menu;
-		
+
 		$this->protected_globals['menus'] = array();
-		
+
 		if (!isset($_menu)) {
 			return;
 		}
-		
+
 		foreach($_menu as $m) {
 			$this->protected_globals['menus'][] = array(
@@ -554,5 +556,5 @@
 		}
 	}
-	
+
 	/**
 	Get an array of debug/dev infos
@@ -563,5 +565,5 @@
 			return array();
 		}
-		
+
 		$di = array(
 			'global_vars' => implode(', ',array_keys($GLOBALS)),
@@ -572,11 +574,11 @@
 			'xdebug' => array()
 		);
-		
+
 		if (function_exists('xdebug_get_profiler_filename')) {
-		
+
 			$url = http::getSelfURI();
 			$url .= strpos($url,'?') === false ? '?' : '&';
 			$url .= 'XDEBUG_PROFILE';
-			
+
 			$di['xdebug'] = array(
 				'elapse_time' => xdebug_time_index(),
@@ -584,5 +586,5 @@
 				'profiler_url' =>  $url
 			);
-			
+
 			/* xdebug configuration:
 			zend_extension = /.../xdebug.so
@@ -598,13 +600,13 @@
 			*/
 		}
-		
+
 		return $di;
 	}
-	
+
 	/**
 	Add a value in a namespace memory
-	
+
 	This help keep variable when recalling Twig macros
-	
+
 	@param string $ns A namespace
 	@param string $str A value to memorize in this namespace
@@ -616,8 +618,8 @@
 		}
 	}
-	
+
 	/**
 	Check if a value is previously memorized in a namespace
-	
+
 	@param string $ns A namespace
 	@param string $str A value to search in this namespace
