From ed14575208d2d8e1f359068a739af7b0af33ad03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Fr=C3=B6hlich?= Date: Tue, 23 Aug 2011 21:59:15 +0200 Subject: Proposed fix by Uli --- pages/account/43.php | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) mode change 100644 => 100755 pages/account/43.php diff --git a/pages/account/43.php b/pages/account/43.php old mode 100644 new mode 100755 index a286ec6..58fa6f5 --- a/pages/account/43.php +++ b/pages/account/43.php @@ -178,7 +178,7 @@ - : + : @@ -324,9 +324,10 @@ - + + @@ -345,6 +346,7 @@ $points += $drow['points']; ?> + @@ -355,7 +357,7 @@ - + @@ -371,9 +373,10 @@ ?>
::  
- + + @@ -392,6 +395,7 @@ $points += $drow['points']; ?> + @@ -402,7 +406,7 @@ - + @@ -414,4 +418,3 @@

- -- cgit v1.2.1 From 951e34fa8cb4234d425cb61cc8e1715cf70b086a Mon Sep 17 00:00:00 2001 From: dirk Date: Wed, 7 Sep 2011 21:39:48 +0200 Subject: bug-882 added new point-calculation to 43.php (support) --- includes/notary.inc.php | 554 ++++++++++++++++++++++++++++++++++++++++++++++++ pages/account/43.php | 64 ++++-- 2 files changed, 596 insertions(+), 22 deletions(-) create mode 100644 includes/notary.inc.php mode change 100755 => 100644 pages/account/43.php diff --git a/includes/notary.inc.php b/includes/notary.inc.php new file mode 100644 index 0000000..1e73056 --- /dev/null +++ b/includes/notary.inc.php @@ -0,0 +1,554 @@ + '".intval($no_of_assurances)."'"); + return intval(query_get_number_of_rows($res)+1); + } + + function get_top_assuree_position ($no_of_assurees) + { + $res = query_init ("SELECT count(*) AS `list` FROM `notary` + WHERE `method` = 'Face to Face Meeting' + GROUP BY .`to` HAVING count(*) > '".intval($no_of_assurees)."'"); + return intval(query_get_number_of_rows($res)+1); + } + + function get_given_assurances ($userid) + { + $res = query_init ("select * from `notary` where `from`='".intval($userid)."' and `from` != `to` order by `id` asc"); + return $res; + } + + function get_received_assurances ($userid) + { + $res = query_init ("select * from `notary` where `to`='".intval($userid)."' and `from` != `to` order by `id` asc "); + return $res; + } + + function get_given_assurances_summary ($userid) + { + $res = query_init ("select count(*) as number,points,awarded,method from notary where `from`='".intval($userid)."' group by points,awarded,method"); + return $res; + } + + function get_received_assurances_summary ($userid) + { + $res = query_init ("select count(*) as number,points,awarded,method from notary where `to`='".intval($userid)."' group by points,awarded,method"); + return $res; + } + + function get_user ($userid) + { + $res = query_init ("select * from `users` where `id`='".intval($userid)."'"); + return mysql_fetch_assoc($res); + } + + function get_cats_state ($userid) + { + + $res = query_init ("select * from `cats_passed` inner join `cats_variant` on `cats_passed`.`variant_id` = `cats_variant`.`id` and `cats_variant`.`type_id` = 1 + WHERE `cats_passed`.`user_id` = '".intval($userid)."'"); + return mysql_num_rows($res); + } + + function calc_experience ($row,&$points,&$experience,&$sum_experience,&$revoked) + { + $points += $row['awarded']; + $experience = " "; + $revoked = false; # to be coded later (after DB-upgrade) + if ($row['method'] == "Face to Face Meeting") + { + $sum_experience = $sum_experience +2; + $experience = "2"; + } + return $row['awarded']; + } + + function calc_assurances ($row,&$points,&$experience,&$sumexperience,&$awarded,&$revoked) + { + $awarded = calc_points($row); + $revoked = false; + + if ($awarded > 100) + { + $experience = $awarded - 100; // needs to be fixed in the future (limit 50 pts and/or no experience if pts > 100) + $awarded = 100; + } + else + $experience = 0; + + switch ($row['method']) + { + case 'Thawte Points Transfer': + case 'CT Magazine - Germany': + case 'Temporary Increase': // Current usage of 'Temporary Increase' may break audit aspects, needs to be reimplemented + $awarded=sprintf("%s",_("Revoked")); + $experience=0; + $revoked=true; + break; + default: + $points += $awarded; + } + $sumexperience = $sumexperience + $experience; + } + + + function show_user_link ($name,$userid) + { + $name = trim($name); + if($name == "") + $name = _("Deleted before Verification"); + else + $name = "$name"; + return $name; + } + + function get_assurer_ranking($userid,&$num_of_assurances,&$rank_of_assurer) + { + $num_of_assurances = get_number_of_assurances (intval($userid)); + $rank_of_assurer = get_top_assurer_position($num_of_assurances); + } + + function get_assuree_ranking($userid,&$num_of_assurees,&$rank_of_assuree) + { + $num_of_assurees = get_number_of_assurees (intval($userid)); + $rank_of_assuree = get_top_assuree_position($num_of_assurees); + } + + +// ************* html table definitions ****************** + + function output_ranking($userid) + { + get_assurer_ranking($userid,$num_of_assurances,$rank_of_assurer); + get_assuree_ranking($userid,$num_of_assurees,$rank_of_assuree); + +?> +
::  
+ + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
: : 
+
+ + + + + + + + + + +   + + ');"> + + + + + + + + + + + + + + +
+
+ + + + + + + + 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 '': // 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); + } + + function output_summary_content($userid,$display_output) + { + $sum_points = 0; + $sum_experience = 0; + $sum_experience_other = 0; + $max_points = 100; + $max_experience = 50; + + $experience_limit_reached_txt = _("Limit reached"); + + if (check_date_limit($userid,18) != 1) + { + $max_experience = 10; + $experience_limit_reached_txt = _("Limit given by PoJAM reached"); + } + if (check_date_limit($userid,14) != 1) + { + $max_experience = 0; + $experience_limit_reached_txt = _("Limit given by PoJAM reached"); + } + + $res = get_received_assurances_summary($userid); + while($row = mysql_fetch_assoc($res)) + { + $points = calc_points ($row); + + if ($points > $max_points) // limit to 100 points, above is experience (needs to be fixed) + { + $sum_experience_other = $sum_experience_other+($points-$max_points)*intval($row['number']); + $points = $max_points; + } + $sum_points += $points*intval($row['number']); + } + + $res = get_given_assurances_summary($userid); + while($row = mysql_fetch_assoc($res)) + { + switch ($row['method']) + { + case 'Face to Face Meeting': // count Face to Face only + $sum_experience += 2*intval($row['number']); + break; + } + + } + + if ($sum_points > $max_points) + { + $sum_points_countable = $max_points; + $remark_points = _("Limit reached"); + } + else + { + $sum_points_countable = $sum_points; + $remark_points = " "; + } + if ($sum_experience > $max_experience) + { + $sum_experience_countable = $max_experience; + $remark_experience = $experience_limit_reached_txt; + } + else + { + $sum_experience_countable = $sum_experience; + $remark_experience = " "; + } + + if ($sum_experience_countable + $sum_experience_other > $max_experience) + { + $sum_experience_other_countable = $max_experience-$sum_experience_countable; + $remark_experience_other = $experience_limit_reached_txt; + } + else + { + $sum_experience_other_countable = $sum_experience_other; + $remark_experience_other = " "; + } + + if ($sum_points_countable < $max_points) + { + if ($sum_experience_countable != 0) + $remark_experience = _("Points on hold due to less assurance points"); + $sum_experience_countable = 0; + if ($sum_experience_other_countable != 0) + $remark_experience_other = _("Points on hold due to less assurance points"); + $sum_experience_other_countable = 0; + } + + $issue_points = 0; + $cats_test_passed = get_cats_state ($userid); + if ($cats_test_passed == 0) + { + $issue_points_txt = ""._("You have to pass the CAcert Assurer Challenge (CATS-Test) to be an Assurer").""; + if ($sum_points_countable < $max_points) + { + $issue_points_txt = ""; + $issue_points_txt .= sprintf(_("You need %s assurance points and the passed CATS-Test to be an Assurer"), intval($max_points)); + $issue_points_txt .= ""; + } + } + else + { + $experience_total = $sum_experience_countable+$sum_experience_other_countable; + $issue_points_txt = ""; + if ($sum_points_countable == $max_points) + $issue_points = 10; + if ($experience_total >= 10) + $issue_points = 15; + if ($experience_total >= 20) + $issue_points = 20; + if ($experience_total >= 30) + $issue_points = 25; + if ($experience_total >= 40) + $issue_points = 30; + if ($experience_total >= 50) + $issue_points = 35; + if ($issue_points != 0) + $issue_points_txt = sprintf(_("You may issue up to %s points"),$issue_points); + } + if ($display_output) + { + output_summary_row (_("Assurance Points you received"),$sum_points,$sum_points_countable,$remark_points); + output_summary_row (_("Total Experience Points by Assurance"),$sum_experience,$sum_experience_countable,$remark_experience); + output_summary_row (_("Total Experience Points (other ways)"),$sum_experience_other,$sum_experience_other_countable,$remark_experience_other); + output_summary_row (_("Total Points")," ",$sum_points_countable + $sum_experience_countable + $sum_experience_other_countable,$issue_points_txt); + } + return $issue_points; + } + + function output_given_assurances($userid,$support) + { + output_assurances_header(_("Assurance Points You Issued"),$support); + output_given_assurances_content($userid,$points,$sum_experience,$support); + output_assurances_footer(_("Total Points Issued"),$points,_("Total Experience Points"),$sum_experience,$support); + } + + function output_received_assurances($userid,$support) + { + output_assurances_header(_("Your Assurance Points"),$support); + output_received_assurances_content($userid,$points,$sum_experience,$support); + output_assurances_footer(_("Total Assurance Points"),$points,_("Total Experience Points"),$sum_experience,$support); + } + + function output_summary($userid) + { + output_summary_header(); + output_summary_content($userid,1); + output_summary_footer(); + } + + function output_end_of_page() + { +?> +

