From 98f70ef22180480302cc4f07afa63a2675a71290 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 26 Apr 2010 10:57:00 +0200 Subject: Show 'my points' in reverse order (newest points count, not oldest ones) Needed for revoke of TTP-Assurances in November 2010 (cherry picked from commit 0bee978a0e84aedff45115e3f4e42af152cdfc4d) --- pages/wot/10.php | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/pages/wot/10.php b/pages/wot/10.php index 51ed019..4a6afac 100644 --- a/pages/wot/10.php +++ b/pages/wot/10.php @@ -57,17 +57,29 @@ $maxpoints) + $awarded = $maxpoints-$points; + $points = $points + $awarded; $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'")); ?> - + @@ -93,12 +105,12 @@ - + -- cgit v1.2.1 From 96594c54231547ce277957beed1d442948c30d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=A4nzer?= Date: Tue, 30 Nov 2010 22:26:05 +0100 Subject: https://bugs.cacert.org/view.php?id=827 replace 10.php with supplied patch from bug (cherry picked from commit 5068904d912a09c23f99fb5370d7867596105444) Conflicts: pages/wot/10.php --- pages/wot/10.php | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/pages/wot/10.php b/pages/wot/10.php index 4a6afac..ccf8011 100644 --- a/pages/wot/10.php +++ b/pages/wot/10.php @@ -23,20 +23,13 @@ '$rc' ORDER BY `notary`.`when` DESC"; -*/ - $query = "SELECT count(*) AS `list` FROM `users` - inner join `notary` on `users`.`id` = `notary`.`from` - GROUP BY `notary`.`from` HAVING count(*) > '$rc'"; + $rc = intval($row['assurances']); + + $query = "SELECT COUNT(1) FROM `notary` GROUP BY `from` HAVING COUNT(1) > {$rc}"; $rank = mysql_num_rows(mysql_query($query)) + 1; ?> @@ -65,7 +58,7 @@ $maxpoints=intval($_SESSION['profile']['points'])-$row['apoints']; $points = 0; - $query = "select * from `notary` where `to`='".intval($_SESSION['profile']['id'])."' order by `id` desc "; + $query = "SELECT n.`id`, n.`date`, n.`awarded`, n.`from` as `from_id`, u.`fname` AS `from_fname`, u.`lname` AS `from_lname`, n.`location`, n.`method` FROM `notary` n LEFT JOIN `users` u ON n.`from`=u.`id` WHERE n.`to`=".intval($_SESSION['profile']['id'])." ORDER BY n.`when` DESC, n.`id` DESC"; $res = mysql_query($query); while($row = mysql_fetch_assoc($res)) { @@ -73,12 +66,11 @@ if ($points+$awarded > $maxpoints) $awarded = $maxpoints-$points; $points = $points + $awarded; - $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'")); ?> - + @@ -105,17 +97,16 @@ '._("Deleted before Verification").''; else - $name = "$name"; + $name = "$name"; ?> -- cgit v1.2.1 From aaa11c69b4b04c4169a0c3b5c70937eb0bc61013 Mon Sep 17 00:00:00 2001 From: Markus Warg Date: Tue, 19 Oct 2010 16:41:25 +0200 Subject: https://bugs.cacert.org/view.php?id=827 changes submitted by Dirk Astrath on 10.10.2010 by email (cherry picked from commit 066d7cbdcebe67345c61a958c5aa258eb5b14c18) --- pages/wot/10.php | 60 +++++++++--------- pages/wot/15.php | 185 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 217 insertions(+), 28 deletions(-) create mode 100644 pages/wot/15.php diff --git a/pages/wot/10.php b/pages/wot/10.php index ccf8011..fefc84c 100644 --- a/pages/wot/10.php +++ b/pages/wot/10.php @@ -16,6 +16,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ ?> @@ -23,13 +25,20 @@ {$rc}"; + $rc = intval($row['list']); +/* + $query = "SELECT `users`. *, count(*) AS `list` FROM `users`, `notary` + WHERE `users`.`id` = `notary`.`from` AND `notary`.`from` != `notary`.`to` + GROUP BY `notary`.`from` HAVING count(*) > '$rc' ORDER BY `notary`.`when` DESC"; +*/ + $query = "SELECT count(*) AS `list` FROM `users` + inner join `notary` on `users`.`id` = `notary`.`from` + GROUP BY `notary`.`from` HAVING count(*) > '$rc'"; $rank = mysql_num_rows(mysql_query($query)) + 1; ?> @@ -50,38 +59,32 @@ $maxpoints) - $awarded = $maxpoints-$points; - $points = $points + $awarded; + $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'")); ?> - - + + - - +
:  
+Your Thawte-Points will be revoked as of November 16, 2010. Please check new calculation here"; +?>
@@ -97,22 +100,23 @@ '._("Deleted before Verification").''; + $name = _("Deleted before Verification"); else - $name = "$name"; + $name = "$name"; ?> - + diff --git a/pages/wot/15.php b/pages/wot/15.php new file mode 100644 index 0000000..fa1ca50 --- /dev/null +++ b/pages/wot/15.php @@ -0,0 +1,185 @@ + + +
+ + + + + '$rc' ORDER BY `notary`.`when` DESC"; +*/ + $query = "SELECT count(*) AS `list` FROM `users` + inner join `notary` on `users`.`id` = `notary`.`from` + GROUP BY `notary`.`from` HAVING count(*) > '$rc'"; + + $rank = mysql_num_rows(mysql_query($query)) + 1; +?> + + +
+
+ + + + + + + + + + + + + $maxpoints) + $awarded = $maxpoints-$points; + $points = $points + $awarded; + $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'")); +?> + + + + + + + + + + + + + + +
: 
+
+ + + + + + + + + + + + +Revoked"; + } else + { + if ($points+$awarded > $maxpoints) + $awarded = $maxpoints-$points; + $points = $points + $awarded; + } + $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'")); +?> + + + + + + + + + + + + + + +
: 
+
+ + + + + + + + + + + + +$name"; +?> + + + + + + + + + + + + + + +
: 
+

