summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix Dörre <felix@dogcraft.de>2015-04-07 21:48:20 +0200
committerFelix Dörre <felix@dogcraft.de>2015-04-21 21:39:20 +0200
commit374c9be790b852ee2d40d61b242ced5732a5487d (patch)
treecca79ebaf8b3ee8d9042a673adb4b3842e96b3c5
parentb024b3419ef256089515143d7cc668395430bd7f (diff)
downloadcacert-devel-374c9be790b852ee2d40d61b242ced5732a5487d.tar.gz
cacert-devel-374c9be790b852ee2d40d61b242ced5732a5487d.tar.xz
cacert-devel-374c9be790b852ee2d40d61b242ced5732a5487d.zip
bug 1047: Add notary function for all total points
-rw-r--r--includes/notary.inc.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/includes/notary.inc.php b/includes/notary.inc.php
index c68e7f2..954029b 100644
--- a/includes/notary.inc.php
+++ b/includes/notary.inc.php
@@ -356,6 +356,30 @@ define('THAWTE_REVOCATION_DATETIME', '2010-11-16 00:00:00');
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 ******************
function output_ranking($userid)