use Friendica\BaseObject;
use Friendica\Core\Logger;
use Friendica\Core\System;
+use Friendica\Model\Profile;
/**
* Some functions to handle themes
$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();
+ $puid = Profile::getThemeUid($a);
+ if ($puid) {
+ $query_params['puid'] = $puid;
}
- if ($a->profile_uid) {
- $query_params['puid'] = $a->profile_uid;
- }
-
-
if (file_exists('view/theme/' . $theme . '/style.php')) {
return 'view/theme/' . $theme . '/style.pcss' . (!empty($query_params) ? '?' . http_build_query($query_params) : '');
}
* Get the user ID of the page owner.
*
* Used from within PCSS themes to set theme parameters. If there's a
- * puid request variable, that is the "page owner" and normally their theme
+ * profile_uid variable set in App, that is the "page owner" and normally their theme
* settings take precedence; unless a local user sets the "always_my_theme"
* system pconfig, which means they don't want to see anybody else's theme
* settings except their own while on this site.
* @brief Get the user ID of the page owner
* @return int user ID
*
- * @note Returns local_user instead of user ID if "always_my_theme"
- * is set to true
+ * @note Returns local_user instead of user ID if "always_my_theme" is set to true
*/
- public static function getThemeUid()
+ public static function getThemeUid(App $a)
{
- $uid = (!empty($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0);
- if ((local_user()) && ((PConfig::get(local_user(), 'system', 'always_my_theme')) || (!$uid))) {
+ $uid = !empty($a->profile_uid) ? intval($a->profile_uid) : 0;
+ if (local_user() && (PConfig::get(local_user(), 'system', 'always_my_theme') || !$uid)) {
return local_user();
}
}
/**
- * Stip zrl parameter from a string.
+ * Strip zrl parameter from a string.
*
* @param string $s The input string.
* @return string The zrl.
// Add the theme color meta
// It makes mobile Chrome UI match Frio's top bar color.
- $uid = $a->profile_uid;
- if (is_null($uid)) {
- $uid = Profile::getThemeUid();
- }
+ $uid = Profile::getThemeUid($a);
$scheme = PConfig::get($uid, 'frio', 'scheme', PConfig::get($uid, 'frio', 'schema'));
if ($scheme && ($scheme != '---')) {
if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {