diff options
Diffstat (limited to 'includes/wot.inc.php')
-rw-r--r-- | includes/wot.inc.php | 37 |
1 files changed, 21 insertions, 16 deletions
diff --git a/includes/wot.inc.php b/includes/wot.inc.php index ff9a0a3..a21f78a 100644 --- a/includes/wot.inc.php +++ b/includes/wot.inc.php @@ -34,8 +34,9 @@ function get_number_of_assurances ($userid) { - $res = query_init ("SELECT count(*) AS `list` FROM `notary` - WHERE `notary`.`from` != `notary`.`to` AND `notary`.`from`='".intval($userid)."'"); + $res = query_init ("SELECT `users`. *, count(*) AS `list` FROM `users`, `notary` + WHERE `users`.`id` = `notary`.`from` AND `notary`.`method` = 'Face to Face Meeting' AND `from`='".intval($userid)."' + GROUP BY `notary`.`from`"); $row = query_getnextrow($res); return intval($row['list']); @@ -43,8 +44,9 @@ function get_number_of_assurees ($userid) { - $res = query_init ("SELECT count(*) AS `list` FROM `notary` - WHERE `notary`.`from` != `notary`.`to` AND `notary`.`to`='".intval($userid)."'"); + $res = query_init ("SELECT `users`. *, count(*) AS `list` FROM `users`, `notary` + WHERE `users`.`id` = `notary`.`to` AND `notary`.`method` = 'Face to Face Meeting' AND `to`='".intval($userid)."' + GROUP BY `notary`.`to`"); $row = query_getnextrow($res); return intval($row['list']); @@ -52,14 +54,18 @@ function get_top_assurer_position ($no_of_assurances) { - $res = query_init ("SELECT count(*) AS `list` FROM `notary` + $res = query_init ("SELECT count(*) AS `list` FROM `users` + inner join `notary` on `users`.`id` = `notary`.`from` + WHERE `notary`.`method` = 'Face to Face Meeting' 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 `notary` + $res = query_init ("SELECT count(*) AS `list` FROM `users` + inner join `notary` on `users`.`id` = `notary`.`to` + WHERE `notary`.`method` = 'Face to Face Meeting' GROUP BY `notary`.`to` HAVING count(*) > '".intval($no_of_assurees)."'"); return intval(query_get_number_of_rows($res)+1); } @@ -272,15 +278,6 @@ <? } - function output_cats_needed() - { -?> - <tr> - <td class="DataTD" colspan=4><strong style='color: red'><?=_("You have to pass the CAcert Assurer Challenge (CATS-Test) to be an Assurer")?></strong></td> - </tr> -<? - } - // ************* output given assurances ****************** @@ -309,7 +306,7 @@ { $fromuser = get_user (intval($row['from'])); calc_assurances ($row,$points,$experience,$sum_experience,$awarded); - $name = show_user_link ($fromuser['fname']." ".$fromuser['lname'],intval($row['to'])); + $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); } } @@ -449,7 +446,15 @@ $issue_points = 0; $cats_test_passed = get_cats_state ($userid); if ($cats_test_passed == 0) + { $issue_points_txt = "<strong style='color: red'>"._("You have to pass the CAcert Assurer Challenge (CATS-Test) to be an Assurer")."</strong>"; + if ($sum_points_countable < $max_points) + { + $issue_points_txt = "<strong style='color: red'>"; + $issue_points_txt .= sprintf(_("You need %s assurance points and the passed CATS-Test to be an Assurer"), intval($max_points)); + $issue_points_txt .= "</strong>"; + } + } else { $experience_total = $sum_experience_countable+$sum_experience_other_countable; |