corrected thawte-patch according to last arbitrations/database/...
[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="7" class="title"><?=_("Assurance Points You Issued")?></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 <td class="DataTD"><b><?=_("Experience Points")?></b></td>
59 </tr>
60 <?
61
62 $points = 0;
63 $query = "select * from `notary` where `from`='".intval($_SESSION['profile']['id'])."' and `to`!='".intval($_SESSION['profile']['id'])."' order by `id` desc";
64 $res = mysql_query($query);
65 while($row = mysql_fetch_assoc($res))
66 {
67 $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['to'])."'"));
68 $points += $row['awarded'];
69 $name = trim($fromuser['fname']." ".$fromuser['lname']);
70 if($name == "")
71 $name = _("Deleted before Verification");
72 else
73 $name = "<a href='wot.php?id=9&amp;userid=".intval($row['to'])."'>$name</a>";
74 $experience="";
75 if ($row['method'] == "Face to Face Meeting")
76 if ($sumexperienceA < 50)
77 $sumexperienceA=$sumexperienceA+2;
78 $experience="2";
79
80 ?>
81 <tr>
82 <td class="DataTD"><?=intval($row['id'])?></td>
83 <td class="DataTD"><?=$row['date']?></td>
84 <td class="DataTD"><?=$name?></td>
85 <td class="DataTD"><?=intval($row['awarded'])?></td>
86 <td class="DataTD"><?=$row['location']?></td>
87 <td class="DataTD"><?=$row['method']==""?"":_(sprintf("%s", $row['method']))?></td>
88 <td class="DataTD"><?=$experience?>&nbsp;</td>
89 </tr>
90 <? } ?>
91 <tr>
92 <td class="DataTD" colspan="3"><b><?=_("Total Points Issued")?>:</b></td>
93 <td class="DataTD"><?=$points?></td>
94 <td class="DataTD">&nbsp;</td>
95 <td class="DataTD"><strong><?=_("Total Points")?>:</strong></td>
96 <td class="DataTD"><?=$sumexperienceA?></td>
97 </tr>
98 </table>
99 <br>
100
101 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
102 <tr>
103 <td colspan="7" class="title"><?=_("Your Assurance Points")?></td>
104 </tr>
105 <tr>
106 <td class="DataTD"><b><?=_("ID")?></b></td>
107 <td class="DataTD"><b><?=_("Date")?></b></td>
108 <td class="DataTD"><b><?=_("Who")?></b></td>
109 <td class="DataTD"><b><?=_("Points")?></b></td>
110 <td class="DataTD"><b><?=_("Location")?></b></td>
111 <td class="DataTD"><b><?=_("Method")?></b></td>
112 <td class="DataTD"><b><?=_("Experience Points")?></b></td>
113 </tr>
114 <?
115 $points = 0;
116 $maxpoints = 100;
117 // $query = "select sum(points) as apoints from `notary` where `from`='".intval($_SESSION['profile']['id'])."' and `from`=`to` ";
118 // $res = mysql_query($query);
119 // $row = mysql_fetch_assoc($res);
120 // $maxpoints=intval($_SESSION['profile']['points'])-$row['apoints'];
121
122 $points = 0;
123 $query = "select * from `notary` where `to`='".intval($_SESSION['profile']['id'])."' and `from` != `to` order by `id` desc ";
124 $res = mysql_query($query);
125 while($row = mysql_fetch_assoc($res))
126 {
127 $experience = 0;
128 $awarded = $row['awarded'];
129 if ($awarded < 0)
130 $awarded = 0;
131 if ($row['points'] > $row['awarded'])
132 $awarded = $row['points'];
133 if ($awarded > 150)
134 $awarded = 150;
135 $awardedcount = $awarded;
136 if ($awarded > 100)
137 {
138 $experience = $awarded - $maxpoints;
139 $awarded = 100;
140 }
141 if ($points+$awarded > $maxpoints)
142 $awarded = $maxpoints-$points;
143
144 switch ($row['method'])
145 {
146 case 'Thawte Points Transfer':
147 // $points=0;
148 $awarded=sprintf("<strong style='color: red'>%s</strong>",_("Revoked"));
149 $experience=0;
150 break;
151 case 'CT Magazine - Germany':
152 // $points=0;
153 $awarded=sprintf("<strong style='color: red'>%s</strong>",_("Revoked"));
154 $experience=0;
155 break;
156 case 'Temporary Increase':
157 // Current usage of 'Temporary Increase' may break audit aspects, needs to be reimplemented
158 // $points=0;
159 $awarded=sprintf("<strong style='color: red'>%s</strong>",_("Revoked"));
160 $experience=0;
161 break;
162 case 'Administrative Increase':
163 if ($row['points'] > 2)
164 $points = $points + $awarded;
165 break;
166 default:
167 $points = $points + $awarded;
168 }
169 if ($sumexperience+$experience < 150)
170 $sumexperience = $sumexperience + $experience;
171 else
172 $sumexperience = 150;
173
174 $fromuser = mysql_fetch_assoc(mysql_query("select * from `users` where `id`='".intval($row['from'])."'"));
175 ?>
176 <tr>
177 <td class="DataTD"><?=$row['id']?></td>
178 <td class="DataTD"><?=$row['date']?></td>
179 <td class="DataTD"><a href="wot.php?id=9&amp;userid=<?=intval($row['from'])?>"><?=$fromuser['fname']." ".$fromuser['lname']?></td>
180 <td class="DataTD"><?=$awarded?></td>
181 <td class="DataTD"><?=$row['location']?></td>
182 <td class="DataTD"><?=_(sprintf("%s", $row['method']))?></td>
183 <td class="DataTD"><?=$experience?></b></td>
184 </tr>
185 <? }
186 if ($sumexperienceA + $sumexperience > 50)
187 $sumexperienceOut = 50-$sumexperienceA;
188 else
189 $sumexperienceOut = $sumexperience;
190
191 ?>
192 <tr>
193 <td class="DataTD" colspan="3"><b><?=_("Total Assurance Points")?>:</b></td>
194 <td class="DataTD"><?=$points?></td>
195 <td class="DataTD" colspan="3">&nbsp;</td>
196 </tr>
197 <tr>
198 <td class="DataTD" colspan="3"><b><?=_("Total Experience Points by Assurance")?>:</b></td>
199 <td class="DataTD"><?=$sumexperienceA?></td>
200 <td class="DataTD" colspan="3">&nbsp;</td>
201 </tr>
202 <tr>
203 <td class="DataTD" colspan="3"><b><?=_("Total Experience Points (other ways)")?>:</b></td>
204 <td class="DataTD"><?=$sumexperienceOut?></td>
205 <td class="DataTD" colspan="3">&nbsp;
206 <? if ($sumexperience != $sumexperienceOut)
207 {
208 ?>
209 <?=_("Limit reached")?>
210 <? }
211 ?>
212 </td>
213 </tr>
214 <tr>
215 <td class="DataTD" colspan="3"><b><?=_("Total Points")?>:</b></td>
216 <td class="DataTD"><?=$points + $sumexperienceA + $sumexperienceOut?></td>
217 <td class="DataTD" colspan="3">&nbsp;</td>
218 </tr>
219
220 </table>
221 <p>[ <a href='javascript:history.go(-1)'><?=_("Go Back")?></a> ]</p>
222