"Wrong language for ''you've been assured'' & ''[CAcert.org] Client Certificate'' emails"
This commit is contained in:
Wytze van der Raay 2014-11-24 09:59:19 +00:00
parent 4f70392a23
commit add8566161
5 changed files with 32 additions and 3 deletions

View file

@ -2780,7 +2780,8 @@ function buildSubjectFromSession() {
$row = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($_REQUEST['userid'])."'"));
printf(_("The password for %s has been updated successfully in the system."), sanitizeHTML($row['email']));
$my_translation = L10n::get_translation();
L10n::set_recipient_language(intval($_REQUEST['userid']));
$body = sprintf(_("Hi %s,"),$row['fname'])."\n\n";
$body .= _("You are receiving this email because a CAcert administrator ".
"has changed the password on your account.")."\n\n";
@ -2789,6 +2790,7 @@ function buildSubjectFromSession() {
sendmail($row['email'], "[CAcert.org] "._("Password Update Notification"), $body,
"support@cacert.org", "", "", "CAcert Support");
L10n::set_translation($my_translation);
}
showfooter();

View file

@ -355,4 +355,21 @@ class L10n {
bindtextdomain($domain, $_SESSION['_config']['filepath'].'/locale');
textdomain($domain);
}
public static function set_recipient_language($accountid) {
//returns the language of a recipient to make sure that the language is correct
//use together with
$query = "select `language` from `users` where `id`='".intval($accountid)."'";
$res = mysql_query($query);
if (mysql_num_rows($res)>=0) {
$row = mysql_fetch_assoc($res);
if (NULL==$row['language'] || $row['language']=='') {
self::set_translation('en');
} else {
self::set_translation($row['language']);
}
} else {
self::set_translation('en');
}
}
}

View file

@ -19,6 +19,7 @@
require_once(dirname(__FILE__).'/../../includes/mysql.php');
require_once(dirname(__FILE__).'/../../includes/lib/general.php');
require_once(dirname(__FILE__).'/../../includes/lib/l10n.php');
$days = array("1" => "3", "15" => "2", "30" => "1", "45" => "0");
@ -35,6 +36,7 @@
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
L10n::set_recipient_language(intval($row['id']));
if($row['subject'] == "")
{
$row['crt_name'] = str_replace("../", "www/", $row['crt_name']);
@ -108,6 +110,7 @@ echo $row['fname']." ".$row['lname']." <".$row['email']."> (memid: ".$row['memid
$res = mysql_query($query);
while($row = mysql_fetch_assoc($res))
{
L10n::set_recipient_language(intval($row['memid']));
if($row['subject'] == "")
$row['subject'] = $row['CN'];

View file

@ -18,6 +18,7 @@
<?
require_once("../includes/loggedin.php");
require_once("../includes/notary.inc.php");
require_once("../includes/lib/l10n.php");
loadem("account");
@ -287,11 +288,15 @@
`IP`='".$_SERVER['REMOTE_ADDR']."'";
mysql_query($query);
$my_translation = L10n::get_translation();
L10n::set_recipient_language($oldmemid);
$body = sprintf(_("You have been sent this email as the email address '%s' is being disputed. You have the option to accept or reject this request, after 2 days the request will automatically be discarded. Click the following link to accept or reject the dispute:"), $email)."\n\n";
$body .= "https://".$_SESSION['_config']['normalhostname']."/disputes.php?type=email&emailid=$emailid&hash=$hash\n\n";
$body .= _("Best regards")."\n"._("CAcert.org Support!");
sendmail($email, "[CAcert.org] "._("Dispute Probe"), $body, "support@cacert.org", "", "", "CAcert Support");
L10n::set_translation($my_translation);
showheader(_("Email Dispute"));
printf(_("The email address '%s' has been entered into the dispute system, the email address will now be sent an email which will give the recipent the option of accepting or rejecting the request, if after 2 days we haven't received a valid response for or against we will discard the request."), sanitizeHTML($email));
@ -447,10 +452,13 @@
$query = "insert into `disputedomain` set `domain`='$domain',`memid`='".$_SESSION['profile']['id']."',
`oldmemid`='$oldmemid',`created`=NOW(),`hash`='$hash',`id`='$domainid'";
mysql_query($query);
$my_translation = L10n::get_translation();
L10n::set_recipient_language($oldmemid);
$body = sprintf(_("You have been sent this email as the domain '%s' is being disputed. You have the option to accept or reject this request, after 2 days the request will automatically be discarded. Click the following link to accept or reject the dispute:"), $domain)."\n\n";
$body .= "https://".$_SESSION['_config']['normalhostname']."/disputes.php?type=domain&domainid=$domainid&hash=$hash\n\n";
$body .= _("Best regards")."\n"._("CAcert.org Support!");
L10n::set_recipient_language($my_translation);
sendmail($authaddy, "[CAcert.org] "._("Dispute Probe"), $body, "support@cacert.org", "", "", "CAcert Support");

View file

@ -21,7 +21,6 @@ require_once("../includes/lib/l10n.php");
require_once("../includes/notary.inc.php");
function show_page($target,$message,$error)
{
showheader(_("My CAcert.org Account!"));