remove cacert/ prefix
[cacert.git] / pages / account / 12.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 <? $viewall=0; if(array_key_exists('viewall',$_REQUEST)) $viewall=intval($_REQUEST['viewall']); ?>
19 <form method="post" action="account.php">
20 <table align="center" valign="middle" border="0" cellspacing="0" cellpadding="0" class="wrapper">
21 <tr>
22 <td colspan="5" class="title"><?=_("Domain Certificates")?> - <a href="account.php?id=12&amp;viewall=<?=!$viewall?>"><?=_("View all certificates")?></a></td>
23 </tr>
24 <tr>
25 <td class="DataTD"><?=_("Renew/Revoke/Delete")?></td>
26 <td class="DataTD"><?=_("Status")?></td>
27 <td class="DataTD"><?=_("CommonName")?></td>
28 <td class="DataTD"><?=_("Revoked")?></td>
29 <td class="DataTD"><?=_("Expires")?></td>
30 </tr>
31 <?
32 $query = "select UNIX_TIMESTAMP(`domaincerts`.`created`) as `created`,
33 UNIX_TIMESTAMP(`domaincerts`.`expire`) - UNIX_TIMESTAMP() as `timeleft`,
34 UNIX_TIMESTAMP(`domaincerts`.`expire`) as `expired`,
35 `domaincerts`.`expire` as `expires`, `revoked` as `revoke`,
36 UNIX_TIMESTAMP(`revoked`) as `revoked`, `CN`, `domaincerts`.`id` as `id`
37 from `domaincerts`,`domains`
38 where `memid`='".intval($_SESSION['profile']['id'])."' and `deleted`=0 and `domaincerts`.`domid`=`domains`.`id` ";
39 if($viewall != 1)
40 {
41 $query .= "AND `revoked`=0 AND `renewed`=0 ";
42 $query .= "HAVING `timeleft` > 0 ";
43 }
44 $query .= "ORDER BY `domaincerts`.`modified` desc";
45 //echo $query."<br>\n";
46 $res = mysql_query($query);
47 if(mysql_num_rows($res) <= 0)
48 {
49 ?>
50 <tr>
51 <td colspan="5" class="DataTD"><?=_("No domains are currently listed.")?></td>
52 </tr>
53 <? } else {
54 while($row = mysql_fetch_assoc($res))
55 {
56 if($row['timeleft'] > 0)
57 $verified = _("Valid");
58 if($row['timeleft'] < 0)
59 $verified = _("Expired");
60 if($row['expired'] == 0)
61 $verified = _("Pending");
62 if($row['revoked'] > 0)
63 $verified = _("Revoked");
64 if($row['revoked'] == 0)
65 $row['revoke'] = _("Not Revoked");
66 ?>
67 <tr>
68 <? if($verified != _("Pending") && $verified != _("Revoked")) { ?>
69 <td class="DataTD"><input type="checkbox" name="revokeid[]" value="<?=$row['id']?>"></td>
70 <? } else if($verified != _("Revoked")) { ?>
71 <td class="DataTD"><input type="checkbox" name="delid[]" value="<?=$row['id']?>"></td>
72 <? } else { ?>
73 <td class="DataTD">&nbsp;</td>
74 <? } ?>
75 <td class="DataTD"><?=$verified?></td>
76 <td class="DataTD"><a href="account.php?id=15&amp;cert=<?=$row['id']?>"><?=$row['CN']?></a></td>
77 <td class="DataTD"><?=$row['revoke']?></td>
78 <td class="DataTD"><?=$row['expires']?></td>
79 </tr>
80 <? } ?>
81 <tr>
82 <td class="DataTD" colspan="5"><input type="submit" name="renew" value="<?=_("Renew")?>">&#160;&#160;&#160;&#160;
83 <input type="submit" name="revoke" value="<?=_("Revoke/Delete")?>"></td>
84 </tr>
85 <? } ?>
86 </table>
87 <input type="hidden" name="oldid" value="<?=$id?>">
88 <input type="hidden" name="csrf" value="<?=make_csrf('srvcerchange')?>" />
89 </form>
90 <p><?=_("From here you can delete pending requests, or revoke valid certificates.")?></p>