From 6e6cbb2dd33cda022ed49584c4d7cadcbfcfd45b Mon Sep 17 00:00:00 2001 From: Ben Schmidt Date: Thu, 21 Oct 2010 09:30:39 +1100 Subject: [PATCH] Simplify file-reading code in php-admin (Franky Van Liedekerke) --- contrib/web/php-admin/htdocs/edit.php | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/contrib/web/php-admin/htdocs/edit.php b/contrib/web/php-admin/htdocs/edit.php index a0d7908e..d76df126 100644 --- a/contrib/web/php-admin/htdocs/edit.php +++ b/contrib/web/php-admin/htdocs/edit.php @@ -53,12 +53,10 @@ function mlmmj_string($name, $nicename, $text) $file = $topdir."/".$list."/control/".$name; $value = ""; - if(!is_file($file)) - $lines = array(""); - else + if(is_file($file)) { $lines = file($file); - - $value = $lines[0]; + $value = $lines[0]; + } $tpl->assign(array("NAME" => htmlentities($name), "NICENAME" => htmlentities($nicename), @@ -75,15 +73,8 @@ function mlmmj_list($name, $nicename, $text) $file = "$topdir/$list/control/$name"; $value = ""; - if(!is_file($file)) - $lines = array(); - else - $lines = file($file); - - foreach ($lines as $line) - { - $value .= $line; - } + if(is_file($file)) + $value = file_get_contents($file); $tpl->assign(array("NAME" => htmlentities($name), "NICENAME" => htmlentities($nicename), -- 2.47.3