fa1ca50aa4b302f76fc56c84fd42bebd9213d7b7
[cacert-devel.git] / pages / wot / 15.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 ?>
20 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
21 <tr>
22 <td colspan="5" class="title"><?=_("Assurer Ranking")?></td>
23 </tr>
24 <tr>
25 <?
26 $query = "SELECT `users`. *, count(*) AS `list` FROM `users`, `notary`
27 WHERE `users`.`id` = `notary`.`from` AND `notary`.`from` != `notary`.`to`
28 AND `from`='".intval($_SESSION['profile']['id'])."' GROUP BY `notary`.`from`";
29 $res = mysql_query($query);
30 $row = mysql_fetch_assoc($res);
31 $rc = intval($row['list']);
32 /*
33 $query = "SELECT `users`. *, count(*) AS `list` FROM `users`, `notary`
34 WHERE `users`.`id` = `notary`.`from` AND `notary`.`from` != `notary`.`to`
35 GROUP BY `notary`.`from` HAVING count(*) > '$rc' ORDER BY `notary`.`when` DESC";
36 */
37 $query = "SELECT count(*) AS `list` FROM `users`
38 inner join `notary` on `users`.`id` = `notary`.`from`
39 GROUP BY `notary`.`from` HAVING count(*) > '$rc'";
40
41 $rank = mysql_num_rows(mysql_query($query)) + 1;
42 ?>
43 <td class="DataTD"><?=sprintf(_("You have made %s assurances which ranks you as the #%s top assurer."), intval($rc), intval($rank))?></td>
44 </tr>
45 </table>
46 <br>
47 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
48 <tr>
49 <td colspan="6" class="title"><?=_("Your Experience Points")?></td>
50 </tr>
51 <tr>
52 <td class="DataTD"><b><?=_("ID")?></b></td>
53 <td class="DataTD"><b><?=_("Date")?></b></td>
54 <td class="DataTD"><b><?=_("Who")?></b></td>
55 <td class="DataTD"><b><?=_("Points")?></b></td>
56 <td class="DataTD"><b><?=_("Location")?></b></td>
57 <td class="DataTD"><b><?=_("Method")?></b></td>
58 </tr>
59 <?
60 $maxpoints=50;
61 $points = 0;
62
63 $query = "select * from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `from` = `to` order by `id` desc ";
64 $res = mysql_query($query);
65 while($row = mysql_fetch_assoc($res))
66 {
67 $awarded = $row['awarded'];
68 if ($points+$awarded > $maxpoints)
69 $awarded = $maxpoints-$points;
70 $points = $points + $awarded;
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"><?=$awarded?></td>
78 <td class="DataTD"><?=$row['location']?></td>
79 <td class="DataTD"><?=_(sprintf("%s", $row['method']))?></td>
80 </tr>
81 <? } ?>
82 <tr>
83 <td class="DataTD" colspan="3"><b><?=_("Total Points")?>:</b></td>
84 <td class="DataTD"><?=$points?></td>
85 <td class="DataTD" colspan="2">&nbsp;</td>
86 </tr>
87 </table>
88 <br>
89 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
90 <tr>
91 <td colspan="6" class="title"><?=_("Your Assurance Points")?></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 $maxpoints = 100;
104 // $query = "select sum(points) as apoints from `notary` where `from`='".intval($_SESSION['profile']['id'])."' and `from`=`to` ";
105 // $res = mysql_query($query);
106 // $row = mysql_fetch_assoc($res);
107 // $maxpoints=intval($_SESSION['profile']['points'])-$row['apoints'];
108
109 $points = 0;
110 $query = "select * from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `from` != `to` order by `id` desc ";
111 $res = mysql_query($query);
112 while($row = mysql_fetch_assoc($res))
113 {
114 $awarded = $row['awarded'];
115 if ($row['method'] == "Thawte Points Transfer")
116 {
117 $points=0;
118 $awarded="<strong style='color: red'>Revoked</strong>";
119 } else
120 {
121 if ($points+$awarded > $maxpoints)
122 $awarded = $maxpoints-$points;
123 $points = $points + $awarded;
124 }
125 $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'"));
126 ?>
127 <tr>
128 <td class="DataTD"><?=$row['id']?></td>
129 <td class="DataTD"><?=$row['date']?></td>
130 <td class="DataTD"><a href="wot.php?id=9&amp;userid=<?=intval($row['from'])?>"><?=$fromuser['fname']." ".$fromuser['lname']?></td>
131 <td class="DataTD"><?=$awarded?></td>
132 <td class="DataTD"><?=$row['location']?></td>
133 <td class="DataTD"><?=_(sprintf("%s", $row['method']))?></td>
134 </tr>
135 <? } ?>
136 <tr>
137 <td class="DataTD" colspan="3"><b><?=_("Total Points")?>:</b></td>
138 <td class="DataTD"><?=$points?></td>
139 <td class="DataTD" colspan="2">&nbsp;</td>
140 </tr>
141 </table>
142 <br>
143 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
144 <tr>
145 <td colspan="6" class="title"><?=_("Assurance Points You Issued")?></td>
146 </tr>
147 <tr>
148 <td class="DataTD"><b><?=_("ID")?></b></td>
149 <td class="DataTD"><b><?=_("Date")?></b></td>
150 <td class="DataTD"><b><?=_("Who")?></b></td>
151 <td class="DataTD"><b><?=_("Points")?></b></td>
152 <td class="DataTD"><b><?=_("Location")?></b></td>
153 <td class="DataTD"><b><?=_("Method")?></b></td>
154 </tr>
155 <?
156 $points = 0;
157 $query = "select * from `notary` where `from`='".intval($_SESSION['profile']['id'])."' and `to`!='".intval($_SESSION['profile']['id'])."' order by `id` desc";
158 $res = mysql_query($query);
159 while($row = mysql_fetch_assoc($res))
160 {
161 $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['to'])."'"));
162 $points += $row['awarded'];
163 $name = trim($fromuser['fname']." ".$fromuser['lname']);
164 if($name == "")
165 $name = _("Deleted before Verification");
166 else
167 $name = "<a href='wot.php?id=9&amp;userid=".intval($row['to'])."'>$name</a>";
168 ?>
169 <tr>
170 <td class="DataTD"><?=intval($row['id'])?></td>
171 <td class="DataTD"><?=$row['date']?></td>
172 <td class="DataTD"><?=$name?></td>
173 <td class="DataTD"><?=intval($row['awarded'])?></td>
174 <td class="DataTD"><?=$row['location']?></td>
175 <td class="DataTD"><?=$row['method']==""?"":_(sprintf("%s", $row['method']))?></td>
176 </tr>
177 <? } ?>
178 <tr>
179 <td class="DataTD" colspan="3"><b><?=_("Total Points Issued")?>:</b></td>
180 <td class="DataTD"><?=$points?></td>
181 <td class="DataTD" colspan="2">&nbsp;</td>
182 </tr>
183 </table>
184 <p>[ <a href='javascript:history.go(-1)'><?=_("Go Back")?></a> ]</p>
185