]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - plugins/ModHelper/ModHelperPlugin.php
disabling auto-backlog-importer on subscribe
[quix0rs-gnu-social.git] / plugins / ModHelper / ModHelperPlugin.php
index c2757bbeae5cb4c0a974866e140cca788e7bd773..45b8bf27d10947b7307a325e9793bb2d084aa475 100644 (file)
@@ -17,9 +17,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-if (!defined('STATUSNET')) {
-    exit(1);
-}
+if (!defined('GNUSOCIAL')) { exit(1); }
 
 /**
  * @package ModHelperPlugin
@@ -27,12 +25,14 @@ 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.'));
@@ -42,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;