]> git.mxchange.org Git - friendica.git/blobdiff - boot.php
Merge pull request #7666 from MrPetovan/bug/7665-audio-tag
[friendica.git] / boot.php
index 028ba1e829f400c35710daa98dfa67610b61ffdc..224eba1f45b4f6267d71a6c43b013363440e5178 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -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;
 }