]> git.mxchange.org Git - friendica.git/blobdiff - include/security.php
Try additional $_SERVER properties to get relative path of Friendica
[friendica.git] / include / security.php
index cf5b03d04c5dfeb03863bdc62d0fb7262ad47a65..2063bdd16253d56b19343e62c02ba01520cd60ac 100644 (file)
@@ -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);
                        }