[ ]

+ diff --git a/pages/account/43.php b/pages/account/43.php old mode 100755 new mode 100644 index 58fa6f5..8bdd8e1 --- a/pages/account/43.php +++ b/pages/account/43.php @@ -16,6 +16,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ ?> 0) { $assurance = mysql_escape_string(intval($_REQUEST['assurance'])); @@ -178,7 +181,7 @@ - : + : @@ -318,16 +321,25 @@
+ + () +
+ + () +
+ +// if(array_key_exists('assuredto',$_GET) && $_GET['assuredto'] == "yes") { +function showassuredto() +{ +?> - + @@ -337,7 +349,7 @@ - + @@ -357,26 +369,23 @@ - +
::  
- - - - -
+ - + @@ -386,7 +395,7 @@ - + @@ -406,15 +415,26 @@ - +
::  
- - - -

- + -- cgit v1.2.1 From 962a0a59b338df57a76bd5b101860946722afbad Mon Sep 17 00:00:00 2001 From: dirk Date: Wed, 7 Sep 2011 22:16:53 +0200 Subject: bug-882 added when and email for new display of points for support --- includes/notary.inc.php | 37 ++++++++++++++++++++++++++++++++----- pages/account/43.php | 2 +- 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/includes/notary.inc.php b/includes/notary.inc.php index 1e73056..cf6b80f 100644 --- a/includes/notary.inc.php +++ b/includes/notary.inc.php @@ -156,6 +156,16 @@ return $name; } + function show_email_link ($email,$userid) + { + $email = trim($email); + if($email == "") + $email = _("Deleted before Verification"); + else + $email = "".sanitizeHTML($email).""; + return $email; + } + function get_assurer_ranking($userid,&$num_of_assurances,&$rank_of_assurer) { $num_of_assurances = get_number_of_assurances (intval($userid)); @@ -201,7 +211,7 @@ if ($support == "1") { ?> - + @@ -212,6 +222,13 @@ + + + + @@ -233,7 +250,7 @@ { ?> - : + :   : @@ -253,12 +270,20 @@ + + + + @@ -331,7 +356,8 @@ $fromuser = get_user (intval($row['to'])); calc_experience ($row,$points,$experience,$sum_experience,$revoked); $name = show_user_link ($fromuser['fname']." ".$fromuser['lname'],intval($row['to'])); - output_assurances_row (intval($row['id']),$row['date'],$name,intval($row['awarded']),$row['location'],$row['method']==""?"":_(sprintf("%s", $row['method'])),$experience,$userid,$support,$revoked); + $email = show_email_link ($fromuser['email'],intval($row['to'])); + output_assurances_row (intval($row['id']),$row['date'],$row['when'],$email,$name,intval($row['awarded']),$row['location'],$row['method']==""?"":_(sprintf("%s", $row['method'])),$experience,$userid,$support,$revoked); } } @@ -347,7 +373,8 @@ $fromuser = get_user (intval($row['from'])); calc_assurances ($row,$points,$experience,$sum_experience,$awarded,$revoked); $name = show_user_link ($fromuser['fname']." ".$fromuser['lname'],intval($row['from'])); - output_assurances_row (intval($row['id']),$row['date'],$name,$awarded,$row['location'],$row['method']==""?"":_(sprintf("%s", $row['method'])),$experience,$userid,$support,$revoked); + $email = show_email_link ($fromuser['email'],intval($row['from'])); + output_assurances_row (intval($row['id']),$row['date'],$row['when'],$email,$name,$awarded,$row['location'],$row['method']==""?"":_(sprintf("%s", $row['method'])),$experience,$userid,$support,$revoked); } } diff --git a/pages/account/43.php b/pages/account/43.php index 8bdd8e1..e60f0bc 100644 --- a/pages/account/43.php +++ b/pages/account/43.php @@ -181,7 +181,7 @@ include_once($_SESSION['_config']['filepath']."/includes/notary.inc.php"); - : + : -- cgit v1.2.1 From 0c678e9bca40a595f2e1fb5ee196a766366cd1b5 Mon Sep 17 00:00:00 2001 From: dirk Date: Wed, 7 Sep 2011 22:30:40 +0200 Subject: bug-882 corrected link for email --- includes/notary.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/notary.inc.php b/includes/notary.inc.php index cf6b80f..9c60d57 100644 --- a/includes/notary.inc.php +++ b/includes/notary.inc.php @@ -152,7 +152,7 @@ if($name == "") $name = _("Deleted before Verification"); else - $name = "$name"; + $name = "".sanitizeHTML($name).""; return $name; } @@ -162,7 +162,7 @@ if($email == "") $email = _("Deleted before Verification"); else - $email = "".sanitizeHTML($email).""; + $email = "".sanitizeHTML($email).""; return $email; } -- cgit v1.2.1 From 6b4d8af8a914231c20075445db01fd2d9a9d575f Mon Sep 17 00:00:00 2001 From: dirk Date: Wed, 7 Sep 2011 22:44:56 +0200 Subject: bug-882 corrected email-link for old pointsystem --- pages/account/43.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/account/43.php b/pages/account/43.php index e60f0bc..3212667 100644 --- a/pages/account/43.php +++ b/pages/account/43.php @@ -361,7 +361,7 @@ function showassuredto() - + -- cgit v1.2.1 From de3570db653021cd2f21dec335bdc57d1fcb236b Mon Sep 17 00:00:00 2001 From: dirk Date: Tue, 20 Sep 2011 00:45:19 +0200 Subject: bug-882 changed behaviour of deleted accounts --- includes/notary.inc.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/includes/notary.inc.php b/includes/notary.inc.php index 9c60d57..af8d6f1 100644 --- a/includes/notary.inc.php +++ b/includes/notary.inc.php @@ -150,7 +150,12 @@ { $name = trim($name); if($name == "") - $name = _("Deleted before Verification"); + { + if ($userid == 0) + $name = _("System"); + else + $name = _("Deleted account"); + } else $name = "".sanitizeHTML($name).""; return $name; @@ -159,9 +164,7 @@ function show_email_link ($email,$userid) { $email = trim($email); - if($email == "") - $email = _("Deleted before Verification"); - else + if($email != "") $email = "".sanitizeHTML($email).""; return $email; } -- cgit v1.2.1 From 44959a0d3734ea36e1beb1b60074b6fd35ee2c40 Mon Sep 17 00:00:00 2001 From: dirk Date: Tue, 20 Sep 2011 01:21:35 +0200 Subject: bug-882 changed awarded=null --- includes/notary.inc.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/includes/notary.inc.php b/includes/notary.inc.php index af8d6f1..3651ea5 100644 --- a/includes/notary.inc.php +++ b/includes/notary.inc.php @@ -392,8 +392,11 @@ function calc_points($row) { - if (intval($row['points']) < intval($row['awarded'])) - $points = intval($row['awarded']); // if 'sum of added points' > 100, awarded shows correct value + $awarded = intval($row['awarded']); + if ($awarded == "") + $awarded = 0; + 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']) -- cgit v1.2.1 From def213717802160c42b794a9a55c7397e4c96d96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=A4nzer?= Date: Wed, 28 Sep 2011 05:21:25 +0200 Subject: bug 882: highlight rows where points==awarded==0 in support interface MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch provided by Uli60 Signed-off-by: Michael Tänzer --- includes/notary.inc.php | 42 ++++++++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 14 deletions(-) diff --git a/includes/notary.inc.php b/includes/notary.inc.php index 3651ea5..95cd889 100644 --- a/includes/notary.inc.php +++ b/includes/notary.inc.php @@ -273,35 +273,49 @@ "; + $emclose=""; + } + } ?> - - + > + > - - + > + > - - - - - + > + > + > + > + > -   + >  - ');"> + >');"> Date: Wed, 5 Oct 2011 20:59:02 +0200 Subject: Undone checkin error --- pages/account/43.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/account/43.php b/pages/account/43.php index 3212667..3d93556 100644 --- a/pages/account/43.php +++ b/pages/account/43.php @@ -181,7 +181,7 @@ include_once($_SESSION['_config']['filepath']."/includes/notary.inc.php"); - : + : -- cgit v1.2.1 From c9524ee04d797eedb02a6d329de8960fe5b79bb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Fr=C3=B6hlich?= Date: Wed, 5 Oct 2011 21:20:09 +0200 Subject: Revert "Undone checkin error" This reverts commit de76c631f9b6aff1500479da059e8a8457c19dd9. --- pages/account/43.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/account/43.php b/pages/account/43.php index 3d93556..3212667 100644 --- a/pages/account/43.php +++ b/pages/account/43.php @@ -181,7 +181,7 @@ include_once($_SESSION['_config']['filepath']."/includes/notary.inc.php"); - : + : -- cgit v1.2.1