]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
GUID should be urlencoded in template since it is urlencoded in uri as well.
[friendica.git] / boot.php
index 2767709b81567decb290fd910fac1b6a073f774b..0e50e8c0e5dd607fda6cac4cf05a11dd0e0933d2 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -17,7 +17,7 @@ require_once('include/dbstructure.php');
 
 define ( 'FRIENDICA_PLATFORM',     'Friendica');
 define ( 'FRIENDICA_CODENAME',     'Lily of the valley');
-define ( 'FRIENDICA_VERSION',      '3.4.0' );
+define ( 'FRIENDICA_VERSION',      '3.4.1' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
 define ( 'DB_UPDATE_VERSION',      1185      );
 define ( 'EOL',                    "<br />\r\n"     );
@@ -358,6 +358,7 @@ if(! class_exists('App')) {
                public  $config;
                public  $page;
                public  $profile;
+               public  $profile_uid;
                public  $user;
                public  $cid;
                public  $contact;
@@ -1446,29 +1447,58 @@ if(! function_exists('current_theme')) {
 
                $a = get_app();
 
+               $page_theme = null;
+               
+               // Find the theme that belongs to the user whose stuff we are looking at
+
+               if($a->profile_uid && ($a->profile_uid != local_user())) {
+                       $r = q("select theme from user where uid = %d limit 1",
+                               intval($a->profile_uid)
+                       );
+                       if($r)
+                               $page_theme = $r[0]['theme'];
+               }
+
+               // Allow folks to over-rule user themes and always use their own on their own site.
+               // This works only if the user is on the same server
+
+               if($page_theme && local_user() && (local_user() != $a->profile_uid)) {
+                       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();
                $is_mobile = $a->is_mobile || $a->is_tablet;
 
+               $standard_system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
+               $standard_theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $standard_system_theme);
+
                if($is_mobile) {
                        if(isset($_SESSION['show-mobile']) && !$_SESSION['show-mobile']) {
-                               $system_theme = '';
-                               $theme_name = '';
+                               $system_theme = $standard_system_theme;
+                               $theme_name = $standard_theme_name;
                        }
                        else {
-                               $system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : '');
+                               $system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-theme'] : $standard_system_theme);
                                $theme_name = ((isset($_SESSION) && x($_SESSION,'mobile-theme')) ? $_SESSION['mobile-theme'] : $system_theme);
 
                                if($theme_name === '---') {
                                        // user has selected to have the mobile theme be the same as the normal one
-                                       $system_theme = '';
-                                       $theme_name = '';
+                                       $system_theme = $standard_system_theme;
+                                       $theme_name = $standard_theme_name;
+                                       
+                                       if($page_theme)
+                                               $theme_name = $page_theme;
                                }
                        }
                }
-               if(!$is_mobile || ($system_theme === '' && $theme_name === '')) {
-                       $system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');
-                       $theme_name = ((isset($_SESSION) && x($_SESSION,'theme')) ? $_SESSION['theme'] : $system_theme);
+               else {
+                       $system_theme = $standard_system_theme;
+                       $theme_name = $standard_theme_name;
+
+                       if($page_theme)
+                               $theme_name = $page_theme;
                }
 
                if($theme_name &&
@@ -1496,9 +1526,13 @@ if(! function_exists('current_theme')) {
 if(! function_exists('current_theme_url')) {
        function current_theme_url() {
                global $a;
+
                $t = current_theme();
+
+               $opts = (($a->profile_uid) ? '?f=&puid=' . $a->profile_uid : '');
                if (file_exists('view/theme/' . $t . '/style.php'))
-                       return($a->get_baseurl() . '/view/theme/' . $t . '/style.pcss');
+                       return($a->get_baseurl() . '/view/theme/' . $t . '/style.pcss' . $opts);
+               
                return($a->get_baseurl() . '/view/theme/' . $t . '/style.css');
        }
 }