]> source.dussan.org Git - nextcloud-server.git/commitdiff
Early errors (in base.php) don't have session available
authorBart Visscher <bartv@thisnet.nl>
Tue, 16 Jul 2013 20:37:32 +0000 (22:37 +0200)
committerBart Visscher <bartv@thisnet.nl>
Tue, 16 Jul 2013 20:37:32 +0000 (22:37 +0200)
lib/template.php
lib/user.php

index ae9ea187445912434622f0f0a8481ac9a2d98d44..a1808c0b3566d76ab2233d44a473f331ffd49553 100644 (file)
@@ -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
index 830f13bb8df6900304eb60d042d410ac844b54ef..d93ab1a5f73802ec650bd4dc04a497061632a610 100644 (file)
@@ -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 {