bc76a86a847255bb2de4e07f0a8c10d2ecf565cc
[cacert.git] / pages / wot / 10.php
1 <? /*
2 LibreSSL - CAcert web application
3 Copyright (C) 2004-2008 CAcert Inc.
4
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; version 2 of the License.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */ ?>
18 <?
19 $thawte = false;
20
21 ?>
22 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
23 <tr>
24 <td colspan="5" class="title"><?=_("Assurer Ranking")?></td>
25 </tr>
26 <tr>
27 <?
28 $query = "SELECT `users`. *, count(*) AS `list` FROM `users`, `notary`
29 WHERE `users`.`id` = `notary`.`from` AND `notary`.`from` != `notary`.`to`
30 AND `from`='".intval($_SESSION['profile']['id'])."' GROUP BY `notary`.`from`";
31 $res = mysql_query($query);
32 $row = mysql_fetch_assoc($res);
33 $rc = intval($row['list']);
34 /*
35 $query = "SELECT `users`. *, count(*) AS `list` FROM `users`, `notary`
36 WHERE `users`.`id` = `notary`.`from` AND `notary`.`from` != `notary`.`to`
37 GROUP BY `notary`.`from` HAVING count(*) > '$rc' ORDER BY `notary`.`when` DESC";
38 */
39 $query = "SELECT count(*) AS `list` FROM `users`
40 inner join `notary` on `users`.`id` = `notary`.`from`
41 GROUP BY `notary`.`from` HAVING count(*) > '$rc'";
42
43 $rank = mysql_num_rows(mysql_query($query)) + 1;
44 ?>
45 <td class="DataTD"><?=sprintf(_("You have made %s assurances which ranks you as the #%s top assurer."), intval($rc), intval($rank))?></td>
46 </tr>
47 </table>
48 <center>
49 <br>
50 <?=sprintf(_("The calculation of points will be changed in the near future. Please check the %s new calculation %s"), "<a href='/wot.php?id=15'>", "</a>")?>
51 <br>
52 </center>
53 <br>
54 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
55 <tr>
56 <td colspan="6" class="title"><?=_("Your Assurance Points")?></td>
57 </tr>
58 <tr>
59 <td class="DataTD"><b><?=_("ID")?></b></td>
60 <td class="DataTD"><b><?=_("Date")?></b></td>
61 <td class="DataTD"><b><?=_("Who")?></b></td>
62 <td class="DataTD"><b><?=_("Points")?></b></td>
63 <td class="DataTD"><b><?=_("Location")?></b></td>
64 <td class="DataTD"><b><?=_("Method")?></b></td>
65 </tr>
66 <?
67 $query = "select * from `notary` where `to`='".intval($_SESSION['profile']['id'])."'";
68 $res = mysql_query($query);
69 while($row = mysql_fetch_assoc($res))
70 {
71 $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'"));
72 ?>
73 <tr>
74 <td class="DataTD"><?=$row['id']?></td>
75 <td class="DataTD"><?=$row['date']?></td>
76 <td class="DataTD"><a href="wot.php?id=9&amp;userid=<?=intval($row['from'])?>"><?=$fromuser['fname']." ".$fromuser['lname']?></td>
77 <td class="DataTD"><?=$row['points']?></td>
78 <td class="DataTD"><?=$row['location']?></td>
79 <td class="DataTD"><?=_(sprintf("%s", $row['method']))?></td>
80 </tr>
81 <?
82 $thawte = ($row['method'] == "Thawte Points Transfer") || $thawte;
83 } ?>
84 <tr>
85 <td class="DataTD" colspan="3"><b><?=_("Total Points")?>:</b></td>
86 <td class="DataTD"><?=intval($_SESSION['profile']['points'])?></td>
87 <td class="DataTD" colspan="2">&nbsp;</td>
88 </tr>
89 </table>
90 <?
91 if ($thawte)
92 {
93 ?>
94 <br>
95 <center>
96 <strong style='color: red'>
97 <?=_("Your Thawte-Points will be revoked in the near future. Please check new calculation!");?>
98 <br>
99 </strong>
100 </center>
101 <?}?>
102 <br>
103 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
104 <tr>
105 <td colspan="6" class="title"><?=_("Assurance Points You Issued")?></td>
106 </tr>
107 <tr>
108 <td class="DataTD"><b><?=_("ID")?></b></td>
109 <td class="DataTD"><b><?=_("Date")?></b></td>
110 <td class="DataTD"><b><?=_("Who")?></b></td>
111 <td class="DataTD"><b><?=_("Points")?></b></td>
112 <td class="DataTD"><b><?=_("Location")?></b></td>
113 <td class="DataTD"><b><?=_("Method")?></b></td>
114 </tr>
115 <?
116 $points = 0;
117 $query = "select * from `notary` where `from`='".intval($_SESSION['profile']['id'])."' and `to`!='".intval($_SESSION['profile']['id'])."'";
118 $res = mysql_query($query);
119 while($row = mysql_fetch_assoc($res))
120 {
121 $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['to'])."'"));
122 $points += $row['points'];
123 $name = trim($fromuser['fname']." ".$fromuser['lname']);
124 if($name == "")
125 $name = _("Deleted before Verification");
126 else
127 $name = "<a href='wot.php?id=9&amp;userid=".intval($row['to'])."'>$name</a>";
128 ?>
129 <tr>
130 <td class="DataTD"><?=intval($row['id'])?></td>
131 <td class="DataTD"><?=$row['date']?></td>
132 <td class="DataTD"><?=$name?></td>
133 <td class="DataTD"><?=intval($row['points'])?></td>
134 <td class="DataTD"><?=$row['location']?></td>
135 <td class="DataTD"><?=$row['method']==""?"":_(sprintf("%s", $row['method']))?></td>
136 </tr>
137 <? } ?>
138 <tr>
139 <td class="DataTD" colspan="3"><b><?=_("Total Points Issued")?>:</b></td>
140 <td class="DataTD"><?=$points?></td>
141 <td class="DataTD" colspan="2">&nbsp;</td>
142 </tr>
143 </table>
144 <p>[ <a href='javascript:history.go(-1)'><?=_("Go Back")?></a> ]</p>
145