+ $this->setCurrentTheme($theme_name);
+ }
+ }
+
+ /**
+ * Computes the current mobile theme name based on the node settings, the page owner settings and the user settings
+ */
+ private function computeCurrentMobileTheme()
+ {
+ $system_mobile_theme = $this->config->get('system', 'mobile-theme', '');
+
+ // Sane default
+ $this->setCurrentMobileTheme($system_mobile_theme);
+
+ $page_mobile_theme = null;
+ // Find the theme that belongs to the user whose stuff we are looking at
+ if ($this->profile_uid && ($this->profile_uid != local_user())) {
+ // 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
+ if (!Core\PConfig::get(local_user(), 'system', 'always_my_theme')) {
+ $page_mobile_theme = Core\PConfig::get($this->profile_uid, 'system', 'mobile-theme');
+ }
+ }
+
+ $mobile_theme_name = $page_mobile_theme ?: Core\Session::get('mobile-theme', $system_mobile_theme);
+
+ $mobile_theme_name = Strings::sanitizeFilePathItem($mobile_theme_name);
+ if ($mobile_theme_name == '---'
+ ||
+ in_array($mobile_theme_name, Theme::getAllowedList())
+ && (file_exists('view/theme/' . $mobile_theme_name . '/style.css')
+ || file_exists('view/theme/' . $mobile_theme_name . '/style.php'))
+ ) {
+ $this->setCurrentMobileTheme($mobile_theme_name);