]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
Simplify file-reading code in php-admin (Franky Van Liedekerke)
authorBen Schmidt <none@none>
Wed, 20 Oct 2010 22:30:39 +0000 (09:30 +1100)
committerBen Schmidt <none@none>
Wed, 20 Oct 2010 22:30:39 +0000 (09:30 +1100)
contrib/web/php-admin/htdocs/edit.php

index a0d7908e324d7b868dbb0b641cb5175337da6479..d76df126962dcd789e6034997d1eb6f833e1e7a7 100644 (file)
@@ -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),