summaryrefslogtreecommitdiff
path: root/manager/application/models/User.php
diff options
context:
space:
mode:
Diffstat (limited to 'manager/application/models/User.php')
-rw-r--r--manager/application/models/User.php43
1 files changed, 30 insertions, 13 deletions
diff --git a/manager/application/models/User.php b/manager/application/models/User.php
index 7b7a519..86556de 100644
--- a/manager/application/models/User.php
+++ b/manager/application/models/User.php
@@ -274,25 +274,42 @@ class Default_Model_User {
$addpoints = 1;
}
- $increase = array();
- $increase['from'] = $this->id;
- $increase['to'] = $this->id;
- $increase['points'] = $addpoints;
- $increase['awarded'] = $addpoints;
- $increase['location'] = $location;
- $increase['date'] = $date;
- $increase['method'] = 'Administrative Increase';
- $increase['when'] = new Zend_Db_Expr('now()');
-
- $this->db->insert('notary', $increase);
- $this->points += $addpoints;
- // No need to fix assurer flag here
+ $this->adminIncrease($addpoints, $location, $date);
}
return $rounddown;
}
/**
+ * Do an administrative increase
+ *
+ * @param $points int
+ * @param $location string
+ * @param $date string
+ */
+ public function adminIncrease($points, $location, $date) {
+ //Sanitize inputs
+ $points = intval($points);
+ $location = stripslashes($location);
+ $date = stripslashes($date);
+
+ $increase = array();
+ $increase['from'] = $this->id;
+ $increase['to'] = $this->id;
+ $increase['points'] = $points;
+ $increase['awarded'] = $points;
+ $increase['location'] = $location;
+ $increase['date'] = $date;
+ $increase['method'] = 'Administrative Increase';
+ $increase['when'] = new Zend_Db_Expr('now()');
+
+ $this->db->insert('notary', $increase);
+ $this->points += $points;
+
+ $this->fixAssurerFlag();
+ }
+
+ /**
* Maximum number of points the user may issue
*
* @return int