summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorINOPIAE <inopiae@cacert.org>2015-07-31 08:26:12 +0200
committerINOPIAE <inopiae@cacert.org>2015-07-31 08:38:44 +0200
commit7239b831f830eb8f3f40603e3beb7d78d952496c (patch)
treeacd205886c31e1f848892762ee622b691168a4cc
parent3c8663a208346f502173a4b123d98120869b0765 (diff)
downloadcacert-mgr-7239b831f830eb8f3f40603e3beb7d78d952496c.tar.gz
cacert-mgr-7239b831f830eb8f3f40603e3beb7d78d952496c.tar.xz
cacert-mgr-7239b831f830eb8f3f40603e3beb7d78d952496c.zip
bug 1391: added range check for points
-rw-r--r--manager/application/models/User.php13
1 files changed, 13 insertions, 0 deletions
diff --git a/manager/application/models/User.php b/manager/application/models/User.php
index f8ebf60..83857ca 100644
--- a/manager/application/models/User.php
+++ b/manager/application/models/User.php
@@ -115,6 +115,19 @@ class Default_Model_User {
if ($row['total'] === null) $row['total'] = 0;
$this->points = $row['total'];
+
+ if($this->points < 100) return;
+
+ $this->points = 100;
+
+ $query = "SELECT COUNT(`points`) AS `total` FROM `notary` " .
+ "WHERE `from` = :user AND `method` == 'Face to Face Meeting' AND `from` != `to`";
+ $query_params['user'] = $this->id;
+ $row = $this->db->query($query, $query_params)->fetch();
+ if ($row['total'] === null) $row['total'] = 0;
+
+ $this->points += ($row['total'] > 25) ? 50 : $row['total'];
+
}
/**