Mercurial > hg > mlmmj
diff contrib/web/php-admin/htdocs/edit.php @ 767:4be42e1ca045
Simplify file-reading code in php-admin (Franky Van Liedekerke)
author | Ben Schmidt |
---|---|
date | Thu, 21 Oct 2010 09:30:39 +1100 |
parents | dbb144f085a5 |
children | fc5892d87716 |
line wrap: on
line diff
--- 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),