summaryrefslogtreecommitdiff
path: root/lib/plugins/config/settings
diff options
context:
space:
mode:
Diffstat (limited to 'lib/plugins/config/settings')
-rw-r--r--lib/plugins/config/settings/config.class.php25
-rw-r--r--lib/plugins/config/settings/config.metadata.php8
-rw-r--r--lib/plugins/config/settings/extra.class.php1
3 files changed, 27 insertions, 7 deletions
diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php
index 4f2129c70..01f15a54e 100644
--- a/lib/plugins/config/settings/config.class.php
+++ b/lib/plugins/config/settings/config.class.php
@@ -342,8 +342,8 @@ if (!class_exists('setting')) {
var $_cautionList = array(
'basedir' => 'danger', 'baseurl' => 'danger', 'savedir' => 'danger', 'useacl' => 'danger', 'authtype' => 'danger', 'superuser' => 'danger', 'userewrite' => 'danger',
- 'start' => 'warning', 'camelcase' => 'warning', 'deaccent' => 'warning', 'sepchar' => 'warning', 'compression' => 'warning', 'xsendfile' => 'warning', 'renderer_xhtml' => 'warning',
- 'allowdebug' => 'security', 'htmlok' => 'security', 'phpok' => 'security', 'iexssprotect' => 'security', 'xmlrpc' => 'security', 'fnencode' => 'warning'
+ 'start' => 'warning', 'camelcase' => 'warning', 'deaccent' => 'warning', 'sepchar' => 'warning', 'compression' => 'warning', 'xsendfile' => 'warning', 'renderer_xhtml' => 'warning', 'fnencode' => 'warning',
+ 'allowdebug' => 'security', 'htmlok' => 'security', 'phpok' => 'security', 'iexssprotect' => 'security', 'xmlrpc' => 'security', 'fullpath' => 'security'
);
function setting($key, $params=NULL) {
@@ -616,8 +616,25 @@ if (!class_exists('setting_numeric')) {
// This allows for many PHP syntax errors...
// var $_pattern = '/^[-+\/*0-9 ]*$/';
// much more restrictive, but should eliminate syntax errors.
- var $_pattern = '/^[-]?[0-9]+(?:[-+*][0-9]+)*$/';
- //FIXME - make the numeric error checking better.
+ var $_pattern = '/^[-+]? *[0-9]+ *(?:[-+*] *[0-9]+ *)*$/';
+ var $_min = null;
+ var $_max = null;
+
+ function update($input) {
+ $local = $this->_local;
+ $valid = parent::update($input);
+ if ($valid && !(is_null($this->_min) && is_null($this->_max))) {
+ $numeric_local = (int) eval('return '.$this->_local.';');
+ if ((!is_null($this->_min) && $numeric_local < $this->_min) ||
+ (!is_null($this->_max) && $numeric_local > $this->_max)) {
+ $this->_error = true;
+ $this->_input = $input;
+ $this->_local = $local;
+ $valid = false;
+ }
+ }
+ return $valid;
+ }
function out($var, $fmt='php') {
diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php
index edba65262..af7e63a61 100644
--- a/lib/plugins/config/settings/config.metadata.php
+++ b/lib/plugins/config/settings/config.metadata.php
@@ -16,6 +16,7 @@
* '' - default class ('setting'), textarea, minimal input validation, setting output in quotes
* 'string' - single line text input, minimal input validation, setting output in quotes
* 'numeric' - text input, accepts numbers and arithmetic operators, setting output without quotes
+ * if given the '_min' and '_max' parameters are used for validation
* 'numericopt' - like above, but accepts empty values
* 'onoff' - checkbox input, setting output 0|1
* 'multichoice' - select input (single choice), setting output with quotes, required _choices parameter
@@ -54,6 +55,8 @@
* '_combine' - complimentary output setting values which can be combined into a single display checkbox
* optional for 'multicheckbox', ignored by other classes
* '_code' - encoding method to use, accepted values: 'base64','uuencode','plain'. defaults to plain.
+ * '_min' - minimum numeric value, optional for 'numeric' and 'numericopt', ignored by others
+ * '_max' - maximum numeric value, optional for 'numeric' and 'numericopt', ignored by others
*
* @author Chris Smith <chris@jalakai.co.uk>
*/
@@ -98,7 +101,7 @@ $meta['allowdebug'] = array('onoff');
$meta['_display'] = array('fieldset');
$meta['recent'] = array('numeric');
-$meta['breadcrumbs'] = array('numeric');
+$meta['breadcrumbs'] = array('numeric','_min' => 0);
$meta['youarehere'] = array('onoff');
$meta['fullpath'] = array('onoff');
$meta['typography'] = array('multichoice','_choices' => array(0,1,2));
@@ -119,7 +122,7 @@ $meta['_authentication'] = array('fieldset');
$meta['useacl'] = array('onoff');
$meta['autopasswd'] = array('onoff');
$meta['authtype'] = array('authtype');
-$meta['passcrypt'] = array('multichoice','_choices' => array('smd5','md5','apr1','sha1','ssha','crypt','mysql','my411','kmd5'));
+$meta['passcrypt'] = array('multichoice','_choices' => array('smd5','md5','apr1','sha1','ssha','crypt','mysql','my411','kmd5','pmd5','hmd5'));
$meta['defaultgroup']= array('string');
$meta['superuser'] = array('string');
$meta['manager'] = array('string');
@@ -174,6 +177,7 @@ $meta['canonical'] = array('onoff');
$meta['fnencode'] = array('multichoice','_choices' => array('url','safe','utf-8'));
$meta['autoplural'] = array('onoff');
$meta['mailfrom'] = array('richemail');
+$meta['mailprefix'] = array('string');
$meta['compress'] = array('onoff');
$meta['gzip_output'] = array('onoff');
$meta['hidepages'] = array('string');
diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php
index f6b69ead1..b4e35b1cc 100644
--- a/lib/plugins/config/settings/extra.class.php
+++ b/lib/plugins/config/settings/extra.class.php
@@ -90,7 +90,6 @@ if (!class_exists('setting_disableactions')) {
// transfer some DokuWiki language strings to the plugin
if (!$plugin->localised) $this->setupLocale();
$plugin->lang[$this->_key.'_revisions'] = $lang['btn_revs'];
- $plugin->lang[$this->_key.'_register'] = $lang['register'];
foreach ($this->_choices as $choice)
if (isset($lang['btn_'.$choice])) $plugin->lang[$this->_key.'_'.$choice] = $lang['btn_'.$choice];