From a67f6492797a493924ef19b6e3c45d4be7325bf2 Mon Sep 17 00:00:00 2001 From: Axel ROGER Date: Wed, 5 Dec 2012 16:52:03 +0000 Subject: [PATCH] Translation of mails automatically sent + some fixes --- bureau/class/m_admin.php | 16 ++++++++++------ bureau/class/m_mem.php | 33 +++++++++++++++++---------------- 2 files changed, 27 insertions(+), 22 deletions(-) diff --git a/bureau/class/m_admin.php b/bureau/class/m_admin.php index 8b749a6f..1abf638e 100644 --- a/bureau/class/m_admin.php +++ b/bureau/class/m_admin.php @@ -415,14 +415,14 @@ class m_admin { * This sends an email if configured through the interface. */ function hook_admin_add_member() { - global $cuid, $L_FQDN, $L_HOSTING; + global $err, $cuid, $L_FQDN, $L_HOSTING; $dest = variable_get('new_email'); if (!$dest) { return false; } $db=new DB_System(); if (!$db->query("SELECT m.*, parent.login as parentlogin FROM membres m LEFT JOIN membres parent ON parent.uid=m.creator WHERE m.uid='$cuid'")) { - echo "query failed: " . $db->Error; + $err->raise("admin",sprintf(_("query failed: %s "), $db->Error)); return false; } if ($db->next_record()) { @@ -449,13 +449,17 @@ EOF; '%canpass' => $db->Record['canpass'], '%type' => $db->Record['type'], '%notes' => $db->Record['notes'])); - if (mail($dest,"New account (" . $db->Record['login']." from ".$db->Record['parentlogin'].") on $L_HOSTING",$mail,"From: postmaster@$L_FQDN")) { - echo "Successfully sent email to $dest"; + $subject=sprintf(_("New account %s from %s on %s"), $db->Record['login'], $db->Record['parentlogin'], $L_HOSTING); + if (mail($dest,$subject,$mail,"From: postmaster@$L_FQDN")) { + //sprintf(_("Email successfully sent to %s"), $dest); + return true; } else { - echo "Cannot send email to $dest"; + $err->raise("admin",sprintf(_("Cannot send email to %s"), $dest)); + return false; } } else { - echo "query failed: " . $db->Error; + $err->raise("admin",sprintf(_("Query failed: %s"), $db->Error)); + return false; } } diff --git a/bureau/class/m_mem.php b/bureau/class/m_mem.php index d3ee291f..76386e13 100644 --- a/bureau/class/m_mem.php +++ b/bureau/class/m_mem.php @@ -409,28 +409,26 @@ class m_mem { $err->raise("mem",_("The new passwords are differents, please retry")); return false; } - $txt="Bonjour, -Il semblerait que vous ayez demandé à recevoir le mot de passe du -compte ".$login." sur $L_HOSTING -Voici donc le nom d'utilisateur et le mot de passe qui vous -permettront de rentrer sur le bureau virtuel : + $txt=sprintf(_("Hello, + +You requested the modification of your password for your +account %s on %s +Here are your username and password to access the panel : -------------------------------------- -Nom d'utilisateur : ".$db->f("login")." - -Mot de passe : ".$db->f("pass")." +Username : %s +Password : %s -------------------------------------- -Note : si vous n'avez pas fait cette demande, cela signifie que -quelqu'un l'a faite pour vous. Vous pouvez donc ignorer ce message. -Si cela se reproduit, n'hésitez pas à contacter l'administrateur -de votre serveur. +Note : if you didn't requested that modification, it means that +someone did it instead of you. You can choose to ignore this message. +If it happens again, please contact your server's Administrator. -Cordialement. -"; - mail($db->f("mail"),"Votre mot de passe sur $L_HOSTING",$txt,"From: postmaster@$L_FQDN\nReply-to: postmaster@$L_FQDN"); +Cordially. +"), $login, $L_HOSTING, $db->f("login"), $db->f("pass")); + mail($db->f("mail"),"Your password on $L_HOSTING",$txt,"From: postmaster@$L_FQDN\nReply-to: postmaster@$L_FQDN"); $db->query("UPDATE membres SET lastaskpass=".time()." WHERE login='$login';"); return true; } @@ -471,7 +469,10 @@ modification was requested. If you didn't asked for this modification, it means that someone did it instead of you. You can choose to ignore this message. If it happens -again later, please contact the server's administrator."), $db->f("login"), $L_HOSTING, $link); +again, please contact your server's administrator. + +Cordially. +"), $db->f("login"), $L_HOSTING, $link); mail($newmail,"Email modification request on $L_HOSTING",$txt,"From: postmaster@$L_FQDN\nReply-to: postmaster@$L_FQDN"); // Supprime les demandes précédentes de ce compte ! $db->query("DELETE FROM chgmail WHERE uid='$cuid';");