From 3775f51235096c14d05e8ab0ded8fa1feed9b8be Mon Sep 17 00:00:00 2001 From: Jean-Marc Pigeon Date: Mon, 8 Sep 2025 07:24:46 -0400 Subject: [PATCH] Improving main screen and translation --- www/gesdis.php | 28 +++++++++++++++++----------- www/gessql.php | 33 +++++++++++++++++++++++++++++---- www/lvllog.php | 3 --- www/lvlmai.php | 3 ++- www/lvlusr.php | 3 ++- www/subrou.php | 1 + www/unilng.php | 18 ++++++++++-------- 7 files changed, 61 insertions(+), 28 deletions(-) diff --git a/www/gesdis.php b/www/gesdis.php index b62bbe3..a30e6b6 100644 --- a/www/gesdis.php +++ b/www/gesdis.php @@ -29,16 +29,22 @@ switch ($pageref) { case "lvllog" : break; case "lvlmai" : + $entete=gettranslate($userlang,"Main screen"); + $out=gettranslate($userlang,"Logout"); if ($isadmin==true) { - $click1="Remotes"; - $click2="Users"; + $remotes=gettranslate($userlang,"SMTP server"); + $users=gettranslate($userlang,"User Management"); + $click1="$remotes"; + $click2="$users"; } - $click3="logout"; + $click3="$out"; break; case "lvlusr" : - $entete=gettranslate(lng::fr,"User Management"); - $click2="Main screen"; - $click3="logout"; + $entete=gettranslate($userlang,"User Management"); + $main=gettranslate($userlang,"Main screen"); + $out=gettranslate($userlang,"Logout"); + $click2="$main"; + $click3="$out"; break; default : $color="red"; @@ -52,24 +58,24 @@ $entete - -
+ $logname + diff --git a/www/gessql.php b/www/gessql.php index daa745f..b20c5d7 100644 --- a/www/gessql.php +++ b/www/gessql.php @@ -74,12 +74,14 @@ return $isgood; // Function to get a log name if a cookie is available // //============================================================== -function sql_getlogname($dbsql) +function sql_setlogname($dbsql) { global $isadmin; +global $logname; +global $userlang; -$OPEP="gessql.php:sql_getlogname"; +$OPEP="gessql.php:sql_setlogname"; $isadmin=0; $logname=NULL; @@ -119,7 +121,31 @@ while ($proceed==true) { $phase=999; } break; - case 4 : //checking if logname is an admin + case 4 : //getting user information + $stmt=$dbsql->Select("Select * from emails where email='$logname'"); + if ($stmt==NULL) { //is user really known? + rou_alert(0,"$OPEP, cookie but user <$logname> missing from DB?"); + $logname=NULL; + $phase=999; + } + else { + $userlang=lng::en; + $language=$stmt->fetch(PDO::FETCH_ASSOC)['lang']; + rou_alert(0,"$OPEP, JMPDBG langage=$language"); + if ($language!=NULL) { + switch ($language) { + case "FRA" : + $userlang=lng::fr; + break; + case "ENG" : + default : //NO BREAK + $userlang=lng::en; + break; + } + } + } + break; + case 5 : //checking if logname is an admin $stmt=$dbsql->Select("Select * from admins where email='$logname'"); $id=$stmt->fetch(PDO::FETCH_ASSOC)['email']; if ($id!=NULL) @@ -132,7 +158,6 @@ while ($proceed==true) { $phase++; } rou_alert(0,"$OPEP, now logname=<$logname>"); -return $logname; } //============================================================== diff --git a/www/lvllog.php b/www/lvllog.php index 1ad364e..0d67498 100644 --- a/www/lvllog.php +++ b/www/lvllog.php @@ -22,9 +22,6 @@ function login() $STR = << - - -
-

+

$click1

-

+

$click2

-

+

$click3

diff --git a/www/lvlmai.php b/www/lvlmai.php index 0b7bdd0..1c01adc 100644 --- a/www/lvlmai.php +++ b/www/lvlmai.php @@ -46,9 +46,10 @@ EOT; return $STR; } +global $logname; $dbsql=sql_connect(); -$logname=sql_getlogname($dbsql); +sql_setlogname($dbsql); sql_close($dbsql); rou_closelog(); diff --git a/www/lvlusr.php b/www/lvlusr.php index 16d00af..f41b45e 100644 --- a/www/lvlusr.php +++ b/www/lvlusr.php @@ -15,6 +15,7 @@ function body($logname) { global $isadmin; +global $logname; $line=""; $count=0; @@ -85,7 +86,7 @@ return $STR; $dbsql=sql_connect(); -$logname=sql_getlogname($dbsql); +sql_setlogname($dbsql); sql_close($dbsql); rou_closelog(); diff --git a/www/subrou.php b/www/subrou.php index fe62558..139d148 100644 --- a/www/subrou.php +++ b/www/subrou.php @@ -6,6 +6,7 @@ //============================================================== //gobal variables. $debug=0; //default debug level +$logname=NULL; //authenticated user name $isadmin=0; //authenticated user with admin level //============================================================== diff --git a/www/unilng.php b/www/unilng.php index 466247a..08bae4d 100644 --- a/www/unilng.php +++ b/www/unilng.php @@ -16,19 +16,21 @@ enum lng { $userlang=lng::en; $english =array ( - "User Management", - "Show", - "Password", "Email", - "Authentication" + "Logout", + "Main screen", + "SMTP server", + "User Management", + "???" ); $francais=array ( - "Gestion des Utilisateurs", - "Afficher", - "Mot de Passe", "Courriel", - "Authentification" + "Deconnexion", + "Ecran Principal", + "Serveur SMTP", + "Gestion des usagers", + "???" ); -- 2.47.3