From: Ben Schmidt Date: Wed, 20 Oct 2010 22:30:39 +0000 (+1100) Subject: Simplify file-reading code in php-admin (Franky Van Liedekerke) X-Git-Tag: RELEASE_1_2_18a1~90 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e6cbb2dd33cda022ed49584c4d7cadcbfcfd45b;p=thirdparty%2Fmlmmj.git Simplify file-reading code in php-admin (Franky Van Liedekerke) --- 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),