Source code taken from cacert-20110927.tar.bz2
[cacert.git] / pages / account / 25.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 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper" width="700">
19 <tr>
20 <td colspan="5" class="title"><?=_("Organisations")?></td>
21 </tr>
22
23 <tr>
24 <td colspan="5" class="title"><?=_("Order by:")?>
25 <a href="account.php?id=25"><?=_("Id")?></a> -
26 <a href="account.php?id=25&amp;ord=1"><?=_("Country")?></a> -
27 <a href="account.php?id=25&amp;ord=2"><?=_("Name")?></a>
28 </td>
29 </tr>
30
31 <tr>
32 <td class="DataTD" width="350"><?=_("Organisation")?></td>
33 <td class="DataTD"><?=_("Domains")?></td>
34 <td class="DataTD"><?=_("Admins")?></td>
35 <td class="DataTD"><?=_("Edit")?></td>
36 <td class="DataTD"><?=_("Delete")?></td>
37 </tr>
38 <?
39 $order = 0;
40 if (array_key_exists('ord',$_REQUEST)) {
41 $order = intval($_REQUEST['ord']);
42 }
43
44 $order_by = "`id`";
45 switch ($order) {
46 case 1:
47 $order_by = "`C`,`O`";
48 break;
49 case 2:
50 $order_by = "`O`";
51 break;
52 // the 0 and default case are handled by the preset
53 }
54
55 // Safe because $order_by only contains fixed strings
56 $query = sprintf("select * from `orginfo` ORDER BY %s", $order_by);
57 $res = mysql_query($query);
58 while($row = mysql_fetch_assoc($res))
59 {
60 $r2 = mysql_query("select * from `org` where `orgid`='".intval($row['id'])."'");
61 $admincount = mysql_num_rows($r2);
62 $r2 = mysql_query("select * from `orgdomains` where `orgid`='".intval($row['id'])."'");
63 $domcount = mysql_num_rows($r2);
64 ?>
65 <tr>
66 <td class="DataTD"><?=htmlspecialchars($row['O'])?>, <?=htmlspecialchars($row['ST'])?> <?=htmlspecialchars($row['C'])?></td>
67 <td class="DataTD"><a href="account.php?id=26&amp;orgid=<?=intval($row['id'])?>"><?=_("Domains")?> (<?=$domcount?>)</a></td>
68 <td class="DataTD"><a href="account.php?id=32&amp;orgid=<?=$row['id']?>"><?=_("Admins")?> (<?=$admincount?>)</a></td>
69 <td class="DataTD"><a href="account.php?id=27&amp;orgid=<?=$row['id']?>"><?=_("Edit")?></a></td>
70 <td class="DataTD"><a href="account.php?id=31&amp;orgid=<?=$row['id']?>"><?=_("Delete")?></a></td>
71 <? if(array_key_exists('viewcomment',$_REQUEST) && $_REQUEST['viewcomment']!='') { ?>
72 <td class="DataTD"><?=sanitizeHTML($row['comments'])?></td>
73 <? } ?>
74 </tr>
75 <? } ?>
76 </table>