From: Evan Prodromou Date: Tue, 26 Apr 2011 20:50:42 +0000 (-0400) Subject: utility functions for setting config options in memory X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=d09df2804057e90dff97ea6ba06a811c4f61a6e4;p=quix0rs-gnu-social.git utility functions for setting config options in memory --- diff --git a/lib/util.php b/lib/util.php index 07a344633b..f830d9b643 100644 --- a/lib/util.php +++ b/lib/util.php @@ -1860,6 +1860,30 @@ function common_config($main, $sub) array_key_exists($sub, $config[$main])) ? $config[$main][$sub] : false; } +function common_config_set($main, $sub, $value) +{ + global $config; + if (!array_key_exists($main, $config)) { + $config[$main] = array(); + } + $config[$main][$sub] = $value; +} + +function common_config_append($main, $sub, $value) +{ + global $config; + if (!array_key_exists($main, $config)) { + $config[$main] = array(); + } + if (!array_key_exists($sub, $config[$main])) { + $config[$main][$sub] = array(); + } + if (!is_array($config[$main][$sub])) { + $config[$main][$sub] = array($config[$main][$sub]); + } + array_push($config[$main][$sub], $value); +} + /** * Pull arguments from a GET/POST/REQUEST array with first-level input checks: * strips "magic quotes" slashes if necessary, and kills invalid UTF-8 strings.