From: <car...@us...> - 2025-02-22 08:17:27
|
Revision: 11159 http://sourceforge.net/p/phpwiki/code/11159 Author: carstenklapp Date: 2025-02-22 08:17:25 +0000 (Sat, 22 Feb 2025) Log Message: ----------- Fixed boolean config lines are now successfully commented when default is false and selection is also false. Modified Paths: -------------- trunk/configurator.php Modified: trunk/configurator.php =================================================================== --- trunk/configurator.php 2025-02-22 04:32:48 UTC (rev 11158) +++ trunk/configurator.php 2025-02-22 08:17:25 UTC (rev 11159) @@ -467,7 +467,7 @@ new boolean_define_commented_optional('ENABLE_WYSIWYG'); $properties["WYSIWYG_BACKEND"] = - new _define_selection( + new _define_selection_optional( 'WYSIWYG_BACKEND', array('Wikiwyg' => 'Wikiwyg', 'tinymce' => 'tinymce', @@ -497,7 +497,7 @@ new boolean_define_commented_optional('ENABLE_SPAMASSASSIN'); $properties["ENABLE_SPAMBLOCKLIST"] = - new boolean_define_optional('ENABLE_SPAMBLOCKLIST'); + new boolean_define_commented_optional('ENABLE_SPAMBLOCKLIST'); $properties["NUM_SPAM_LINKS"] = new numeric_define_optional('NUM_SPAM_LINKS'); @@ -581,7 +581,7 @@ new numeric_define_optional('MAX_PAGENAME_LENGTH'); $properties["Reverse DNS"] = - new boolean_define_optional( + new boolean_define_commented_optional( 'ENABLE_REVERSE_DNS', array('true' => "true. perform additional reverse dns lookups", 'false' => "false. just record the address as given by the httpd server") @@ -588,7 +588,7 @@ ); $properties["ZIP Dump Authentication"] = - new boolean_define_optional( + new boolean_define_commented_optional( 'ZIPDUMP_AUTH', array('false' => "false. Everyone may download zip dumps", 'true' => "true. Only admin may download zip dumps") @@ -885,7 +885,7 @@ "); $properties["Publicly viewable"] = - new boolean_define_optional( + new boolean_define_commented_optional( 'ALLOW_ANON_USER', array('true' => "true. Permit anonymous view. (Default)", 'false' => "false. Force login even on view (strictly private)"), @@ -894,7 +894,7 @@ ); $properties["Allow anonymous edit"] = - new boolean_define_optional( + new boolean_define_commented_optional( 'ALLOW_ANON_EDIT', array('true' => "true. Permit anonymous users to edit. (Default)", 'false' => "false. Force login on edit (moderately locked)"), @@ -903,7 +903,7 @@ ); $properties["Allow Bogo Login"] = - new boolean_define_optional( + new boolean_define_commented_optional( 'ALLOW_BOGO_LOGIN', array('true' => "true. Users may Sign In with any WikiWord, without password. (Default)", 'false' => "false. Require stricter authentication."), @@ -913,7 +913,7 @@ ); $properties["Allow User Passwords"] = - new boolean_define_optional( + new boolean_define_commented_optional( 'ALLOW_USER_PASSWORDS', array('true' => "True user authentication with password checking. (Default)", 'false' => "false. Ignore authentication settings below."), @@ -960,7 +960,7 @@ </pre>"); $properties["ENABLE_AUTH_OPENID"] = - new boolean_define('ENABLE_AUTH_OPENID'); + new boolean_define_commented_optional('ENABLE_AUTH_OPENID'); $properties["PASSWORD_LENGTH_MINIMUM"] = new numeric_define_optional('PASSWORD_LENGTH_MINIMUM', PASSWORD_LENGTH_MINIMUM); @@ -1064,10 +1064,10 @@ Check to see if the supplied username/password pair is OK Plaintext passwords: (DBAUTH_AUTH_CRYPT_METHOD = plain)<br /> -; DBAUTH_AUTH_CHECK = \"SELECT IF(passwd='\$password',1,0) AS ok FROM user WHERE userid='\$userid'\" + DBAUTH_AUTH_CHECK = \"SELECT IF(passwd='\$password',1,0) AS ok FROM user WHERE userid='\$userid'\" database-hashed passwords (more secure):<br /> -; DBAUTH_AUTH_CHECK = \"SELECT IF(passwd=PASSWORD('\$password'),1,0) AS ok FROM user WHERE userid='\$userid'\""); + DBAUTH_AUTH_CHECK = \"SELECT IF(passwd=PASSWORD('\$password'),1,0) AS ok FROM user WHERE userid='\$userid'\""); $properties["Crypt Method"] = new _define_selection_optional( @@ -1079,8 +1079,8 @@ to get the password out of the database with a simple SELECT query, and specify DBAUTH_AUTH_USER_EXISTS and DBAUTH_AUTH_CRYPT_METHOD: -; DBAUTH_AUTH_CHECK = \"SELECT passwd FROM user where userid='\$userid'\" <br /> -; DBAUTH_AUTH_CRYPT_METHOD = crypt" + DBAUTH_AUTH_CHECK = \"SELECT passwd FROM user where userid='\$userid'\" <br /> + DBAUTH_AUTH_CRYPT_METHOD = crypt" ); $properties["Update the user's authentication credential"] = @@ -1376,7 +1376,7 @@ by INTERWIKI_MAP_FILE (if any) will be used."); $properties["WARN_NONPUBLIC_INTERWIKIMAP"] = - new boolean_define('WARN_NONPUBLIC_INTERWIKIMAP'); + new boolean_define_commented_optional('WARN_NONPUBLIC_INTERWIKIMAP'); $properties["Keyword Link Regexp"] = new _define_optional('KEYWORDS', '\"Category* OR Topic*\"', " @@ -1418,16 +1418,16 @@ Default Author URL"); $properties["TOC_FULL_SYNTAX"] = - new boolean_define_optional('TOC_FULL_SYNTAX'); + new boolean_define_commented_optional('TOC_FULL_SYNTAX'); $properties["ENABLE_MARKUP_COLOR"] = - new boolean_define_optional('ENABLE_MARKUP_COLOR'); + new boolean_define_commented_optional('ENABLE_MARKUP_COLOR'); $properties["DISABLE_MARKUP_WIKIWORD"] = - new boolean_define_optional('DISABLE_MARKUP_WIKIWORD'); + new boolean_define_commented_optional('DISABLE_MARKUP_WIKIWORD'); $properties["ENABLE_MARKUP_DIVSPAN"] = - new boolean_define_optional('ENABLE_MARKUP_DIVSPAN'); + new boolean_define_commented_optional('ENABLE_MARKUP_DIVSPAN'); /////////////////// @@ -1546,7 +1546,7 @@ "); $properties["Strict Mailable Pagedumps"] = - new boolean_define_optional( + new boolean_define_commented_optional( 'STRICT_MAILABLE_PAGEDUMPS', array('false' => "binary", 'true' => "quoted-printable") @@ -1628,7 +1628,7 @@ "); $properties["pear Cache USECACHE"] = - new boolean_define_optional( + new boolean_define_commented_optional( 'PLUGIN_CACHED_USECACHE', array('true' => 'Enabled', 'false' => 'Disabled'), @@ -1662,7 +1662,7 @@ new numeric_define_optional('PLUGIN_CACHED_MAXARGLEN', "1000", " max. generated url length."); $properties["pear Cache FORCE_SYNCMAP"] = - new boolean_define_optional( + new boolean_define_commented_optional( 'PLUGIN_CACHED_FORCE_SYNCMAP', array('true' => 'Enabled', 'false' => 'Disabled'), @@ -1953,6 +1953,21 @@ class _define_optional extends _define { + public function _get_config_line($posted_value) + { + $n = ""; + if ($this->description) { + $n = "\n"; + } + if ($posted_value == $this->default_value) { + return "$n;" . $this->_config_format($posted_value); + } + if ($posted_value == '') { + return "$n;" . $this->_config_format(""); + } else { + return "$n" . $this->_config_format($posted_value); + } + } } class _define_notempty extends _define @@ -2390,12 +2405,16 @@ } else { $default_value = $this->default_value; } + $default_value = $default_value ? true : 'false'; //FIXME: ugly hack to cast booleans around, otherwise false will never get commented even though it is default false if ($posted_value == $default_value) { return "$n;" . $this->_config_format($posted_value); + return "$n; DEBUG: equal dv=$default_value".gettype($default_value)." pv=" .gettype($posted_value). $this->_config_format($posted_value); } elseif ($posted_value == '') { return "$n;" . $this->_config_format('false'); + return "$n; DEBUG: posted is empty " . $this->_config_format('false'); } else { return "$n" . $this->_config_format($posted_value); + return "$n DEBUG else dv=$default_value".gettype($default_value)." pv=" .gettype($posted_value). $this->_config_format($posted_value); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |