From 6213a25ab4cae3542eda730564d1a4aaa746c805 Mon Sep 17 00:00:00 2001 From: kkalev Date: Fri, 9 Jul 2004 12:14:39 +0000 Subject: [PATCH] Add a missing.php3 file with functions that may be missing from the PHP version used. Include it if a function is missing. Currently only array_change_key_case() is included --- Changelog | 2 ++ conf/config.php3 | 4 ++++ lib/missing.php3 | 13 +++++++++++++ 3 files changed, 19 insertions(+) create mode 100644 lib/missing.php3 diff --git a/Changelog b/Changelog index e6880e4..3338b04 100644 --- a/Changelog +++ b/Changelog @@ -15,6 +15,8 @@ Ver 1.72: have different mappings for each administrator. * Use require_once instead of require when including xlat.php3 * Add debug statements in sql connect functions +* Add a missing.php3 file with functions that may be missing from the PHP version used. Include it + if a function is missing. Currently only array_change_key_case() is included Ver 1.70: * Add the /bin postgresql compatibility patch from Guy Fraser * Add ldap_userdn as a configuration directive. If set we use that for diff --git a/conf/config.php3 b/conf/config.php3 index 9b10af4..1001eab 100644 --- a/conf/config.php3 +++ b/conf/config.php3 @@ -96,4 +96,8 @@ if (!isset($mappings) && $config[general_username_mappings_file] != ''){ if ($config[general_use_session] == 'yes') session_register('mappings'); } + +//Include missing.php3 if needed +if (!function_exists('array_change_key_case')) + include_once('../lib/missing.php3'); ?> diff --git a/lib/missing.php3 b/lib/missing.php3 new file mode 100644 index 0000000..af2bb8e --- /dev/null +++ b/lib/missing.php3 @@ -0,0 +1,13 @@ +function array_change_key_case($input,$case) +{ + $NEW_ARR = array(); + foreach ($input as $val => $key){ + if ($case == CASE_UPPER) + $K = strtoupper($key); + else if ($case == CASE_LOWER) + $K = strtolower($key); + $NEW_ARR[$K] = $val; + } + + return $NEW_ARR; +} -- 2.39.5