summaryrefslogtreecommitdiff
path: root/includes/notary.inc.php
diff options
context:
space:
mode:
authorFelix Dörre <felix@dogcraft.de>2015-04-21 22:10:45 +0200
committerFelix Dörre <felix@dogcraft.de>2015-04-21 22:10:45 +0200
commit789164b7fe19751b597c1b41c52e9691e1587d5e (patch)
tree1c57fcecd0f43bb474220e9013cad98f5fade34d /includes/notary.inc.php
parentc8ab3e8010d33158f127fe0c6a89966f9395898a (diff)
parent16cb7044fa31e618f969d6104d976a7bc087e1be (diff)
downloadcacert-devel-789164b7fe19751b597c1b41c52e9691e1587d5e.tar.gz
cacert-devel-789164b7fe19751b597c1b41c52e9691e1587d5e.tar.xz
cacert-devel-789164b7fe19751b597c1b41c52e9691e1587d5e.zip
Merge branch 'bug-1047' into bug-1050
Diffstat (limited to 'includes/notary.inc.php')
-rw-r--r--includes/notary.inc.php61
1 files changed, 59 insertions, 2 deletions
diff --git a/includes/notary.inc.php b/includes/notary.inc.php
index 3b8e736..954029b 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))
{