summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-02-26 12:33:50 -0800
committerBrion Vibber <brion@pobox.com>2010-02-26 12:33:50 -0800
commit9b366547d743b9c85455e02cae2f84a658a4baf2 (patch)
tree815817fdd6a88f9cac18de9f8be0544bb8df3a80 /lib
parent517fd54b6515375b075a5d7253a8b66e53785baa (diff)
parent88ae7f53bb4470a899678d231cecb8cb963b2075 (diff)
Merge branch 'testing' of gitorious.org:statusnet/mainline into 0.9.x
Diffstat (limited to 'lib')
-rw-r--r--lib/action.php2
-rw-r--r--lib/adminpanelaction.php29
2 files changed, 19 insertions, 12 deletions
diff --git a/lib/action.php b/lib/action.php
index fa9ddb911..a7e0eb33b 100644
--- a/lib/action.php
+++ b/lib/action.php
@@ -976,7 +976,7 @@ class Action extends HTMLOutputter // lawsuit
if (is_null($arg)) {
return $def;
- } else if (in_array($arg, array('true', 'yes', '1'))) {
+ } else if (in_array($arg, array('true', 'yes', '1', 'on'))) {
return true;
} else if (in_array($arg, array('false', 'no', '0'))) {
return false;
diff --git a/lib/adminpanelaction.php b/lib/adminpanelaction.php
index f05627b31..536d97cdf 100644
--- a/lib/adminpanelaction.php
+++ b/lib/adminpanelaction.php
@@ -103,7 +103,7 @@ class AdminPanelAction extends Action
$name = mb_substr($name, 0, -10);
- if (!in_array($name, common_config('admin', 'panels'))) {
+ if (!self::canAdmin($name)) {
$this->clientError(_('Changes to that panel are not allowed.'), 403);
return false;
}
@@ -262,6 +262,17 @@ class AdminPanelAction extends Action
return $result;
}
+
+ function canAdmin($name)
+ {
+ $isOK = false;
+
+ if (Event::handle('AdminPanelCheck', array($name, &$isOK))) {
+ $isOK = in_array($name, common_config('admin', 'panels'));
+ }
+
+ return $isOK;
+ }
}
/**
@@ -307,32 +318,32 @@ class AdminPanelNav extends Widget
if (Event::handle('StartAdminPanelNav', array($this))) {
- if ($this->canAdmin('site')) {
+ if (AdminPanelAction::canAdmin('site')) {
$this->out->menuItem(common_local_url('siteadminpanel'), _('Site'),
_('Basic site configuration'), $action_name == 'siteadminpanel', 'nav_site_admin_panel');
}
- if ($this->canAdmin('design')) {
+ if (AdminPanelAction::canAdmin('design')) {
$this->out->menuItem(common_local_url('designadminpanel'), _('Design'),
_('Design configuration'), $action_name == 'designadminpanel', 'nav_design_admin_panel');
}
- if ($this->canAdmin('user')) {
+ if (AdminPanelAction::canAdmin('user')) {
$this->out->menuItem(common_local_url('useradminpanel'), _('User'),
_('User configuration'), $action_name == 'useradminpanel', 'nav_design_admin_panel');
}
- if ($this->canAdmin('access')) {
+ if (AdminPanelAction::canAdmin('access')) {
$this->out->menuItem(common_local_url('accessadminpanel'), _('Access'),
_('Access configuration'), $action_name == 'accessadminpanel', 'nav_design_admin_panel');
}
- if ($this->canAdmin('paths')) {
+ if (AdminPanelAction::canAdmin('paths')) {
$this->out->menuItem(common_local_url('pathsadminpanel'), _('Paths'),
_('Paths configuration'), $action_name == 'pathsadminpanel', 'nav_design_admin_panel');
}
- if ($this->canAdmin('sessions')) {
+ if (AdminPanelAction::canAdmin('sessions')) {
$this->out->menuItem(common_local_url('sessionsadminpanel'), _('Sessions'),
_('Sessions configuration'), $action_name == 'sessionsadminpanel', 'nav_design_admin_panel');
}
@@ -342,8 +353,4 @@ class AdminPanelNav extends Widget
$this->action->elementEnd('ul');
}
- function canAdmin($name)
- {
- return in_array($name, common_config('admin', 'panels'));
- }
}