Translation of mails automatically sent + some fixes

This commit is contained in:
Axel ROGER 2012-12-05 16:52:03 +00:00
parent d85973cada
commit a67f649279
2 changed files with 27 additions and 22 deletions

View File

@ -415,14 +415,14 @@ class m_admin {
* This sends an email if configured through the interface. * This sends an email if configured through the interface.
*/ */
function hook_admin_add_member() { function hook_admin_add_member() {
global $cuid, $L_FQDN, $L_HOSTING; global $err, $cuid, $L_FQDN, $L_HOSTING;
$dest = variable_get('new_email'); $dest = variable_get('new_email');
if (!$dest) { if (!$dest) {
return false; return false;
} }
$db=new DB_System(); $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'")) { 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; return false;
} }
if ($db->next_record()) { if ($db->next_record()) {
@ -449,13 +449,17 @@ EOF;
'%canpass' => $db->Record['canpass'], '%canpass' => $db->Record['canpass'],
'%type' => $db->Record['type'], '%type' => $db->Record['type'],
'%notes' => $db->Record['notes'])); '%notes' => $db->Record['notes']));
if (mail($dest,"New account (" . $db->Record['login']." from ".$db->Record['parentlogin'].") on $L_HOSTING",$mail,"From: postmaster@$L_FQDN")) { $subject=sprintf(_("New account %s from %s on %s"), $db->Record['login'], $db->Record['parentlogin'], $L_HOSTING);
echo "Successfully sent email to $dest"; if (mail($dest,$subject,$mail,"From: postmaster@$L_FQDN")) {
//sprintf(_("Email successfully sent to %s"), $dest);
return true;
} else { } else {
echo "Cannot send email to $dest"; $err->raise("admin",sprintf(_("Cannot send email to %s"), $dest));
return false;
} }
} else { } else {
echo "query failed: " . $db->Error; $err->raise("admin",sprintf(_("Query failed: %s"), $db->Error));
return false;
} }
} }

View File

@ -409,28 +409,26 @@ class m_mem {
$err->raise("mem",_("The new passwords are differents, please retry")); $err->raise("mem",_("The new passwords are differents, please retry"));
return false; return false;
} }
$txt="Bonjour, $txt=sprintf(_("Hello,
Il semblerait que vous ayez demandé à recevoir le mot de passe du
compte ".$login." sur $L_HOSTING You requested the modification of your password for your
Voici donc le nom d'utilisateur et le mot de passe qui vous account %s on %s
permettront de rentrer sur le bureau virtuel : Here are your username and password to access the panel :
-------------------------------------- --------------------------------------
Nom d'utilisateur : ".$db->f("login")." Username : %s
Password : %s
Mot de passe : ".$db->f("pass")."
-------------------------------------- --------------------------------------
Note : si vous n'avez pas fait cette demande, cela signifie que Note : if you didn't requested that modification, it means that
quelqu'un l'a faite pour vous. Vous pouvez donc ignorer ce message. someone did it instead of you. You can choose to ignore this message.
Si cela se reproduit, n'hésitez pas à contacter l'administrateur If it happens again, please contact your server's Administrator.
de votre serveur.
Cordialement. Cordially.
"; "), $login, $L_HOSTING, $db->f("login"), $db->f("pass"));
mail($db->f("mail"),"Votre mot de passe sur $L_HOSTING",$txt,"From: postmaster@$L_FQDN\nReply-to: postmaster@$L_FQDN"); 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';"); $db->query("UPDATE membres SET lastaskpass=".time()." WHERE login='$login';");
return true; return true;
} }
@ -471,7 +469,10 @@ modification was requested.
If you didn't asked for this modification, it means that someone 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 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"); 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 ! // Supprime les demandes précédentes de ce compte !
$db->query("DELETE FROM chgmail WHERE uid='$cuid';"); $db->query("DELETE FROM chgmail WHERE uid='$cuid';");