X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;ds=sidebyside;f=src%2FCore%2FTheme.php;h=62dfaa51f3072f45ce8d3bc56e871b2f0f4e3d5a;hb=d6a82c6c2d7befde9914fce3bd4e3e07b97ca036;hp=1ea39d606c763556a8ab94934e5b98e61e217801;hpb=3b80f335fad83fac4cdcf059f4129d5364eb6f90;p=friendica.git diff --git a/src/Core/Theme.php b/src/Core/Theme.php index 1ea39d606c..62dfaa51f3 100644 --- a/src/Core/Theme.php +++ b/src/Core/Theme.php @@ -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,18 +195,19 @@ class Theme */ public static function getStylesheetPath($theme) { + if (!file_exists('view/theme/' . $theme . '/style.php')) { + return 'view/theme/' . $theme . '/style.css'; + } + $a = BaseObject::getApp(); - $opts = (($a->profile_uid) ? '?f=&puid=' . $a->profile_uid : ''); - if (file_exists('view/theme/' . $theme . '/style.php')) { - if ($a->is_mobile) { - // Workaround for iOS Safari not sending the cookie for static files - return 'view/theme/' . $theme . '/style' . $opts; - } else { - return 'view/theme/' . $theme . '/style.pcss' . $opts; - } + $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) : ''); } }