]> git.mxchange.org Git - friendica.git/blobdiff - src/App.php
Fix missing $_SESSION variable in src/App
[friendica.git] / src / App.php
index c6f8f459ec5303ce09e6f4af9990b8b66c502d60..d02ea73ca46de28dd984ef69803b36d22a19e35e 100644 (file)
@@ -1127,7 +1127,7 @@ class App
                        return;
                }
 
-               $cmdline = $this->getConfigValue('config', 'php_path', 'php') . ' ' . $command;
+               $cmdline = $this->getConfigValue('config', 'php_path', 'php') . ' ' . escapeshellarg($command);
 
                foreach ($args as $key => $value) {
                        if (!is_null($value) && is_bool($value) && !$value) {
@@ -1140,8 +1140,6 @@ class App
                        }
                }
 
-               $cmdline = escapeshellarg($cmdline);
-
                if ($this->min_memory_reached()) {
                        return;
                }
@@ -1309,11 +1307,11 @@ class App
                // Only arrays are serialized in database, so we have to unserialize sparingly
                $value = is_string($v) && preg_match("|^a:[0-9]+:{.*}$|s", $v) ? unserialize($v) : $v;
 
-               if (!isset($this->config[$uid])) {
+               if (!isset($this->config[$uid]) || !is_array($this->config[$uid])) {
                        $this->config[$uid] = [];
                }
 
-               if (!isset($this->config[$uid][$cat])) {
+               if (!isset($this->config[$uid][$cat]) || !is_array($this->config[$uid][$cat])) {
                        $this->config[$uid][$cat] = [];
                }
 
@@ -1396,21 +1394,17 @@ class App
                        // Allow folks to override user themes and always use their own on their own site.
                        // This works only if the user is on the same server
                        $user = DBA::selectFirst('user', ['theme'], ['uid' => $this->profile_uid]);
-                       if (DBA::is_result($user) && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
+                       if (DBA::isResult($user) && !PConfig::get(local_user(), 'system', 'always_my_theme')) {
                                $page_theme = $user['theme'];
                        }
                }
 
-               if (!empty($_SESSION)) {
-                       $user_theme = defaults($_SESSION, 'theme', $system_theme);
-               } else {
-                       $user_theme = $system_theme;
-               }
+               $user_theme = Core\Session::get('theme', $system_theme);
 
                // Specific mobile theme override
-               if (($this->is_mobile || $this->is_tablet) && defaults($_SESSION, 'show-mobile', true)) {
+               if (($this->is_mobile || $this->is_tablet) && Core\Session::get('show-mobile', true)) {
                        $system_mobile_theme = Config::get('system', 'mobile-theme');
-                       $user_mobile_theme = defaults($_SESSION, 'mobile-theme', $system_mobile_theme);
+                       $user_mobile_theme = Core\Session::get('mobile-theme', $system_mobile_theme);
 
                        // --- means same mobile theme as desktop
                        if (!empty($user_mobile_theme) && $user_mobile_theme !== '---') {