aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xboot.php45
-rw-r--r--mod/network.php1
-rw-r--r--version.inc2
-rw-r--r--view/theme/redbasic/php/config.php3
-rw-r--r--view/theme/redbasic/php/style.php6
5 files changed, 50 insertions, 7 deletions
diff --git a/boot.php b/boot.php
index c4bade7b1..9eb2bf3dd 100755
--- a/boot.php
+++ b/boot.php
@@ -1915,6 +1915,27 @@ function current_theme(){
$app_base_themes = array('redbasic');
$a = get_app();
+ $page_theme = null;
+
+ // Find the theme that belongs to the channel whose stuff we are looking at
+
+ if($a->profile_uid && $a->profile_uid != local_user()) {
+ $r = q("select channel_theme from channel where channel_id = %d limit 1",
+ intval($a->profile_uid)
+ );
+ if($r)
+ $page_theme = $r[0]['channel_theme'];
+ }
+
+ // Allow folks to over-rule channel themes and always use their own on their own site.
+ // The default is for channel themes to take precedence over your own on pages belonging
+ // to that channel.
+
+ if($page_theme && local_user() && local_user() != $a->profile_url) {
+ if(get_pconfig(local_user(),'system','always_my_theme'))
+ $page_theme = null;
+ }
+
// $mobile_detect = new Mobile_Detect();
// $is_mobile = $mobile_detect->isMobile() || $mobile_detect->isTablet();
@@ -1933,6 +1954,9 @@ function current_theme(){
else {
$system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
$theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
+
+ if($page_theme)
+ $theme_name = $page_theme;
}
if($theme_name &&
@@ -1961,8 +1985,10 @@ function current_theme(){
function current_theme_url($installing = false) {
global $a;
$t = current_theme();
+ $uid = '';
+ $uid = (($a->profile_uid) ? '?f=&puid=' . $a->profile_uid : '');
if(file_exists('view/theme/' . $t . '/php/style.php'))
- return('view/theme/' . $t . '/php/style.pcss');
+ return('view/theme/' . $t . '/php/style.pcss' . $uid);
return('view/theme/' . $t . '/css/style.css');
}
@@ -2343,6 +2369,19 @@ function head_get_icon() {
return $icon;
}
-function get_controlling_channel_id() {
- return get_app()->profile_uid;
+// 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
+// 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.
+
+function get_theme_uid() {
+ $uid = (($_REQUEST['puid']) ? intval($_REQUEST['puid']) : 0);
+ if(local_user()) {
+ if((get_pconfig(local_user(),'system','always_my_theme')) || (! $uid))
+ return local_user();
+ if(! $uid)
+ return local_user();
+ }
+ return $uid;
}
diff --git a/mod/network.php b/mod/network.php
index 0f4b4f7e8..13614f00d 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -9,6 +9,7 @@ function network_init(&$a) {
}
$channel = $a->get_channel();
+ $a->profile_uid = local_user();
head_set_icon($channel['xchan_photo_s']);
$is_a_date_query = false;
diff --git a/version.inc b/version.inc
index 2c1e5158a..ac2cd8ef7 100644
--- a/version.inc
+++ b/version.inc
@@ -1 +1 @@
-2013-07-16.376
+2013-07-17.377
diff --git a/view/theme/redbasic/php/config.php b/view/theme/redbasic/php/config.php
index 5917b1e36..4e7363362 100644
--- a/view/theme/redbasic/php/config.php
+++ b/view/theme/redbasic/php/config.php
@@ -23,7 +23,7 @@ function theme_content(&$a) {
function theme_post(&$a) {
if(!local_user()) { return; }
-
+
if (isset($_POST['redbasic-settings-submit'])) {
set_pconfig(local_user(), 'redbasic', 'font_size', $_POST['redbasic_font_size']);
set_pconfig(local_user(), 'redbasic', 'line_height', $_POST['redbasic_line_height']);
@@ -37,6 +37,7 @@ function theme_post(&$a) {
set_pconfig(local_user(), 'redbasic', 'colour_scheme', $_POST['redbasic_colour_scheme']);
set_pconfig(local_user(), 'redbasic', 'radius', $_POST['redbasic_radius']);
}
+
}
// We probably don't want these if we're having global settings, but we'll comment out for now, just in case
diff --git a/view/theme/redbasic/php/style.php b/view/theme/redbasic/php/style.php
index e42770d17..8643925d3 100644
--- a/view/theme/redbasic/php/style.php
+++ b/view/theme/redbasic/php/style.php
@@ -3,9 +3,11 @@
// the get_config bits, though this is untested.
// We also need to eventually. Use the page owners settings for everybody - get_pconfig(page_owner()) or whatever that would look like.
- $uid = get_controlling_channel_id();
- load_pconfig($uid,'redbasic');
+ $uid = get_theme_uid();
+
+ if($uid)
+ load_pconfig($uid,'redbasic');
$line_height = false;
$redbasic_font_size = false;