]> git.mxchange.org Git - friendica.git/commitdiff
Replace REGEXP with LOCATE for allow_cid and deny_cid
authorPhilipp <admin@philipp.info>
Sun, 31 Oct 2021 18:51:03 +0000 (19:51 +0100)
committerPhilipp <admin@philipp.info>
Sun, 31 Oct 2021 18:53:38 +0000 (19:53 +0100)
src/Security/PermissionSet/Repository/PermissionSet.php

index 097f669415148f46a8f3f913c4f788697d6a227b..1c3b393520f145580406c9ff28ecaf9dbb2a862f 100644 (file)
@@ -137,7 +137,7 @@ class PermissionSet extends BaseRepository
                                $cid                = $cdata['user'];
                        } else {
                                $public_contact_str = $this->aclFormatter->toString($cid);
-                               $user_contact_str   = '<<>>';
+                               $user_contact_str   = '';
                        }
 
                        $groups = [];
@@ -155,13 +155,13 @@ class PermissionSet extends BaseRepository
                        }
 
                        if (!empty($user_contact_str)) {
-                               $condition = ["`uid` = ? AND (NOT (`deny_cid` REGEXP ? OR `deny_cid` REGEXP ? OR deny_gid REGEXP ?)
-                               AND (allow_cid REGEXP ? OR allow_cid REGEXP ? OR allow_gid REGEXP ? OR (allow_cid = '' AND allow_gid = '')))",
+                               $condition = ["`uid` = ? AND (NOT (LOCATE(?, `deny_cid`) OR LOCATE(?, `deny_cid`) OR deny_gid REGEXP ?)
+                               AND (LOCATE(?, allow_cid) OR LOCATE(?, allow_cid) OR allow_gid REGEXP ? OR (allow_cid = '' AND allow_gid = '')))",
                                        $uid, $user_contact_str, $public_contact_str, $group_str,
                                        $user_contact_str, $public_contact_str, $group_str];
                        } else {
-                               $condition = ["`uid` = ? AND (NOT (`deny_cid` REGEXP ? OR deny_gid REGEXP ?)
-                               AND (allow_cid REGEXP ? OR allow_gid REGEXP ? OR (allow_cid = '' AND allow_gid = '')))",
+                               $condition = ["`uid` = ? AND (NOT (LOCATE(?, `deny_cid`) OR deny_gid REGEXP ?)
+                               AND (LOCATE(?, allow_cid) OR allow_gid REGEXP ? OR (allow_cid = '' AND allow_gid = '')))",
                                        $uid, $public_contact_str, $group_str, $public_contact_str, $group_str];
                        }