fefc84c07d2d04fc2974b2ee05fc7d9e3451dae6
[cacert-devel.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 <br>
49 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
50 <tr>
51 <td colspan="6" class="title"><?=_("Your Assurance Points")?></td>
52 </tr>
53 <tr>
54 <td class="DataTD"><b><?=_("ID")?></b></td>
55 <td class="DataTD"><b><?=_("Date")?></b></td>
56 <td class="DataTD"><b><?=_("Who")?></b></td>
57 <td class="DataTD"><b><?=_("Points")?></b></td>
58 <td class="DataTD"><b><?=_("Location")?></b></td>
59 <td class="DataTD"><b><?=_("Method")?></b></td>
60 </tr>
61 <?
62 $query = "select * from `notary` where `to`='".intval($_SESSION['profile']['id'])."'";
63 $res = mysql_query($query);
64 while($row = mysql_fetch_assoc($res))
65 {
66 $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'"));
67 ?>
68 <tr>
69 <td class="DataTD"><?=$row['id']?></td>
70 <td class="DataTD"><?=$row['date']?></td>
71 <td class="DataTD"><a href="wot.php?id=9&amp;userid=<?=intval($row['from'])?>"><?=$fromuser['fname']." ".$fromuser['lname']?></td>
72 <td class="DataTD"><?=$row['points']?></td>
73 <td class="DataTD"><?=$row['location']?></td>
74 <td class="DataTD"><?=_(sprintf("%s", $row['method']))?></td>
75 </tr>
76 <?
77 $thawte = ($row['method'] == "Thawte Points Transfer") or $thawte;
78 } ?>
79 <td class="DataTD" colspan="3"><b><?=_("Total Points")?>:</b></td>
80 <td class="DataTD"><?=intval($_SESSION['profile']['points'])?></td>
81 <td class="DataTD" colspan="2">&nbsp;</td>
82 </tr>
83 </table>
84 <?
85 if ($thawte)
86 echo "<br><strong style='color: red'>Your Thawte-Points will be revoked as of November 16, 2010. Please check new calculation <a href='/wot.php?id=15'></strong>here</a>";
87 ?>
88 <br>
89 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
90 <tr>
91 <td colspan="6" class="title"><?=_("Assurance Points You Issued")?></td>
92 </tr>
93 <tr>
94 <td class="DataTD"><b><?=_("ID")?></b></td>
95 <td class="DataTD"><b><?=_("Date")?></b></td>
96 <td class="DataTD"><b><?=_("Who")?></b></td>
97 <td class="DataTD"><b><?=_("Points")?></b></td>
98 <td class="DataTD"><b><?=_("Location")?></b></td>
99 <td class="DataTD"><b><?=_("Method")?></b></td>
100 </tr>
101 <?
102 $points = 0;
103 $query = "select * from `notary` where `from`='".intval($_SESSION['profile']['id'])."' and `to`!='".intval($_SESSION['profile']['id'])."'";
104 $res = mysql_query($query);
105 while($row = mysql_fetch_assoc($res))
106 {
107 $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['to'])."'"));
108 $points += $row['points'];
109 $name = trim($fromuser['fname']." ".$fromuser['lname']);
110 if($name == "")
111 $name = _("Deleted before Verification");
112 else
113 $name = "<a href='wot.php?id=9&amp;userid=".intval($row['to'])."'>$name</a>";
114 ?>
115 <tr>
116 <td class="DataTD"><?=intval($row['id'])?></td>
117 <td class="DataTD"><?=$row['date']?></td>
118 <td class="DataTD"><?=$name?></td>
119 <td class="DataTD"><?=intval($row['points'])?></td>
120 <td class="DataTD"><?=$row['location']?></td>
121 <td class="DataTD"><?=$row['method']==""?"":_(sprintf("%s", $row['method']))?></td>
122 </tr>
123 <? } ?>
124 <tr>
125 <td class="DataTD" colspan="3"><b><?=_("Total Points Issued")?>:</b></td>
126 <td class="DataTD"><?=$points?></td>
127 <td class="DataTD" colspan="2">&nbsp;</td>
128 </tr>
129 </table>
130 <p>[ <a href='javascript:history.go(-1)'><?=_("Go Back")?></a> ]</p>
131