summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@status.net>2009-12-28 08:19:22 -0800
committerEvan Prodromou <evan@status.net>2009-12-28 08:19:22 -0800
commit2c2a82fda0b78422802a9d0b23afc765c2f5f52b (patch)
tree50fc79ceee0f2bde9f0cb3edbac9f1786958b767
parent75fbec2fa336ac9b749fa273ac5a44c2fb211623 (diff)
add stuff for clearing flags to UserFlagPlugin
-rw-r--r--plugins/UserFlag/UserFlagPlugin.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/plugins/UserFlag/UserFlagPlugin.php b/plugins/UserFlag/UserFlagPlugin.php
index b4f9bd783..78979ace2 100644
--- a/plugins/UserFlag/UserFlagPlugin.php
+++ b/plugins/UserFlag/UserFlagPlugin.php
@@ -44,6 +44,7 @@ if (!defined('STATUSNET') && !defined('LACONICA')) {
class UserFlagPlugin extends Plugin
{
const REVIEWFLAGS = 'UserFlagPlugin::reviewflags';
+ const CLEARFLAGS = 'UserFlagPlugin::clearflags';
function onCheckSchema()
{
@@ -72,6 +73,7 @@ class UserFlagPlugin extends Plugin
function onRouterInitialized($m) {
$m->connect('main/flag/profile', array('action' => 'flagprofile'));
+ $m->connect('main/flag/clear', array('action' => 'clearflag'));
$m->connect('admin/profile/flag', array('action' => 'adminprofileflag'));
return true;
}
@@ -82,9 +84,11 @@ class UserFlagPlugin extends Plugin
{
case 'FlagprofileAction':
case 'AdminprofileflagAction':
+ case 'ClearflagAction':
require_once(INSTALLDIR.'/plugins/UserFlag/' . strtolower(mb_substr($cls, 0, -6)) . '.php');
return false;
case 'FlagProfileForm':
+ case 'ClearFlagForm':
require_once(INSTALLDIR.'/plugins/UserFlag/' . strtolower($cls . '.php'));
return false;
case 'User_flag_profile':
@@ -152,10 +156,13 @@ class UserFlagPlugin extends Plugin
}
function onUserRightsCheck($user, $right, &$result) {
- if ($right == self::REVIEWFLAGS) {
+ switch ($right) {
+ case self::REVIEWFLAGS:
+ case self::CLEARFLAGS:
$result = $user->hasRole('moderator');
return false; // done processing!
}
+
return true; // unchanged!
}
}