[ ]

+ -- cgit v1.2.1 From 8fe30daa7e89e15caa14054af72bedbe5bd11602 Mon Sep 17 00:00:00 2001 From: dirk astrath Date: Tue, 14 Dec 2010 20:49:43 +0100 Subject: corrected thawte-patch according to last arbitrations/database/... --- pages/wot/10.php | 15 ++++- pages/wot/15.php | 167 +++++++++++++++++++++++++++++++++---------------------- 2 files changed, 116 insertions(+), 66 deletions(-) diff --git a/pages/wot/10.php b/pages/wot/10.php index fefc84c..2c2e620 100644 --- a/pages/wot/10.php +++ b/pages/wot/10.php @@ -45,6 +45,11 @@ +
+
+","")?> +
+

@@ -83,9 +88,17 @@
Your Thawte-Points will be revoked as of November 16, 2010. Please check new calculation here"; +{ ?>
+
+ + +
+
+
+ +
diff --git a/pages/wot/15.php b/pages/wot/15.php index fa1ca50..d3fbb98 100644 --- a/pages/wot/15.php +++ b/pages/wot/15.php @@ -46,7 +46,7 @@
- + @@ -55,40 +55,52 @@ + $maxpoints) - $awarded = $maxpoints-$points; - $points = $points + $awarded; - $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'")); + $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['to'])."'")); + $points += $row['awarded']; + $name = trim($fromuser['fname']." ".$fromuser['lname']); + if($name == "") + $name = _("Deleted before Verification"); + else + $name = "$name"; + $experience=""; + if ($row['method'] == "Face to Face Meeting") + if ($sumexperienceA < 50) + $sumexperienceA=$sumexperienceA+2; + $experience="2"; + ?> - + - - + + - - + + + - + - + + +
 
::   :

