Compare commits

..

No commits in common. "master" and "bug-1390" have entirely different histories.

57 changed files with 3694 additions and 3699 deletions

7
.gitattributes vendored
View file

@ -1,7 +0,0 @@
* text=auto
*.php text
*.html text
*.phtml text
*.js text
*.css text

View file

@ -32,3 +32,4 @@ class ErrorController extends Zend_Controller_Action
} }
} }

View file

@ -108,25 +108,13 @@ class Default_Model_User {
* user's points * user's points
*/ */
public function refreshPoints() { public function refreshPoints() {
$query = "SELECT SUM(`points`) AS `total` FROM `notary` " . $query = 'select sum(`points`) as `total` from `notary` '.
"WHERE `to` = :user AND `method` != 'Administrative Increase' AND `from` != `to`"; 'where `to` = :user';
$query_params['user'] = $this->id; $query_params['user'] = $this->id;
$row = $this->db->query($query, $query_params)->fetch(); $row = $this->db->query($query, $query_params)->fetch();
if ($row['total'] === null) $row['total'] = 0; if ($row['total'] === null) $row['total'] = 0;
$this->points = $row['total']; $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 : 2 * $row['total'];
} }
/** /**
@ -161,16 +149,12 @@ class Default_Model_User {
'`expire` < now()) >= 100'; '`expire` < now()) >= 100';
$query_params['user'] = $this->id; $query_params['user'] = $this->id;
$this->db->query($query, $query_params); $this->db->query($query, $query_params);
$this->refreshPoints();
} }
/** /**
* @return boolean * @return boolean
*/ */
public function getAssurerStatus() { public function getAssurerStatus() {
$this->refreshPoints();
$query = 'SELECT 1 FROM `users` WHERE `users`.`id` = :user AND '. $query = 'SELECT 1 FROM `users` WHERE `users`.`id` = :user AND '.
'`assurer_blocked` = 0 AND '. '`assurer_blocked` = 0 AND '.
@ -241,7 +225,8 @@ class Default_Model_User {
* The amount of points that have been issued (might be less than * The amount of points that have been issued (might be less than
* $points) * $points)
*/ */
public function assure(Default_Model_User $assuree, $points, $location, $date) { public function assure(Default_Model_User $assuree, $points, $location,
$date) {
// Sanitize inputs // Sanitize inputs
$points = intval($points); $points = intval($points);
$location = stripslashes($location); $location = stripslashes($location);
@ -312,6 +297,18 @@ class Default_Model_User {
$this->db->insert('notary', $assurance); $this->db->insert('notary', $assurance);
$assuree->points += $rounddown; $assuree->points += $rounddown;
$assuree->fixAssurerFlag(); $assuree->fixAssurerFlag();
if ($this->getPoints() < 150) {
$addpoints = 0;
if ($this->getPoints() < 149 && $this->getPoints() >= 100) {
$addpoints = 2;
} elseif ($this->getPoints() === 149) {
$addpoints = 1;
}
$this->adminIncrease($addpoints, $location, $date);
}
return $rounddown; return $rounddown;
} }

View file

@ -82,7 +82,7 @@ class Zend_View_Helper_UserInfo extends Zend_View_Helper_Placeholder_Container_S
$output .= $indent . "<div id=\"userinfo\">\n"; $output .= $indent . "<div id=\"userinfo\">\n";
$output .= $indent . "\tUser: " . $this->items['authed_username'] . "<br>\n"; $output .= $indent . "\tUser: " . $this->items['authed_username'] . "<br>\n";
$output .= $indent . "\tName: " . htmlentities(strip_tags($this->items['authed_fname'] . ' ' . $this->items['authed_lname']), ENT_QUOTES, 'ISO-8859-1') . "<br>\n"; $output .= $indent . "\tName: " . $this->items['authed_fname'] . ' ' . $this->items['authed_lname'] . "<br>\n";
$output .= $indent . "\tRole: " . $this->items['authed_role'] . "<br>\n"; $output .= $indent . "\tRole: " . $this->items['authed_role'] . "<br>\n";
if ($this->items['authed_by_crt'] === true) if ($this->items['authed_by_crt'] === true)
$output .= $indent . "\tLoginmethod: CRT<br>\n"; $output .= $indent . "\tLoginmethod: CRT<br>\n";

View file

@ -26,7 +26,7 @@ else {
print " <tr>\n"; print " <tr>\n";
print " <td><a href=\"" . $header->detailslink . "\">" . $header->fromaddress . "</a></td>"; print " <td><a href=\"" . $header->detailslink . "\">" . $header->fromaddress . "</a></td>";
print " <td>" . $header->toaddress . "</td>"; print " <td>" . $header->toaddress . "</td>";
print " <td>" . htmlspecialchars(iconv_mime_decode($header->subject, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . "</td>"; print " <td>" . $header->subject . "</td>";
print " <td>" . $header->date . "</td>"; print " <td>" . $header->date . "</td>";
print " <td>" . $header->Size . "</td>"; print " <td>" . $header->Size . "</td>";
print " <td><a class=\"delete\" href=\"" . $header->deletelink . "\"><img src=\"/img/delete_icon.jpg\"></a></td>"; print " <td><a class=\"delete\" href=\"" . $header->deletelink . "\"><img src=\"/img/delete_icon.jpg\"></a></td>";

View file

@ -26,7 +26,7 @@ else {
print " <tr>\n"; print " <tr>\n";
print " <td><a href=\"" . $header->detailslink . "\">" . $header->fromaddress . "</a></td>"; print " <td><a href=\"" . $header->detailslink . "\">" . $header->fromaddress . "</a></td>";
print " <td>" . $header->toaddress . "</td>"; print " <td>" . $header->toaddress . "</td>";
print " <td>" . htmlspecialchars(iconv_mime_decode($header->subject, ICONV_MIME_DECODE_CONTINUE_ON_ERROR, 'UTF-8'), ENT_QUOTES | ENT_SUBSTITUTE, 'UTF-8') . "</td>"; print " <td>" . $header->subject . "</td>";
print " <td>" . $header->date . "</td>"; print " <td>" . $header->date . "</td>";
print " <td>" . $header->Size . "</td>"; print " <td>" . $header->Size . "</td>";
print " <td><a class=\"delete\" href=\"" . $header->deletelink . "\"><img src=\"/img/delete_icon.jpg\"></a></td>"; print " <td><a class=\"delete\" href=\"" . $header->deletelink . "\"><img src=\"/img/delete_icon.jpg\"></a></td>";

View file

@ -101,3 +101,4 @@ class Config {
return $this->config; return $this->config;
} }
} }
?>

View file

@ -34,3 +34,4 @@ class HumanReadableTimeException extends BaseException {
} }
*/ */
} }
?>

View file

@ -13,3 +13,4 @@ print 'Day: ' . HumanReadableTime::Seconds2HR($hrf, 'd') . "\n";
print 'Hour: ' . HumanReadableTime::Seconds2HR($hrf, 'h') . "\n"; print 'Hour: ' . HumanReadableTime::Seconds2HR($hrf, 'h') . "\n";
print 'Minute: ' . HumanReadableTime::Seconds2HR($hrf, 'm') . "\n"; print 'Minute: ' . HumanReadableTime::Seconds2HR($hrf, 'm') . "\n";
print 'Second: ' . HumanReadableTime::Seconds2HR($hrf, 's') . "\n"; print 'Second: ' . HumanReadableTime::Seconds2HR($hrf, 's') . "\n";

View file

@ -95,3 +95,4 @@ class BaseException extends Exception {
} }
} }
?>