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