summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Tänzer <neo@nhng.de>2014-04-21 23:34:39 +0200
committerMichael Tänzer <neo@nhng.de>2014-04-21 23:34:39 +0200
commit2982bea5f3d3427463627d37dbcc0415480ed1a8 (patch)
treee78ad63acad0a2c2528582ec814c88ecb29d47bc
parentb63a8d83041a6b8e4517198eb5cd999ac1fe35dd (diff)
downloadcacert-devel-2982bea5f3d3427463627d37dbcc0415480ed1a8.tar.gz
cacert-devel-2982bea5f3d3427463627d37dbcc0415480ed1a8.tar.xz
cacert-devel-2982bea5f3d3427463627d37dbcc0415480ed1a8.zip
bug 1221: Move calc_points() up to the other point calculation functions
Signed-off-by: Michael Tänzer <neo@nhng.de>
-rw-r--r--includes/notary.inc.php68
1 files changed, 35 insertions, 33 deletions
diff --git a/includes/notary.inc.php b/includes/notary.inc.php
index 7d8a3f0..42f5e5c 100644
--- a/includes/notary.inc.php
+++ b/includes/notary.inc.php
@@ -113,6 +113,41 @@
return mysql_num_rows($res);
}
+
+ function calc_points($row)
+ {
+ $awarded = intval($row['awarded']);
+ if (intval($row['points']) < $awarded)
+ $points = $awarded; // if 'sum of added points' > 100, awarded shows correct value
+ else
+ $points = intval($row['points']); // on very old assurances, awarded is '0' instead of correct value
+ switch ($row['method'])
+ {
+ case 'Thawte Points Transfer': // revoke all Thawte-points (as per arbitration)
+ case 'CT Magazine - Germany': // revoke c't (only one test-entry)
+ case 'Temporary Increase': // revoke 'temporary increase' (Current usage breaks audit aspects, needs to be reimplemented)
+ $points = 0;
+ break;
+ case 'Administrative Increase': // ignore AI with 2 points or less (historical for experiance points, now other calculation)
+ if ($points <= 2) // maybe limit to 35/50 pts in the future?
+ $points = 0;
+ break;
+ case 'Unknown': // to be revoked in the future? limit to max 50 pts?
+ case 'Trusted Third Parties': // to be revoked in the future? limit to max 35 pts?
+ case 'TTP-Assisted': // TTP assurances, limit to 35
+ case 'TOPUP': // TOPUP to be delevoped in the future, limit to 30
+ case '': // to be revoked in the future? limit to max 50 pts?
+ case 'Face to Face Meeting': // normal assurances, limit to 35/50 pts in the future?
+ break;
+ default: // should never happen ... ;-)
+ $points = 0;
+ }
+ if ($points < 0) // ignore negative points (bug needs to be fixed)
+ $points = 0;
+ return $points;
+ }
+
+
function calc_experience ($row,&$points,&$experience,&$sum_experience,&$revoked)
{
$apoints = max($row['points'], $row['awarded']);
@@ -422,39 +457,6 @@
return intval(query_get_number_of_rows($res));
}
- function calc_points($row)
- {
- $awarded = intval($row['awarded']);
- if (intval($row['points']) < $awarded)
- $points = $awarded; // if 'sum of added points' > 100, awarded shows correct value
- else
- $points = intval($row['points']); // on very old assurances, awarded is '0' instead of correct value
- switch ($row['method'])
- {
- case 'Thawte Points Transfer': // revoke all Thawte-points (as per arbitration)
- case 'CT Magazine - Germany': // revoke c't (only one test-entry)
- case 'Temporary Increase': // revoke 'temporary increase' (Current usage breaks audit aspects, needs to be reimplemented)
- $points = 0;
- break;
- case 'Administrative Increase': // ignore AI with 2 points or less (historical for experiance points, now other calculation)
- if ($points <= 2) // maybe limit to 35/50 pts in the future?
- $points = 0;
- break;
- case 'Unknown': // to be revoked in the future? limit to max 50 pts?
- case 'Trusted Third Parties': // to be revoked in the future? limit to max 35 pts?
- case 'TTP-Assisted': // TTP assurances, limit to 35
- case 'TOPUP': // TOPUP to be delevoped in the future, limit to 30
- case '': // to be revoked in the future? limit to max 50 pts?
- case 'Face to Face Meeting': // normal assurances, limit to 35/50 pts in the future?
- break;
- default: // should never happen ... ;-)
- $points = 0;
- }
- if ($points < 0) // ignore negative points (bug needs to be fixed)
- $points = 0;
- return $points;
- }
-
function max_points($userid)
{
return output_summary_content ($userid,0);