*space changes only*

This commit is contained in:
Benjamin Sonntag 2015-02-10 16:10:54 +01:00
parent 9025bcd78c
commit 06313e510a
9 changed files with 1035 additions and 1042 deletions

View File

@ -3,18 +3,13 @@
/**
* SSL Api of AlternC, used by alternc-api package
*/
class Alternc_Api_Object_Ssl {
const ERR_INVALID_ARGUMENT = 11151901;
const ERR_ALTERNC_FUNCTION = 11151902;
class Alternc_Api_Object_Ssl extends Alternc_Api_Legacyobject {
protected $ssl;
function __construct($service) {
global $ssl,$cuid;
if (!($service instanceof Alternc_Api_Service)) {
throw new \Exception("Bad argument: service is not an Alternc_Api_Service", self::ERR_INVALID_ARGUMENT);
}
// We store the global $cuid to AlternC legacy classes
$cuid=$service->token->uid;
global $ssl;
parent::__construct($service);
// We use the global $ssl from AlternC legacy classes
$this->ssl=$ssl;
}
@ -189,14 +184,4 @@ class Alternc_Api_Object_Ssl {
/** return a proper Alternc_Api_Response from an error class and error string
* from AlternC legacy class
*/
private function alterncLegacyErrorManager() {
global $err;
return new Alternc_Api_Response( array("code" => self::ERR_ALTERNC_FUNCTION, "message" => "[".$err->clsid."] ".$err->error) );
}
} // class Alternc_Api_Object_Ssl

View File

@ -1,52 +1,53 @@
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
require_once("../class/config.php");
if ( !isset($is_include) ) {
$fields = array (
"key" => array ("post", "string", ""),
"crt" => array ("post", "string", ""),
"chain" => array ("post", "string", ""),
);
getFields($fields);
if (!isset($is_include)) {
$fields = array(
"key" => array("post", "string", ""),
"crt" => array("post", "string", ""),
"chain" => array("post", "string", ""),
);
getFields($fields);
}
if (!$key && !$crt) {
$error=_("Please enter an ssl key and a certificate");
require_once("ssl_new.php");
exit();
$error = _("Please enter an ssl key and a certificate");
require_once("ssl_new.php");
exit();
}
$id=$ssl->import_cert($key,$crt,$chain);
$error=$err->errstr();
$id = $ssl->import_cert($key, $crt, $chain);
$error = $err->errstr();
if ($error) {
require_once("ssl_new.php");
exit();
require_once("ssl_new.php");
exit();
}
header("Location: /ssl_view.php?id=".$id);
header("Location: /ssl_view.php?id=" . $id);

View File

@ -1,54 +1,57 @@
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
require_once("../class/config.php");
if ( !isset($is_include) ) {
$fields = array (
"fqdn" => array ("request", "string", ""),
"fqdnt" => array ("request", "string", ""),
);
getFields($fields);
if (!isset($is_include)) {
$fields = array(
"fqdn" => array("request", "string", ""),
"fqdnt" => array("request", "string", ""),
);
getFields($fields);
}
if (!$fqdn && !$fqdnt) {
$error=_("Please enter a proper domain name");
require_once("ssl_new.php");
exit();
$error = _("Please enter a proper domain name");
require_once("ssl_new.php");
exit();
}
if ($fqdnt) $d=$fqdnt;
if ($fqdn) $d=$fqdn;
if ($fqdnt)
$d = $fqdnt;
if ($fqdn)
$d = $fqdn;
$id=$ssl->new_csr($d);
$error=$err->errstr();
$id = $ssl->new_csr($d);
$error = $err->errstr();
if ($error) {
require_once("ssl_new.php");
exit();
require_once("ssl_new.php");
exit();
}
$is_include=true;
require_once("ssl_view.php");
$is_include = true;
require_once("ssl_view.php");

View File

@ -1,44 +1,45 @@
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
require_once("../class/config.php");
$fields = array (
"id" => array ("post", "integer", ""),
"crt" => array ("post", "string", ""),
"chain" => array ("post", "string", ""),
);
$fields = array(
"id" => array("post", "integer", ""),
"crt" => array("post", "string", ""),
"chain" => array("post", "string", ""),
);
getFields($fields);
$cert=$ssl->finalize($id,$crt,$chain);
$cert = $ssl->finalize($id, $crt, $chain);
echo $ssl->error;
$error=$err->errstr();
$error = $err->errstr();
if ($error) {
require_once("ssl_list.php");
exit();
require_once("ssl_list.php");
exit();
}
$info=_("Your ssl certificate has been imported successfully");
$info = _("Your ssl certificate has been imported successfully");
require_once("ssl_view.php");
require_once("ssl_view.php");

View File

@ -1,106 +1,110 @@
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
require_once("../class/config.php");
if ( !isset($is_include) ) {
$fields = array (
"filter" => array ("request", "integer", null),
"filter1" => array ("request", "integer", 0),
"filter2" => array ("request", "integer", 0),
"filter4" => array ("request", "integer", 0),
"filter8" => array ("request", "integer", 0),
);
getFields($fields);
if (!isset($is_include)) {
$fields = array(
"filter" => array("request", "integer", null),
"filter1" => array("request", "integer", 0),
"filter2" => array("request", "integer", 0),
"filter4" => array("request", "integer", 0),
"filter8" => array("request", "integer", 0),
);
getFields($fields);
}
if (isset($filter1) && isset($filter2) && isset($filter4) && isset($filter8)) {
$filter=$filter1+$filter2+$filter4+$filter8;
if ($filter==0) $filter=null;
$filter = $filter1 + $filter2 + $filter4 + $filter8;
if ($filter == 0)
$filter = null;
}
$r=$ssl->get_list($filter);
$r = $ssl->get_list($filter);
if (!$error) $error.=$err->errstr();
if (!$error)
$error.=$err->errstr();
$astatus=array(
$ssl::STATUS_PENDING => _("Pending Certificate"),
$ssl::STATUS_OK => _("Valid"),
$ssl::STATUS_EXPIRED => ("Expired"),
);
$astatus = array(
$ssl::STATUS_PENDING => _("Pending Certificate"),
$ssl::STATUS_OK => _("Valid"),
$ssl::STATUS_EXPIRED => ("Expired"),
);
include_once("head.php");
if ($error) {
echo "<p class=\"alert alert-danger\">$error</p>";
echo "<p class=\"alert alert-danger\">$error</p>";
}
if ($info) {
echo "<p class=\"alert alert-info\">$info</p>";
echo "<p class=\"alert alert-info\">$info</p>";
}
?>
<h3><?php __("Your Certificates"); ?></h3>
<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>
<form method="get" action="ssl_list.php" name="filter">
<p><?php __("Only show the following certificates:"); ?> <br />
<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>
<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>
<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>
<br />
<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>
&nbsp; &nbsp;
<input type="submit" name="go" value="<?php __("Filter"); ?>"/>
<form method="get" action="ssl_list.php" name="filter">
<p><?php __("Only show the following certificates:"); ?> <br />
<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>
<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>
<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>
<br />
<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>
&nbsp; &nbsp;
<input type="submit" name="go" value="<?php __("Filter"); ?>"/>
</form>
<table class="tlist">
<tr><th></th><th><?php __("FQDN"); ?></th><th><?php __("Status"); ?></th><th><?php __("Valid From"); ?></th><th><?php __("Valid Until"); ?></th></tr>
<?php
reset($r);
while (list($key,$val)=each($r)) { ?>
<tr class="lst">
<td><div class="ina edit"><a href="ssl_view.php?id=<?php echo $val["id"] ?>"><?php __("Details"); ?></a></div></td>
<tr><th></th><th><?php __("FQDN"); ?></th><th><?php __("Status"); ?></th><th><?php __("Valid From"); ?></th><th><?php __("Valid Until"); ?></th></tr>
<?php
reset($r);
while (list($key, $val) = each($r)) {
?>
<tr class="lst">
<td><div class="ina edit"><a href="ssl_view.php?id=<?php echo $val["id"] ?>"><?php __("Details"); ?></a></div></td>
<td><?php echo $val["fqdn"]; ?></td>
<td><?php echo $astatus[$val["status"]];
if ($val["shared"]) echo " <i>"._("(shared)")."</i>"; ?></td>
<?php
if ($val["status"]!=$ssl::STATUS_PENDING) {
?>
<td><?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d H:i:s",$val["validstartts"])); ?></td>
<td><?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d H:i:s",$val["validendts"])); ?></td>
<?php } else { ?>
<td><?php __("Requested on: "); ?></td>
<td><?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d H:i:s",$val["validstartts"])); ?></td>
<?php } ?>
</tr>
<?php
}
<td><?php echo $val["fqdn"]; ?></td>
<td><?php echo $astatus[$val["status"]];
if ($val["shared"])
echo " <i>" . _("(shared)") . "</i>";
?></td>
<?php
if ($val["status"] != $ssl::STATUS_PENDING) {
?>
<td><?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'), date("Y-m-d H:i:s", $val["validstartts"])); ?></td>
<td><?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'), date("Y-m-d H:i:s", $val["validendts"])); ?></td>
<?php } else { ?>
<td><?php __("Requested on: "); ?></td>
<td><?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'), date("Y-m-d H:i:s", $val["validstartts"])); ?></td>
<?php } ?>
</tr>
<?php
}
?>
</table>
<p>
<span class="inb add"><a href="ssl_new.php"><?php __("Create or Import a new SSL Certificate"); ?></a></span>
<span class="inb add"><a href="ssl_new.php"><?php __("Create or Import a new SSL Certificate"); ?></a></span>
</p>
<?php include_once("foot.php"); ?>

View File

@ -1,163 +1,164 @@
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
require_once("../class/config.php");
include_once("head.php");
if ( !isset($is_include) ) {
$fields = array (
"fqdnt" => array ("request", "string", ""),
"key" => array ("request", "string", ""),
"crt" => array ("request", "string", ""),
"chain" => array ("request", "string", ""),
);
getFields($fields);
if (!isset($is_include)) {
$fields = array(
"fqdnt" => array("request", "string", ""),
"key" => array("request", "string", ""),
"crt" => array("request", "string", ""),
"chain" => array("request", "string", ""),
);
getFields($fields);
}
$advice=$ssl->get_new_advice();
$advice = $ssl->get_new_advice();
?>
<h3><?php __("New SSL Certificate"); ?></h3>
<?php
if (isset($error) && $error) {
echo "<p class=\"alert alert-danger\">$error</p>";
echo "<p class=\"alert alert-danger\">$error</p>";
}
?>
<p>
<?php __("An SSL certificate is a file which must be obtained from a Certificate Authority, and allow you to enable HTTPS encryption on a domain name."); ?>
<?php __("An SSL certificate is a file which must be obtained from a Certificate Authority, and allow you to enable HTTPS encryption on a domain name."); ?>
</p>
<p>
<?php __("To obtain one, you need to generate a <i>Certificate Request</i> (CSR) and a <i>RSA Key</i> (KEY) here, then give the CSR to the Certificate Authority, which will give you a certificate (CRT) and also often a chained certificate (CHAIN)."); ?>
<?php __("To obtain one, you need to generate a <i>Certificate Request</i> (CSR) and a <i>RSA Key</i> (KEY) here, then give the CSR to the Certificate Authority, which will give you a certificate (CRT) and also often a chained certificate (CHAIN)."); ?>
</p>
<p>
<?php __("If you already know what it is and already have all those files (CRT/KEY/CHAIN) You can import them here too."); ?>
<?php __("If you already know what it is and already have all those files (CRT/KEY/CHAIN) You can import them here too."); ?>
</p>
<div id="content">
<div id="tabsssl">
<div id="tabsssl">
<ul>
<li class="add"><a href="#tabsssl-create"><?php __("Create a CSR/KEY"); ?></a></li>
<li class="settings"><a href="#tabsssl-import"><?php __("Import existing files"); ?></a></li>
</ul>
<ul>
<li class="add"><a href="#tabsssl-create"><?php __("Create a CSR/KEY"); ?></a></li>
<li class="settings"><a href="#tabsssl-import"><?php __("Import existing files"); ?></a></li>
</ul>
<div id="tabsssl-create">
<h3><?php __("Create a CSR/KEY for a given domain name"); ?></h3>
<div id="tabsssl-create">
<h3><?php __("Create a CSR/KEY for a given domain name"); ?></h3>
<p><?php __("Use this form to generate a <i>Certificate Request file</i> (CSR) and a <i>RSA Key file</i> (KEY) for a given domain name"); ?></p>
<p><?php __("Use this form to generate a <i>Certificate Request file</i> (CSR) and a <i>RSA Key file</i> (KEY) for a given domain name"); ?></p>
<script type="text/javascript">
function switchmanual() {
if ($("#fqdn").val()==-1) {
$("#fqdn").hide();
$("#fqdnt").show();
$("#relist").show();
$("#fqdn").val("");
$("#fqdnt").focus();
}
}
<script type="text/javascript">
function switchmanual() {
if ($("#fqdn").val() == -1) {
$("#fqdn").hide();
$("#fqdnt").show();
$("#relist").show();
$("#fqdn").val("");
$("#fqdnt").focus();
}
}
function switchlist() {
$("#fqdn").show();
$("#fqdnt").hide();
$("#relist").hide();
$("#fqdnt").val("");
$("#fqdn").val("");
$("#fqdn").focus();
}
function switchlist() {
$("#fqdn").show();
$("#fqdnt").hide();
$("#relist").hide();
$("#fqdnt").val("");
$("#fqdn").val("");
$("#fqdn").focus();
}
</script>
</script>
<form method="post" action="ssl_donew.php" name="main" id="main">
<table border="1" cellspacing="0" cellpadding="4" class="tedit">
<tr><td colspan="2">
<?php __("Please choose the domain name for which you want a SSL Certificate, or enter it manually"); ?>
</td></tr>
<tr>
<th><label for="fqdn"><?php __("Fully Qualified Domain Name"); ?></label></th>
<td>
<select name="fqdn" id="fqdn" onchange="switchmanual()"<?php if ($fqdnt!="") echo " style=\"display: none\""; ?>>
<option value=""><?php __("--- Choose here ---"); ?></option>
<?php foreach($advice as $a) {
echo "<option>".$a."</option>";
}
?>
<option value="-1" style="font-style: italic; padding-left: 80px"> <?php __("... or click here to enter it manually"); ?></option>
</select>
<input<?php if ($fqdnt=="") echo " style=\"display: none\""; ?> type="text" class="int" name="fqdnt" id="fqdnt" value="" size="40" maxlength="64" /><input <?php if ($fqdnt=="") echo " style=\"display: none\""; ?> type="button" id="relist" name="relist" value=" list v " onclick="switchlist()" />
</td>
</tr>
</table>
<p>
<input type="submit" class="inb ok" name="submit" value="<?php __("Save"); ?>"/> &nbsp;
<input type="button" class="inb cancel" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='ssl_list.php'"/>
</p>
</form>
<form method="post" action="ssl_donew.php" name="main" id="main">
<table border="1" cellspacing="0" cellpadding="4" class="tedit">
<tr><td colspan="2">
<?php __("Please choose the domain name for which you want a SSL Certificate, or enter it manually"); ?>
</td></tr>
<tr>
<th><label for="fqdn"><?php __("Fully Qualified Domain Name"); ?></label></th>
<td>
<select name="fqdn" id="fqdn" onchange="switchmanual()"<?php if ($fqdnt != "") echo " style=\"display: none\""; ?>>
<option value=""><?php __("--- Choose here ---"); ?></option>
<?php
foreach ($advice as $a) {
echo "<option>" . $a . "</option>";
}
?>
<option value="-1" style="font-style: italic; padding-left: 80px"> <?php __("... or click here to enter it manually"); ?></option>
</select>
<input<?php if ($fqdnt == "") echo " style=\"display: none\""; ?> type="text" class="int" name="fqdnt" id="fqdnt" value="" size="40" maxlength="64" /><input <?php if ($fqdnt == "") echo " style=\"display: none\""; ?> type="button" id="relist" name="relist" value=" list v " onclick="switchlist()" />
</td>
</tr>
</table>
<p>
<input type="submit" class="inb ok" name="submit" value="<?php __("Save"); ?>"/> &nbsp;
<input type="button" class="inb cancel" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location = 'ssl_list.php'"/>
</p>
</form>
<div style="padding-left: 40px; margin-top: 20px; background: url(/images/warning.png) 5px 5px no-repeat">
<p><?php __("Please note that a SSL Certificate is only valid for one fully qualified domain name. As a result, a certificate for <code>www.example.com</code> is NOT valid for <code>intranet.example.com</code> or <code>intranet.www.example.com</code> !"); ?> <br /><?php __("<i>(If you want to get a valid certificate for all the subdomains of a domain, use a wildcard notation (eg: *.example.com). Please note that a wildcard certificate is usually more expensive than normal one.)</i>"); ?></p>
</div>
<div style="padding-left: 40px; margin-top: 20px; background: url(/images/warning.png) 5px 5px no-repeat">
<p><?php __("Please note that a SSL Certificate is only valid for one fully qualified domain name. As a result, a certificate for <code>www.example.com</code> is NOT valid for <code>intranet.example.com</code> or <code>intranet.www.example.com</code> !"); ?> <br /><?php __("<i>(If you want to get a valid certificate for all the subdomains of a domain, use a wildcard notation (eg: *.example.com). Please note that a wildcard certificate is usually more expensive than normal one.)</i>"); ?></p>
</div>
</div> <!-- create -->
</div> <!-- create -->
<div id="tabsssl-import">
<h3><?php __("Import existing Key Certificate and Chain files"); ?></h3>
<div id="tabsssl-import">
<h3><?php __("Import existing Key Certificate and Chain files"); ?></h3>
<p><?php __("If you already have a RSA Key file, a Certificate for this key and (maybe) a Chained certificate, please paste their content here."); ?></p>
<p><?php __("We will verify the content of those files and add them in your certificate repository"); ?></p>
<p><?php __("If you already have a RSA Key file, a Certificate for this key and (maybe) a Chained certificate, please paste their content here."); ?></p>
<p><?php __("We will verify the content of those files and add them in your certificate repository"); ?></p>
<form method="post" action="ssl_doimport.php" name="main" id="main">
<table border="1" cellspacing="0" cellpadding="4" class="tedit">
<tr>
<th><label for="key"><?php __("RSA Key"); ?></label></th>
<td><textarea class="int" name="key" id="key" style="width: 420px; height: 120px;"></textarea></td>
</tr>
<tr>
<th><label for="crt"><?php __("SSL Certificate"); ?></label></th>
<td><textarea class="int" name="crt" id="crt" style="width: 420px; height: 120px;"></textarea></td>
</tr>
<tr>
<th><label for="chain"><?php __("Chained Certificate<br />(not mandatory)"); ?></label></th>
<td><textarea class="int" name="chain" id="chain" style="width: 420px; height: 120px;"></textarea></td>
</tr>
</table>
<p>
<input type="submit" class="inb ok" name="submit" value="<?php __("Save"); ?>"/> &nbsp;
<input type="button" class="inb cancel" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='ssl_list.php'"/>
</p>
</form>
</div> <!-- create -->
<form method="post" action="ssl_doimport.php" name="main" id="main">
<table border="1" cellspacing="0" cellpadding="4" class="tedit">
<tr>
<th><label for="key"><?php __("RSA Key"); ?></label></th>
<td><textarea class="int" name="key" id="key" style="width: 420px; height: 120px;"></textarea></td>
</tr>
<tr>
<th><label for="crt"><?php __("SSL Certificate"); ?></label></th>
<td><textarea class="int" name="crt" id="crt" style="width: 420px; height: 120px;"></textarea></td>
</tr>
<tr>
<th><label for="chain"><?php __("Chained Certificate<br />(not mandatory)"); ?></label></th>
<td><textarea class="int" name="chain" id="chain" style="width: 420px; height: 120px;"></textarea></td>
</tr>
</table>
<p>
<input type="submit" class="inb ok" name="submit" value="<?php __("Save"); ?>"/> &nbsp;
<input type="button" class="inb cancel" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location = 'ssl_list.php'"/>
</p>
</form>
</div> <!-- create -->
</div>
</div>
</div>
<script type="text/javascript">
$("#tabsssl").tabs(<?php if ($crt!="" and $key!="") echo "{ active: 'tabsssl-import' }"; ?>);
$("#tabsssl").tabs(<?php if ($crt != "" and $key != "") echo "{ active: 'tabsssl-import' }"; ?>);
</script>
<?php
include_once("foot.php");
include_once("foot.php");
?>

View File

@ -1,44 +1,45 @@
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
require_once("../class/config.php");
if (!$admin->enabled) {
__("This page is restricted to authorized staff");
exit();
__("This page is restricted to authorized staff");
exit();
}
$fields = array (
"id" => array ("request", "integer", 0),
"action" => array ("request", "integer", 0),
);
$fields = array(
"id" => array("request", "integer", 0),
"action" => array("request", "integer", 0),
);
getFields($fields);
if ($ssl->share($id,$action)) {
require_once("ssl_view.php");
if ($ssl->share($id, $action)) {
require_once("ssl_view.php");
} else {
require_once("ssl_list.php");
require_once("ssl_list.php");
}

View File

@ -1,197 +1,200 @@
<?php
/*
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
----------------------------------------------------------------------
AlternC - Web Hosting System
Copyright (C) 2002 by the AlternC Development Team.
http://alternc.org/
----------------------------------------------------------------------
LICENSE
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
To read the license please visit http://www.gnu.org/copyleft/gpl.html
----------------------------------------------------------------------
Original Author of file: Benjamin Sonntag
Purpose of file: Create / Import an SSL Certificate
----------------------------------------------------------------------
*/
require_once("../class/config.php");
if ( !isset($is_include) ) {
$fields = array (
"id" => array ("request", "integer", ""),
);
getFields($fields);
if (!isset($is_include)) {
$fields = array(
"id" => array("request", "integer", ""),
);
getFields($fields);
}
$cert=$ssl->get_certificate($id);
$error=$err->errstr();
$cert = $ssl->get_certificate($id);
$error = $err->errstr();
if ($error) {
require_once("ssl_list.php");
exit();
require_once("ssl_list.php");
exit();
}
include_once("head.php");
if ($info) {
echo "<p class=\"alert alert-info\">$info</p>";
echo "<p class=\"alert alert-info\">$info</p>";
}
if ($cert["status"]==$ssl::STATUS_PENDING) {
?>
<h3><?php __("Pending Certificate"); ?></h3>
<p><?php __("Your <i>Certificate Request File</i> (CSR) has been created, along with its <i>private RSA Key</i> (KEY). Please find below the CSR you must send to your SSL Certificate provider."); ?></p>
<p><?php __("Once you'll have your <i>Certificate File</i> (CRT) and a <i>Chained Certificate File</i> (CHAIN), please paste them here to finish the enrollment."); ?></p>
<form method="post" action="ssl_finalize.php" name="main" id="main">
<input type="hidden" name="id" id="id" value="<?php echo $cert["id"]; ?>"/>
<table border="1" cellspacing="0" cellpadding="4" class="tedit">
<tr>
<th><label for="fqdn"><?php __("Fully Qualified Domain Name"); ?></label></th>
<td><?php echo $cert["fqdn"]; ?></td>
</tr>
<tr>
<th><label for="validstart"><?php __("Date of the request"); ?></label></th>
<td><?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d H:i:s",$cert["validstartts"])); ?></td>
</tr>
<tr>
<th><label for="csr"><?php __("Certificate Request File"); ?></label></th>
<td><textarea readonly="readonly" onclick="this.focus();this.select()" class="int cert" name="csr" id="csr" style="width: 500px; height: 120px;"><?php echo $cert["sslcsr"]; ?></textarea></td>
</tr>
<tr>
<th><label for="crt"><?php __("SSL Certificate"); ?></label></th>
<td><textarea class="int cert" name="crt" id="crt" style="width: 500px; height: 120px;"><?php echo $cert["sslcrt"]; ?></textarea></td>
</tr>
<tr>
<th><label for="chain"><?php __("Chained Certificate<br />(not mandatory)"); ?></label></th>
<td><textarea class="int cert" name="chain" id="chain" style="width: 500px; height: 120px;"><?php echo $cert["sslchain"]; ?></textarea></td>
</tr>
</table>
<p>
<input type="submit" class="inb ok" name="submit" value="<?php __("Save"); ?>"/> &nbsp;
<input type="button" class="inb cancel" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location='ssl_list.php'"/>
</p>
</form>
<?php
}
else {
if ($cert["status"]==$ssl::STATUS_OK) {
?>
<h3><?php __("Valid Certificate"); ?></h3>
<p><?php __("Please find below your valid certificate data."); ?></p>
<?php
}
if ($cert["status"]==$ssl::STATUS_EXPIRED) {
?>
<h3><?php __("EXPIRED Certificate"); ?></h3>
<p><?php __("Your certificate is EXPIRED. You should not use it for any purpose. Please find below its data."); ?></p>
<?php
}
?>
<p>
<span class="inb ok"><a href="ssl_list.php"><?php __("Back to my SSL Certificates"); ?></a></span>
</p>
<table border="1" cellspacing="0" cellpadding="4" class="tedit">
<tr>
<th><?php __("Valid From:"); ?></th>
<td><?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d H:i:s",$cert["validstartts"]));
echo " ";
$days=intval((time()-$cert["validstartts"])/86400);
if ($days<60) {
printf(_("(%d days ago)"),$days);
} else {
$month=intval($days/30);
printf(_("(%d month ago)"),$month);
}
?></td>
</tr>
<tr>
<th><?php __("Valid Until:"); ?></th>
<td><?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'),date("Y-m-d H:i:s",$cert["validendts"]));
echo " ";
$days=intval(($cert["validendts"]-time())/86400);
if ($days<60) {
printf(_("(%d days from now)"),$days);
} else {
$month=intval($days/30);
printf(_("(%d month from now)"),$month);
}
?></td>
</tr>
<tr>
<th><?php __("FQDN:"); ?></th>
<td><?php echo $cert["fqdn"]; ?></td>
</tr>
<tr>
<th><?php __("Other Valid FQDN:"); ?></th>
<td><?php echo nl2br($cert["altnames"]); ?></td>
</tr>
<tr>
<th><label for="csr"><?php __("Certificate Request File"); ?></label></th>
<td><textarea readonly="readonly" onclick="this.focus();this.select()" class="int cert" name="csr" id="csr" style="width: 500px; height: 120px;"><?php echo $cert["sslcsr"]; ?></textarea></td>
</tr>
<tr>
<th><label for="crt"><?php __("SSL Certificate"); ?></label></th>
<td><textarea readonly="readonly" onclick="this.focus();this.select()" class="int cert" name="crt" id="crt" style="width: 500px; height: 120px;"><?php echo $cert["sslcrt"]; ?></textarea></td>
</tr>
<tr>
<th><label for="chain"><?php __("Chained Certificate<br />(not mandatory)"); ?></label></th>
<td><textarea readonly="readonly" onclick="this.focus();this.select()" class="int cert" name="chain" id="chain" style="width: 500px; height: 120px;"><?php echo $cert["sslchain"]; ?></textarea></td>
</tr>
</table>
<?php
// The admin is allowed to share (or not share) his valid certificates
if ($admin->enabled) {
?>
<p><?php __("As an administrator you can allow any account on this server to use this certificate to host his services. <br />(This is only useful for wildcard or multi-domain certificates)."); ?></p>
<p>
<?php
if ($cert["shared"]) {
echo _("This certificate is currently <b>shared</b>");
if ($cert["uid"]==$cuid) {
?>
</p>
<form method="post" action="ssl_share.php">
<input type="hidden" name="id" id="id" value="<?php echo $cert["id"]; ?>"/>
<input type="hidden" name="action" id="action" value="0" />
<input class="inb cancel" type="submit" name="unshare" value="<?php __("Click here to stop sharing this certificate"); ?>" />
</form>
<?php
}
} else {
echo _("This certificate is currently <b>NOT shared</b>");
if ($cert["uid"]==$cuid) {
if ($cert["status"] == $ssl::STATUS_PENDING) {
?>
<h3><?php __("Pending Certificate"); ?></h3>
<p><?php __("Your <i>Certificate Request File</i> (CSR) has been created, along with its <i>private RSA Key</i> (KEY). Please find below the CSR you must send to your SSL Certificate provider."); ?></p>
<p><?php __("Once you'll have your <i>Certificate File</i> (CRT) and a <i>Chained Certificate File</i> (CHAIN), please paste them here to finish the enrollment."); ?></p>
<form method="post" action="ssl_finalize.php" name="main" id="main">
<input type="hidden" name="id" id="id" value="<?php echo $cert["id"]; ?>"/>
<table border="1" cellspacing="0" cellpadding="4" class="tedit">
<tr>
<th><label for="fqdn"><?php __("Fully Qualified Domain Name"); ?></label></th>
<td><?php echo $cert["fqdn"]; ?></td>
</tr>
<tr>
<th><label for="validstart"><?php __("Date of the request"); ?></label></th>
<td><?php echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'), date("Y-m-d H:i:s", $cert["validstartts"])); ?></td>
</tr>
<tr>
<th><label for="csr"><?php __("Certificate Request File"); ?></label></th>
<td><textarea readonly="readonly" onclick="this.focus();
this.select()" class="int cert" name="csr" id="csr" style="width: 500px; height: 120px;"><?php echo $cert["sslcsr"]; ?></textarea></td>
</tr>
<tr>
<th><label for="crt"><?php __("SSL Certificate"); ?></label></th>
<td><textarea class="int cert" name="crt" id="crt" style="width: 500px; height: 120px;"><?php echo $cert["sslcrt"]; ?></textarea></td>
</tr>
<tr>
<th><label for="chain"><?php __("Chained Certificate<br />(not mandatory)"); ?></label></th>
<td><textarea class="int cert" name="chain" id="chain" style="width: 500px; height: 120px;"><?php echo $cert["sslchain"]; ?></textarea></td>
</tr>
</table>
<p>
<input type="submit" class="inb ok" name="submit" value="<?php __("Save"); ?>"/> &nbsp;
<input type="button" class="inb cancel" name="cancel" value="<?php __("Cancel"); ?>" onclick="document.location = 'ssl_list.php'"/>
</p>
</form>
<?php
} else {
if ($cert["status"] == $ssl::STATUS_OK) {
?>
<h3><?php __("Valid Certificate"); ?></h3>
<p><?php __("Please find below your valid certificate data."); ?></p>
<?php
}
if ($cert["status"] == $ssl::STATUS_EXPIRED) {
?>
<h3><?php __("EXPIRED Certificate"); ?></h3>
<p><?php __("Your certificate is EXPIRED. You should not use it for any purpose. Please find below its data."); ?></p>
<?php
}
?>
<p>
<span class="inb ok"><a href="ssl_list.php"><?php __("Back to my SSL Certificates"); ?></a></span>
</p>
<form method="post" action="ssl_share.php">
<input type="hidden" name="id" id="id" value="<?php echo $cert["id"]; ?>"/>
<input type="hidden" name="action" id="action" value="1" />
<input class="inb ok" type="submit" name="unshare" value="<?php __("Click here to share this certificate"); ?>" />
</form>
<?php
}
}
<table border="1" cellspacing="0" cellpadding="4" class="tedit">
<tr>
<th><?php __("Valid From:"); ?></th>
<td><?php
echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'), date("Y-m-d H:i:s", $cert["validstartts"]));
echo " ";
$days = intval((time() - $cert["validstartts"]) / 86400);
if ($days < 60) {
printf(_("(%d days ago)"), $days);
} else {
$month = intval($days / 30);
printf(_("(%d month ago)"), $month);
}
?></td>
</tr>
<tr>
<th><?php __("Valid Until:"); ?></th>
<td><?php
echo format_date(_('%3$d-%2$d-%1$d %4$d:%5$d'), date("Y-m-d H:i:s", $cert["validendts"]));
echo " ";
$days = intval(($cert["validendts"] - time()) / 86400);
if ($days < 60) {
printf(_("(%d days from now)"), $days);
} else {
$month = intval($days / 30);
printf(_("(%d month from now)"), $month);
}
?></td>
</tr>
<tr>
<th><?php __("FQDN:"); ?></th>
<td><?php echo $cert["fqdn"]; ?></td>
</tr>
<tr>
<th><?php __("Other Valid FQDN:"); ?></th>
<td><?php echo nl2br($cert["altnames"]); ?></td>
</tr>
<tr>
<th><label for="csr"><?php __("Certificate Request File"); ?></label></th>
<td><textarea readonly="readonly" onclick="this.focus();
this.select()" class="int cert" name="csr" id="csr" style="width: 500px; height: 120px;"><?php echo $cert["sslcsr"]; ?></textarea></td>
</tr>
<tr>
<th><label for="crt"><?php __("SSL Certificate"); ?></label></th>
<td><textarea readonly="readonly" onclick="this.focus();
this.select()" class="int cert" name="crt" id="crt" style="width: 500px; height: 120px;"><?php echo $cert["sslcrt"]; ?></textarea></td>
</tr>
<tr>
<th><label for="chain"><?php __("Chained Certificate<br />(not mandatory)"); ?></label></th>
<td><textarea readonly="readonly" onclick="this.focus();
this.select()" class="int cert" name="chain" id="chain" style="width: 500px; height: 120px;"><?php echo $cert["sslchain"]; ?></textarea></td>
</tr>
</table>
<?php
// The admin is allowed to share (or not share) his valid certificates
if ($admin->enabled) {
?>
<p><?php __("As an administrator you can allow any account on this server to use this certificate to host his services. <br />(This is only useful for wildcard or multi-domain certificates)."); ?></p>
<p>
<?php
if ($cert["shared"]) {
echo _("This certificate is currently <b>shared</b>");
if ($cert["uid"] == $cuid) {
?>
</p>
<form method="post" action="ssl_share.php">
<input type="hidden" name="id" id="id" value="<?php echo $cert["id"]; ?>"/>
<input type="hidden" name="action" id="action" value="0" />
<input class="inb cancel" type="submit" name="unshare" value="<?php __("Click here to stop sharing this certificate"); ?>" />
</form>
<?php
}
} else {
echo _("This certificate is currently <b>NOT shared</b>");
if ($cert["uid"] == $cuid) {
?>
</p>
<form method="post" action="ssl_share.php">
<input type="hidden" name="id" id="id" value="<?php echo $cert["id"]; ?>"/>
<input type="hidden" name="action" id="action" value="1" />
<input class="inb ok" type="submit" name="unshare" value="<?php __("Click here to share this certificate"); ?>" />
</form>
<?php
}
}
}
?>
<?php
}
?>
<?php
}
?>
<?php include_once("foot.php"); ?>

File diff suppressed because it is too large Load Diff