]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Merge https://github.com/friendica/friendica into pull
[friendica.git] / boot.php
index b49c92bf05f470b64910f2cd512cba6c6aae73bb..5d08e7cec8b50f7d87184c4f2cc12076b629a18e 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -11,7 +11,7 @@ require_once('include/cache.php');
 require_once('library/Mobile_Detect/Mobile_Detect.php');
 
 define ( 'FRIENDICA_PLATFORM',     'Friendica');
-define ( 'FRIENDICA_VERSION',      '3.0.1443' );
+define ( 'FRIENDICA_VERSION',      '3.0.1464' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
 define ( 'DB_UPDATE_VERSION',      1154      );
 
@@ -472,6 +472,7 @@ if(! class_exists('App')) {
                        $this->argc = count($this->argv);
                        if((array_key_exists('0',$this->argv)) && strlen($this->argv[0])) {
                                $this->module = str_replace(".", "_", $this->argv[0]);
+                               $this->module = str_replace("-", "_", $this->module);
                        }
                        else {
                                $this->argc = 1;
@@ -479,16 +480,6 @@ if(! class_exists('App')) {
                                $this->module = 'home';
                        }
 
-                       /**
-                        * Special handling for the webfinger/lrdd host XRD file
-                        */
-
-                       if($this->cmd === '.well-known/host-meta') {
-                               $this->argc = 1;
-                               $this->argv = array('hostxrd');
-                               $this->module = 'hostxrd';
-                       }
-
                        /**
                         * See if there is any page number information, and initialise
                         * pagination
@@ -1034,11 +1025,29 @@ if(! function_exists('get_max_import_size')) {
 
 if(! function_exists('profile_load')) {
        function profile_load(&$a, $nickname, $profile = 0) {
-               if(remote_user()) {
-                       $r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1",
-                                       intval($_SESSION['visitor_id']));
-                       if(count($r))
-                               $profile = $r[0]['profile-id'];
+
+               $user = q("select uid from user where nickname = '%s' limit 1",
+                       dbesc($nickname)
+               );
+               
+               if(! ($user && count($user))) {
+                       logger('profile error: ' . $a->query_string, LOGGER_DEBUG);
+                       notice( t('Requested account is not available.') . EOL );
+                       $a->error = 404;
+                       return;
+               }
+
+               if(remote_user() && count($_SESSION['remote'])) {
+                       foreach($_SESSION['remote'] as $visitor) {
+                               if($visitor['uid'] == $user[0]['uid']) {
+                                       $r = q("SELECT `profile-id` FROM `contact` WHERE `id` = %d LIMIT 1",
+                                               intval($visitor['cid'])
+                                       );
+                                       if(count($r))
+                                               $profile = $r[0]['profile-id'];
+                                       break;
+                               }
+                       }
                }
 
                $r = null;
@@ -1079,9 +1088,12 @@ if(! function_exists('profile_load')) {
 
                $a->profile = $r[0];
 
+               $a->profile['mobile-theme'] = get_pconfig($profile_uid, 'system', 'mobile_theme');
+
 
                $a->page['title'] = $a->profile['name'] . " @ " . $a->config['sitename'];
                $_SESSION['theme'] = $a->profile['theme'];
+               $_SESSION['mobile-theme'] = $a->profile['mobile-theme'];
 
                /**
                 * load/reload current theme info
@@ -1153,8 +1165,14 @@ if(! function_exists('profile_sidebar')) {
 
                // don't show connect link to authenticated visitors either
 
-               if((remote_user()) && ($_SESSION['visitor_visiting'] == $profile['uid']))
-                       $connect = False;
+               if(remote_user() && count($_SESSION['remote'])) {
+                       foreach($_SESSION['remote'] as $visitor) {
+                               if($visitor['uid'] == $profile['uid']) {
+                                       $connect = false;
+                                       break;
+                               }
+                       }
+               }
 
                if(get_my_url() && $profile['unkmail'])
                        $wallmessage = t('Message');
@@ -1476,7 +1494,10 @@ if(! function_exists('proc_run')) {
                        $args[$x] = escapeshellarg($args[$x]);
 
                $cmdline = implode($args," ");
-               proc_close(proc_open($cmdline." &",array(),$foo));
+               if(get_config('system','proc_windows'))
+                       proc_close(proc_open('cmd /c start /b ' . $cmdline,array(),$foo));
+               else
+                       proc_close(proc_open($cmdline." &",array(),$foo));
        }
 }
 
@@ -1492,6 +1513,12 @@ if(! function_exists('current_theme')) {
                if($is_mobile) {
                        $system_theme = ((isset($a->config['system']['mobile-theme'])) ? $a->config['system']['mobile-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 = '';
+                       }
                }
                if(!$is_mobile || ($system_theme === '' && $theme_name === '')) {
                        $system_theme = ((isset($a->config['system']['theme'])) ? $a->config['system']['theme'] : '');