Alternc  latest
Alternc logiel libre pour l'hébergement
ssl_list.php
Go to the documentation of this file.
1 <?php
2 /*
3  ----------------------------------------------------------------------
4  AlternC - Web Hosting System
5  Copyright (C) 2002 by the AlternC Development Team.
6  http://alternc.org/
7  ----------------------------------------------------------------------
8  LICENSE
9 
10  This program is free software; you can redistribute it and/or
11  modify it under the terms of the GNU General Public License (GPL)
12  as published by the Free Software Foundation; either version 2
13  of the License, or (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  To read the license please visit http://www.gnu.org/copyleft/gpl.html
21  ----------------------------------------------------------------------
22  Original Author of file: Benjamin Sonntag
23  Purpose of file: Create / Import an SSL Certificate
24  ----------------------------------------------------------------------
25  */
26 require_once("../class/config.php");
27 
28 if (!isset($is_include)) {
29  $fields = array(
30  "filter" => array("request", "integer", null),
31  "filter1" => array("request", "integer", 0),
32  "filter2" => array("request", "integer", 0),
33  "filter4" => array("request", "integer", 0),
34  "filter8" => array("request", "integer", 0),
35  );
37 }
38 
39 if (isset($filter1) && isset($filter2) && isset($filter4) && isset($filter8)) {
40  $filter = $filter1 + $filter2 + $filter4 + $filter8;
41  if ($filter == 0)
42  $filter = null;
43 }
44 
45 $r = $ssl->get_list($filter);
46 
47 if (!$error)
48  $error.=$err->errstr();
49 
50 $astatus = array(
51  $ssl::STATUS_PENDING => _("Pending Certificate"),
52  $ssl::STATUS_OK => _("Valid"),
53  $ssl::STATUS_EXPIRED => "<span style=\"color: red; font-weight:bold\">" . _("Expired") . "</span>",
54 );
55 
56 $vhosts = $ssl->get_vhosts();
57 foreach ($vhosts as $v) {
58  if ($v["certif"] == 0) {
59  $info=_("Some of your hosting are using a <b>self-signed</b> certificate. <br>Your browser will not let you surf those domains properly<br>To fix this, buy a properly signed certificate")."<br>".$info;
60  }
61 }
62 include_once("head.php");
63 
64 if ($error) {
65  echo "<p class=\"alert alert-danger\">$error</p>";
66 }
67 if ($info) {
68  echo "<p class=\"alert alert-info\">$info</p>";
69 }
70 ?>
71 <h3><?php __("Your Certificates"); ?></h3>
72 
73 <p><?php __("Please find below your SSL Certificates. Some may be provided by the administrator of the server, some may be Expired or Pending (waiting for a CRT from your Certificate Provider)"); ?></p>
74 <form method="get" action="ssl_list.php" name="filter">
75  <p><?php __("Only show the following certificates:"); ?> <br />
76  <label for="filter1"><input type="checkbox" onclick="document.forms['filter'].submit()" name="filter1" id="filter1" value="1" <?php cbox($filter & $ssl::FILTER_PENDING); ?>><?php __("Pending Certificates"); ?></label>
77  <label for="filter2"><input type="checkbox" onclick="document.forms['filter'].submit()" name="filter2" id="filter2" value="2" <?php cbox($filter & $ssl::FILTER_OK); ?>><?php __("Valid Certificates"); ?></label>
78  <label for="filter4"><input type="checkbox" onclick="document.forms['filter'].submit()" name="filter4" id="filter4" value="4" <?php cbox($filter & $ssl::FILTER_EXPIRED); ?>><?php __("Expired Certificates"); ?></label>
79  <br />
80  <label for="filter8"><input type="checkbox" onclick="document.forms['filter'].submit()" name="filter8" id="filter8" value="8" <?php cbox($filter & $ssl::FILTER_SHARED); ?>><?php __("Certificates Shared by the Administrator"); ?></label>
81  &nbsp; &nbsp;
82  <input type="submit" name="go" value="<?php __("Filter"); ?>"/>
83 </form>
84 <table class="tlist">
85  <tr><th></th><th><?php __("Domain Name"); ?></th><th><?php __("Status"); ?></th><th><?php __("Validity period"); ?></th><th><?php __("Used by"); ?></th></tr>
86  <?php
87  reset($r);
88  while (list($key, $val) = each($r)) {
89  ?>
90  <tr class="lst">
91  <td><div class="ina edit"><a href="ssl_view.php?id=<?php echo $val["id"] ?>"><?php __("Details"); ?></a></div></td>
92 
93  <td><?php echo $val["fqdn"]; ?></td>
94  <td><?php
95  echo $astatus[$val["status"]];
96  if ($val["shared"])
97  echo " <i>" . _("(shared)") . "</i>";
98  ?></td>
99  <?php
100  if ($val["status"] != $ssl::STATUS_PENDING) {
101  ?>
102  <td><?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'), date("Y-m-d H:i:s", $val["validstartts"])); ?><br>
103  <?php
104  if ($val["validendts"] < (time() + 86400 * 31))
105  echo "<span style=\"color: red; font-weight:bold\">";
106  echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'), date("Y-m-d H:i:s", $val["validendts"]));
107  if ($val["validendts"] < (time() + 86400 * 31))
108  echo "</span>";
109  ?></td>
110  <?php } else { ?>
111  <td><?php __("Requested on: "); ?><br>
112  <?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'), date("Y-m-d H:i:s", $val["validstartts"])); ?></td>
113  <?php } ?>
114  <td><?php
115  foreach ($vhosts as $v) {
116  if ($v["certif"] == $val["id"]) {
117  $v["fqdn"] = (($v["sub"]) ? ($v["sub"] . ".") : "") . $v["domaine"];
118  echo "<a href=\"dom_edit.php?domain=" . $v["domaine"] . "\">" . $v["fqdn"] . "</a><br>\n";
119  }
120  }
121  ?></td>
122  </tr>
123  <?php
124  }
125  // Now we enumerate self-signed certificates
126  foreach ($vhosts as $v) {
127  if ($v["certif"] == 0) {
128  $v["fqdn"] = (($v["sub"]) ? ($v["sub"] . ".") : "") . $v["domaine"];
129  echo "<tr><td><div class=\"ina add\"><a href=\"ssl_new.php?fqdn=" . $v["fqdn"] . "\">" . _("Create one") . "</a></div></td>";
130  echo "<td colspan=\"3\"><span style=\"color: red; font-weight:bold\">" . _("This hosting has no valid certificate<br>a self-signed one has been created") . "</span></td>";
131  echo "<td><a href=\"dom_edit.php?domain=" . $v["domaine"] . "\">" . $v["fqdn"] . "</a></td>";
132  echo "</tr>";
133  }
134  }
135  ?>
136 
137 </table>
138 <p>&nbsp;</p>
139 <p>
140  <span class="inb add"><a href="ssl_new.php"><?php __("Create or Import a new SSL Certificate"); ?></a></span>
141 </p>
142 
143 
144 <?php include_once("foot.php"); ?>
$err
Definition: bootstrap.php:72
$fields
Definition: aws_add.php:27
format_date($format, $date)
Definition: functions.php:494
__($str)
Definition: functions.php:404
cbox($test, $echo=true)
ECHOes checked="checked" only if the parameter is true useful for checkboxes and radio buttons.
Definition: functions.php:345
getFields($fields, $requestOnly=false)
Get the Fields of the posted form from $_REQUEST or POST or GET and check their type.
Definition: functions.php:688
$error
Definition: ssl_delete.php:45
if($error) $is_include
Definition: ssl_donew.php:55
if($error) $info
$vhosts
Definition: ssl_list.php:56
if(!isset($is_include)) if(isset($filter1) &&isset($filter2) &&isset($filter4) &&isset($filter8)) $r
Definition: ssl_list.php:45
$astatus
Definition: ssl_list.php:50
$val
Definition: tempovars.php:15
if(empty($_POST['key'])||empty($_POST['val'])) $key
Definition: tempovars.php:14