From 0a5771818d1912405271eadda36f46a95ad61794 Mon Sep 17 00:00:00 2001 From: tokul Date: Sun, 20 Mar 2005 10:42:41 +0000 Subject: [PATCH 1/1] 'trim' was not working as expected and admins file was usable on for one admin without whitespace. specific to 1.5.1cvs and 1.4.5cvs git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@9091 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- plugins/administrator/auth.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/plugins/administrator/auth.php b/plugins/administrator/auth.php index 0f394471..3aac1a10 100644 --- a/plugins/administrator/auth.php +++ b/plugins/administrator/auth.php @@ -32,11 +32,11 @@ function adm_check_user() { $auth = FALSE; } else if (file_exists(SM_PATH . 'plugins/administrator/admins')) { $auths = file(SM_PATH . 'plugins/administrator/admins'); - array_walk($auths, 'trim'); + array_walk($auths, 'adm_array_trim'); $auth = in_array($username, $auths); } else if (file_exists(SM_PATH . 'config/admins')) { $auths = file(SM_PATH . 'config/admins'); - array_walk($auths, 'trim'); + array_walk($auths, 'adm_array_trim'); $auth = in_array($username, $auths); } else if (($adm_id = fileowner(SM_PATH . 'config/config.php')) && function_exists('posix_getpwuid')) { @@ -49,4 +49,13 @@ function adm_check_user() { return ($auth); } -?> +/** + * Removes whitespace from array values + * @param string $value array value that has to be trimmed + * @param string $key array key + * @since 1.5.1 + */ +function adm_array_trim(&$value,$key) { + $value=trim($value); +} +?> \ No newline at end of file -- 2.25.1