+ - + @@ -97,6 +109,7 @@ + $row['awarded']) + $awarded = $row['points']; + if ($awarded > 150) + $awarded = 150; + $awardedcount = $awarded; + if ($awarded > 100) { - $points=0; - $awarded="Revoked"; - } else - { - if ($points+$awarded > $maxpoints) - $awarded = $maxpoints-$points; - $points = $points + $awarded; + $experience = $awarded - $maxpoints; + $awarded = 100; } - $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'")); + if ($points+$awarded > $maxpoints) + $awarded = $maxpoints-$points; + + switch ($row['method']) + { + case 'Thawte Points Transfer': + // $points=0; + $awarded=sprintf("%s",_("Revoked")); + $experience=0; + break; + case 'CT Magazine - Germany': + // $points=0; + $awarded=sprintf("%s",_("Revoked")); + $experience=0; + break; + case 'Temporary Increase': +// Current usage of 'Temporary Increase' may break audit aspects, needs to be reimplemented + // $points=0; + $awarded=sprintf("%s",_("Revoked")); + $experience=0; + break; + case 'Administrative Increase': + if ($row['points'] > 2) + $points = $points + $awarded; + break; + default: + $points = $points + $awarded; + } + if ($sumexperience+$experience < 150) + $sumexperience = $sumexperience + $experience; + else + $sumexperience = 150; + +$fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'")); ?> @@ -131,55 +180,43 @@ + - + 50) + $sumexperienceOut = 50-$sumexperienceA; + else + $sumexperienceOut = $sumexperience; + +?> - + - - -
::  
-
- - - + - - - - - - + + + -$name"; -?> - - - - - - + + + - - - - + + + +
 
: 
:  + + + +
: : 

[ ]

-- cgit v1.2.1 From 36b3d8434449ef1a412c1d144634f23024afd9f9 Mon Sep 17 00:00:00 2001 From: dirk astrath Date: Tue, 14 Dec 2010 23:59:04 +0100 Subject: Don't count experience points if not enough assurance points --- pages/wot/15.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/pages/wot/15.php b/pages/wot/15.php index d3fbb98..c5121f9 100644 --- a/pages/wot/15.php +++ b/pages/wot/15.php @@ -187,7 +187,14 @@ $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".i $sumexperienceOut = 50-$sumexperienceA; else $sumexperienceOut = $sumexperience; - +$points=70; + if ($points < 100) + { + $sumexperienceAHold = $sumexperienceA; + $sumexperienceA = 0; + $sumexperienceOutHold = $sumexperienceOut; + $sumexperienceOut = 0; + } ?> : @@ -197,7 +204,12 @@ $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".i : -   + + + + + : @@ -206,7 +218,12 @@ $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".i - + + + + + -- cgit v1.2.1 From 55c305d6c2c766e4aed538e6c2d2e93bcdbb8ddc Mon Sep 17 00:00:00 2001 From: dirk astrath Date: Wed, 15 Dec 2010 01:54:54 +0100 Subject: forgot to remov the test-setting for not-calculating the experience points --- pages/wot/15.php | 1 - 1 file changed, 1 deletion(-) diff --git a/pages/wot/15.php b/pages/wot/15.php index c5121f9..172e722 100644 --- a/pages/wot/15.php +++ b/pages/wot/15.php @@ -187,7 +187,6 @@ $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".i $sumexperienceOut = 50-$sumexperienceA; else $sumexperienceOut = $sumexperience; -$points=70; if ($points < 100) { $sumexperienceAHold = $sumexperienceA; -- cgit v1.2.1 From a509863d4933c17fe08f6081858c6b22c4517fdd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=A4nzer?= Date: Wed, 16 Feb 2011 20:01:54 +0100 Subject: #827: Review Thawte Patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Corrections: - Fix HTML markup - Slight rewordings - Always initialize variables before use - Use printf() or echo instead of escaping PHP mode and immediately entering it again Signed-off-by: Michael Tänzer --- pages/wot/10.php | 3 ++- pages/wot/15.php | 32 +++++++++++++++++--------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/pages/wot/10.php b/pages/wot/10.php index 2c2e620..50b1ecb 100644 --- a/pages/wot/10.php +++ b/pages/wot/10.php @@ -47,7 +47,7 @@

-","")?> +", "")?>

