X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=plugins%2FModHelper%2FModHelperPlugin.php;h=45b8bf27d10947b7307a325e9793bb2d084aa475;hb=10f17efc4f5a4eb9af09aef8397726dab0d164db;hp=d003827d13e63078219fcf9d704c48dccfc09588;hpb=8ff44a1fb9f54ce61a91987ca44cbd4fccf0a012;p=quix0rs-gnu-social.git diff --git a/plugins/ModHelper/ModHelperPlugin.php b/plugins/ModHelper/ModHelperPlugin.php index d003827d13..45b8bf27d1 100644 --- a/plugins/ModHelper/ModHelperPlugin.php +++ b/plugins/ModHelper/ModHelperPlugin.php @@ -17,9 +17,7 @@ * along with this program. If not, see . */ -if (!defined('STATUSNET')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } /** * @package ModHelperPlugin @@ -27,13 +25,16 @@ if (!defined('STATUSNET')) { */ class ModHelperPlugin extends Plugin { - function onPluginVersion(&$versions) + static $rights = array(Right::SILENCEUSER, Right::TRAINSPAM, Right::REVIEWSPAM); + + function onPluginVersion(array &$versions) { $versions[] = array('name' => 'ModHelper', - 'version' => STATUSNET_VERSION, + 'version' => GNUSOCIAL_VERSION, 'author' => 'Brion Vibber', - 'homepage' => 'http://status.net/wiki/Plugin:ModHelper', + 'homepage' => 'https://git.gnu.io/gnu/gnu-social/tree/master/plugins/ModHelper', 'rawdescription' => + // TRANS: Plugin description. _m('Lets users who have been manually marked as "modhelper"s silence accounts.')); return true; @@ -41,8 +42,10 @@ class ModHelperPlugin extends Plugin function onUserRightsCheck($profile, $right, &$result) { - if ($right == Right::SILENCEUSER) { - // Hrm.... really we should confirm that the *other* user isn't privleged. :) + if (in_array($right, self::$rights)) { + // To silence a profile without accidentally silencing other + // privileged users, always call Profile->silenceAs($actor) + // since it checks target's privileges too. if ($profile->hasRole('modhelper')) { $result = true; return false;