]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #3213 from Hypolite/issue/#2792-2
authorMichael Vogel <icarus@dabo.de>
Mon, 13 Mar 2017 17:35:32 +0000 (18:35 +0100)
committerGitHub <noreply@github.com>
Mon, 13 Mar 2017 17:35:32 +0000 (18:35 +0100)
Like behavior fix/improvements

1  2 
boot.php

diff --combined boot.php
index 285c70370ec6d19e2aaac49bb7935a8d67b050d9,a5774aaad8f35fd3e69eee5ed89b3df7973aaa7e..56279f4ec8a0dd2af84ff3bf15cb18576ad36b15
+++ b/boot.php
@@@ -38,9 -38,9 +38,9 @@@ require_once('include/dbstructure.php')
  
  define ( 'FRIENDICA_PLATFORM',     'Friendica');
  define ( 'FRIENDICA_CODENAME',     'Asparagus');
 -define ( 'FRIENDICA_VERSION',      '3.5.1-dev' );
 +define ( 'FRIENDICA_VERSION',      '3.5.2-dev' );
  define ( 'DFRN_PROTOCOL_VERSION',  '2.23'    );
 -define ( 'DB_UPDATE_VERSION',      1214      );
 +define ( 'DB_UPDATE_VERSION',      1215      );
  
  /**
   * @brief Constant with a HTML line break.
@@@ -1889,11 -1889,35 +1889,35 @@@ function goaway($s) 
   * @return int|bool user id or false
   */
  function local_user() {
-       if((x($_SESSION,'authenticated')) && (x($_SESSION,'uid')))
+       if (x($_SESSION, 'authenticated') && x($_SESSION, 'uid')) {
                return intval($_SESSION['uid']);
+       }
        return false;
  }
  
+ /**
+  * @brief Returns the public contact id of logged in user or false.
+  *
+  * @return int|bool public contact id or false
+  */
+ function public_contact() {
+       static $public_contact_id = false;
+       if (!$public_contact_id && x($_SESSION, 'authenticated')) {
+               if (x($_SESSION, 'my_address')) {
+                       // Local user
+                       $public_contact_id = intval(get_contact($_SESSION['my_address'], 0));
+               } else if (x($_SESSION, 'visitor_home')) {
+                       // Remote user
+                       $public_contact_id = intval(get_contact($_SESSION['visitor_home'], 0));
+               }
+       } else if (!x($_SESSION, 'authenticated')) {
+               $public_contact_id = false;
+       }
+       return $public_contact_id;
+ }
  /**
   * @brief Returns contact id of authenticated site visitor or false
   *