# HG changeset patch # User Ben Schmidt # Date 1287613839 -39600 # Node ID 4be42e1ca045c40a35f16f5bb147d26610ecffe7 # Parent 75fb7729c6e8e30b4a5a1cf791f0021185aa0ce9 Simplify file-reading code in php-admin (Franky Van Liedekerke) diff -r 75fb7729c6e8 -r 4be42e1ca045 contrib/web/php-admin/htdocs/edit.php --- a/contrib/web/php-admin/htdocs/edit.php Thu Oct 21 09:22:07 2010 +1100 +++ b/contrib/web/php-admin/htdocs/edit.php Thu Oct 21 09:30:39 2010 +1100 @@ -53,12 +53,10 @@ $file = $topdir."/".$list."/control/".$name; $value = ""; - if(!is_file($file)) - $lines = array(""); - else + if(is_file($file)) { $lines = file($file); - $value = $lines[0]; + } $tpl->assign(array("NAME" => htmlentities($name), "NICENAME" => htmlentities($nicename), @@ -75,15 +73,8 @@ $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),