From ac473b33edf95480fa85b5025447595ef9b555c2 Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Fri, 6 May 2005 18:29:26 +0000 Subject: [PATCH] Bugfixes. --- src/lib/file.admins.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/file.admins.php b/src/lib/file.admins.php index 74498c9..a4c716a 100644 --- a/src/lib/file.admins.php +++ b/src/lib/file.admins.php @@ -25,8 +25,7 @@ function file_admins_check() */ function file_admins_es_admin($user) { - if (!($admins = file('data/admins.txt'))) return false; - foreach ($admins as $admin) if (trim($admin) == $user) return true; + if (in_array($user, file_admins_get())) return true; return false; } @@ -38,7 +37,7 @@ function file_admins_es_admin($user) function file_admins_get() { if (!($admins = file('data/admins.txt'))) return false; - if (array_walk($admins, '_file_admins_walk_trim')) return false; + array_walk($admins, '_file_admins_walk_trim'); return $admins; } @@ -64,8 +63,7 @@ function file_admins_add($user) function file_admins_replace($viejo, $nuevo) { if (($admins = file_admins_get()) === false) return false; // error - if (array_walk($admins, '_file_admins_walk_replace', array($viejo, $nuevo))) - return false; //error + array_walk($admins, '_file_admins_walk_replace', array($viejo, $nuevo)); if (($f = fopen('data/admins.txt', 'w')) === false) return false; //error foreach ($admins as $admin) fwrite($f, "$admin\n"); fclose($f); -- 2.43.0