]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/PermissionTooltip.php
Merge pull request #11141 from urbalazs/language-names
[friendica.git] / src / Module / PermissionTooltip.php
index 3f23032d6d838b4618f1806357d99e9f16515ba9..71ce2beee2aca1a11a4402e3130266bf102c56fe 100644 (file)
@@ -1,12 +1,31 @@
 <?php
+/**
+ * @copyright Copyright (C) 2010-2022, the Friendica project
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <https://www.gnu.org/licenses/>.
+ *
+ */
 
 namespace Friendica\Module;
 
 use Friendica\Core\Hook;
 use Friendica\Database\DBA;
 use Friendica\DI;
-use Friendica\Model\Item;
 use Friendica\Model\Group;
+use Friendica\Model\Item;
 use Friendica\Model\Post;
 use Friendica\Network\HTTPException;
 
@@ -15,10 +34,10 @@ use Friendica\Network\HTTPException;
  */
 class PermissionTooltip extends \Friendica\BaseModule
 {
-       public static function rawContent(array $parameters = [])
+       protected function rawContent(array $request = [])
        {
-               $type = $parameters['type'];
-               $referenceId = $parameters['id'];
+               $type = $this->parameters['type'];
+               $referenceId = $this->parameters['id'];
 
                $expectedTypes = ['item', 'photo', 'event'];
                if (!in_array($type, $expectedTypes)) {
@@ -32,6 +51,10 @@ class PermissionTooltip extends \Friendica\BaseModule
                } else {
                        $fields = ['uid', 'allow_cid', 'allow_gid', 'deny_cid', 'deny_gid'];
                        $model = DBA::selectFirst($type, $fields, $condition);
+                       $model['allow_cid'] = DI::aclFormatter()->expand($model['allow_cid']);
+                       $model['allow_gid'] = DI::aclFormatter()->expand($model['allow_gid']);
+                       $model['deny_cid']  = DI::aclFormatter()->expand($model['deny_cid']);
+                       $model['deny_gid']  = DI::aclFormatter()->expand($model['deny_gid']);
                }
 
                if (!DBA::isResult($model)) {
@@ -39,7 +62,7 @@ class PermissionTooltip extends \Friendica\BaseModule
                }
 
                if (isset($model['psid'])) {
-                       $permissionSet = DI::permissionSet()->selectOneById($model['psid']);
+                       $permissionSet = DI::permissionSet()->selectOneById($model['psid'], $model['uid']);
                        $model['allow_cid'] = $permissionSet->allow_cid;
                        $model['allow_gid'] = $permissionSet->allow_gid;
                        $model['deny_cid']  = $permissionSet->deny_cid;