diff options
author | Christopher Smith <chris@jalakai.co.uk> | 2013-02-25 14:50:59 +0000 |
---|---|---|
committer | Christopher Smith <chris@jalakai.co.uk> | 2013-02-25 14:50:59 +0000 |
commit | 1fe0882c56ea31e738540e942b743966927415fd (patch) | |
tree | c3324566ada64f09775b35bc989592c7701c32d4 /lib/plugins/config/settings | |
parent | 177daee5492e8c3cdfdb950cdf61a6798f7a9586 (diff) | |
parent | 058fd09655df42c72f3c447e3b9561e4909e978d (diff) | |
download | rpg-1fe0882c56ea31e738540e942b743966927415fd.tar.gz rpg-1fe0882c56ea31e738540e942b743966927415fd.tar.bz2 |
Merge branch 'master' into FS#2415
Diffstat (limited to 'lib/plugins/config/settings')
-rw-r--r-- | lib/plugins/config/settings/config.class.php | 24 | ||||
-rw-r--r-- | lib/plugins/config/settings/config.metadata.php | 10 | ||||
-rw-r--r-- | lib/plugins/config/settings/extra.class.php | 74 |
3 files changed, 51 insertions, 57 deletions
diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php index 5b81be782..8eb99284d 100644 --- a/lib/plugins/config/settings/config.class.php +++ b/lib/plugins/config/settings/config.class.php @@ -20,6 +20,7 @@ if (!class_exists('configuration')) { var $_metadata = array(); // holds metadata describing the settings var $setting = array(); // array of setting objects var $locked = false; // configuration is considered locked if it can't be updated + var $show_disabled_plugins = false; // configuration filenames var $_default_files = array(); @@ -70,9 +71,14 @@ if (!class_exists('configuration')) { foreach ($keys as $key) { if (isset($this->_metadata[$key])) { $class = $this->_metadata[$key][0]; - $class = ($class && class_exists('setting_'.$class)) ? 'setting_'.$class : 'setting'; - if ($class=='setting') { - $this->setting[] = new setting_no_class($key,$param); + + if($class && class_exists('setting_'.$class)){ + $class = 'setting_'.$class; + } else { + if($class != '') { + $this->setting[] = new setting_no_class($key,$param); + } + $class = 'setting'; } $param = $this->_metadata[$key]; @@ -262,7 +268,7 @@ if (!class_exists('configuration')) { function get_plugin_list() { if (is_null($this->_plugin_list)) { - $list = plugin_list('',true); // all plugins, including disabled ones + $list = plugin_list('',$this->show_disabled_plugins); // remove this plugin from the list $idx = array_search('config',$list); @@ -364,7 +370,7 @@ if (!class_exists('setting')) { var $_cautionList = array( 'basedir' => 'danger', 'baseurl' => 'danger', 'savedir' => 'danger', 'cookiedir' => 'danger', 'useacl' => 'danger', 'authtype' => 'danger', 'superuser' => 'danger', 'userewrite' => 'danger', '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' + 'allowdebug' => 'security', 'htmlok' => 'security', 'phpok' => 'security', 'iexssprotect' => 'security', 'remote' => 'security', 'fullpath' => 'security' ); function setting($key, $params=null) { @@ -387,10 +393,12 @@ if (!class_exists('setting')) { } /** - * update setting with user provided value $input - * if value fails error check, save it + * update changed setting with user provided value $input + * - if changed value fails error check, save it to $this->_input (to allow echoing later) + * - if changed value passes error check, set $this->_local to the new value * - * @return boolean true if changed, false otherwise (incl. on error) + * @param mixed $input the new value + * @return boolean true if changed, false otherwise (incl. on error) */ function update($input) { if (is_null($input)) return false; diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php index 663eab9dd..22e76a013 100644 --- a/lib/plugins/config/settings/config.metadata.php +++ b/lib/plugins/config/settings/config.metadata.php @@ -70,14 +70,6 @@ $config['varname'] = 'conf'; // name of the config variable, sans $ // this value can be overriden when calling save_settings() method $config['heading'] = 'Dokuwiki\'s Main Configuration File - Local Settings'; -/* DEPRECATED -// ---------------[ setting files ]-------------------------------------- -// these values can be string expressions, they will be eval'd before use -$file['local'] = "DOKU_CONF.'local.php'"; // mandatory (file doesn't have to exist) -$file['default'] = "DOKU_CONF.'dokuwiki.php'"; // optional -$file['protected'] = "DOKU_CONF.'local.protected.php'"; // optional - */ - // test value (FIXME, remove before publishing) //$meta['test'] = array('multichoice','_choices' => array('')); @@ -127,7 +119,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','lsmd5','crypt','mysql','my411','kmd5','pmd5','hmd5','mediawiki','bcrypt','sha512')); +$meta['passcrypt'] = array('multichoice','_choices' => array('smd5','md5','apr1','sha1','ssha','lsmd5','crypt','mysql','my411','kmd5','pmd5','hmd5','mediawiki','bcrypt','djangomd5','djangosha1','sha512')); $meta['defaultgroup']= array('string'); $meta['superuser'] = array('string'); $meta['manager'] = array('string'); diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php index 6998e1fbf..e4b97eb01 100644 --- a/lib/plugins/config/settings/extra.class.php +++ b/lib/plugins/config/settings/extra.class.php @@ -43,56 +43,50 @@ if (!class_exists('setting_authtype')) { class setting_authtype extends setting_multichoice { function initialize($default,$local,$protected) { - global $plugin_controller; + global $plugin_controller; - // retrive auth types provided by plugins - foreach ($plugin_controller->getList('auth') as $plugin) { - $this->_choices[] = $plugin; - } + // retrieve auth types provided by plugins + foreach ($plugin_controller->getList('auth') as $plugin) { + $this->_choices[] = $plugin; + } - parent::initialize($default,$local,$protected); + parent::initialize($default,$local,$protected); } function update($input) { - global $plugin_controller; - - // is an update posible? - $mayUpdate = parent::update($input); - - // is it an auth plugin? - if (in_array($input, $plugin_controller->getList('auth'))) { - // reject disabled plugins - if ($plugin_controller->isdisabled($input)) { - $this->_error = true; - msg('Auth type ' . $input . ' is disabled.', -1); - return false; - } - - // load the plugin - $auth_plugin = $plugin_controller->load('auth', $input); - - // @TODO: throw an error in plugin controller instead of returning null - if (is_null($auth_plugin)) { - $this->_error = true; - msg('Cannot load Auth Plugin "' . $input . '"', -1); - return false; - } - - // verify proper instanciation (is this really a plugin?) @TODO use instanceof? impement interface? - if (is_object($auth_plugin) && !method_exists($auth_plugin, 'getPluginName')) { - $this->_error = true; - msg('Cannot create Auth Plugin "' . $input . '"', -1); - return false; - } - } + global $plugin_controller; + + // is an update possible/requested? + $local = $this->_local; // save this, parent::update() may change it + if (!parent::update($input)) return false; // nothing changed or an error caught by parent + $this->_local = $local; // restore original, more error checking to come + + // attempt to load the plugin + $auth_plugin = $plugin_controller->load('auth', $input); + + // @TODO: throw an error in plugin controller instead of returning null + if (is_null($auth_plugin)) { + $this->_error = true; + msg('Cannot load Auth Plugin "' . $input . '"', -1); + return false; + } + + // verify proper instantiation (is this really a plugin?) @TODO use instanceof? implement interface? + if (is_object($auth_plugin) && !method_exists($auth_plugin, 'getPluginName')) { + $this->_error = true; + msg('Cannot create Auth Plugin "' . $input . '"', -1); + return false; + } // did we change the auth type? logout global $conf; if($conf['authtype'] != $input) { - msg('Authentication system changed. Please re-login.'); - auth_logoff(); + msg('Authentication system changed. Please re-login.'); + auth_logoff(); } - return true; + + $this->_local = $input; + return true; } } } |