From 971a3fd124785033e7ed7db1018512b838c5ec58 Mon Sep 17 00:00:00 2001 From: Bart Visscher Date: Tue, 16 Jul 2013 22:37:32 +0200 Subject: [PATCH] Early errors (in base.php) don't have session available --- lib/template.php | 5 ++++- lib/user.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/template.php b/lib/template.php index ae9ea187445..a1808c0b356 100644 --- a/lib/template.php +++ b/lib/template.php @@ -181,7 +181,7 @@ class OC_Template{ $this->renderas = $renderas; $this->application = $app; $this->vars = array(); - $this->vars['requesttoken'] = OC_Util::callRegister(); + $this->vars['requesttoken'] = OC::$session && OC_Util::callRegister(); $parts = explode('/', $app); // fix translation when app is something like core/lostpassword $this->l10n = OC_L10N::get($parts[0]); @@ -243,6 +243,9 @@ class OC_Template{ */ static public function getFormFactorExtension() { + if (!\OC::$session) { + return ''; + } // if the formfactor is not yet autodetected do the // autodetection now. For possible formfactors check the // detectFormfactor documentation diff --git a/lib/user.php b/lib/user.php index 830f13bb8df..d93ab1a5f73 100644 --- a/lib/user.php +++ b/lib/user.php @@ -316,7 +316,7 @@ class OC_User { * @return string uid or false */ public static function getUser() { - $uid = OC::$session->get('user_id'); + $uid = OC::$session ? OC::$session->get('user_id') : null; if (!is_null($uid)) { return $uid; } else {