summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Baumann <BenBE@geshi.org>2015-05-05 19:09:30 +0200
committerBenny Baumann <BenBE@geshi.org>2015-05-05 19:09:30 +0200
commit70f867dca49fa2f999470913ff75f816bcbb700d (patch)
treee8907b51235fe0c5e9d3d95defa61c685d5221b9
parentaaffd10f8439c32bfbb8bfca83c08f98f23fb2c9 (diff)
parent77ed5c5b06c2dc8fafc74c1be5a6197bb45e0f11 (diff)
downloadcacert-devel-70f867dca49fa2f999470913ff75f816bcbb700d.tar.gz
cacert-devel-70f867dca49fa2f999470913ff75f816bcbb700d.tar.xz
cacert-devel-70f867dca49fa2f999470913ff75f816bcbb700d.zip
Merge branch 'bug-1042' into testserver-stable
-rwxr-xr-xCommModule/client.pl2
-rw-r--r--includes/account.php10
-rw-r--r--includes/general.php9
-rw-r--r--includes/lib/account.php8
-rw-r--r--includes/loggedin.php7
-rw-r--r--includes/notary.inc.php61
-rw-r--r--pages/account/55.php3
-rw-r--r--pages/wot/1.php3
-rw-r--r--pages/wot/9.php3
-rwxr-xr-xscripts/cron/refresh_stats.php10
-rw-r--r--www/api/ccsr.php109
-rw-r--r--www/api/cemails.php48
-rw-r--r--www/index.php6
-rw-r--r--www/wot.php48
14 files changed, 97 insertions, 230 deletions
diff --git a/CommModule/client.pl b/CommModule/client.pl
index 64c3c7f..24f0abc 100755
--- a/CommModule/client.pl
+++ b/CommModule/client.pl
@@ -441,7 +441,7 @@ sub calculateDays($)
{
if($_[0])
{
- my @sum = $dbh->selectrow_array("select sum(`points`) as `total` from `notary` where `to`='".$_[0]."' and `deleted`=0 group by `to`");
+ my @sum = $dbh->selectrow_array("select sum(`awarded`) as `total` from `notary` where `to`='".$_[0]."' and `deleted`=0 AND `notary`.`method` != 'Administrative Increase' AND `notary`.`from` != `notary`.`to` group by `to`");
SysLog("Summe: $sum[0]\n") if($debug);
return ($sum[0]>=50)?30:3;
diff --git a/includes/account.php b/includes/account.php
index 2568d29..2eeca73 100644
--- a/includes/account.php
+++ b/includes/account.php
@@ -1294,10 +1294,7 @@ function buildSubjectFromSession() {
if($oldid == 13 && $process != "")
{
- $ddquery = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `deleted` = 0 group by `to`";
- $ddres = mysql_query($ddquery);
- $ddrow = mysql_fetch_assoc($ddres);
- $_SESSION['profile']['points'] = $ddrow['total'];
+ update_points_in_profile();
if($_SESSION['profile']['points'] == 0)
{
@@ -1356,10 +1353,7 @@ function buildSubjectFromSession() {
$_SESSION['profile'] = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($_SESSION['profile']['id'])."'"));
$_SESSION['profile']['loggedin'] = 1;
- $ddquery = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `deleted` = 0 group by `to`";
- $ddres = mysql_query($ddquery);
- $ddrow = mysql_fetch_assoc($ddres);
- $_SESSION['profile']['points'] = $ddrow['total'];
+ update_points_in_profile();
$id = 13;
diff --git a/includes/general.php b/includes/general.php
index f575719..f87a482 100644
--- a/includes/general.php
+++ b/includes/general.php
@@ -85,10 +85,7 @@
$locked = mysql_fetch_assoc(mysql_query("select `locked` from `users` where `id`='".intval($_SESSION['profile']['id'])."'"));
if($locked['locked'] == 0)
{
- $query = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `deleted` = 0 group by `to`";
- $res = mysql_query($query);
- $row = mysql_fetch_assoc($res);
- $_SESSION['profile']['points'] = $row['total'];
+ update_points_in_profile();
} else {
$_SESSION['profile'] = "";
unset($_SESSION['profile']);
@@ -511,9 +508,7 @@
if($id <= 0)
$id = $_SESSION['profile']['id'];
- $query = "select sum(`points`) as `points` from `notary` where `to`='$id' and `deleted` = 0 group by `to`";
- $row = mysql_fetch_assoc(mysql_query($query));
- $points = $row['points'];
+ $points = get_received_total_points($id);
$dob = date("Y-m-d", mktime(0,0,0,date("m"),date("d"),date("Y")-18));
$query = "select * from `users` where `id`='".intval($_SESSION['profile']['id'])."' and `dob` < '$dob'";
diff --git a/includes/lib/account.php b/includes/lib/account.php
index dd8afd3..6e17dda 100644
--- a/includes/lib/account.php
+++ b/includes/lib/account.php
@@ -48,8 +48,8 @@ function fix_assurer_flag($userID = NULL)
AND `cp`.`user_id` = `u`.`id`
)
AND (
- SELECT SUM(`points`) FROM `notary` AS `n`
- WHERE `n`.`to` = `u`.`id`
+ SELECT SUM(`awarded`) FROM `notary` AS `n`
+ WHERE `n`.`to` = `u`.`id` AND `n`.`method` != 'Administrative Increase' AND `n`.`from` != `n`.`to`
AND (`n`.`expire` > now()
OR `n`.`expire` IS NULL)
AND `n`.`deleted` = 0
@@ -81,8 +81,8 @@ function fix_assurer_flag($userID = NULL)
AND `cp`.`user_id` = `u`.`id`
)
OR (
- SELECT SUM(`points`) FROM `notary` AS `n`
- WHERE `n`.`to` = `u`.`id`
+ SELECT SUM(`awarded`) FROM `notary` AS `n`
+ WHERE `n`.`to` = `u`.`id` AND `n`.`method` != 'Administrative Increase' AND `n`.`from` != `n`.`to`
AND (
`n`.`expire` > now()
OR `n`.`expire` IS NULL
diff --git a/includes/loggedin.php b/includes/loggedin.php
index c14f8c2..8a1dab3 100644
--- a/includes/loggedin.php
+++ b/includes/loggedin.php
@@ -102,12 +102,9 @@
if($_SERVER['HTTP_HOST'] == $_SESSION['_config']['securehostname'] && $_SESSION['profile']['id'] > 0 && $_SESSION['profile']['loggedin'] > 0)
{
- $query = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `deleted` = 0 group by `to`";
- $res = mysql_query($query);
- $row = mysql_fetch_assoc($res);
- $_SESSION['profile']['points'] = $row['total'];
+ update_points_in_profile();
- if($_SESSION['profile']['language'] == "")
+ If($_SESSION['profile']['language'] == "")
{
$query = "update `users` set `language`='".L10n::get_translation()."'
where `id`='".intval($_SESSION['profile']['id'])."'";
diff --git a/includes/notary.inc.php b/includes/notary.inc.php
index 40170ad..2fcb4bd 100644
--- a/includes/notary.inc.php
+++ b/includes/notary.inc.php
@@ -322,6 +322,63 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
$rank_of_assuree = get_top_assuree_position($num_of_assurees);
}
+ /**
+ * Helper function to sum all assurance points received by the user
+ * @param int $userid
+ */
+ function get_received_assurance_points($userid)
+ {
+ $sum_points = 0;
+ $sum_experience = 0;
+ $res = get_received_assurances(intval($userid), $log);
+ while($row = mysql_fetch_assoc($res))
+ {
+ $fromuser = get_user(intval($row['from']));
+ calc_assurances($row, $sum_points, $sum_experience);
+ }
+ return $sum_points;
+ }
+
+ /**
+ * Helper function to sum all assurance points received by the user
+ * @param int $userid
+ */
+ function get_received_experience_points($userid)
+ {
+ $sum_points = 0;
+ $sum_experience = 0;
+ $res = get_received_assurances(intval($userid), $log);
+ while($row = mysql_fetch_assoc($res))
+ {
+ $fromuser = get_user(intval($row['from']));
+ calc_assurances($row, $sum_points, $sum_experience);
+ }
+ return $sum_experience;
+ }
+
+ /**
+ * Helper function to sum all points received by the user
+ * @param int $userid
+ */
+ function get_received_total_points($userid)
+ {
+ $sum_points = 0;
+ $sum_experience = 0;
+ $res = get_received_assurances(intval($userid), $log);
+ while($row = mysql_fetch_assoc($res))
+ {
+ $fromuser = get_user(intval($row['from']));
+ calc_assurances($row, $sum_points, $sum_experience);
+ }
+ return $sum_experience + $sum_points;
+ }
+
+ /**
+ * Updates the assurance points in $_SESSION['profile']
+ */
+ function update_points_in_profile(){
+ $_SESSION['profile']['points'] = get_received_total_points($_SESSION['profile']['id']);
+ }
// ************* html table definitions ******************
@@ -585,7 +642,7 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
$log)
{
$sum_points = 0;
- $sumexperience = 0;
+ $sum_experience = 0;
$res = get_given_assurances(intval($userid), $log);
while($row = mysql_fetch_assoc($res))
{
@@ -615,7 +672,7 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
$log)
{
$sum_points = 0;
- $sumexperience = 0;
+ $sum_experience = 0;
$res = get_received_assurances(intval($userid), $log);
while($row = mysql_fetch_assoc($res))
{
diff --git a/pages/account/55.php b/pages/account/55.php
index 24cc86d..1f01771 100644
--- a/pages/account/55.php
+++ b/pages/account/55.php
@@ -90,10 +90,11 @@
$query = '
SELECT `u`.`id`,
`u`.`assurer`,
- SUM(`points`)
+ SUM(`awarded`)
FROM `users` AS `u`,
`notary` AS `n`
WHERE `u`.`id` = \''.intval($_SESSION['profile']['id']).'\'
+ AND `n`.`method` != 'Administrative Increase' AND `n`.`from` != `n`.`to`
AND `n`.`to` = `u`.`id`
AND `expire` < NOW()
AND `n`.`deleted` = 0
diff --git a/pages/wot/1.php b/pages/wot/1.php
index 8062f38..e69178d 100644
--- a/pages/wot/1.php
+++ b/pages/wot/1.php
@@ -92,7 +92,8 @@
$query = "select *, `users`.`id` as `id` from `users`,`notary` where `listme`='1' and
`ccid`='".$ccid."' and `regid`='".$regid."' and
`locid`='".$locid."' and `users`.`id`=`notary`.`to` and `notary`.`deleted`=0
- group by `notary`.`to` HAVING SUM(`points`) >= 100 order by `points` desc";
+ AND `notary`.`method` != 'Administrative Increase' AND `notary`.`from` != `notary`.`to`
+ group by `notary`.`to` HAVING SUM(`awarded`) >= 100 order by `points` desc";
$list = mysql_query($query);
if(mysql_num_rows($list) > 0)
{
diff --git a/pages/wot/9.php b/pages/wot/9.php
index 7f030a0..ffdb26b 100644
--- a/pages/wot/9.php
+++ b/pages/wot/9.php
@@ -27,8 +27,7 @@
$user = mysql_fetch_array($res);
$userlang = L10n::normalise_translation($user['language']);
- $points = mysql_num_rows(mysql_query("select sum(`points`) as `total` from `notary`
- where `to`='".intval($user['id'])."' and `deleted`=0 group by `to` HAVING SUM(`points`) > 0"));
+ $points = get_received_total_points(intval($user['id']));
if($points <= 0) {
echo _("Sorry, I was unable to locate that user.");
} else {
diff --git a/scripts/cron/refresh_stats.php b/scripts/cron/refresh_stats.php
index 4f18b0b..b9d1f8e 100755
--- a/scripts/cron/refresh_stats.php
+++ b/scripts/cron/refresh_stats.php
@@ -122,23 +122,23 @@ function getDataFromLive() {
$stats['users_1to49'] = number_format(tc(
"select count(*) as `count` from (
select 1 from `notary`
- where `deleted` = 0
+ where `deleted` = 0 AND `method` != 'Administrative Increase' AND `from` != `to`
group by `to`
- having sum(`points`) > 0 and sum(`points`) < 50
+ having sum(`awarded`) > 0 and sum(`awarded`) < 50
) as `low_points`"));
$stats['users_50to99'] = number_format(tc(
"select count(*) as `count` from (
select 1 from `notary`
- where `deleted` = 0
+ where `deleted` = 0 AND `method` != 'Administrative Increase' AND `from` != `to`
group by `to`
- having sum(`points`) >= 50 and sum(`points`) < 100
+ having sum(`awarded`) >= 50 and sum(`awarded`) < 100
) as `high_points`"));
$startdate = date("Y-m-d", mktime(0, 0, 0, 1, 1, 2002));
$enddate = date("Y-m-d", mktime(0, 0, 0, 1, 1, date("Y") + 1));
- $assurercount= assurer_count($startdate, $enddate,1);
+ $assurercount = assurer_count($startdate, $enddate, 1);
$stats['assurer_with_test'] = number_format($assurercount);
$stats['assurer_candidates'] = number_format(assurer_count($startdate, $enddate,0) - $assurercount);
diff --git a/www/api/ccsr.php b/www/api/ccsr.php
deleted file mode 100644
index 3bfe55a..0000000
--- a/www/api/ccsr.php
+++ /dev/null
@@ -1,109 +0,0 @@
-<? /*
- LibreSSL - CAcert web application
- Copyright (C) 2004-2008 CAcert Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-require_once '../../includes/lib/check_weak_key.php';
-
- $username = mysql_real_escape_string($_REQUEST['username']);
- $password = mysql_real_escape_string($_REQUEST['password']);
-
- $query = "select * from `users` where `email`='$username' and (`password`=old_password('$password') or `password`=sha1('$password'))";
- $res = mysql_query($query);
- if(mysql_num_rows($res) != 1)
- die("403,That username couldn't be found\n");
- $user = mysql_fetch_assoc($res);
- $memid = $user['id'];
- $emails = array();
- foreach($_REQUEST['email'] as $email)
- {
- $email = mysql_real_escape_string(trim($email));
- $query = "select * from `email` where `memid`='".intval($memid)."' and `hash`='' and `deleted`=0 and `email`='$email'";
- $res = mysql_query($query);
- if(mysql_num_rows($res) > 0)
- {
- $row = mysql_fetch_assoc($res);
- $id = $row['id'];
- $emails[$id] = $email;
- }
- }
- if(count($emails) <= 0)
- die("404,Wasn't able to match any emails sent against your account");
- $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($memid)."' and `notary`.`deleted`=0 group by `to`";
- $row = mysql_fetch_assoc(mysql_query($query));
- $points = $row['points'];
-
- $name = "CAcert WoT User\n";
- $newname = mysql_real_escape_string(trim($_REQUEST['name']));
- if($points >= 50)
- {
- if($newname == $user['fname']." ".$user['lname'] ||
- $newname == $user['fname']." ".$user['mname']." ".$user['lname'] ||
- $newname == $user['fname']." ".$user['lname']." ".$user['suffix'] ||
- $newname == $user['fname']." ".$user['mname']." ".$user['lname']." ".$user['suffix'])
- $name = $newname;
- }
-
- $codesign = 0;
- if($user['codesign'] == "1" && $_REQUEST['codesign'] == "1" && $points >= 100)
- $codesign = 1;
-
- $CSR = trim($_REQUEST['optionalCSR']);
-
- if (($weakKey = checkWeakKeyCSR($CSR)) !== "")
- {
- die("403, $weakKey");
- }
-
- $incsr = tempnam("/tmp", "ccsrIn");
- $checkedcsr = tempnam("/tmp", "ccsrOut");
- $fp = fopen($incsr, "w");
- fputs($fp, $CSR);
- fclose($fp);
- $incsr_esc = escapeshellarg($incsr);
- $checkedcsr_esc = escapeshellarg($checkedcsr);
- $do = shell_exec("/usr/bin/openssl req -in $incsr_esc -out $checkedcsr_esc");
- @unlink($incsr);
- if(filesize($checkedcsr) <= 0)
- die("404,Invalid or missing CSR");
-
- $csrsubject = "/CN=$name";
- foreach($emails as $id => $email)
- $csrsubject .= "/emailAddress=".$email;
-
- $query = "insert into `emailcerts` set `CN`='".mysql_real_escape_string($user['email'])."', `keytype`='MS',
- `memid`='".intval($user['id'])."', `created`=FROM_UNIXTIME(UNIX_TIMESTAMP()),
- `subject`='".mysql_real_escape_string($csrsubject)."', `codesign`='".intval($codesign)."'";
- mysql_query($query);
- $certid = mysql_insert_id();
- $CSRname = generatecertpath("csr","client",$certid);
- rename($checkedcsr, $CSRname);
-
- mysql_query("update `emailcerts` set `csr_name`='$CSRname' where `id`='$certid'");
-
- foreach($emails as $emailid => $email)
- mysql_query("insert into `emaillink` set `emailcertsid`='$certid', `emailid`='".intval($emailid)."'");
-
- $do = shell_exec("../../scripts/runclient");
- sleep(10); // THIS IS BROKEN AND SHOULD BE FIXED
- $query = "select * from `emailcerts` where `id`='$certid' and `crt_name` != ''";
- $res = mysql_query($query);
- if(mysql_num_rows($res) <= 0)
- die("404,Your certificate request has failed. ID: ".intval($certid));
- $cert = mysql_fetch_assoc($res);
- echo "200,Authentication Ok\n";
- readfile("../".$cert['crt_name']);
-?>
diff --git a/www/api/cemails.php b/www/api/cemails.php
deleted file mode 100644
index 6fceb04..0000000
--- a/www/api/cemails.php
+++ /dev/null
@@ -1,48 +0,0 @@
-<? /*
- LibreSSL - CAcert web application
- Copyright (C) 2004-2008 CAcert Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; version 2 of the License.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-*/
- $username = mysql_real_escape_string($_REQUEST['username']);
- $password = mysql_real_escape_string($_REQUEST['password']);
-
- $query = "select * from `users` where `email`='$username' and (`password`=old_password('$password') or `password`=sha1('$password'))";
- $res = mysql_query($query);
- if(mysql_num_rows($res) != 1)
- die("403,That username couldn't be found\n");
- echo "200,Authentication Ok\n";
- $user = mysql_fetch_assoc($res);
- $memid = $user['id'];
- $query = "select sum(`points`) as `points` from `notary` where `to`='".intval($memid)."' and `notary`.`deleted`=0 group by `to`";
- $row = mysql_fetch_assoc(mysql_query($query));
- $points = $row['points'];
- echo "CS=".intval($user['codesign'])."\n";
- echo "NAME=CAcert WoT User\n";
- if($points >= 50)
- {
- echo "NAME=".sanitizeHTML($user['fname'])." ".sanitizeHTML($user['lname'])."\n";
- if($user['mname'] != "")
- echo "NAME=".sanitizeHTML($user['fname'])." ".sanitizeHTML($user['mname'])." ".sanitizeHTML($user['lname'])."\n";
- if($user['suffix'] != "")
- echo "NAME=".sanitizeHTML($user['fname'])." ".sanitizeHTML($user['lname'])." ".sanitizeHTML($user['suffix'])."\n";
- if($user['mname'] != "" && $user['suffix'] != "")
- echo "NAME=".sanitizeHTML($user['fname'])." ".sanitizeHTML($user['mname'])." ".sanitizeHTML($user['lname'])." ".sanitizeHTML($user['suffix'])."\n";
- }
- $query = "select * from `email` where `memid`='".intval($memid)."' and `hash`='' and `deleted`=0";
- $res = mysql_query($query);
- while($row = mysql_fetch_assoc($res)) {
- echo "EMAIL=".sanitizeHTML($row['email'])."\n";
- }
-?>
diff --git a/www/index.php b/www/index.php
index e7229c5..a3e4e14 100644
--- a/www/index.php
+++ b/www/index.php
@@ -217,10 +217,8 @@ require_once('../includes/notary.inc.php');
L10n::set_translation($_SESSION['profile']['language']);
L10n::init_gettext();
}
- $query = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `deleted`=0 group by `to`";
- $res = mysql_query($query);
- $row = mysql_fetch_assoc($res);
- $_SESSION['profile']['points'] = $row['total'];
+ update_points_in_profile();
+
$_SESSION['profile']['loggedin'] = 1;
if($_SESSION['profile']['Q1'] == "" || $_SESSION['profile']['Q2'] == "" ||
$_SESSION['profile']['Q3'] == "" || $_SESSION['profile']['Q4'] == "" ||
diff --git a/www/wot.php b/www/wot.php
index 808d57f..cde3870 100644
--- a/www/wot.php
+++ b/www/wot.php
@@ -343,25 +343,13 @@ function send_reminder()
{
$max = maxpoints();
- $awarded = $newpoints = intval($_POST['points']);
- if($newpoints > $max)
- $newpoints = $awarded = $max;
- if($newpoints < 0)
- $newpoints = $awarded = 0;
+ $awarded = intval($_POST['points']);
+ if($awarded > $max)
+ $awarded = $max;
+ if($awarded < 0)
+ $awarded = 0;
- $query = "select sum(`points`) as `total` from `notary` where `to`='".intval($_SESSION['_config']['notarise']['id'])."' and `deleted` = 0 group by `to`";
- $res = mysql_query($query);
- $drow = mysql_fetch_assoc($res);
- $oldpoints = intval($drow['total']);
-
- $_POST['expire'] = 0;
-
- if(($oldpoints + $newpoints) > 100 && $max < 100)
- $newpoints = 100 - $oldpoints;
- if(($oldpoints + $newpoints) > $max && $max >= 100)
- $newpoints = $max - $oldpoints;
- if($newpoints < 0)
- $newpoints = 0;
+ $drow_points = get_received_total_points(intval($_SESSION['_config']['notarise']['id']));
if(mysql_real_escape_string(stripslashes($_POST['date'])) == "")
$_POST['date'] = date("Y-m-d H:i:s");
@@ -384,7 +372,7 @@ function send_reminder()
{
$query = "insert into `notary` set `from`='".intval($_SESSION['profile']['id'])."',
`to`='".intval($_SESSION['_config']['notarise']['id'])."',
- `points`='".intval($newpoints)."', `awarded`='".intval($awarded)."',
+ `points`='0', `awarded`='".intval($awarded)."',
`location`='".mysql_real_escape_string(stripslashes($_POST['location']))."',
`date`='".mysql_real_escape_string(stripslashes($_POST['date']))."',
`when`=NOW()";
@@ -426,19 +414,16 @@ function send_reminder()
$my_translation = L10n::get_translation();
L10n::set_translation($_SESSION['_config']['notarise']['language']);
- $assurer = $_SESSION['profile']['fname'].' '.$_SESSION['profile']['lname'];
- $body = sprintf(_("You are receiving this email because you have been assured by %s (%s)."), $assurer, $_SESSION['profile']['email'])."\n\n";
- if(($oldpoints + $newpoints) >= 100)
- $body .= sprintf(_("You were issued %s points. However the system only counts up to 100 assurance points."), $awarded)."\n\n";
- else
- $body .= sprintf(_("You were issued %s points and you now have %s points in total."), $awarded, ($newpoints + $oldpoints))."\n\n";
+ $body = sprintf(_("You are receiving this email because you have been assured by %s %s (%s)."), $_SESSION['profile']['fname'], $_SESSION['profile']['lname'], $_SESSION['profile']['email'])."\n\n";
+
+ $body .= sprintf(_("You were issued %s assurance points and you now have %s assurance points in total."), $awarded, ($awarded + $drow_total))."\n\n";
- if(($oldpoints + $newpoints) < 100 && ($oldpoints + $newpoints) >= 50)
+ if(($drow_total + $awarded) < 100 && ($drow_total + $awarded) >= 50)
{
$body .= _("You now have over 50 points, and can now have your name added to client certificates, and issue server certificates for up to 2 years.")."\n\n";
}
- if(($oldpoints + $newpoints) >= 100 && $newpoints > 0)
+ if(($drow_total + $awarded) >= 100 && $drow_total < 0 && !is_assurer(intval($_SESSION['_config']['notarise']['id'])) )
{
$body .= _("You have at least 100 Assurance Points, if you want to become an assurer try the Assurer Challenge")." ( https://cats.cacert.org )\n\n";
$body .= _("To make it easier for others in your area to find you, it's helpful to list yourself as an assurer (this is voluntary), as well as a physical location where you live or work the most. You can flag your account to be listed, and add a comment to the display by going to:")."\n";
@@ -454,9 +439,8 @@ function send_reminder()
L10n::set_translation($my_translation);
- $assuree = $_SESSION['_config']['notarise']['fname'].' '.$_SESSION['_config']['notarise']['lname'];
- $body = sprintf(_("You are receiving this email because you have assured %s (%s)."), $assuree, $_SESSION['_config']['notarise']['email'])."\n\n";
- $body .= sprintf(_("You issued %s points."), $awarded)."\n\n";
+ $body = sprintf(_("You are receiving this email because you have assured %s %s (%s)."), $_SESSION['_config']['notarise']['fname'], $_SESSION['_config']['notarise']['lname'], $_SESSION['_config']['notarise']['email'])."\n\n";
+ $body .= sprintf(_("You issued %s assurance points and they now have %s assurance points in total."), $awarded, ($awarded + $drow['total']))."\n\n";
$body .= _("Best regards")."\n";
$body .= _("CAcert Support Team");
@@ -501,9 +485,7 @@ function send_reminder()
$subject = $_REQUEST['subject'];
$userid = intval($_REQUEST['userid']);
$user = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($userid)."' and `listme`=1"));
- $points = mysql_num_rows(mysql_query("select sum(`points`) as `total` from `notary`
- where `to`='".intval($user['id'])."' and `deleted` = 0 group by `to` HAVING SUM(`points`) > 0"));
- if($points > 0)
+ if(is_assurer($userid) > 0)
{
$my_translation = L10n::get_translation();
L10n::set_translation($user['language']);