X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=include%2Fsecurity.php;h=2063bdd16253d56b19343e62c02ba01520cd60ac;hb=ac1ff6c8ce9f23eebf5e53ce799c3b8b84d6de93;hp=cf5b03d04c5dfeb03863bdc62d0fb7262ad47a65;hpb=986106a8f7d0b58a2b2834b082301a426bc98999;p=friendica.git diff --git a/include/security.php b/include/security.php index cf5b03d04c..2063bdd162 100644 --- a/include/security.php +++ b/include/security.php @@ -179,7 +179,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive * The cookie will be renewed automatically. * The week ensures that sessions will expire after some inactivity. */ - if ($_SESSION['remember']) { + if (!empty($_SESSION['remember'])) { logger('Injecting cookie for remembered user ' . $a->user['nickname']); new_cookie(604800, $user_record); unset($_SESSION['remember']); @@ -225,7 +225,7 @@ function can_write_wall($owner) } else { $cid = 0; - if (is_array($_SESSION['remote'])) { + if (!empty($_SESSION['remote'])) { foreach ($_SESSION['remote'] as $visitor) { if ($visitor['uid'] == $owner) { $cid = $visitor['cid']; @@ -245,7 +245,7 @@ function can_write_wall($owner) intval($cid), intval(Contact::SHARING), intval(Contact::FRIEND), - intval(PAGE_COMMUNITY) + intval(Contact::PAGE_COMMUNITY) ); if (DBA::isResult($r)) { @@ -299,11 +299,7 @@ function permissions_sql($owner_id, $remote_verified = false, $groups = null) */ if (!$remote_verified) { - $r = q("SELECT id FROM contact WHERE id = %d AND uid = %d AND blocked = 0 LIMIT 1", - intval($remote_user), - intval($owner_id) - ); - if (DBA::isResult($r)) { + if (DBA::exists('contact', ['id' => $remote_user, 'uid' => $owner_id, 'blocked' => false])) { $remote_verified = true; $groups = Group::getIdsByContactId($remote_user); }