Fix "redir" loop

This commit is contained in:
Michael 2019-09-23 22:13:20 +00:00
parent c0afa761ac
commit 5254147ccc
7 changed files with 93 additions and 39 deletions

View file

@ -413,7 +413,7 @@ function public_contact()
*
* @return int|bool visitor_id or false
*/
function remote_user()
function remote_user($uid = 0)
{
// 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 (!empty($uid) && !empty($_SESSION['remote'])) {
foreach ($_SESSION['remote'] as $visitor) {
if ($visitor['uid'] == $uid) {
return $visitor['cid'];
}
}
}
if (!empty($_SESSION['visitor_id'])) {
return intval($_SESSION['visitor_id']);
}
return false;
}