summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorINOPIAE <inopiae@cacert.org>2014-02-22 20:34:16 +0100
committerINOPIAE <inopiae@cacert.org>2014-02-22 20:34:16 +0100
commit25f321c0992525b3b52570ab35ba0ad28a399cd8 (patch)
tree1553a6757074015310f4d4181335bfbcc401f959
parent7daee44101e058a70d85a6c081d0203462132cc1 (diff)
downloadcacert-devel-25f321c0992525b3b52570ab35ba0ad28a399cd8.tar.gz
cacert-devel-25f321c0992525b3b52570ab35ba0ad28a399cd8.tar.xz
cacert-devel-25f321c0992525b3b52570ab35ba0ad28a399cd8.zip
bug 649: implemented the is_assurer check and the mailing of the result.
-rw-r--r--includes/notary.inc.php9
-rw-r--r--www/wot.php66
2 files changed, 69 insertions, 6 deletions
diff --git a/includes/notary.inc.php b/includes/notary.inc.php
index b34b2f4..0da855f 100644
--- a/includes/notary.inc.php
+++ b/includes/notary.inc.php
@@ -1125,3 +1125,12 @@
function check_date_difference($date, $diff=1){
return (strtotime($date)<=time()+$diff*86400);
}
+
+ //user function
+ function get_user_id_from_mail($email){
+ $email = trim(mysql_real_escape_string($email));
+ $res = query_init ("select `id` from `users` where `email` = '" . $email . "'");
+ $row = query_getnextrow($res);
+
+ return intval($row['id']);
+ }
diff --git a/www/wot.php b/www/wot.php
index 240f21f..4a255d1 100644
--- a/www/wot.php
+++ b/www/wot.php
@@ -569,15 +569,69 @@ $iecho= "c";
show_page("ContactAssurer","",_("There was an error and I couldn't proceed"));
exit;
}
-
- echo "passt 1";
-
+// Assurer Check
if($oldid == 16 )
{
$oldid=0;
- $id = 16;
-
- show_page("AssurerCheck","",_("There was an error and I couldn't proceed"));
+ $id = 0;
+ $email = trim(mysql_real_escape_string($_REQUEST['email']));
+ $uid = get_user_id_from_mail($email);
+ if ($uid == 0) {
+ show_page("AssurerCheck","",_("I'm sorry, there was no email matching what you entered in the system. Please double check your information."));
+ exit;
+ }
+ if (is_assurer($uid)) {
+ $status = _('is assurer');
+ } else {
+ $status = _('is no assurer');
+ }
+ $assurer = get_user($uid);
+ //mail to assurer
+ $my_translation = L10n::get_translation();
+ L10n::set_translation($assurer['language']);
+
+ $subject = "[CAcert.org] ".sprintf(_("Assurer status report for you"));
+
+ $body = sprintf(_("Hi %s,"), $assurer['fname'])."\n\n";
+ $body .= sprintf(_("%s %s (%s) has requested your assurer status."),
+ $_SESSION['profile']['fname'],
+ $_SESSION['profile']['lname'],
+ $_SESSION['profile']['email'])."\n\n";
+ $body .= sprintf(_("The transmitted result: %s"), $status)."\n";
+ $body .= _("Best regards")."\n";
+ $body .= _("CAcert Support Team");
+
+ //sendmail($assurer['email'], "[CAcert.org] " . $subject, $body, "support@cacert.org", "", "", "CAcert Support");
+ sendmail($assurer['email'], "[CAcert.org] ". $subject, $body,
+ "support@cacert.org", //from
+ "", //replyto
+ "", //toname
+ "CAcert Support"); //fromname
+ //mail to requestor
+ L10n::set_translation($my_translation);
+
+ // $subject = "[CAcert.org] ".sprintf(_("Assurer status report that you requested"));
+//
+// $body = sprintf(_("Hi %s,"), $_SESSION['profile']['fname'])."\n\n";
+// $body .= sprintf(_("you requested the assurer status of %s %s (%s)."),
+// $assurer['fname'],
+// $assurer['lname'],
+// $assurer['email'])."\n\n";
+// $body .= sprintf(_("The transmitted result: %s"), $status)."\n";
+// $body .= _("Best regards")."\n";
+// $body .= _("CAcert Support Team");
+
+ sendmail($_SESSION['profile']['email'], "[CAcert.org] ". $subject, $body,
+ "support@cacert.org", //from
+ "", //replyto
+ "", //toname
+ "CAcert Support"); //fromname
+ showheader(_("My CAcert.org Account!"));?>
+ <p>
+ <? printf(_('The mail with the status request has been sent to the assurer and you.'). '<br/>'.$subject. '<br/>'.$body); ?>
+ </p>
+ <?
+ showfooter();
exit;
}
// showheader(_("My CAcert.org Account!"));