SF.net SVN: postfixadmin:[418] trunk/functions.inc.php
Brought to you by:
christian_boltz,
gingerdog
From: <chr...@us...> - 2008-07-27 18:48:31
|
Revision: 418 http://postfixadmin.svn.sourceforge.net/postfixadmin/?rev=418&view=rev Author: christian_boltz Date: 2008-07-27 18:48:41 +0000 (Sun, 27 Jul 2008) Log Message: ----------- function.inc.php - new function boolconf() for easier handling of boolean $CONF settings Modified Paths: -------------- trunk/functions.inc.php Modified: trunk/functions.inc.php =================================================================== --- trunk/functions.inc.php 2008-07-27 17:11:37 UTC (rev 417) +++ trunk/functions.inc.php 2008-07-27 18:48:41 UTC (rev 418) @@ -2186,6 +2186,27 @@ } + +/* + Convert $CONF['whatever'] to boolean + + Returns: TRUE (on YES/yes) or FALSE (on NO/no/not set/unknown value) + */ + +function boolconf($setting) { + global $CONF; + if (!isset($CONF[$setting])) { # not set + return false; + } elseif (strtoupper($CONF[$setting]) == 'YES') { # YES + return true; + } else { # NO, unknown value + # TODO: show error on unknown value? + return false; + } +} + + + $table_admin = table_by_key ('admin'); $table_alias = table_by_key ('alias'); $table_alias_domain = table_by_key ('alias_domain'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |