]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
remote_user can now support multiple contacts being logged in at once
[friendica.git] / boot.php
index 3df59f4c01fd8dc97f5e875b0f51113825caca34..bb58d28086b2d3c26bb755a8b8e9e2b7f9fc4f12 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.1429' );
+define ( 'FRIENDICA_VERSION',      '3.0.1456' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
 define ( 'DB_UPDATE_VERSION',      1154      );
 
@@ -253,6 +253,7 @@ define ( 'ACTIVITY_TAG',         NAMESPACE_ACTIVITY_SCHEMA . 'tag' );
 define ( 'ACTIVITY_FAVORITE',    NAMESPACE_ACTIVITY_SCHEMA . 'favorite' );
 
 define ( 'ACTIVITY_POKE',        NAMESPACE_ZOT . '/activity/poke' );
+define ( 'ACTIVITY_MOOD',        NAMESPACE_ZOT . '/activity/mood' );
 
 define ( 'ACTIVITY_OBJ_COMMENT', NAMESPACE_ACTIVITY_SCHEMA . 'comment' );
 define ( 'ACTIVITY_OBJ_NOTE',    NAMESPACE_ACTIVITY_SCHEMA . 'note' );
@@ -364,6 +365,8 @@ if(! class_exists('App')) {
                public  $sourcename = '';
                public  $videowidth = 425;
                public  $videoheight = 350;
+               public  $force_max_items = 0;
+               public  $theme_thread_allow = true;
 
                private $scheme;
                private $hostname;
@@ -469,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;
@@ -476,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
@@ -733,10 +727,14 @@ if(! function_exists('check_config')) {
                // than the currently visited url, store the current value accordingly.
                // "Radically different" ignores common variations such as http vs https
                // and www.example.com vs example.com.
+               // We will only change the url to an ip address if there is no existing setting
 
-               if((! x($url)) || (! link_compare($url,$a->get_baseurl())))
+               if(! x($url))
+                       $url = set_config('system','url',$a->get_baseurl());
+               if((! link_compare($url,$a->get_baseurl())) && (! preg_match("/^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/",$a->get_hostname)))
                        $url = set_config('system','url',$a->get_baseurl());
 
+
                if($build != DB_UPDATE_VERSION) {
                        $stored = intval($build);
                        $current = intval(DB_UPDATE_VERSION);
@@ -898,6 +896,10 @@ if(! function_exists('login')) {
                        $tpl = get_markup_template("logout.tpl");
                }
                else {
+                       $a->page['htmlhead'] .= replace_macros(get_markup_template("login_head.tpl"),array(
+                               '$baseurl'              => $a->get_baseurl(true)
+                       ));
+
                        $tpl = get_markup_template("login.tpl");
                        $_SESSION['return_url'] = $a->query_string;
                }
@@ -1023,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;
@@ -1142,8 +1162,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');
@@ -1465,7 +1491,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));
        }
 }