From: Jean-Marc Pigeon (Delson) Date: Wed, 27 Aug 2025 16:18:26 +0000 (-0400) Subject: Improving unienv.php X-Git-Tag: end-0.15~64 X-Git-Url: https://jmp-git.ovh.safe.ca/?a=commitdiff_plain;h=44050ec3afbda1e880bcba839d3d7b089847c5cc;p=jmp%2Fmailleur Improving unienv.php --- diff --git a/www/unienv.php b/www/unienv.php index 6486e4b..37ca081 100644 --- a/www/unienv.php +++ b/www/unienv.php @@ -8,28 +8,35 @@ function loadenv() { +$env_file_path="/etc/mailleur/mailleur.conf"; $var_arrs=array(); $phase=0; $proceed=true; while ($proceed==true) { + echo ("unienv.c:loadenv JMPDBG phase='$phase'\n"); switch ($phase) { - case 0 : //Loading environment variable - $env_file_path=realpath("/etc/mailleur/"."mailleur.conf"); - echo $env_file_path; - break; - case 1 : //checking if file exist + case 0 : //checking if file exist if(!is_file($env_file_path)){ throw new ErrorException("Environment File is Missing."); $phase=999; //no need to go further } break; - case 2 : //opening file + case 1 : //opening file $fopen=fopen($env_file_path,'r'); if (!$fopen) { throw new ErrorException("Unable to read file <".($env_file_path).">"); $phase=999; + } break; case 3 : //scanning file + while (($line=fgets($fopen))!==false) { + if ((substr(trim($line),0,1)=='#') + continue; + if (empty(trim($line))) + continue; + $line_no_comment=explode("#",$line,2)[0]; + echo ("no_com=<$line_no_comment>\n"); + } break; case 4 : //closing file fclose($fopen); @@ -42,4 +49,5 @@ while ($proceed==true) { } } +loadenv(); ?>