2016-09-26 09:48:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file is part of the Froxlor project.
|
2022-04-28 18:48:00 +00:00
|
|
|
* Copyright (c) 2010 the Froxlor Team (see authors).
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
2016-09-26 09:48:36 +00:00
|
|
|
*
|
2022-04-28 18:48:00 +00:00
|
|
|
* 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.
|
2016-09-26 09:48:36 +00:00
|
|
|
*
|
2022-04-28 18:48:00 +00:00
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you can also view it online at
|
|
|
|
* https://files.froxlor.org/misc/COPYING.txt
|
2022-02-24 20:39:31 +00:00
|
|
|
*
|
2022-04-28 18:48:00 +00:00
|
|
|
* @copyright the authors
|
|
|
|
* @author Froxlor team <team@froxlor.org>
|
|
|
|
* @license https://files.froxlor.org/misc/COPYING.txt GPLv2
|
2016-09-26 09:48:36 +00:00
|
|
|
*/
|
|
|
|
|
2022-04-28 18:48:00 +00:00
|
|
|
if (!defined('AREA')) {
|
|
|
|
header("Location: index.php");
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2022-02-24 20:39:31 +00:00
|
|
|
use Froxlor\Api\Commands\Certificates;
|
2022-04-28 18:48:00 +00:00
|
|
|
use Froxlor\Api\Commands\Domains;
|
|
|
|
use Froxlor\Api\Commands\SubDomains;
|
|
|
|
use Froxlor\FroxlorLogger;
|
2022-02-24 20:39:31 +00:00
|
|
|
use Froxlor\UI\Collection;
|
|
|
|
use Froxlor\UI\Listing;
|
|
|
|
use Froxlor\UI\Panel\UI;
|
|
|
|
use Froxlor\UI\Response;
|
2018-12-18 12:45:05 +00:00
|
|
|
|
2016-09-26 09:48:36 +00:00
|
|
|
// This file is being included in admin_domains and customer_domains
|
2018-02-22 20:05:58 +00:00
|
|
|
// and therefore does not need to require lib/init.php
|
2016-09-26 09:48:36 +00:00
|
|
|
|
|
|
|
$success_message = "";
|
|
|
|
|
2017-01-10 07:37:50 +00:00
|
|
|
// do the delete and then just show a success-message and the certificates list again
|
2016-09-26 09:48:36 +00:00
|
|
|
if ($action == 'delete') {
|
2022-04-28 18:48:00 +00:00
|
|
|
$id = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
2016-09-26 09:48:36 +00:00
|
|
|
if ($id > 0) {
|
2018-03-05 13:21:36 +00:00
|
|
|
try {
|
2022-02-24 20:39:31 +00:00
|
|
|
$json_result = Certificates::getLocal($userinfo, [
|
2017-01-10 07:37:50 +00:00
|
|
|
'id' => $id
|
2022-03-10 15:39:49 +00:00
|
|
|
])->delete();
|
2022-04-28 18:48:00 +00:00
|
|
|
$success_message = lng('domains.ssl_certificate_removed', [$id]);
|
2018-03-05 13:21:36 +00:00
|
|
|
} catch (Exception $e) {
|
2022-04-28 18:48:00 +00:00
|
|
|
Response::dynamicError($e->getMessage());
|
2017-01-10 07:37:50 +00:00
|
|
|
}
|
2016-09-26 09:48:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-02-24 20:39:31 +00:00
|
|
|
$log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed domains::ssl_certificates");
|
|
|
|
|
2019-11-10 17:35:32 +00:00
|
|
|
try {
|
2022-03-18 18:25:25 +00:00
|
|
|
$certificates_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/tablelisting.sslcertificates.php';
|
2022-03-10 15:39:49 +00:00
|
|
|
$collection = (new Collection(Certificates::class, $userinfo))
|
2022-09-30 07:44:11 +00:00
|
|
|
->withPagination($certificates_list_data['sslcertificates_list']['columns'], $certificates_list_data['sslcertificates_list']['default_sorting']);
|
2022-03-26 13:09:16 +00:00
|
|
|
if ($userinfo['adminsession'] == 1) {
|
2022-04-28 18:48:00 +00:00
|
|
|
$collection->has('domains', Domains::class, 'domainid', 'id');
|
2022-03-18 18:25:25 +00:00
|
|
|
} else {
|
2022-04-28 18:48:00 +00:00
|
|
|
$collection->has('domains', SubDomains::class, 'domainid', 'id');
|
2022-03-18 18:25:25 +00:00
|
|
|
}
|
2019-11-10 17:35:32 +00:00
|
|
|
} catch (Exception $e) {
|
2022-04-28 18:48:00 +00:00
|
|
|
Response::dynamicError($e->getMessage());
|
2016-09-26 09:48:36 +00:00
|
|
|
}
|
|
|
|
|
2022-03-18 11:53:34 +00:00
|
|
|
UI::view('user/table.html.twig', [
|
2022-04-28 18:48:00 +00:00
|
|
|
'listing' => Listing::format($collection, $certificates_list_data, 'sslcertificates_list'),
|
2022-02-24 20:39:31 +00:00
|
|
|
]);
|