Merge branch 'bug-1394' into testserver-stable
[cacert-devel.git] / pages / wot / 1.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 $res=mysql_fetch_assoc(mysql_query("select sum(acount) as summe from countries"));
20 $total1 =$res['summe'];
21
22 $locid=array_key_exists('locid',$_REQUEST)?intval($_REQUEST['locid']):0;
23 $regid=array_key_exists('regid',$_REQUEST)?intval($_REQUEST['regid']):0;
24 $ccid=array_key_exists('ccid',$_REQUEST)?intval($_REQUEST['ccid']):0;
25
26 echo "<ul class='top'>\n<li>";
27 echo "<a href='wot.php?id=1'>"._("Home")." ("._("Listed").": $total1)</a>\n";
28
29 $display = "";
30 if($locid > 0)
31 {
32 $loc = mysql_fetch_assoc(mysql_query("select * from `locations` where `id`='".$locid."'"));
33 $display = "<ul class='top'>\n<li>\n".
34 "<a href='wot.php?id=1&locid=".$locid."'>".$loc['name']." ("._("Listed").": ".$loc['acount'].")</a>\n".
35 $display;
36 $regid = $loc['regid'];
37 }
38
39 if($regid > 0)
40 {
41 $reg = mysql_fetch_assoc(mysql_query("select * from `regions` where `id`='".$regid."'"));
42 $display = "<ul class='top'>\n<li>\n".
43 "<a href='wot.php?id=1&regid=".$regid."'>".$reg['name']." ("._("Listed").": ".$reg['acount'].")</a>\n".
44 $display;
45 $ccid = $reg['ccid'];
46 }
47
48 if($ccid > 0)
49 {
50 $cnt = mysql_fetch_assoc(mysql_query("select * from `countries` where `id`='".$ccid."'"));
51 $display = "<ul class='top'>\n<li>\n".
52 "<a href='wot.php?id=1&ccid=".$ccid."'>".$cnt['name']." ("._("Listed").": ".$cnt['acount'].")</a>\n".
53 $display;
54 }
55
56 if($display)
57 echo $display;
58
59 if($ccid <= 0)
60 {
61 echo "<ul>\n";
62 $query = "select * from countries where acount>0 order by `name`";
63 $res = mysql_query($query);
64 while($row = mysql_fetch_assoc($res))
65 {
66 echo "<li><a href='wot.php?id=1&ccid=".$row['id']."'>".$row['name']." ("._("Listed").": ".$row['acount'].")</a></li>\n";
67 }
68 echo "</ul>\n</li>\n</ul>\n<br>\n";
69 } elseif($ccid > 0 && $regid <= 0 && $locid <= 0) {
70 echo "<ul>\n";
71 $query = "select * from regions where ccid='".$ccid."' and acount>0 order by `name`";
72 $res = mysql_query($query);
73 while($row = mysql_fetch_assoc($res))
74 {
75 echo "<li><a href='wot.php?id=1&regid=".$row['id']."'>".$row['name']." ("._("Listed").": ".$row['acount'].")</a></li>\n";
76 }
77 echo "</ul>\n</li>\n</ul>\n</li>\n</ul>\n<br>\n";
78 } elseif($regid > 0 && $locid <= 0) {
79 echo "<ul>\n";
80 $query = "select * from locations where regid='".$regid."' and acount>0 order by `name`";
81 $res = mysql_query($query);
82 while($row = mysql_fetch_assoc($res))
83 {
84 echo "<li><a href='wot.php?id=1&locid=".$row['id']."'>".$row['name']." ("._("Listed").": ".$row['acount'].")</a></li>\n";
85 }
86 echo "</ul>\n</li>\n</ul>\n</li>\n</ul>\n<br>\n";
87 } elseif($locid > 0){
88 echo "</ul>\n</li>\n</ul>\n</li>\n</ul>\n</li>\n</ul>\n<br>\n";
89 }
90 if($locid>0 || $regid>0 || $ccid>0)
91 {
92 $query = "select *, `users`.`id` as `id` from `users`,`notary` where `listme`='1' and
93 `ccid`='".$ccid."' and `regid`='".$regid."' and
94 `locid`='".$locid."' and `users`.`id`=`notary`.`to` and `notary`.`deleted`=0
95 AND `notary`.`method` != 'Administrative Increase' AND `notary`.`from` != `notary`.`to`
96 group by `notary`.`to` HAVING SUM(`awarded`) >= 100 order by `points` desc";
97 $list = mysql_query($query);
98 if(mysql_num_rows($list) > 0)
99 {
100 ?>
101 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper" width="550">
102 <tr>
103 <td class="title"><?=_("Name")?></td>
104 <td class="title"><?=_("Max Points")?></td>
105 <td class="title"><?=_("Contact Details")?></td>
106 <td class="title"><?=_("Email Assurer")?></td>
107 <td class="title"><?=_("Assurer Challenge")?></td>
108 </tr>
109
110 <? while($row = mysql_fetch_assoc($list)) { ?>
111 <tr>
112 <td class="DataTD" width="100"><nobr><?=sanitizeHTML($row['fname'])?> <?=substr($row['lname'], 0, 1)?>.</nobr></td>
113 <td class="DataTD"><?=maxpoints($row['id'])?></td>
114 <td class="DataTD"><?=sanitizeHTML($row['contactinfo'])?></td>
115 <td class="DataTD"><a href="wot.php?id=9&amp;userid=<?=intval($row['id'])?>"><?=_("Email Me")?></a></td>
116 <td class="DataTD"><?=$row['assurer']?_("Yes"):("<span class=\"error_indicator\">"._("Not yet!")."</span>")?></td>
117 </tr>
118 <?
119 }
120 }
121 ?>
122 </table>
123 <br>
124 <? } ?>