bug 28: created a new function to find the lanugae of the reciepient in temp_function...
authorINOPIAE <inopiae@cacert.org>
Sat, 15 Dec 2012 15:41:36 +0000 (16:41 +0100)
committerBenny Baumann <BenBE@geshi.org>
Wed, 1 May 2013 13:50:25 +0000 (15:50 +0200)
Later the function from temp_function1.php should be moved to notary_inc.php???

includes/account.php
includes/temp_function1.php [new file with mode: 0644]
www/disputes.php
www/wot.php

index 4faa0e5..a89d620 100644 (file)
@@ -18,6 +18,7 @@
        require_once("../includes/loggedin.php");
        require_once("../includes/lib/l10n.php");
        require_once('lib/check_weak_key.php');
+       require_once("../includes/temp-function1.php");
 
        loadem("account");
 
                        $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_translation(get_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";
 
                        sendmail($row['email'], "[CAcert.org] "._("Password Update Notification"), $body,
                                                "support@cacert.org", "", "", "CAcert Support");
-
+               L10n::set_translation($my_translation);
                }
                showfooter();
                exit;
diff --git a/includes/temp_function1.php b/includes/temp_function1.php
new file mode 100644 (file)
index 0000000..ce6854e
--- /dev/null
@@ -0,0 +1,14 @@
+<?php
+function get_recipient_language($accoundid){
+//returns the language of a recipient to make sure that the language is correct
+//use together with
+// $my_translation = L10n::get_translation();
+// L10n::set_translation($_SESSION['_config']['notarise']['language']);
+// L10n::set_translation($my_translation);
+       $query = "select * from `users` where `id`='".$id:"'";
+       $res = mysql_query($query);
+       $row = mysql_fetch_assoc($res);
+       return $row['language'];
+
+}
+?>
index 5b78c1e..2fa015d 100644 (file)
@@ -17,6 +17,7 @@
 */ ?>
 <?
        require_once("../includes/loggedin.php");
+       require_once("../includes/temp-function1.php");
 
        loadem("account");
 
                                `IP`='".$_SERVER['REMOTE_ADDR']."'";
                mysql_query($query);
 
+               $my_translation = L10n::get_translation();
+               L10n::set_translation(get_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));
                $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_translation(get_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_translation(get_recipient_language($my_translation));
 
                sendmail($authaddy, "[CAcert.org] "._("Dispute Probe"), $body, "support@cacert.org", "", "", "CAcert Support");
 
index c6c0568..c5a442c 100644 (file)
@@ -18,7 +18,7 @@
 <?
 require_once("../includes/loggedin.php");
 require_once("../includes/lib/l10n.php");
-
+       require_once("../includes/temp-function1.php");
 
 function show_page($target,$message,$error)
 {
@@ -371,9 +371,11 @@ $iecho= "c";
 
                if($_SESSION['profile']['board'] == 1 && intval($_POST['expire']) > 0)
                {
+                       $my_translation = L10n::get_translation();
+                       L10n::set_translation('en_AU');
                        $body  = sprintf("%s %s (%s) has issued a temporary increase to 200 points for %s %s (%s) for %s days. This action was sponsored by %s %s (%s).", $_SESSION['profile']['fname'], $_SESSION['profile']['lname'], $_SESSION['profile']['email'], $_SESSION['_config']['notarise']['fname'], $_SESSION['_config']['notarise']['lname'], $_SESSION['_config']['notarise']['email'], intval($_POST['expire']), $sponsor['fname'], $sponsor['lname'], $sponsor['email'])."\n\n";
-
                        sendmail("cacert-board@lists.cacert.org", "[CAcert.org] Temporary Increase Issued.", $body, "website@cacert.org", "", "", "CAcert Website");
+                       L10n::set_translation($my_translation);
                }
 
                showheader(_("My CAcert.org Account!"));