fomfields for admin/domains and some fixes in tablelistings

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-03-10 16:39:49 +01:00
parent 5def8c1635
commit 9c60cf006f
13 changed files with 224 additions and 137 deletions

View File

@@ -33,15 +33,15 @@ if ($page == 'domains' || $page == 'overview') {
if ($action == '') { if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_domains"); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_domains");
try { try {
$domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.domains.php'; $domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.domains.php';
$collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Domains::class, $userinfo)) $collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Domains::class, $userinfo))
->has('customer', \Froxlor\Api\Commands\Customers::class, 'customerid', 'customerid') ->has('customer', \Froxlor\Api\Commands\Customers::class, 'customerid', 'customerid')
->withPagination($domain_list_data['domain_list']['columns']); ->withPagination($domain_list_data['domain_list']['columns']);
$customerCollection = (new \Froxlor\UI\Collection(Customers::class, $userinfo)); $customerCollection = (new \Froxlor\UI\Collection(Customers::class, $userinfo));
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); \Froxlor\UI\Response::dynamic_error($e->getMessage());
} }
$actions_links = false; $actions_links = false;
if (($userinfo['domains_used'] < $userinfo['domains'] || $userinfo['domains'] == '-1') && $customerCollection->count() != 0) { if (($userinfo['domains_used'] < $userinfo['domains'] || $userinfo['domains'] == '-1') && $customerCollection->count() != 0) {
@@ -124,7 +124,9 @@ if ($page == 'domains' || $page == 'overview') {
)); ));
} else { } else {
$customers = \Froxlor\UI\HTML::makeoption($lng['panel']['please_choose'], 0, 0, true); $customers = [
0 => $lng['panel']['please_choose']
];
$result_customers_stmt = Database::prepare(" $result_customers_stmt = Database::prepare("
SELECT `customerid`, `loginname`, `name`, `firstname`, `company` SELECT `customerid`, `loginname`, `name`, `firstname`, `company`
FROM `" . TABLE_PANEL_CUSTOMERS . "` " . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '" . (int) $userinfo['adminid'] . "' ") . " ORDER BY COALESCE(NULLIF(`name`,''), `company`) ASC"); FROM `" . TABLE_PANEL_CUSTOMERS . "` " . ($userinfo['customers_see_all'] ? '' : " WHERE `adminid` = '" . (int) $userinfo['adminid'] . "' ") . " ORDER BY COALESCE(NULLIF(`name`,''), `company`) ASC");
@@ -135,10 +137,10 @@ if ($page == 'domains' || $page == 'overview') {
Database::pexecute($result_customers_stmt, $params); Database::pexecute($result_customers_stmt, $params);
while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) {
$customers .= \Froxlor\UI\HTML::makeoption(\Froxlor\User::getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid']); $customers[$row_customer['customerid']] = \Froxlor\User::getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')';
} }
$admins = ''; $admins = [];
if ($userinfo['customers_see_all'] == '1') { if ($userinfo['customers_see_all'] == '1') {
$result_admins_stmt = Database::query(" $result_admins_stmt = Database::query("
@@ -147,7 +149,7 @@ if ($page == 'domains' || $page == 'overview') {
WHERE `domains_used` < `domains` OR `domains` = '-1' ORDER BY `name` ASC"); WHERE `domains_used` < `domains` OR `domains` = '-1' ORDER BY `name` ASC");
while ($row_admin = $result_admins_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_admin = $result_admins_stmt->fetch(PDO::FETCH_ASSOC)) {
$admins .= \Froxlor\UI\HTML::makeoption(\Froxlor\User::getCorrectFullUserDetails($row_admin) . ' (' . $row_admin['loginname'] . ')', $row_admin['adminid'], $userinfo['adminid']); $admins[$row_admin['adminid']] = \Froxlor\User::getCorrectFullUserDetails($row_admin) . ' (' . $row_admin['loginname'] . ')';
} }
} }
@@ -182,7 +184,7 @@ if ($page == 'domains' || $page == 'overview') {
} }
// Build array holding all IPs and Ports available to this admin // Build array holding all IPs and Ports available to this admin
$ipsandports = array(); $ipsandports = [];
while ($row_ipandport = $result_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_ipandport = $result_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
if (filter_var($row_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { if (filter_var($row_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
@@ -190,12 +192,12 @@ if ($page == 'domains' || $page == 'overview') {
} }
$ipsandports[] = array( $ipsandports[] = array(
'label' => $row_ipandport['ip'] . ':' . $row_ipandport['port'] . '<br />', 'label' => $row_ipandport['ip'] . ':' . $row_ipandport['port'],
'value' => $row_ipandport['id'] 'value' => $row_ipandport['id']
); );
} }
$ssl_ipsandports = array(); $ssl_ipsandports = [];
while ($row_ssl_ipandport = $result_ssl_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_ssl_ipandport = $result_ssl_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
if (filter_var($row_ssl_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { if (filter_var($row_ssl_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
@@ -203,18 +205,18 @@ if ($page == 'domains' || $page == 'overview') {
} }
$ssl_ipsandports[] = array( $ssl_ipsandports[] = array(
'label' => $row_ssl_ipandport['ip'] . ':' . $row_ssl_ipandport['port'] . '<br />', 'label' => $row_ssl_ipandport['ip'] . ':' . $row_ssl_ipandport['port'],
'value' => $row_ssl_ipandport['id'] 'value' => $row_ssl_ipandport['id']
); );
} }
$standardsubdomains = array(); $standardsubdomains = [];
$result_standardsubdomains_stmt = Database::query(" $result_standardsubdomains_stmt = Database::query("
SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` WHERE `d`.`id` = `c`.`standardsubdomain` SELECT `id` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` WHERE `d`.`id` = `c`.`standardsubdomain`
"); ");
while ($row_standardsubdomain = $result_standardsubdomains_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_standardsubdomain = $result_standardsubdomains_stmt->fetch(PDO::FETCH_ASSOC)) {
$standardsubdomains[] = $row_standardsubdomain['id']; $standardsubdomains[$row_standardsubdomain['id']] = $row_standardsubdomain['id'];
} }
if (count($standardsubdomains) > 0) { if (count($standardsubdomains) > 0) {
@@ -223,7 +225,9 @@ if ($page == 'domains' || $page == 'overview') {
$standardsubdomains = ''; $standardsubdomains = '';
} }
$domains = \Froxlor\UI\HTML::makeoption($lng['domains']['noaliasdomain'], 0, NULL, true); $domains = [
0 => $lng['domains']['noaliasdomain']
];
$result_domains_stmt = Database::prepare(" $result_domains_stmt = Database::prepare("
SELECT `d`.`id`, `d`.`domain`, `c`.`loginname` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` SELECT `d`.`id`, `d`.`domain`, `c`.`loginname` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c`
WHERE `d`.`aliasdomain` IS NULL AND `d`.`parentdomainid` = 0" . $standardsubdomains . ($userinfo['customers_see_all'] ? '' : " AND `d`.`adminid` = :adminid") . " WHERE `d`.`aliasdomain` IS NULL AND `d`.`parentdomainid` = 0" . $standardsubdomains . ($userinfo['customers_see_all'] ? '' : " AND `d`.`adminid` = :adminid") . "
@@ -236,10 +240,12 @@ if ($page == 'domains' || $page == 'overview') {
Database::pexecute($result_domains_stmt, $params); Database::pexecute($result_domains_stmt, $params);
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']) . ' (' . $row_domain['loginname'] . ')', $row_domain['id']); $domains[$row_domain['id']] = $idna_convert->decode($row_domain['domain']) . ' (' . $row_domain['loginname'] . ')';
} }
$subtodomains = \Froxlor\UI\HTML::makeoption($lng['domains']['nosubtomaindomain'], 0, NULL, true); $subtodomains = [
0 => $lng['domains']['nosubtomaindomain']
];
$result_domains_stmt = Database::prepare(" $result_domains_stmt = Database::prepare("
SELECT `d`.`id`, `d`.`domain`, `c`.`loginname` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` SELECT `d`.`id`, `d`.`domain`, `c`.`loginname` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c`
WHERE `d`.`aliasdomain` IS NULL AND `d`.`parentdomainid` = 0 AND `d`.`ismainbutsubto` = 0 " . $standardsubdomains . ($userinfo['customers_see_all'] ? '' : " AND `d`.`adminid` = :adminid") . " WHERE `d`.`aliasdomain` IS NULL AND `d`.`parentdomainid` = 0 AND `d`.`ismainbutsubto` = 0 " . $standardsubdomains . ($userinfo['customers_see_all'] ? '' : " AND `d`.`adminid` = :adminid") . "
@@ -249,10 +255,10 @@ if ($page == 'domains' || $page == 'overview') {
Database::pexecute($result_domains_stmt, $params); Database::pexecute($result_domains_stmt, $params);
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$subtodomains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']) . ' (' . $row_domain['loginname'] . ')', $row_domain['id']); $subtodomains[$row_domain['id']] = $idna_convert->decode($row_domain['domain']) . ' (' . $row_domain['loginname'] . ')';
} }
$phpconfigs = ''; $phpconfigs = [];
$configs = Database::query(" $configs = Database::query("
SELECT c.*, fc.description as interpreter SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
@@ -261,32 +267,33 @@ if ($page == 'domains' || $page == 'overview') {
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) { while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) { if ((int) Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs .= \Froxlor\UI\HTML::makeoption($row['description'] . " [" . $row['interpreter'] . "]", $row['id'], Settings::Get('phpfpm.defaultini'), true, true); $phpconfigs[$row['id']] = $row['description'] . " [" . $row['interpreter'] . "]";
} else { } else {
$phpconfigs .= \Froxlor\UI\HTML::makeoption($row['description'], $row['id'], Settings::Get('system.mod_fcgid_defaultini'), true, true); $phpconfigs[$row['id']] = $row['description'];
} }
} }
// create serveralias options // create serveralias options
$serveraliasoptions = ""; $serveraliasoptions = [
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_wildcard'], '0', Settings::Get('system.domaindefaultalias'), true, true); 0 => $lng['domains']['serveraliasoption_wildcard'],
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_www'], '1', Settings::Get('system.domaindefaultalias'), true, true); 1 => $lng['domains']['serveraliasoption_www'],
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_none'], '2', Settings::Get('system.domaindefaultalias'), true, true); 2 => $lng['domains']['serveraliasoption_none']
];
$subcanemaildomain = \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['never'], '0', '0', true, true); $subcanemaildomain = [
$subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', '0', true, true); 0 => $lng['admin']['subcanemaildomain']['never'],
$subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['choosableyes'], '2', '0', true, true); 1 => $lng['admin']['subcanemaildomain']['choosableno'],
$subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['always'], '3', '0', true, true); 2 => $lng['admin']['subcanemaildomain']['choosableyes'],
3 => $lng['admin']['subcanemaildomain']['always']
$add_date = date('Y-m-d'); ];
$domain_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_add.php'; $domain_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_add.php';
$domain_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($domain_add_data);
$title = $domain_add_data['domain_add']['title']; UI::twigBuffer('user/form.html.twig', [
$image = $domain_add_data['domain_add']['image']; 'formaction' => $linker->getLink(array('section' => 'domains')),
'formdata' => $domain_add_data['domain_add']
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains_add") . "\";"); ]);
UI::twigOutputBuffer();
} }
} elseif ($action == 'edit' && $id != 0) { } elseif ($action == 'edit' && $id != 0) {
@@ -341,7 +348,7 @@ if ($page == 'domains' || $page == 'overview') {
if (in_array($domain_emails_row['email_full'], $domain_emails_row['destination'])) { if (in_array($domain_emails_row['email_full'], $domain_emails_row['destination'])) {
$email_forwarders -= 1; $email_forwarders -= 1;
$email_accounts ++; $email_accounts++;
} }
} }
} }
@@ -375,7 +382,7 @@ if ($page == 'domains' || $page == 'overview') {
} else { } else {
if (Settings::Get('panel.allow_domain_change_customer') == '1') { if (Settings::Get('panel.allow_domain_change_customer') == '1') {
$customers = ''; $customers = [];
$result_customers_stmt = Database::prepare(" $result_customers_stmt = Database::prepare("
SELECT `customerid`, `loginname`, `name`, `firstname`, `company` FROM `" . TABLE_PANEL_CUSTOMERS . "` SELECT `customerid`, `loginname`, `name`, `firstname`, `company` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE ( (`subdomains_used` + :subdomains <= `subdomains` OR `subdomains` = '-1' ) WHERE ( (`subdomains_used` + :subdomains <= `subdomains` OR `subdomains` = '-1' )
@@ -397,7 +404,7 @@ if ($page == 'domains' || $page == 'overview') {
Database::pexecute($result_customers_stmt, $params); Database::pexecute($result_customers_stmt, $params);
while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_customer = $result_customers_stmt->fetch(PDO::FETCH_ASSOC)) {
$customers .= \Froxlor\UI\HTML::makeoption(\Froxlor\User::getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')', $row_customer['customerid'], $result['customerid']); $customers[$row_customer['customerid']] = \Froxlor\User::getCorrectFullUserDetails($row_customer) . ' (' . $row_customer['loginname'] . ')';
} }
} else { } else {
$customer_stmt = Database::prepare(" $customer_stmt = Database::prepare("
@@ -413,7 +420,7 @@ if ($page == 'domains' || $page == 'overview') {
if ($userinfo['customers_see_all'] == '1') { if ($userinfo['customers_see_all'] == '1') {
if (Settings::Get('panel.allow_domain_change_admin') == '1') { if (Settings::Get('panel.allow_domain_change_admin') == '1') {
$admins = ''; $admins = [];
$result_admins_stmt = Database::prepare(" $result_admins_stmt = Database::prepare("
SELECT `adminid`, `loginname`, `name` FROM `" . TABLE_PANEL_ADMINS . "` SELECT `adminid`, `loginname`, `name` FROM `" . TABLE_PANEL_ADMINS . "`
WHERE (`domains_used` < `domains` OR `domains` = '-1') OR `adminid` = :adminid ORDER BY `name` ASC WHERE (`domains_used` < `domains` OR `domains` = '-1') OR `adminid` = :adminid ORDER BY `name` ASC
@@ -423,7 +430,7 @@ if ($page == 'domains' || $page == 'overview') {
)); ));
while ($row_admin = $result_admins_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_admin = $result_admins_stmt->fetch(PDO::FETCH_ASSOC)) {
$admins .= \Froxlor\UI\HTML::makeoption(\Froxlor\User::getCorrectFullUserDetails($row_admin) . ' (' . $row_admin['loginname'] . ')', $row_admin['adminid'], $result['adminid']); $admins[$row_admin['adminid']] = \Froxlor\User::getCorrectFullUserDetails($row_admin) . ' (' . $row_admin['loginname'] . ')';
} }
} else { } else {
$admin_stmt = Database::prepare(" $admin_stmt = Database::prepare("
@@ -436,8 +443,9 @@ if ($page == 'domains' || $page == 'overview') {
} }
} }
$result['domain'] = $idna_convert->decode($result['domain']); $domains = [
$domains = \Froxlor\UI\HTML::makeoption($lng['domains']['noaliasdomain'], 0, null, true); 0 => $lng['domains']['noaliasdomain']
];
$result_domains_stmt = Database::prepare(" $result_domains_stmt = Database::prepare("
SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c`
@@ -451,10 +459,12 @@ if ($page == 'domains' || $page == 'overview') {
)); ));
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['aliasdomain']); $domains[$row_domain['id']] = $idna_convert->decode($row_domain['domain']);
} }
$subtodomains = \Froxlor\UI\HTML::makeoption($lng['domains']['nosubtomaindomain'], 0, null, true); $subtodomains = [
0 => $lng['domains']['nosubtomaindomain']
];
$result_domains_stmt = Database::prepare(" $result_domains_stmt = Database::prepare("
SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c` SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d`, `" . TABLE_PANEL_CUSTOMERS . "` `c`
WHERE `d`.`aliasdomain` IS NULL AND `d`.`parentdomainid` = '0' AND `d`.`id` <> :id WHERE `d`.`aliasdomain` IS NULL AND `d`.`parentdomainid` = '0' AND `d`.`id` <> :id
@@ -470,7 +480,7 @@ if ($page == 'domains' || $page == 'overview') {
Database::pexecute($result_domains_stmt, $params); Database::pexecute($result_domains_stmt, $params);
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
$subtodomains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id'], $result['ismainbutsubto']); $subtodomains[$row_domain['id']] = $idna_convert->decode($row_domain['domain']);
} }
if ($userinfo['ip'] == "-1") { if ($userinfo['ip'] == "-1") {
@@ -503,97 +513,98 @@ if ($page == 'domains' || $page == 'overview') {
)); ));
} }
$ipsandports = array(); $ipsandports = [];
while ($row_ipandport = $result_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_ipandport = $result_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
if (filter_var($row_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { if (filter_var($row_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row_ipandport['ip'] = '[' . $row_ipandport['ip'] . ']'; $row_ipandport['ip'] = '[' . $row_ipandport['ip'] . ']';
} }
$ipsandports[] = array( $ipsandports[] = array(
'label' => $row_ipandport['ip'] . ':' . $row_ipandport['port'] . '<br />', 'label' => $row_ipandport['ip'] . ':' . $row_ipandport['port'],
'value' => $row_ipandport['id'] 'value' => $row_ipandport['id']
); );
} }
$ssl_ipsandports = array(); $ssl_ipsandports = [];
while ($row_ssl_ipandport = $result_ssl_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) { while ($row_ssl_ipandport = $result_ssl_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
if (filter_var($row_ssl_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) { if (filter_var($row_ssl_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row_ssl_ipandport['ip'] = '[' . $row_ssl_ipandport['ip'] . ']'; $row_ssl_ipandport['ip'] = '[' . $row_ssl_ipandport['ip'] . ']';
} }
$ssl_ipsandports[] = array( $ssl_ipsandports[] = array(
'label' => $row_ssl_ipandport['ip'] . ':' . $row_ssl_ipandport['port'] . '<br />', 'label' => $row_ssl_ipandport['ip'] . ':' . $row_ssl_ipandport['port'],
'value' => $row_ssl_ipandport['id'] 'value' => $row_ssl_ipandport['id']
); );
} }
// create serveralias options // check that letsencrypt is not activated for wildcard domain
$serveraliasoptions = "";
$_value = '2';
if ($result['iswildcarddomain'] == '1') { if ($result['iswildcarddomain'] == '1') {
$_value = '0';
$letsencrypt = 0; $letsencrypt = 0;
} elseif ($result['wwwserveralias'] == '1') {
$_value = '1';
} }
// Fudge the result for ssl_redirect to hide the Let's Encrypt steps // Fudge the result for ssl_redirect to hide the Let's Encrypt steps
$result['temporary_ssl_redirect'] = $result['ssl_redirect']; $result['temporary_ssl_redirect'] = $result['ssl_redirect'];
$result['ssl_redirect'] = ($result['ssl_redirect'] == 0 ? 0 : 1); $result['ssl_redirect'] = ($result['ssl_redirect'] == 0 ? 0 : 1);
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_wildcard'], '0', $_value, true, true); $serveraliasoptions = [
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_www'], '1', $_value, true, true); 0 => $lng['domains']['serveraliasoption_wildcard'],
$serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_none'], '2', $_value, true, true); 1 => $lng['domains']['serveraliasoption_www'],
2 => $lng['domains']['serveraliasoption_none']
];
$subcanemaildomain = \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['never'], '0', $result['subcanemaildomain'], true, true); $subcanemaildomain = [
$subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', $result['subcanemaildomain'], true, true); 0 => $lng['admin']['subcanemaildomain']['never'],
$subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['choosableyes'], '2', $result['subcanemaildomain'], true, true); 1 => $lng['admin']['subcanemaildomain']['choosableno'],
$subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['always'], '3', $result['subcanemaildomain'], true, true); 2 => $lng['admin']['subcanemaildomain']['choosableyes'],
$speciallogfile = ($result['speciallogfile'] == 1 ? $lng['panel']['yes'] : $lng['panel']['no']); 3 => $lng['admin']['subcanemaildomain']['always']
$result['add_date'] = date('Y-m-d', $result['add_date']); ];
$phpconfigs = ''; $phpconfigs = [];
$phpconfigs_result_stmt = Database::query(" $phpconfigs_result_stmt = Database::query("
SELECT c.*, fc.description as interpreter SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
"); ");
$c_allowed_configs = \Froxlor\Customer\Customer::getCustomerDetail($result['customerid'], 'allowed_phpconfigs'); $c_allowed_configs = \Froxlor\Customer\Customer::getCustomerDetail($result['customerid'], 'allowed_phpconfigs');
if (! empty($c_allowed_configs)) { if (!empty($c_allowed_configs)) {
$c_allowed_configs = json_decode($c_allowed_configs, true); $c_allowed_configs = json_decode($c_allowed_configs, true);
} else { } else {
$c_allowed_configs = array(); $c_allowed_configs = array();
} }
while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) { while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) {
$disabled = ! empty($c_allowed_configs) && ! in_array($phpconfigs_row['id'], $c_allowed_configs); $disabled = !empty($c_allowed_configs) && !in_array($phpconfigs_row['id'], $c_allowed_configs);
if ((int) Settings::Get('phpfpm.enabled') == 1) { if (!$disabled) {
$phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]", $phpconfigs_row['id'], $result['phpsettingid'], true, true, null, $disabled); if ((int) Settings::Get('phpfpm.enabled') == 1) {
} else { $phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]";
$phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'], $phpconfigs_row['id'], $result['phpsettingid'], true, true, null, $disabled); } else {
$phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'];
}
} }
} }
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
if (Settings::Get('panel.allow_domain_change_customer') != '1') { if (Settings::Get('panel.allow_domain_change_customer') != '1') {
$result['customername'] .= ' (<a href="' . $linker->getLink(array('section' => 'customers', 'page' => 'customers', $result['customername'] .= ' (<a href="' . $linker->getLink(array(
'action' => 'su', 'id' => $customer['customerid'])) . '" rel="external">' . $customer['loginname'] . '</a>)'; 'section' => 'customers', 'page' => 'customers',
'action' => 'su', 'id' => $customer['customerid']
)) . '" rel="external">' . $customer['loginname'] . '</a>)';
} }
$domain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_edit.php'; $domain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/domains/formfield.domains_edit.php';
$domain_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($domain_edit_data);
$title = $domain_edit_data['domain_edit']['title'];
$image = $domain_edit_data['domain_edit']['image'];
$speciallogwarning = sprintf($lng['admin']['speciallogwarning'], $lng['admin']['delete_statistics']); $speciallogwarning = sprintf($lng['admin']['speciallogwarning'], $lng['admin']['delete_statistics']);
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains_edit") . "\";"); UI::twigBuffer('user/form.html.twig', [
'formaction' => $linker->getLink(array('section' => 'domains', 'id' => $id)),
'formdata' => $domain_edit_data['domain_edit'],
'editid' => $id
]);
UI::twigOutputBuffer();
} }
} }
} elseif ($action == 'jqGetCustomerPHPConfigs') { } elseif ($action == 'jqGetCustomerPHPConfigs') {
$customerid = intval($_POST['customerid']); $customerid = intval($_POST['customerid']);
$allowed_phpconfigs = \Froxlor\Customer\Customer::getCustomerDetail($customerid, 'allowed_phpconfigs'); $allowed_phpconfigs = \Froxlor\Customer\Customer::getCustomerDetail($customerid, 'allowed_phpconfigs');
echo ! empty($allowed_phpconfigs) ? $allowed_phpconfigs : json_encode(array()); echo !empty($allowed_phpconfigs) ? $allowed_phpconfigs : json_encode([]);
exit(); exit();
} elseif ($action == 'import') { } elseif ($action == 'import') {
@@ -613,7 +624,7 @@ if ($page == 'domains' || $page == 'overview') {
\Froxlor\UI\Response::standard_error('domain_import_error', $e->getMessage()); \Froxlor\UI\Response::standard_error('domain_import_error', $e->getMessage());
} }
if (! empty($bulk->getErrors())) { if (!empty($bulk->getErrors())) {
\Froxlor\UI\Response::dynamic_error(implode("<br>", $bulk->getErrors())); \Froxlor\UI\Response::dynamic_error(implode("<br>", $bulk->getErrors()));
} }
@@ -622,7 +633,7 @@ if ($page == 'domains' || $page == 'overview') {
\Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST); \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_VHOST);
\Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS); \Froxlor\System\Cronjob::inserttask(\Froxlor\Cron\TaskId::REBUILD_DNS);
$result_str = $result['imported'] . ' / ' . $result['all'] . (! empty($result['note']) ? ' (' . $result['note'] . ')' : ''); $result_str = $result['imported'] . ' / ' . $result['all'] . (!empty($result['note']) ? ' (' . $result['note'] . ')' : '');
\Froxlor\UI\Response::standard_success('domain_import_successfully', $result_str, array( \Froxlor\UI\Response::standard_success('domain_import_successfully', $result_str, array(
'filename' => $filename, 'filename' => $filename,
'action' => '', 'action' => '',
@@ -663,7 +674,7 @@ function formatDomainEntry(&$row, &$idna_convert)
$row['ipandport'] .= $rowip['ip'] . ':' . $rowip['port'] . "\n"; $row['ipandport'] .= $rowip['ip'] . ':' . $rowip['port'] . "\n";
} }
} }
$row['ipandport'] = substr($row['ipandport'], 0, - 1); $row['ipandport'] = substr($row['ipandport'], 0, -1);
$row['termination_date'] = str_replace("0000-00-00", "", $row['termination_date']); $row['termination_date'] = str_replace("0000-00-00", "", $row['termination_date']);
$row['termination_css'] = ""; $row['termination_css'] = "";

View File

@@ -21,7 +21,6 @@ const AREA = 'admin';
require __DIR__ . '/lib/init.php'; require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\IpsAndPorts; use Froxlor\Api\Commands\IpsAndPorts;
use Froxlor\Settings;
use Froxlor\UI\Panel\UI; use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request; use Froxlor\UI\Request;
@@ -32,10 +31,10 @@ if ($page == 'ipsandports' || $page == 'overview') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports"); $log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
try { try {
$ipsandports_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.ipsandports.php'; $ipsandports_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.ipsandports.php';
$collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\IpsAndPorts::class, $userinfo)) $collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\IpsAndPorts::class, $userinfo))
->withPagination($ipsandports_list_data['ipsandports_list']['columns']); ->withPagination($ipsandports_list_data['ipsandports_list']['columns']);
} catch (Exception $e) { } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage()); \Froxlor\UI\Response::dynamic_error($e->getMessage());
} }

View File

@@ -5,6 +5,7 @@ namespace Froxlor\UI\Callbacks;
use Froxlor\FileDir; use Froxlor\FileDir;
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\UI\Panel\UI; use Froxlor\UI\Panel\UI;
use Froxlor\Domain\Domain as DDomain;
/** /**
* This file is part of the Froxlor project. * This file is part of the Froxlor project.
@@ -22,6 +23,20 @@ use Froxlor\UI\Panel\UI;
*/ */
class Domain class Domain
{ {
public static function domainWithCustomerLink(array $attributes)
{
$linker = UI::getLinker();
$result = '<a href="https://' . $attributes['data'] . '" target="_blank">' . $attributes['data'] . '</a>';
$result .= ' (<a href="' . $linker->getLink([
'section' => 'customers',
'page' => 'customers',
'action' => 'su',
'sort' => $attributes['fields']['loginname'],
'id' => $attributes['fields']['customerid'],
]) . '">' . $attributes['fields']['loginname'] . '</a>)';
return $result;
}
public static function domainTarget(array $attributes) public static function domainTarget(array $attributes)
{ {
if (empty($attributes['fields']['aliasdomain'])) { if (empty($attributes['fields']['aliasdomain'])) {
@@ -85,14 +100,31 @@ class Domain
&& Settings::Get('system.dnsenabled') == '1'; && Settings::Get('system.dnsenabled') == '1';
} }
public function canEditSSL(array $attributes): bool public static function hasLetsEncryptActivated(array $attributes): bool
{ {
// FIXME: https://github.com/Froxlor/Froxlor/blob/master/templates/Sparkle/customer/domains/domains_domain.tpl#L41 return (bool) $attributes['fields']['letsencrypt'];
}
public static function canEditSSL(array $attributes): bool
{
if (
Settings::Get('system.use_ssl') == '1'
&& DDomain::domainHasSslIpPort($attributes['fields']['id'])
&& $attributes['fields']['caneditdomain'] == '1'
&& $attributes['fields']['letsencrypt'] == 0
) {
return true;
}
return false; return false;
} }
public function canEditAlias(array $attributes): bool public static function canEditAlias(array $attributes): bool
{ {
return !empty($attributes['fields']['domainaliasid']); return !empty($attributes['fields']['domainaliasid']);
} }
public static function isAssigned(array $attributes): bool
{
return ($attributes['fields']['parentdomainid'] == 0 && empty($attributes['fields']['domainaliasid']));
}
} }

View File

@@ -39,6 +39,7 @@ return array(
'label' => $lng['admin']['admin'], 'label' => $lng['admin']['admin'],
'type' => 'select', 'type' => 'select',
'select_var' => $admins, 'select_var' => $admins,
'selected' => $userinfo['adminid'],
'mandatory' => true 'mandatory' => true
), ),
'alias' => array( 'alias' => array(
@@ -63,7 +64,7 @@ return array(
'label' => $lng['domains']['add_date'], 'label' => $lng['domains']['add_date'],
'desc' => $lng['panel']['dateformat'], 'desc' => $lng['panel']['dateformat'],
'type' => 'label', 'type' => 'label',
'value' => $add_date 'value' => date('Y-m-d')
), ),
'registration_date' => array( 'registration_date' => array(
'label' => $lng['domains']['registration_date'], 'label' => $lng['domains']['registration_date'],
@@ -102,7 +103,8 @@ return array(
'label' => $lng['admin']['selectserveralias'], 'label' => $lng['admin']['selectserveralias'],
'desc' => $lng['admin']['selectserveralias_desc'], 'desc' => $lng['admin']['selectserveralias_desc'],
'type' => 'select', 'type' => 'select',
'select_var' => $serveraliasoptions 'select_var' => $serveraliasoptions,
'selected' => \Froxlor\Settings::Get('system.domaindefaultalias')
), ),
'speciallogfile' => array( 'speciallogfile' => array(
'label' => $lng['admin']['speciallogfile']['title'], 'label' => $lng['admin']['speciallogfile']['title'],
@@ -223,7 +225,7 @@ return array(
), ),
array( array(
'value' => 'TLSv1.3', 'value' => 'TLSv1.3',
'label' => 'TLSv1.3<' 'label' => 'TLSv1.3'
) )
), ),
'is_array' => 1 'is_array' => 1
@@ -328,7 +330,7 @@ return array(
'label' => $lng['admin']['phpsettings']['title'], 'label' => $lng['admin']['phpsettings']['title'],
'type' => 'select', 'type' => 'select',
'select_var' => $phpconfigs, 'select_var' => $phpconfigs,
'selected' => '@TODO' 'selected' => (int) \Froxlor\Settings::Get('phpfpm.enabled') == 1 ? \Froxlor\Settings::Get('phpfpm.defaultini') : \Froxlor\Settings::Get('system.mod_fcgid_defaultini')
), ),
'mod_fcgid_starter' => array( 'mod_fcgid_starter' => array(
'visible' => ((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false), 'visible' => ((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false),
@@ -380,7 +382,7 @@ return array(
'label' => $lng['admin']['subdomainforemail'], 'label' => $lng['admin']['subdomainforemail'],
'type' => 'select', 'type' => 'select',
'select_var' => $subcanemaildomain, 'select_var' => $subcanemaildomain,
'selected' => '@TODO' 'selected' => 0
), ),
'dkim' => array( 'dkim' => array(
'visible' => (\Froxlor\Settings::Get('dkim.use_dkim') == '1' ? true : false), 'visible' => (\Froxlor\Settings::Get('dkim.use_dkim') == '1' ? true : false),

View File

@@ -26,22 +26,23 @@ return array(
'domain' => array( 'domain' => array(
'label' => 'Domain', 'label' => 'Domain',
'type' => 'label', 'type' => 'label',
'value' => $result['domain'], 'value' => $result['domain_ace']
'mandatory' => true
), ),
'customerid' => array( 'customerid' => array(
'label' => $lng['admin']['customer'], 'label' => $lng['admin']['customer'],
'type' => (\Froxlor\Settings::Get('panel.allow_domain_change_customer') == '1' ? 'select' : 'label'), 'type' => (\Froxlor\Settings::Get('panel.allow_domain_change_customer') == '1' ? 'select' : 'infotext'),
'select_var' => (isset($customers) ? $customers : null), 'select_var' => (isset($customers) ? $customers : null),
'selected' => (isset($result['customername']) ? $result['customername'] : null), 'selected' => $result['customerid'],
'value' => (isset($result['customername']) ? $result['customername'] : null),
'mandatory' => true 'mandatory' => true
), ),
'adminid' => array( 'adminid' => array(
'visible' => ($userinfo['customers_see_all'] == '1' ? true : false), 'visible' => ($userinfo['customers_see_all'] == '1' ? true : false),
'label' => $lng['admin']['admin'], 'label' => $lng['admin']['admin'],
'type' => (\Froxlor\Settings::Get('panel.allow_domain_change_admin') == '1' ? 'select' : 'label'), 'type' => (\Froxlor\Settings::Get('panel.allow_domain_change_admin') == '1' ? 'select' : 'infotext'),
'select_var' => (isset($admins) ? $admins : null), 'select_var' => (!empty($admins) ? $admins : null),
'selected' => (isset($result['adminname']) ? $result['adminname'] : null), 'selected' => (isset($result['adminid']) ? $result['adminid'] : $userinfo['adminid']),
'value' => (isset($result['adminname']) ? $result['adminname'] : null),
'mandatory' => true 'mandatory' => true
), ),
'alias' => array( 'alias' => array(
@@ -49,14 +50,14 @@ return array(
'label' => $lng['domains']['aliasdomain'], 'label' => $lng['domains']['aliasdomain'],
'type' => 'select', 'type' => 'select',
'select_var' => $domains, 'select_var' => $domains,
'selected' => '@TODO' 'selected' => $result['aliasdomain']
), ),
'issubof' => array( 'issubof' => array(
'label' => $lng['domains']['issubof'], 'label' => $lng['domains']['issubof'],
'desc' => $lng['domains']['issubofinfo'], 'desc' => $lng['domains']['issubofinfo'],
'type' => 'select', 'type' => 'select',
'select_var' => $subtodomains, 'select_var' => $subtodomains,
'selected' => '@TODO' 'selected' => $result['ismainbutsubto']
), ),
'associated_info' => array( 'associated_info' => array(
'label' => $lng['domains']['associated_with_domain'], 'label' => $lng['domains']['associated_with_domain'],
@@ -74,7 +75,7 @@ return array(
'label' => $lng['domains']['add_date'], 'label' => $lng['domains']['add_date'],
'desc' => $lng['panel']['dateformat'], 'desc' => $lng['panel']['dateformat'],
'type' => 'label', 'type' => 'label',
'value' => $result['add_date'] 'value' => date('Y-m-d', (int) $result['add_date'])
), ),
'registration_date' => array( 'registration_date' => array(
'label' => $lng['domains']['registration_date'], 'label' => $lng['domains']['registration_date'],
@@ -117,7 +118,7 @@ return array(
'desc' => $lng['admin']['selectserveralias_desc'], 'desc' => $lng['admin']['selectserveralias_desc'],
'type' => 'select', 'type' => 'select',
'select_var' => $serveraliasoptions, 'select_var' => $serveraliasoptions,
'selected' => '@TODO' 'selected' => $result['iswildcarddomain'] == '1' ? 0 : ($result['wwwserveralias'] == '1' ? 1 : 2)
), ),
'speciallogfile' => array( 'speciallogfile' => array(
'label' => $lng['admin']['speciallogfile']['title'], 'label' => $lng['admin']['speciallogfile']['title'],
@@ -229,7 +230,7 @@ return array(
'label' => $lng['serversettings']['ssl']['ssl_protocols']['title'], 'label' => $lng['serversettings']['ssl']['ssl_protocols']['title'],
'desc' => $lng['serversettings']['ssl']['ssl_protocols']['description'], 'desc' => $lng['serversettings']['ssl']['ssl_protocols']['description'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => ! empty($result['ssl_protocols']) ? explode(",", $result['ssl_protocols']) : explode(",", \Froxlor\Settings::Get('system.ssl_protocols')), 'value' => !empty($result['ssl_protocols']) ? explode(",", $result['ssl_protocols']) : explode(",", \Froxlor\Settings::Get('system.ssl_protocols')),
'values' => array( 'values' => array(
array( array(
'value' => 'TLSv1', 'value' => 'TLSv1',
@@ -255,14 +256,14 @@ return array(
'label' => $lng['serversettings']['ssl']['ssl_cipher_list']['title'], 'label' => $lng['serversettings']['ssl']['ssl_cipher_list']['title'],
'desc' => $lng['serversettings']['ssl']['ssl_cipher_list']['description'], 'desc' => $lng['serversettings']['ssl']['ssl_cipher_list']['description'],
'type' => 'text', 'type' => 'text',
'value' => ! empty($result['ssl_cipher_list']) ? $result['ssl_cipher_list'] : \Froxlor\Settings::Get('system.ssl_cipher_list') 'value' => !empty($result['ssl_cipher_list']) ? $result['ssl_cipher_list'] : \Froxlor\Settings::Get('system.ssl_cipher_list')
), ),
'tlsv13_cipher_list' => array( 'tlsv13_cipher_list' => array(
'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' && \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1 ? true : false), 'visible' => (($ssl_ipsandports != '' ? true : false) && $userinfo['change_serversettings'] == '1' && \Froxlor\Settings::Get('system.webserver') == "apache2" && \Froxlor\Settings::Get('system.apache24') == 1 ? true : false),
'label' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['title'], 'label' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['title'],
'desc' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['description'], 'desc' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['description'],
'type' => 'text', 'type' => 'text',
'value' => ! empty($result['tlsv13_cipher_list']) ? $result['tlsv13_cipher_list'] : \Froxlor\Settings::Get('system.tlsv13_cipher_list') 'value' => !empty($result['tlsv13_cipher_list']) ? $result['tlsv13_cipher_list'] : \Froxlor\Settings::Get('system.tlsv13_cipher_list')
), ),
'ssl_specialsettings' => array( 'ssl_specialsettings' => array(
'visible' => ($userinfo['change_serversettings'] == '1' ? true : false), 'visible' => ($userinfo['change_serversettings'] == '1' ? true : false),
@@ -350,7 +351,7 @@ return array(
'label' => $lng['admin']['phpsettings']['title'], 'label' => $lng['admin']['phpsettings']['title'],
'type' => 'select', 'type' => 'select',
'select_var' => $phpconfigs, 'select_var' => $phpconfigs,
'selected' => '@TODO' 'selected' => $result['phpsettingid']
), ),
'phpsettingsforsubdomains' => array( 'phpsettingsforsubdomains' => array(
'visible' => ($userinfo['change_serversettings'] == '1' ? true : false), 'visible' => ($userinfo['change_serversettings'] == '1' ? true : false),
@@ -364,13 +365,13 @@ return array(
'visible' => ((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false), 'visible' => ((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false),
'label' => $lng['admin']['mod_fcgid_starter']['title'], 'label' => $lng['admin']['mod_fcgid_starter']['title'],
'type' => 'number', 'type' => 'number',
'value' => ((int) $result['mod_fcgid_starter'] != - 1 ? $result['mod_fcgid_starter'] : '') 'value' => ((int) $result['mod_fcgid_starter'] != -1 ? $result['mod_fcgid_starter'] : '')
), ),
'mod_fcgid_maxrequests' => array( 'mod_fcgid_maxrequests' => array(
'visible' => ((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false), 'visible' => ((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false),
'label' => $lng['admin']['mod_fcgid_maxrequests']['title'], 'label' => $lng['admin']['mod_fcgid_maxrequests']['title'],
'type' => 'number', 'type' => 'number',
'value' => ((int) $result['mod_fcgid_maxrequests'] != - 1 ? $result['mod_fcgid_maxrequests'] : '') 'value' => ((int) $result['mod_fcgid_maxrequests'] != -1 ? $result['mod_fcgid_maxrequests'] : '')
) )
) )
), ),
@@ -413,7 +414,7 @@ return array(
'label' => $lng['admin']['subdomainforemail'], 'label' => $lng['admin']['subdomainforemail'],
'type' => 'select', 'type' => 'select',
'select_var' => $subcanemaildomain, 'select_var' => $subcanemaildomain,
'selected' => '@TODO' 'selected' => $result['subcanemaildomain']
), ),
'dkim' => array( 'dkim' => array(
'visible' => (\Froxlor\Settings::Get('dkim.use_dkim') == '1' ? true : false), 'visible' => (\Froxlor\Settings::Get('dkim.use_dkim') == '1' ? true : false),

View File

@@ -43,14 +43,14 @@ return array(
'image' => 'icons/ipsports_add.png', 'image' => 'icons/ipsports_add.png',
'fields' => array( 'fields' => array(
'listen_statement' => array( 'listen_statement' => array(
'visible' => ! $is_nginx, 'visible' => ! \Froxlor\Settings::Get('system.webserver') == 'nginx',
'label' => $lng['admin']['ipsandports']['create_listen_statement'], 'label' => $lng['admin']['ipsandports']['create_listen_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
'checked' => true 'checked' => true
), ),
'namevirtualhost_statement' => array( 'namevirtualhost_statement' => array(
'visible' => $is_apache && ! $is_apache24, 'visible' => \Froxlor\Settings::Get('system.webserver') == 'apache2' && (int) \Froxlor\Settings::Get('system.apache24') == 0,
'label' => $lng['admin']['ipsandports']['create_namevirtualhost_statement'], 'label' => $lng['admin']['ipsandports']['create_namevirtualhost_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
@@ -75,7 +75,7 @@ return array(
'rows' => 12 'rows' => 12
), ),
'vhostcontainer_servername_statement' => array( 'vhostcontainer_servername_statement' => array(
'visible' => $is_apache, 'visible' => \Froxlor\Settings::Get('system.webserver') == 'apache2',
'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'], 'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',

View File

@@ -44,14 +44,14 @@ return array(
'image' => 'icons/ipsports_edit.png', 'image' => 'icons/ipsports_edit.png',
'fields' => array( 'fields' => array(
'listen_statement' => array( 'listen_statement' => array(
'visible' => ! $is_nginx, 'visible' => ! \Froxlor\Settings::Get('system.webserver') == 'nginx',
'label' => $lng['admin']['ipsandports']['create_listen_statement'], 'label' => $lng['admin']['ipsandports']['create_listen_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
'checked' => $result['listen_statement'] 'checked' => $result['listen_statement']
), ),
'namevirtualhost_statement' => array( 'namevirtualhost_statement' => array(
'visible' => $is_apache && ! $is_apache24, 'visible' => \Froxlor\Settings::Get('system.webserver') == 'apache2' && (int) \Froxlor\Settings::Get('system.apache24') == 0,
'label' => $lng['admin']['ipsandports']['create_namevirtualhost_statement'], 'label' => $lng['admin']['ipsandports']['create_namevirtualhost_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',
@@ -78,7 +78,7 @@ return array(
'value' => $result['specialsettings'] 'value' => $result['specialsettings']
), ),
'vhostcontainer_servername_statement' => array( 'vhostcontainer_servername_statement' => array(
'visible' => $is_apache, 'visible' => \Froxlor\Settings::Get('system.webserver') == 'apache2',
'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'], 'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'],
'type' => 'checkbox', 'type' => 'checkbox',
'value' => '1', 'value' => '1',

View File

@@ -82,10 +82,21 @@ return [
], ],
'visible' => [Domain::class, 'adminCanEditDNS'] 'visible' => [Domain::class, 'adminCanEditDNS']
], ],
'domainssleditor' => [
'icon' => 'fa fa-shield',
'title' => $lng['panel']['ssleditor'], // @todo different certificate types by $row['domain_hascert']
'href' => [
'section' => 'domains',
'page' => 'domainssleditor',
'action' => 'view',
'id' => ':id'
],
'visible' => [Domain::class, 'adminCanEditDNS']
],
'letsencrypt' => [ 'letsencrypt' => [
'icon' => 'fa fa-shield', 'icon' => 'fa fa-shield',
'title' => $lng['panel']['letsencrypt'], 'title' => $lng['panel']['letsencrypt'],
'visible' => ':letsencrypt' // @fixme 'visible' => [Domain::class, 'hasLetsEncryptActivated']
], ],
'delete' => [ 'delete' => [
'icon' => 'fa fa-trash', 'icon' => 'fa fa-trash',

View File

@@ -17,6 +17,7 @@
*/ */
use Froxlor\Settings; use Froxlor\Settings;
use Froxlor\UI\Callbacks\Domain;
use Froxlor\UI\Callbacks\SSLCertificate; use Froxlor\UI\Callbacks\SSLCertificate;
use Froxlor\UI\Callbacks\Text; use Froxlor\UI\Callbacks\Text;
use Froxlor\UI\Listing; use Froxlor\UI\Listing;
@@ -28,7 +29,8 @@ return [
'columns' => [ 'columns' => [
'd.domain' => [ 'd.domain' => [
'label' => $lng['domains']['domainname'], 'label' => $lng['domains']['domainname'],
'field' => 'domain', 'field' => 'domains.domain_ace',
'callback' => [Domain::class, 'domainWithCustomerLink'],
], ],
'c.domain' => [ 'c.domain' => [
'label' => $lng['ssl_certificates']['certificate_for'], 'label' => $lng['ssl_certificates']['certificate_for'],

View File

@@ -70,10 +70,37 @@ return [
], ],
'visible' => [Domain::class, 'canEditDNS'] 'visible' => [Domain::class, 'canEditDNS']
], ],
'domainssleditor' => [
'icon' => 'fa fa-shield',
'title' => $lng['panel']['ssleditor'], // @todo different certificate types by $row['domain_hascert']
'href' => [
'section' => 'domains',
'page' => 'domainssleditor',
'action' => 'view',
'id' => ':id'
],
'visible' => [Domain::class, 'adminCanEditDNS']
],
'letsencrypt' => [ 'letsencrypt' => [
'icon' => 'fa fa-shield', 'icon' => 'fa fa-shield',
'title' => $lng['panel']['letsencrypt'], 'title' => $lng['panel']['letsencrypt'],
'visible' => ':letsencrypt' // @fixme 'visible' => [Domain::class, 'hasLetsEncryptActivated']
],
'haslias' => [
'icon' => 'fa fa-arrow-up-right-from-square',
'title' => $lng['domains']['hasaliasdomains'],
'href' => [
'section' => 'domains',
'page' => 'domains',
'searchfield' => 'd.aliasdomain',
'searchtext' => ':id'
],
'visible' => [Domain::class, 'canEditAlias']
],
'isassigned' => [
'icon' => 'fa-check-to-slot',
'title' => $lng['domains']['isassigneddomain'],
'visible' => [Domain::class, 'isAssigned']
], ],
'delete' => [ 'delete' => [
'icon' => 'fa fa-trash', 'icon' => 'fa fa-trash',

View File

@@ -1,5 +1,5 @@
<?php <?php
if (! defined('AREA')) { if (!defined('AREA')) {
header("Location: index.php"); header("Location: index.php");
exit(); exit();
} }
@@ -39,7 +39,7 @@ if ($action == 'delete') {
try { try {
$json_result = Certificates::getLocal($userinfo, [ $json_result = Certificates::getLocal($userinfo, [
'id' => $id 'id' => $id
])->delete(); ])->delete();
$success_message = sprintf($lng['domains']['ssl_certificate_removed'], $id); $success_message = sprintf($lng['domains']['ssl_certificate_removed'], $id);
} catch (Exception $e) { } catch (Exception $e) {
Response::dynamic_error($e->getMessage()); Response::dynamic_error($e->getMessage());
@@ -50,14 +50,16 @@ if ($action == 'delete') {
$log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed domains::ssl_certificates"); $log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed domains::ssl_certificates");
try { try {
$certificates_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.sslcertificates.php'; $certificates_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.sslcertificates.php';
$collection = (new Collection(Certificates::class, $userinfo)) $collection = (new Collection(Certificates::class, $userinfo))
->withPagination($certificates_list_data['sslcertificates_list']['columns']); ->has('domains', \Froxlor\Api\Commands\Domains::class, 'domainid', 'id')
->has('customer', \Froxlor\Api\Commands\Customers::class, 'customerid', 'customerid')
->withPagination($certificates_list_data['sslcertificates_list']['columns']);
} catch (Exception $e) { } catch (Exception $e) {
Response::dynamic_error($e->getMessage()); Response::dynamic_error($e->getMessage());
} }
UI::twigBuffer('user/table.html.twig', [ UI::twigBuffer('user/table.html.twig', [
'listing' => Listing::format($collection, $certificates_list_data['sslcertificates_list']), 'listing' => Listing::format($collection, $certificates_list_data['sslcertificates_list']),
]); ]);
UI::twigOutputBuffer(); UI::twigOutputBuffer();

View File

@@ -82,7 +82,7 @@
{% if field.next_to is defined %} {% if field.next_to is defined %}
<div class="input-group"> <div class="input-group">
{% endif %} {% endif %}
<span {% if field.classes is defined %} class="{{ field.classes }}" {% endif %}>{{ field.value }}</span> <span {% if field.classes is defined %} class="{{ field.classes }}" {% endif %}>{{ field.value|raw }}</span>
{% if field.next_to is defined %} {% if field.next_to is defined %}
{% for nid, nfield in field.next_to %} {% for nid, nfield in field.next_to %}
{% if nfield.next_to_prefix is defined %} {% if nfield.next_to_prefix is defined %}

View File

@@ -1,4 +1,4 @@
<div class="alert alert-{{ type }} fade show pb-0" role="alert"> <div class="alert alert-{{ type }} fade show pb-1" role="alert">
{% if heading is defined and heading is not empty %} {% if heading is defined and heading is not empty %}
<h4 class="alert-heading"> <h4 class="alert-heading">
{{ heading }} {{ heading }}