SF.net SVN: postfixadmin:[1467] trunk
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2013-06-05 20:35:33
|
Revision: 1467 http://sourceforge.net/p/postfixadmin/code/1467 Author: christian_boltz Date: 2013-06-05 20:35:30 +0000 (Wed, 05 Jun 2013) Log Message: ----------- functions.inc.php, model/Config.php: - move boolconf() to Config::bool() boolconf() will stay for backwards compability, but new code should use Config::bool() Modified Paths: -------------- trunk/functions.inc.php trunk/model/Config.php Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2013-05-01 19:39:25 UTC (rev 1466) +++ trunk/functions.inc.php 2013-06-05 20:35:30 UTC (rev 1467) @@ -2167,17 +2167,12 @@ (obviously only useful for settings that can be YES or NO) Returns: TRUE (on YES/yes) or FALSE (on NO/no/not set/unknown value) + + Note: boolconf() is deprecated - please use Config::bool() instead */ function boolconf($setting) { - $value = Config::read($setting); - - if (strtoupper($value) == 'YES') { # YES - return true; - } else { # NO, unknown value - # TODO: show/log error message on unknown value? - return false; - } + return Config::bool($setting); } $table_admin = table_by_key ('admin'); Modified: trunk/model/Config.php =================================================================== --- trunk/model/Config.php 2013-05-01 19:39:25 UTC (rev 1466) +++ trunk/model/Config.php 2013-06-05 20:35:30 UTC (rev 1467) @@ -115,7 +115,31 @@ return null; } + /** + * Used to read Configure::$var, converted to boolean + * (obviously only useful for settings that can be YES or NO) + * + * Usage + * Configure::read('Name'); will return the value for Name, converted to boolean + * + * @param string $var Variable to obtain + * @return bool value of Configure::$var (TRUE (on YES/yes) or FALSE (on NO/no/not set/unknown value) + * @access public + */ + public static function bool($setting) { + $value = Config::read($setting); + + if (strtoupper($value) == 'YES') { # YES + return true; + } else { # NO, unknown value + # TODO: show/log error message on unknown value? + return false; + } + } + + + function getAll() { $output = $this->config; return $output; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |