mlmmj

changeset 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 diff
     1.1 --- a/contrib/web/php-admin/htdocs/edit.php	Thu Oct 21 09:22:07 2010 +1100
     1.2 +++ b/contrib/web/php-admin/htdocs/edit.php	Thu Oct 21 09:30:39 2010 +1100
     1.3 @@ -53,12 +53,10 @@
     1.4      $file = $topdir."/".$list."/control/".$name;
     1.5      $value = "";
     1.6  
     1.7 -    if(!is_file($file))
     1.8 -	$lines = array("");
     1.9 -    else
    1.10 +    if(is_file($file)) {
    1.11  	$lines = file($file);
    1.12 -
    1.13      $value = $lines[0];
    1.14 +    }
    1.15      
    1.16      $tpl->assign(array("NAME" => htmlentities($name),
    1.17  		       "NICENAME" => htmlentities($nicename),
    1.18 @@ -75,15 +73,8 @@
    1.19      $file = "$topdir/$list/control/$name";
    1.20      $value = "";
    1.21  
    1.22 -    if(!is_file($file))
    1.23 -	$lines = array();
    1.24 -    else
    1.25 -	$lines = file($file);
    1.26 -
    1.27 -    foreach ($lines as $line) 
    1.28 -    {
    1.29 -	$value .= $line;
    1.30 -    }
    1.31 +    if(is_file($file))
    1.32 +	$value = file_get_contents($file);
    1.33  
    1.34      $tpl->assign(array("NAME" => htmlentities($name),
    1.35  		       "NICENAME" => htmlentities($nicename),