1
0
mirror of https://github.com/postfixadmin/postfixadmin.git synced 2026-01-03 17:02:30 +03:00

functions.inc.php, model/Config.php:

- move boolconf() to Config::bool()
  boolconf() will stay for backwards compability, but new code
  should use Config::bool()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1467 a1433add-5e2c-0410-b055-b7f2511e0802
This commit is contained in:
Christian Boltz
2013-06-05 20:35:30 +00:00
parent 3d092324b6
commit b15319c21a
2 changed files with 27 additions and 8 deletions

View File

@@ -2167,17 +2167,12 @@ function getRemoteAddr() {
(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');

View File

@@ -115,6 +115,30 @@ class Config {
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;