@@ -81,6 +81,7 @@ + :   diff --git a/pages/wot/15.php b/pages/wot/15.php index 172e722..e42e316 100644 --- a/pages/wot/15.php +++ b/pages/wot/15.php @@ -59,7 +59,8 @@ $name"; $experience=""; if ($row['method'] == "Face to Face Meeting") + { if ($sumexperienceA < 50) $sumexperienceA=$sumexperienceA+2; $experience="2"; + } ?> @@ -92,7 +95,7 @@ $points = 0; :   - : + : @@ -114,6 +117,7 @@ $points = 0; - - + { + printf(_("%s Points on hold due to less Assurance points"), $sumexperienceAHold); + }?> @@ -215,16 +219,14 @@ $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".i   - - - - - - + { + if (points <100) + { + printf(_("%s Points on hold due to less Assurance points"), $sumexperienceOutHold); + } else { + echo _("Limit reached"); + } + }?> -- cgit v1.2.1 From 1ec50c91b397e4af5a3cf27457ca0a917293b559 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20T=C3=A4nzer?= Date: Tue, 22 Feb 2011 23:01:32 +0100 Subject: #827: Fix Thawte patch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PHP is nasty: "or" precedence is lower than "=" Signed-off-by: Michael Tänzer --- pages/wot/10.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/wot/10.php b/pages/wot/10.php index 50b1ecb..bc76a86 100644 --- a/pages/wot/10.php +++ b/pages/wot/10.php @@ -79,7 +79,7 @@ : -- cgit v1.2.1 From a91549c46d4f3683a79e9647d201a0ca8d7fc3b8 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 5 May 2011 11:00:22 +0200 Subject: just a simple test for the checkout/checkin-procedure ;-) Signed-off-by: root --- pages/wot/15.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pages/wot/15.php b/pages/wot/15.php index e42e316..50ac5b3 100644 --- a/pages/wot/15.php +++ b/pages/wot/15.php @@ -14,6 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ ?> -- cgit v1.2.1 From db3715f55501f9819a18d93af7a6978d03ba4c27 Mon Sep 17 00:00:00 2001 From: root Date: Mon, 23 May 2011 07:37:36 +0200 Subject: bug-827 ... completely rewritten 15.php, now necessary: wot.inc.php ... (however: still one new enhancement needed) --- includes/wot.inc.php | 513 +++++++++++++++++++++++++++++++++++++++++++++++++++ pages/wot/15.php | 230 +---------------------- 2 files changed, 522 insertions(+), 221 deletions(-) create mode 100644 includes/wot.inc.php diff --git a/includes/wot.inc.php b/includes/wot.inc.php new file mode 100644 index 0000000..1d8283b --- /dev/null +++ b/includes/wot.inc.php @@ -0,0 +1,513 @@ + '".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 `users` + inner join `notary` on `users`.`id` = `notary`.`to` + GROUP BY `notary`.`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` = 11 + WHERE `cats_passed`.`user_id` = '".intval($userid)."'"); + return mysql_num_rows($res); + } + + function calc_experience ($row,&$points,&$experience,&$sum_experience) + { + $points += $row['awarded']; + $experience = " "; + 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) + { + $awarded = calc_points($row); + + 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; + 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 3rd 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; + 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_txt;_("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").""; + 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) + { + output_assurances_header(_("Assurance Points You Issued")); + output_given_assurances_content($userid,$points,$sum_experience); + output_assurances_footer(_("Total Points Issued"),$points,_("Total Experience Points"),$sum_experience); + } + + function output_received_assurances($userid) + { + output_assurances_header(_("Your Assurance Points")); + output_received_assurances_content($userid,$points,$sum_experience); + output_assurances_footer(_("Total Assurance Points"),$points,_("Total Experience Points"),$sum_experience); + } + + function output_summary($userid) + { + output_summary_header(); + output_summary_content($userid,1); + output_summary_footer(); + } + + function output_end_of_page() + { +?> +

[ ]

