Source code taken from cacert-20131120.tar.bz2
[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="8" class="title"><?=_("Domain Certificates")?> - <a href="account.php?id=12&amp;viewall=<?=!$viewall?>"><?=$viewall?_("Hide old certificates"):_("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 </tr>
33 <?
34 $query = "select UNIX_TIMESTAMP(`domaincerts`.`created`) as `created`,
35 UNIX_TIMESTAMP(`domaincerts`.`expire`) - UNIX_TIMESTAMP() as `timeleft`,
36 UNIX_TIMESTAMP(`domaincerts`.`expire`) as `expired`,
37 `domaincerts`.`expire` as `expires`, `revoked` as `revoke`,
38 UNIX_TIMESTAMP(`revoked`) as `revoked`, `CN`, `domaincerts`.`serial`, `domaincerts`.`id` as `id`,
39 `domaincerts`.`description`
40 from `domaincerts`,`domains`
41 where `memid`='".intval($_SESSION['profile']['id'])."' and `domaincerts`.`domid`=`domains`.`id` ";
42 if($viewall != 1)
43 {
44 $query .= "AND `revoked`=0 AND `renewed`=0 ";
45 $query .= "HAVING `timeleft` > 0 ";
46 }
47 $query .= "ORDER BY `domaincerts`.`modified` desc";
48 //echo $query."<br>\n";
49 $res = mysql_query($query);
50 if(mysql_num_rows($res) <= 0)
51 {
52 ?>
53 <tr>
54 <td colspan="8" class="DataTD"><?=_("No certificates are currently listed.")?></td>
55 </tr>
56 <? } else {
57 while($row = mysql_fetch_assoc($res))
58 {
59 if($row['timeleft'] > 0)
60 $verified = _("Valid");
61 if($row['timeleft'] < 0)
62 $verified = _("Expired");
63 if($row['expired'] == 0)
64 $verified = _("Pending");
65 if($row['revoked'] > 0)
66 $verified = _("Revoked");
67 if($row['revoked'] == 0)
68 $row['revoke'] = _("Not Revoked");
69 ?>
70 <tr>
71 <? if($verified != _("Pending") && $verified != _("Revoked")) { ?>
72 <td class="DataTD"><input type="checkbox" name="revokeid[]" value="<?=$row['id']?>"/></td>
73 <? } else if($verified != _("Revoked")) { ?>
74 <td class="DataTD"><input type="checkbox" name="delid[]" value="<?=$row['id']?>"/></td>
75 <? } else { ?>
76 <td class="DataTD">&nbsp;</td>
77 <? } ?>
78 <td class="DataTD"><?=$verified?></td>
79 <td class="DataTD"><a href="account.php?id=15&amp;cert=<?=$row['id']?>"><?=$row['CN']?></a></td>
80 <td class="DataTD"><?=$row['serial']?></td>
81 <td class="DataTD"><?=$row['revoke']?></td>
82 <td class="DataTD"><?=$row['expires']?></td>
83 <td class="DataTD"><input name="comment_<?=$row['id']?>" type="text" value="<?=htmlspecialchars($row['description'])?>" /></td>
84 <td class="DataTD"><input type="checkbox" name="check_comment_<?=$row['id']?>" /></td>
85 </tr>
86 <? } ?>
87 <tr>
88 <td class="DataTD" colspan="8">
89 <a href="account.php?id=12&amp;viewall=<?=!$viewall?>"><b><?=$viewall?_("Hide old certificates"):_("View all certificates")?></b></a>
90 </td>
91 </tr>
92 <tr>
93 <td class="DataTD" colspan="8">
94 <?=_('* 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".')?>
95 </td>
96 </tr>
97 <tr>
98 <td class="DataTD" colspan="6"><input type="submit" name="renew" value="<?=_("Renew")?>"/>&#160;&#160;&#160;&#160;
99 <input type="submit" name="revoke" value="<?=_("Revoke/Delete")?>"></td>
100 <td class="DataTD" colspan="2"><input type="submit" name="change" value="<?=_("Change settings")?>"/> </td>
101 </tr>
102 <? } ?>
103 <tr>
104 <td class="DataTD" colspan="8"><?=_("From here you can delete pending requests, or revoke valid certificates.")?></td>
105 </tr>
106 </table>
107 <input type="hidden" name="oldid" value="<?=$id?>"/>
108 <input type="hidden" name="csrf" value="<?=make_csrf('srvcerchange')?>"/>
109 </form>