changeset 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 75fb7729c6e8
children 5c46136b0359
files contrib/web/php-admin/htdocs/edit.php
diffstat 1 files changed, 5 insertions(+), 14 deletions(-) [+]
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),