+ diff --git a/pages/wot/15.php b/pages/wot/15.php index 50ac5b3..8579588 100644 --- a/pages/wot/15.php +++ b/pages/wot/15.php @@ -1,6 +1,6 @@ - - - - - - - '$rc' ORDER BY `notary`.`when` DESC"; -*/ - $query = "SELECT count(*) AS `list` FROM `users` - inner join `notary` on `users`.`id` = `notary`.`from` - GROUP BY `notary`.`from` HAVING count(*) > '$rc'"; - - $rank = mysql_num_rows(mysql_query($query)) + 1; -?> - - -
-
- - - - - - - - - - - - - -$name"; - $experience=""; - if ($row['method'] == "Face to Face Meeting") - { - if ($sumexperienceA < 50) - $sumexperienceA=$sumexperienceA+2; - $experience="2"; - } - -?> - - - - - - - - - - - - - - - - - -
 
: :
-
+ include_once($_SESSION['_config']['filepath']."/includes/wot.inc.php"); - - - - - - - - - - - - - - $row['awarded']) - $awarded = $row['points']; - if ($awarded > 150) - $awarded = 150; - $awardedcount = $awarded; - if ($awarded > 100) - { - $experience = $awarded - $maxpoints; - $awarded = 100; - } - if ($points+$awarded > $maxpoints) - $awarded = $maxpoints-$points; - - switch ($row['method']) - { - case 'Thawte Points Transfer': - // $points=0; - $awarded=sprintf("%s",_("Revoked")); - $experience=0; - break; - case 'CT Magazine - Germany': - // $points=0; - $awarded=sprintf("%s",_("Revoked")); - $experience=0; - break; - case 'Temporary Increase': -// Current usage of 'Temporary Increase' may break audit aspects, needs to be reimplemented - // $points=0; - $awarded=sprintf("%s",_("Revoked")); - $experience=0; - break; - case 'Administrative Increase': - if ($row['points'] > 2) - $points = $points + $awarded; - break; - default: - $points = $points + $awarded; - } - if ($sumexperience+$experience < 150) - $sumexperience = $sumexperience + $experience; - else - $sumexperience = 150; + output_ranking($userid); + output_summary($userid); + output_given_assurances($userid); + output_received_assurances($userid); -$fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'")); -?> - - - - - - - - - - 50) - $sumexperienceOut = 50-$sumexperienceA; - else - $sumexperienceOut = $sumexperience; - if ($points < 100) - { - $sumexperienceAHold = $sumexperienceA; - $sumexperienceA = 0; - $sumexperienceOutHold = $sumexperienceOut; - $sumexperienceOut = 0; - } + output_end_of_page(); ?> - - - - - - - - - - - - - - - - - - - - - -
: 
: - -
:  - -
: 
-

[ ]

- -- cgit v1.2.1 From b218463f92eb382f0c38f79a21402d293b0b4700 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 May 2011 06:38:23 +0200 Subject: 827 fixed CATs-test, fixed calculation of points --- includes/wot.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/includes/wot.inc.php b/includes/wot.inc.php index 1d8283b..f65070f 100644 --- a/includes/wot.inc.php +++ b/includes/wot.inc.php @@ -101,7 +101,7 @@ 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` = 11 + $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); } @@ -402,7 +402,7 @@ switch ($row['method']) { case 'Face to Face Meeting': // count Face to Face only - $sum_experience += 2; + $sum_experience += 2*intval($row['number']); break; } -- cgit v1.2.1 From d3b6033b790f7cbb7fbaa5f07f237b08ff28fe79 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 May 2011 06:56:37 +0200 Subject: 827 removed "birthday added points"-bug since ulis birthday is not today ... ;-) --- includes/wot.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/includes/wot.inc.php b/includes/wot.inc.php index f65070f..e8b0448 100644 --- a/includes/wot.inc.php +++ b/includes/wot.inc.php @@ -458,7 +458,7 @@ { $experience_total = $sum_experience_countable+$sum_experience_other_countable; $issue_points_txt = ""; - if ($sum_points_countable = $max_points) + if ($sum_points_countable == $max_points) $issue_points = 10; if ($experience_total >= 10) $issue_points = 15; -- cgit v1.2.1 From e21571f342cda9dc4b7709287202ed2b33c7be92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernhard=20Fr=C3=B6hlich?= Date: Thu, 4 Aug 2011 23:58:09 +0200 Subject: Simplified unneccesary complex SQL queries --- includes/wot.inc.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/includes/wot.inc.php b/includes/wot.inc.php index e8b0448..68e15d5 100644 --- a/includes/wot.inc.php +++ b/includes/wot.inc.php @@ -34,9 +34,8 @@ function get_number_of_assurances ($userid) { - $res = query_init ("SELECT `users`. *, count(*) AS `list` FROM `users`, `notary` - WHERE `users`.`id` = `notary`.`from` AND `notary`.`from` != `notary`.`to` AND `from`='".intval($userid)."' - GROUP BY `notary`.`from`"); + $res = query_init ("SELECT count(*) AS `list` FROM `notary` + WHERE `notary`.`from` != `notary`.`to` AND `notary`.`from`='".intval($userid)."'"); $row = query_getnextrow($res); return intval($row['list']); @@ -44,9 +43,8 @@ function get_number_of_assurees ($userid) { - $res = query_init ("SELECT `users`. *, count(*) AS `list` FROM `users`, `notary` - WHERE `users`.`id` = `notary`.`to` AND `notary`.`from` != `notary`.`to` AND `to`='".intval($userid)."' - GROUP BY `notary`.`to`"); + $res = query_init ("SELECT count(*) AS `list` FROM `notary` + WHERE `notary`.`from` != `notary`.`to` AND `notary`.`to`='".intval($userid)."'"); $row = query_getnextrow($res); return intval($row['list']); @@ -54,16 +52,14 @@ function get_top_assurer_position ($no_of_assurances) { - $res = query_init ("SELECT count(*) AS `list` FROM `users` - inner join `notary` on `users`.`id` = `notary`.`from` + $res = query_init ("SELECT count(*) AS `list` FROM `notary` GROUP BY `notary`.`from` HAVING count(*) > '".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 `users` - inner join `notary` on `users`.`id` = `notary`.`to` + $res = query_init ("SELECT count(*) AS `list` FROM `notary` GROUP BY `notary`.`to` HAVING count(*) > '".intval($no_of_assurees)."'"); return intval(query_get_number_of_rows($res)+1); } -- cgit v1.2.1 From c0afd35630115a7e186b912d2404f2c34f1f18b3 Mon Sep 17 00:00:00 2001 From: Bernhard Froehlich Date: Sat, 6 Aug 2011 20:56:38 +0200 Subject: Qualified columns in some statements --- includes/wot.inc.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/wot.inc.php b/includes/wot.inc.php index 68e15d5..ce35ed6 100644 --- a/includes/wot.inc.php +++ b/includes/wot.inc.php @@ -14,7 +14,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA -*/ +*/ function query_init ($query) { @@ -66,25 +66,25 @@ function get_given_assurances ($userid) { - $res = query_init ("select * from `notary` where `from`='".intval($userid)."' and `from` != `to` order by `id` asc"); + $res = query_init ("select * from `notary` where `notary`.`from`='".intval($userid)."' and `notary`.`from` != `to` order by `notary`.`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 "); + $res = query_init ("select * from `notary` where `notary`.`to`='".intval($userid)."' and `notary`.`from` != `notary`.`to` order by `notary`.`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"); + $res = query_init ("select count(*) as number,points,awarded,method from notary where `notary`.`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"); + $res = query_init ("select count(*) as number,points,awarded,method from notary where `notary`.`to`='".intval($userid)."' group by points,awarded,method"); return $res; } @@ -124,7 +124,7 @@ $awarded = 100; } else - $experience = 0; + $experience = 0; switch ($row['method']) { @@ -291,7 +291,7 @@ $res = get_given_assurances(intval($userid)); while($row = mysql_fetch_assoc($res)) { - $fromuser = get_user (intval($row['to'])); + $fromuser = get_user (intval($row['to'])); calc_experience ($row,$points,$experience,$sum_experience); $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); -- cgit v1.2.1