Merge pull request #6428 from MrPetovan/bug/5148-get-cookies-from-safari-2
Add variable query parameter to stylesheet URL for iOS Safari
This commit is contained in:
commit
2fbf1d54e2
|
@ -101,6 +101,11 @@ class App
|
||||||
*/
|
*/
|
||||||
private $isAjax;
|
private $isAjax;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var MobileDetect
|
||||||
|
*/
|
||||||
|
public $mobileDetect;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register a stylesheet file path to be included in the <head> tag of every page.
|
* Register a stylesheet file path to be included in the <head> tag of every page.
|
||||||
* Inclusion is done in App->initHead().
|
* Inclusion is done in App->initHead().
|
||||||
|
@ -268,6 +273,9 @@ class App
|
||||||
|
|
||||||
// Detect mobile devices
|
// Detect mobile devices
|
||||||
$mobile_detect = new MobileDetect();
|
$mobile_detect = new MobileDetect();
|
||||||
|
|
||||||
|
$this->mobileDetect = $mobile_detect;
|
||||||
|
|
||||||
$this->is_mobile = $mobile_detect->isMobile();
|
$this->is_mobile = $mobile_detect->isMobile();
|
||||||
$this->is_tablet = $mobile_detect->isTablet();
|
$this->is_tablet = $mobile_detect->isTablet();
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,10 @@
|
||||||
|
|
||||||
namespace Friendica\Core;
|
namespace Friendica\Core;
|
||||||
|
|
||||||
|
use Friendica\BaseObject;
|
||||||
use Friendica\Core\Logger;
|
use Friendica\Core\Logger;
|
||||||
use Friendica\Core\System;
|
use Friendica\Core\System;
|
||||||
|
use Friendica\Model\Profile;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some functions to handle themes
|
* Some functions to handle themes
|
||||||
|
@ -191,13 +193,19 @@ class Theme
|
||||||
*/
|
*/
|
||||||
public static function getStylesheetPath($theme)
|
public static function getStylesheetPath($theme)
|
||||||
{
|
{
|
||||||
$a = get_app();
|
if (!file_exists('view/theme/' . $theme . '/style.php')) {
|
||||||
|
return 'view/theme/' . $theme . '/style.css';
|
||||||
$opts = (($a->profile_uid) ? '?f=&puid=' . $a->profile_uid : '');
|
|
||||||
if (file_exists('view/theme/' . $theme . '/style.php')) {
|
|
||||||
return 'view/theme/' . $theme . '/style.pcss' . $opts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'view/theme/' . $theme . '/style.css';
|
$a = BaseObject::getApp();
|
||||||
|
|
||||||
|
$query_params = [];
|
||||||
|
|
||||||
|
$puid = Profile::getThemeUid($a);
|
||||||
|
if ($puid) {
|
||||||
|
$query_params['puid'] = $puid;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'view/theme/' . $theme . '/style.pcss' . (!empty($query_params) ? '?' . http_build_query($query_params) : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1176,7 +1176,7 @@ class Profile
|
||||||
* Get the user ID of the page owner.
|
* Get the user ID of the page owner.
|
||||||
*
|
*
|
||||||
* Used from within PCSS themes to set theme parameters. If there's a
|
* 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"
|
* 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
|
* system pconfig, which means they don't want to see anybody else's theme
|
||||||
* settings except their own while on this site.
|
* settings except their own while on this site.
|
||||||
|
@ -1184,13 +1184,12 @@ class Profile
|
||||||
* @brief Get the user ID of the page owner
|
* @brief Get the user ID of the page owner
|
||||||
* @return int user ID
|
* @return int user ID
|
||||||
*
|
*
|
||||||
* @note Returns local_user instead of user ID if "always_my_theme"
|
* @note Returns local_user instead of user ID if "always_my_theme" is set to true
|
||||||
* is set to true
|
|
||||||
*/
|
*/
|
||||||
public static function getThemeUid()
|
public static function getThemeUid(App $a)
|
||||||
{
|
{
|
||||||
$uid = (!empty($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0);
|
$uid = !empty($a->profile_uid) ? intval($a->profile_uid) : 0;
|
||||||
if ((local_user()) && ((PConfig::get(local_user(), 'system', 'always_my_theme')) || (!$uid))) {
|
if (local_user() && (PConfig::get(local_user(), 'system', 'always_my_theme') || !$uid)) {
|
||||||
return local_user();
|
return local_user();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1198,7 +1197,7 @@ class Profile
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stip zrl parameter from a string.
|
* Strip zrl parameter from a string.
|
||||||
*
|
*
|
||||||
* @param string $s The input string.
|
* @param string $s The input string.
|
||||||
* @return string The zrl.
|
* @return string The zrl.
|
||||||
|
|
|
@ -10,7 +10,7 @@ if (file_exists("$THEMEPATH/style.css")) {
|
||||||
echo file_get_contents("$THEMEPATH/style.css");
|
echo file_get_contents("$THEMEPATH/style.css");
|
||||||
}
|
}
|
||||||
|
|
||||||
$uid = Profile::getThemeUid();
|
$uid = defaults($_REQUEST, 'puid', 0);
|
||||||
|
|
||||||
$s_colorset = Config::get('duepuntozero', 'colorset');
|
$s_colorset = Config::get('duepuntozero', 'colorset');
|
||||||
$colorset = PConfig::get($uid, 'duepuntozero', 'colorset');
|
$colorset = PConfig::get($uid, 'duepuntozero', 'colorset');
|
||||||
|
|
|
@ -42,10 +42,7 @@ $is_singleuser_class = $is_singleuser ? "is-singleuser" : "is-not-singleuser";
|
||||||
|
|
||||||
// Add the theme color meta
|
// Add the theme color meta
|
||||||
// It makes mobile Chrome UI match Frio's top bar color.
|
// It makes mobile Chrome UI match Frio's top bar color.
|
||||||
$uid = $a->profile_uid;
|
$uid = Profile::getThemeUid($a);
|
||||||
if (is_null($uid)) {
|
|
||||||
$uid = Profile::getThemeUid();
|
|
||||||
}
|
|
||||||
$scheme = PConfig::get($uid, 'frio', 'scheme', PConfig::get($uid, 'frio', 'schema'));
|
$scheme = PConfig::get($uid, 'frio', 'scheme', PConfig::get($uid, 'frio', 'schema'));
|
||||||
if ($scheme && ($scheme != '---')) {
|
if ($scheme && ($scheme != '---')) {
|
||||||
if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
|
if (file_exists('view/theme/frio/scheme/' . $scheme . '.php')) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ $scheme_modified = 0;
|
||||||
|
|
||||||
if ($a->module !== 'install') {
|
if ($a->module !== 'install') {
|
||||||
// Get the UID of the profile owner.
|
// Get the UID of the profile owner.
|
||||||
$uid = Profile::getThemeUid();
|
$uid = defaults($_REQUEST, 'puid', 0);
|
||||||
if ($uid) {
|
if ($uid) {
|
||||||
PConfig::load($uid, 'frio');
|
PConfig::load($uid, 'frio');
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
|
|
||||||
$uid = Profile::getThemeUid();
|
$uid = defaults($_REQUEST, 'puid', 0);
|
||||||
|
|
||||||
$color = false;
|
$color = false;
|
||||||
$quattro_align = false;
|
$quattro_align = false;
|
||||||
|
|
|
@ -7,7 +7,7 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Core\PConfig;
|
use Friendica\Core\PConfig;
|
||||||
use Friendica\Model\Profile;
|
use Friendica\Model\Profile;
|
||||||
|
|
||||||
$uid = Profile::getThemeUid();
|
$uid = defaults($_REQUEST, 'puid', 0);
|
||||||
|
|
||||||
$style = PConfig::get($uid, 'vier', 'style');
|
$style = PConfig::get($uid, 'vier', 'style');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user