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