summaryrefslogtreecommitdiff
path: root/inc/confutils.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2006-07-02 14:16:22 +0200
committerAndreas Gohr <andi@splitbrain.org>2006-07-02 14:16:22 +0200
commit409d7af7c9c6c97c8c00cada876a2bf967fa1526 (patch)
tree19defb2c97f293d4ed6150b0f5510019f0e3592d /inc/confutils.php
parentfd0cab2ee2d8c831bf1c086ab4015c9e74d3fe9c (diff)
downloadrpg-409d7af7c9c6c97c8c00cada876a2bf967fa1526.tar.gz
rpg-409d7af7c9c6c97c8c00cada876a2bf967fa1526.tar.bz2
disableactions support
This patch adds a config option to disable certain internal action commands of DokuWiki's main dispatcher. The options resendpasswd and openregister were removed because they can now set through this new option. The config plugin needs to be adjusted. darcs-hash:20060702121622-7ad00-1e80e77bcfb0ae561fe7abd79cfbe1bb158be720.gz
Diffstat (limited to 'inc/confutils.php')
-rw-r--r--inc/confutils.php22
1 files changed, 22 insertions, 0 deletions
diff --git a/inc/confutils.php b/inc/confutils.php
index b800f5f53..c668e8066 100644
--- a/inc/confutils.php
+++ b/inc/confutils.php
@@ -163,5 +163,27 @@ function confToHash($file,$lower=false) {
return $conf;
}
+/**
+ * check if the given action was disabled in config
+ *
+ * @author Andreas Gohr <andi@splitbrain.org>
+ * @returns boolean true if enabled, false if disabled
+ */
+function actionOK($action){
+ static $disabled = null;
+ if(is_null($disabled)){
+ global $conf;
+
+ // prepare disabled actions array and handle legacy options
+ $disabled = explode(',',$conf['disableactions']);
+ $disabled = array_map('trim',$disabled);
+ if(isset($conf['openregister']) && !$conf['openregister']) $disabled[] = 'register';
+ if(isset($conf['resendpasswd']) && !$conf['resendpasswd']) $disabled[] = 'resendpwd';
+ $disabled = array_unique($disabled);
+ }
+
+ return !in_array($action,$disabled);
+}
+
//Setup VIM: ex: et ts=2 enc=utf-8 :