aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xboot.php62
-rw-r--r--include/Contact.php5
-rw-r--r--mod/network.php1
-rw-r--r--mod/settings.php6
-rw-r--r--version.inc2
-rw-r--r--view/theme/redbasic/css/fancy.css23
-rw-r--r--view/theme/redbasic/css/mod_page.css4
-rw-r--r--view/theme/redbasic/php/config.php3
-rw-r--r--view/theme/redbasic/php/style.php33
9 files changed, 120 insertions, 19 deletions
diff --git a/boot.php b/boot.php
index cf1a540dc..9eb2bf3dd 100755
--- a/boot.php
+++ b/boot.php
@@ -187,6 +187,18 @@ define ( 'PAGE_REMOVED', 0x8000 );
//define ( 'PAGE_BLOG', 4 );
//define ( 'PAGE_PRVGROUP', 5 );
+
+/**
+ * Photo types
+ */
+
+define ( 'PHOTO_NORMAL', 0x0000 );
+define ( 'PHOTO_PROFILE', 0x0001 );
+define ( 'PHOTO_XCHAN', 0x0002 );
+define ( 'PHOTO_THING', 0x0004 );
+
+
+
/**
* Network and protocol family types
*/
@@ -501,6 +513,9 @@ class App {
public $account = null; // account record
public $channel = null; // channel record
public $observer = null; // xchan record
+ public $profile_uid = 0; // If applicable, the uid of the person whose stuff this is.
+
+
private $perms = null; // observer permissions
private $widgets = array(); // widgets for this page
@@ -1521,7 +1536,7 @@ function profile_load(&$a, $nickname, $profile = '') {
}
$a->profile = $r[0];
-
+ $a->profile_uid = $r[0]['profile_uid'];
$a->page['title'] = $a->profile['channel_name'] . " - " . $a->profile['channel_address'] . "@" . $a->get_hostname();
@@ -1900,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();
@@ -1918,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 &&
@@ -1946,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');
}
@@ -2327,3 +2368,20 @@ function head_get_icon() {
$icon = z_root() . $icon;
return $icon;
}
+
+// 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/include/Contact.php b/include/Contact.php
index 245682454..466d7f606 100644
--- a/include/Contact.php
+++ b/include/Contact.php
@@ -43,6 +43,8 @@ function channelx_by_n($id) {
function vcard_from_xchan($xchan, $observer = null, $mode = '') {
+ $a = get_app();
+
$connect = false;
if(local_user()) {
$r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1",
@@ -53,6 +55,9 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') {
$connect = t('Connect');
}
+ if(array_key_exists('channel_id',$xchan))
+ $a->profile_uid = $xchan['channel_id'];
+
$url = (($observer)
? z_root() . '/magic?f=&dest=' . $xchan['xchan_url'] . '&addr=' . $xchan['xchan_addr']
: $xchan['xchan_url']
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/mod/settings.php b/mod/settings.php
index 164a2a8a0..1878fceb6 100644
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -3,6 +3,7 @@
require_once('include/settings.php');
+
function get_theme_config_file($theme){
$base_theme = get_app()->theme_info['extends'];
@@ -16,6 +17,11 @@ function get_theme_config_file($theme){
return null;
}
+function settings_init(&$a) {
+ $a->profile_uid = local_user();
+}
+
+
function settings_aside(&$a) {
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/css/fancy.css b/view/theme/redbasic/css/fancy.css
index 277ea5596..2da9d68d1 100644
--- a/view/theme/redbasic/css/fancy.css
+++ b/view/theme/redbasic/css/fancy.css
@@ -81,3 +81,26 @@ ul.menu-popup a:hover {
background-color: #eec;
color: #f00;
}
+
+section {
+left: 0px;
+width: 800px;
+margin-left: auto;
+margin-right: auto;
+}
+body {background-color: #d00 !important;}
+
+.page-content-wrapper {background: #fff;
+ color: #000;
+ border-radius: 20px;
+ box-shadow: 5px 5px 5px #111;
+}
+
+h3.page-title {
+padding-top: 30px;
+ color: #033}
+.page-body {padding: 40px;}
+
+.page-body strong {color: #033;}
+
+.nav-links {margin-top: 5px;}
diff --git a/view/theme/redbasic/css/mod_page.css b/view/theme/redbasic/css/mod_page.css
index 26c16b88c..37f597fac 100644
--- a/view/theme/redbasic/css/mod_page.css
+++ b/view/theme/redbasic/css/mod_page.css
@@ -1,3 +1,4 @@
+/*
section {
left: 0px;
width: 800px;
@@ -19,4 +20,5 @@ padding-top: 30px;
.page-body strong {color: #033;}
-.nav-links {margin-top: 5px;} \ No newline at end of file
+.nav-links {margin-top: 5px;}
+*/ \ No newline at end of file
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 aa88443bc..8643925d3 100644
--- a/view/theme/redbasic/php/style.php
+++ b/view/theme/redbasic/php/style.php
@@ -2,7 +2,12 @@
// This needs changing now, if we're going for global settings. Admin settings have been removed in preparation, You *should* just be able to remove all
// 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.
- load_pconfig(local_user(),'redbasic');
+
+
+ $uid = get_theme_uid();
+
+ if($uid)
+ load_pconfig($uid,'redbasic');
$line_height = false;
$redbasic_font_size = false;
@@ -31,25 +36,25 @@
if($x !== false)
$radius = $x;
- if (local_user()) {
- $line_height = get_pconfig(local_user(), "redbasic","line_height");
- $redbasic_font_size = get_pconfig(local_user(), "redbasic", "font_size");
- $colour = get_pconfig(local_user(), "redbasic", "colour");
- $shadows = get_pconfig(local_user(), "redbasic", "shadow");
- $navcolour = get_pconfig(local_user(), "redbasic", "navcolour");
- $displaystyle = get_pconfig(local_user(), "redbasic", "displaystyle");
- $linkcolour = get_pconfig(local_user(), "redbasic", "linkcolour");
- $shiny = get_pconfig(local_user(), "redbasic", "shiny");
- $x = get_pconfig(local_user(),'redbasic','radius');
+ if ($uid) {
+ $line_height = get_pconfig($uid, "redbasic","line_height");
+ $redbasic_font_size = get_pconfig($uid, "redbasic", "font_size");
+ $colour = get_pconfig($uid, "redbasic", "colour");
+ $shadows = get_pconfig($uid, "redbasic", "shadow");
+ $navcolour = get_pconfig($uid, "redbasic", "navcolour");
+ $displaystyle = get_pconfig($uid, "redbasic", "displaystyle");
+ $linkcolour = get_pconfig($uid, "redbasic", "linkcolour");
+ $shiny = get_pconfig($uid, "redbasic", "shiny");
+ $x = get_pconfig($uid,'redbasic','radius');
if($x !== false)
$radius = $x;
- if (! feature_enabled(local_user(),'expert')) {$colour_scheme = get_pconfig(local_user(), "redbasic", "colour_scheme");}
+ if (! feature_enabled($uid,'expert')) {$colour_scheme = get_pconfig($uid, "redbasic", "colour_scheme");}
}
// In non-expert mode, we just let them choose font size, line height, and a colour scheme. A colour scheme is just a pre-defined set of the above variables.
// But only apply these settings in non-expert mode to prevent confusion when turning expert mode on and off.
- if(! feature_enabled(local_user(),'expert')) {
+ if(! feature_enabled($uid,'expert')) {
if ($colour_scheme === 'fancyred') {$shadows = true; $navcolour = 'black'; $displaystyle = 'fancy'; $linkcolour = 'f00'; $shiny = "opaque";}
// Dark themes are very different - we need to do some of these from scratch, so don't bother setting vars for anything else
if ($colour_scheme === 'dark') {$colour = 'dark'; $navcolour = 'black';}
@@ -59,7 +64,7 @@
}
// This is probably the easiest place to apply global settings. Don't bother with site line height and such. Instead, check pconfig for global user settings.
-// eg, if ($redbasic_font_size === false) {$redbasic_font_size = get_pconfig(local_user(), "global", "font_size"); If it's not set, we'll just use the CSS with no changes.
+// eg, if ($redbasic_font_size === false) {$redbasic_font_size = get_pconfig($uid, "global", "font_size"); If it's not set, we'll just use the CSS with no changes.
// Then all you need to do is add a "Global Settings" tab to settings/display, and make an equivalent of theme_settings.tpl and config.php to be loaded there. Easy.
if ($line_height === false) {$line_height = $site_line_height;}