]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Merge pull request #7669 from tobiasd/20190927-en
[friendica.git] / boot.php
index 9076331290a447c820c10658d9dfa1111551d141..224eba1f45b4f6267d71a6c43b013363440e5178 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -31,7 +31,7 @@ use Friendica\Util\DateTimeFormat;
 
 define('FRIENDICA_PLATFORM',     'Friendica');
 define('FRIENDICA_CODENAME',     'Dalmatian Bellflower');
-define('FRIENDICA_VERSION',      '2019.06-dev');
+define('FRIENDICA_VERSION',      '2019.09-rc');
 define('DFRN_PROTOCOL_VERSION',  '2.23');
 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
 
@@ -413,7 +413,7 @@ function public_contact()
  *
  * @return int|bool visitor_id or false
  */
-function remote_user()
+function remote_user($uid = null)
 {
        // You cannot be both local and remote.
        // Unncommented by rabuzarus because remote authentication to local
@@ -422,13 +422,22 @@ function remote_user()
 //             return false;
 //     }
 
-       if (empty($_SESSION)) {
+       if (empty($_SESSION['authenticated'])) {
                return false;
        }
 
-       if (!empty($_SESSION['authenticated']) && !empty($_SESSION['visitor_id'])) {
+       if (!is_null($uid) && !empty($_SESSION['remote'])) {
+               /// @todo replace it with this:
+               // if (!empty($_SESSION['remote'][$uid])) ...
+               foreach ($_SESSION['remote'] as $visitor) {
+                       if ($visitor['uid'] == $uid) {
+                               return $visitor['cid'];
+                       }
+               }
+       } elseif (is_null($uid) && !empty($_SESSION['visitor_id'])) {
                return intval($_SESSION['visitor_id']);
        }
+
        return false;
 }
 
@@ -535,39 +544,6 @@ function is_site_admin()
        return local_user() && $admin_email && in_array(defaults($a->user, 'email', ''), $adminlist);
 }
 
-/**
- * @brief Returns querystring as string from a mapped array.
- *
- * @param array  $params mapped array with query parameters
- * @param string $name   of parameter, default null
- *
- * @return string
- */
-function build_querystring($params, $name = null)
-{
-       $ret = "";
-       foreach ($params as $key => $val) {
-               if (is_array($val)) {
-                       /// @TODO maybe not compare against null, use is_null()
-                       if ($name == null) {
-                               $ret .= build_querystring($val, $key);
-                       } else {
-                               $ret .= build_querystring($val, $name . "[$key]");
-                       }
-               } else {
-                       $val = urlencode($val);
-                       /// @TODO maybe not compare against null, use is_null()
-                       if ($name != null) {
-                               /// @TODO two string concated, can be merged to one
-                               $ret .= $name . "[$key]" . "=$val&";
-                       } else {
-                               $ret .= "$key=$val&";
-                       }
-               }
-       }
-       return $ret;
-}
-
 function explode_querystring($query)
 {
        $arg_st = strpos($query, '?');