cb40cf22c2df4ce8b72e8cc0999ef408b4a83993
[cacert-devel.git] / pages / account / 22.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="8" class="title"><?=_("Domain Certificates")?> - <a href="account.php?id=22&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"><?=_("SerialNumber")?></td>
29 <td class="DataTD"><?=_("Revoked")?></td>
30 <td class="DataTD"><?=_("Expires")?></td>
31 <td colspan="2" class="DataTD"><?=_("Comment *")?></td>
32 <?
33 $query = "select UNIX_TIMESTAMP(`orgdomaincerts`.`created`) as `created`,
34 UNIX_TIMESTAMP(`orgdomaincerts`.`expire`) - UNIX_TIMESTAMP() as `timeleft`,
35 UNIX_TIMESTAMP(`orgdomaincerts`.`expire`) as `expired`,
36 `orgdomaincerts`.`expire` as `expires`, `revoked` as `revoke`,
37 UNIX_TIMESTAMP(`revoked`) as `revoked`, `CN`,
38 `orgdomaincerts`.`serial`,
39 `orgdomaincerts`.`id` as `id`,
40 `orgdomaincerts`.`description`
41 from `orgdomaincerts`,`org`
42 where `org`.`memid`='".intval($_SESSION['profile']['id'])."' and `orgdomaincerts`.`orgid`=`org`.`orgid` ";
43 if($viewall != 1)
44 {
45 $query .= "AND `revoked`=0 AND `renewed`=0 ";
46 $query .= "HAVING `timeleft` > 0 ";
47 }
48 $query .= "ORDER BY `orgdomaincerts`.`modified` desc";
49 //echo $query."<br>\n";
50 $res = mysql_query($query);
51 if(mysql_num_rows($res) <= 0)
52 {
53 ?>
54 <tr>
55 <td colspan="8" class="DataTD"><?=_("No domains are currently listed.")?></td>
56 </tr>
57 <? } else {
58 while($row = mysql_fetch_assoc($res))
59 {
60 if($row['timeleft'] > 0)
61 $verified = _("Valid");
62 if($row['timeleft'] < 0)
63 $verified = _("Expired");
64 if($row['expired'] == 0)
65 $verified = _("Pending");
66 if($row['revoked'] > 0)
67 $verified = _("Revoked");
68 if($row['revoked'] == 0)
69 $row['revoke'] = _("Not Revoked");
70 ?>
71 <tr>
72 <? if($verified == _("Valid") || $verified == _("Expired")) { ?>
73 <td class="DataTD"><input type="checkbox" name="revokeid[]" value="<?=$row['id']?>"></td>
74 <? } else if($verified == _("Pending")) { ?>
75 <td class="DataTD"><input type="checkbox" name="delid[]" value="<?=$row['id']?>"></td>
76 <? } else { ?>
77 <td class="DataTD">&nbsp;</td>
78 <? } ?>
79 <td class="DataTD"><?=$verified?></td>
80 <td class="DataTD"><a href="account.php?id=23&cert=<?=$row['id']?>"><?=$row['CN']?></a></td>
81 <td class="DataTD"><?=$row['serial']?></td>
82 <td class="DataTD"><?=$row['revoke']?></td>
83 <td class="DataTD"><?=$row['expires']?></td>
84 <td class="DataTD"><input name="comment_<?=$row['id']?>" type="text" value="<?=htmlspecialchars($row['description'])?>" /></td>
85 <td class="DataTD"><input type="checkbox" name="check_comment_<?=$row['id']?>" /></td>
86 </tr>
87 <? } ?>
88 <tr>
89 <td class="DataTD" colspan="8">
90 <?=_('* Comment is NOT included in the certificate as it is intended for your personal reference only. To change the comment tick the checkbox and hit "Change Settings".')?>
91 </td>
92 </tr>
93 <tr>
94 <td class="DataTD" colspan="6"><input type="submit" name="renew" value="<?=_("Renew")?>" />&#160;&#160;&#160;&#160;
95 <input type="submit" name="revoke" value="<?=_("Revoke/Delete")?>" /></td>
96 <td class="DataTD" colspan="2"><input type="submit" name="change" value="<?=_("Change settings")?>" /> </td>
97 </tr>
98 <? } ?>
99 </table>
100 <input type="hidden" name="oldid" value="<?=$id?>" />
101 <input type="hidden" name="csrf" value="<?=make_csrf('orgsrvcerchange')?>" />
102 </form>
103 <p><?=_("From here you can delete pending requests, or revoke valid certificates.")?></p>