]> git.mxchange.org Git - friendica.git/blobdiff - src/Core/Theme.php
Avoid memory issue in exception
[friendica.git] / src / Core / Theme.php
index 6696917490fbec5f9561b365104f281103fed7d6..62dfaa51f3072f45ce8d3bc56e871b2f0f4e3d5a 100644 (file)
@@ -7,8 +7,9 @@
 namespace Friendica\Core;
 
 use Friendica\BaseObject;
-use Friendica\Core\Logger;
-use Friendica\Core\System;
+use Friendica\Model\Profile;
+
+require_once 'boot.php';
 
 /**
  * Some functions to handle themes
@@ -89,8 +90,9 @@ class Theme
         *
         * The screenshot is expected as view/theme/$theme/screenshot.[png|jpg].
         *
-        * @param sring $theme The name of the theme
+        * @param string $theme The name of the theme
         * @return string
+        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
        public static function getScreenshot($theme)
        {
@@ -147,6 +149,7 @@ class Theme
         * @param string $file Filename
         * @param string $root Full root path
         * @return string Path to the file or empty string if the file isn't found
+        * @throws \Friendica\Network\HTTPException\InternalServerErrorException
         */
        public static function getPathForFile($file, $root = '')
        {
@@ -192,24 +195,19 @@ class Theme
         */
        public static function getStylesheetPath($theme)
        {
-               $a = BaseObject::getApp();
-
-               $query_params = [];
-
-               // Workaround for iOS Safari not initially sending the cookie for static files
-               if ($a->mobileDetect->isIos() && $a->mobileDetect->isSafari()) {
-                       $query_params['t'] = time();
+               if (!file_exists('view/theme/' . $theme . '/style.php')) {
+                       return 'view/theme/' . $theme . '/style.css';
                }
 
-               if ($a->profile_uid) {
-                       $query_params['puid'] = $a->profile_uid;
-               }
+               $a = BaseObject::getApp();
 
+               $query_params = [];
 
-               if (file_exists('view/theme/' . $theme . '/style.php')) {
-                       return 'view/theme/' . $theme . '/style.pcss' . (!empty($query_params) ? '?' . http_build_query($query_params) : '');
+               $puid = Profile::getThemeUid($a);
+               if ($puid) {
+                       $query_params['puid'] = $puid;
                }
 
-               return 'view/theme/' . $theme . '/style.css';
+               return 'view/theme/' . $theme . '/style.pcss' . (!empty($query_params) ? '?' . http_build_query($query_params) : '');
        }
 }