diff --git a/admin_domains.php b/admin_domains.php
index d56abe76..7b09a3ad 100644
--- a/admin_domains.php
+++ b/admin_domains.php
@@ -33,15 +33,15 @@ if ($page == 'domains' || $page == 'overview') {
if ($action == '') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_domains");
- try {
- $domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.domains.php';
- $collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Domains::class, $userinfo))
- ->has('customer', \Froxlor\Api\Commands\Customers::class, 'customerid', 'customerid')
- ->withPagination($domain_list_data['domain_list']['columns']);
- $customerCollection = (new \Froxlor\UI\Collection(Customers::class, $userinfo));
- } catch (Exception $e) {
- \Froxlor\UI\Response::dynamic_error($e->getMessage());
- }
+ try {
+ $domain_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.domains.php';
+ $collection = (new \Froxlor\UI\Collection(\Froxlor\Api\Commands\Domains::class, $userinfo))
+ ->has('customer', \Froxlor\Api\Commands\Customers::class, 'customerid', 'customerid')
+ ->withPagination($domain_list_data['domain_list']['columns']);
+ $customerCollection = (new \Froxlor\UI\Collection(Customers::class, $userinfo));
+ } catch (Exception $e) {
+ \Froxlor\UI\Response::dynamic_error($e->getMessage());
+ }
$actions_links = false;
if (($userinfo['domains_used'] < $userinfo['domains'] || $userinfo['domains'] == '-1') && $customerCollection->count() != 0) {
@@ -124,7 +124,9 @@ if ($page == 'domains' || $page == 'overview') {
));
} else {
- $customers = \Froxlor\UI\HTML::makeoption($lng['panel']['please_choose'], 0, 0, true);
+ $customers = [
+ 0 => $lng['panel']['please_choose']
+ ];
$result_customers_stmt = Database::prepare("
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");
@@ -135,10 +137,10 @@ if ($page == 'domains' || $page == 'overview') {
Database::pexecute($result_customers_stmt, $params);
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') {
$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");
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
- $ipsandports = array();
+ $ipsandports = [];
while ($row_ipandport = $result_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
if (filter_var($row_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
@@ -190,12 +192,12 @@ if ($page == 'domains' || $page == 'overview') {
}
$ipsandports[] = array(
- 'label' => $row_ipandport['ip'] . ':' . $row_ipandport['port'] . '
',
+ 'label' => $row_ipandport['ip'] . ':' . $row_ipandport['port'],
'value' => $row_ipandport['id']
);
}
- $ssl_ipsandports = array();
+ $ssl_ipsandports = [];
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)) {
@@ -203,18 +205,18 @@ if ($page == 'domains' || $page == 'overview') {
}
$ssl_ipsandports[] = array(
- 'label' => $row_ssl_ipandport['ip'] . ':' . $row_ssl_ipandport['port'] . '
',
+ 'label' => $row_ssl_ipandport['ip'] . ':' . $row_ssl_ipandport['port'],
'value' => $row_ssl_ipandport['id']
);
}
- $standardsubdomains = array();
+ $standardsubdomains = [];
$result_standardsubdomains_stmt = Database::query("
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)) {
- $standardsubdomains[] = $row_standardsubdomain['id'];
+ $standardsubdomains[$row_standardsubdomain['id']] = $row_standardsubdomain['id'];
}
if (count($standardsubdomains) > 0) {
@@ -223,7 +225,9 @@ if ($page == 'domains' || $page == 'overview') {
$standardsubdomains = '';
}
- $domains = \Froxlor\UI\HTML::makeoption($lng['domains']['noaliasdomain'], 0, NULL, true);
+ $domains = [
+ 0 => $lng['domains']['noaliasdomain']
+ ];
$result_domains_stmt = Database::prepare("
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") . "
@@ -236,10 +240,12 @@ if ($page == 'domains' || $page == 'overview') {
Database::pexecute($result_domains_stmt, $params);
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("
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") . "
@@ -249,10 +255,10 @@ if ($page == 'domains' || $page == 'overview') {
Database::pexecute($result_domains_stmt, $params);
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("
SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
@@ -261,32 +267,33 @@ if ($page == 'domains' || $page == 'overview') {
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
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 {
- $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
- $serveraliasoptions = "";
- $serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_wildcard'], '0', Settings::Get('system.domaindefaultalias'), true, true);
- $serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_www'], '1', Settings::Get('system.domaindefaultalias'), true, true);
- $serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_none'], '2', Settings::Get('system.domaindefaultalias'), true, true);
+ $serveraliasoptions = [
+ 0 => $lng['domains']['serveraliasoption_wildcard'],
+ 1 => $lng['domains']['serveraliasoption_www'],
+ 2 => $lng['domains']['serveraliasoption_none']
+ ];
- $subcanemaildomain = \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['never'], '0', '0', true, true);
- $subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', '0', true, true);
- $subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['choosableyes'], '2', '0', true, true);
- $subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['always'], '3', '0', true, true);
-
- $add_date = date('Y-m-d');
+ $subcanemaildomain = [
+ 0 => $lng['admin']['subcanemaildomain']['never'],
+ 1 => $lng['admin']['subcanemaildomain']['choosableno'],
+ 2 => $lng['admin']['subcanemaildomain']['choosableyes'],
+ 3 => $lng['admin']['subcanemaildomain']['always']
+ ];
$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'];
- $image = $domain_add_data['domain_add']['image'];
-
- eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains_add") . "\";");
+ UI::twigBuffer('user/form.html.twig', [
+ 'formaction' => $linker->getLink(array('section' => 'domains')),
+ 'formdata' => $domain_add_data['domain_add']
+ ]);
+ UI::twigOutputBuffer();
}
} 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'])) {
$email_forwarders -= 1;
- $email_accounts ++;
+ $email_accounts++;
}
}
}
@@ -375,7 +382,7 @@ if ($page == 'domains' || $page == 'overview') {
} else {
if (Settings::Get('panel.allow_domain_change_customer') == '1') {
- $customers = '';
+ $customers = [];
$result_customers_stmt = Database::prepare("
SELECT `customerid`, `loginname`, `name`, `firstname`, `company` FROM `" . TABLE_PANEL_CUSTOMERS . "`
WHERE ( (`subdomains_used` + :subdomains <= `subdomains` OR `subdomains` = '-1' )
@@ -397,7 +404,7 @@ if ($page == 'domains' || $page == 'overview') {
Database::pexecute($result_customers_stmt, $params);
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 {
$customer_stmt = Database::prepare("
@@ -413,7 +420,7 @@ if ($page == 'domains' || $page == 'overview') {
if ($userinfo['customers_see_all'] == '1') {
if (Settings::Get('panel.allow_domain_change_admin') == '1') {
- $admins = '';
+ $admins = [];
$result_admins_stmt = Database::prepare("
SELECT `adminid`, `loginname`, `name` FROM `" . TABLE_PANEL_ADMINS . "`
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)) {
- $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 {
$admin_stmt = Database::prepare("
@@ -436,8 +443,9 @@ if ($page == 'domains' || $page == 'overview') {
}
}
- $result['domain'] = $idna_convert->decode($result['domain']);
- $domains = \Froxlor\UI\HTML::makeoption($lng['domains']['noaliasdomain'], 0, null, true);
+ $domains = [
+ 0 => $lng['domains']['noaliasdomain']
+ ];
$result_domains_stmt = Database::prepare("
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)) {
- $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("
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
@@ -470,7 +480,7 @@ if ($page == 'domains' || $page == 'overview') {
Database::pexecute($result_domains_stmt, $params);
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") {
@@ -503,97 +513,98 @@ if ($page == 'domains' || $page == 'overview') {
));
}
- $ipsandports = array();
+ $ipsandports = [];
while ($row_ipandport = $result_ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
if (filter_var($row_ipandport['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row_ipandport['ip'] = '[' . $row_ipandport['ip'] . ']';
}
$ipsandports[] = array(
- 'label' => $row_ipandport['ip'] . ':' . $row_ipandport['port'] . '
',
+ 'label' => $row_ipandport['ip'] . ':' . $row_ipandport['port'],
'value' => $row_ipandport['id']
);
}
- $ssl_ipsandports = array();
+ $ssl_ipsandports = [];
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)) {
$row_ssl_ipandport['ip'] = '[' . $row_ssl_ipandport['ip'] . ']';
}
$ssl_ipsandports[] = array(
- 'label' => $row_ssl_ipandport['ip'] . ':' . $row_ssl_ipandport['port'] . '
',
+ 'label' => $row_ssl_ipandport['ip'] . ':' . $row_ssl_ipandport['port'],
'value' => $row_ssl_ipandport['id']
);
}
- // create serveralias options
- $serveraliasoptions = "";
- $_value = '2';
+ // check that letsencrypt is not activated for wildcard domain
if ($result['iswildcarddomain'] == '1') {
- $_value = '0';
$letsencrypt = 0;
- } elseif ($result['wwwserveralias'] == '1') {
- $_value = '1';
}
// Fudge the result for ssl_redirect to hide the Let's Encrypt steps
$result['temporary_ssl_redirect'] = $result['ssl_redirect'];
$result['ssl_redirect'] = ($result['ssl_redirect'] == 0 ? 0 : 1);
- $serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_wildcard'], '0', $_value, true, true);
- $serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_www'], '1', $_value, true, true);
- $serveraliasoptions .= \Froxlor\UI\HTML::makeoption($lng['domains']['serveraliasoption_none'], '2', $_value, true, true);
+ $serveraliasoptions = [
+ 0 => $lng['domains']['serveraliasoption_wildcard'],
+ 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 .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['choosableno'], '1', $result['subcanemaildomain'], true, true);
- $subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['choosableyes'], '2', $result['subcanemaildomain'], true, true);
- $subcanemaildomain .= \Froxlor\UI\HTML::makeoption($lng['admin']['subcanemaildomain']['always'], '3', $result['subcanemaildomain'], true, true);
- $speciallogfile = ($result['speciallogfile'] == 1 ? $lng['panel']['yes'] : $lng['panel']['no']);
- $result['add_date'] = date('Y-m-d', $result['add_date']);
+ $subcanemaildomain = [
+ 0 => $lng['admin']['subcanemaildomain']['never'],
+ 1 => $lng['admin']['subcanemaildomain']['choosableno'],
+ 2 => $lng['admin']['subcanemaildomain']['choosableyes'],
+ 3 => $lng['admin']['subcanemaildomain']['always']
+ ];
- $phpconfigs = '';
+ $phpconfigs = [];
$phpconfigs_result_stmt = Database::query("
SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fc ON fc.id = c.fpmsettingid
");
$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);
} else {
$c_allowed_configs = array();
}
while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) {
- $disabled = ! empty($c_allowed_configs) && ! in_array($phpconfigs_row['id'], $c_allowed_configs);
- if ((int) Settings::Get('phpfpm.enabled') == 1) {
- $phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]", $phpconfigs_row['id'], $result['phpsettingid'], true, true, null, $disabled);
- } else {
- $phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'], $phpconfigs_row['id'], $result['phpsettingid'], true, true, null, $disabled);
+ $disabled = !empty($c_allowed_configs) && !in_array($phpconfigs_row['id'], $c_allowed_configs);
+ if (!$disabled) {
+ if ((int) Settings::Get('phpfpm.enabled') == 1) {
+ $phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]";
+ } else {
+ $phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'];
+ }
}
}
- $result = \Froxlor\PhpHelper::htmlentitiesArray($result);
if (Settings::Get('panel.allow_domain_change_customer') != '1') {
- $result['customername'] .= ' (' . $customer['loginname'] . ')';
+ $result['customername'] .= ' (' . $customer['loginname'] . ')';
}
$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']);
- 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') {
$customerid = intval($_POST['customerid']);
$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();
} elseif ($action == 'import') {
@@ -613,7 +624,7 @@ if ($page == 'domains' || $page == 'overview') {
\Froxlor\UI\Response::standard_error('domain_import_error', $e->getMessage());
}
- if (! empty($bulk->getErrors())) {
+ if (!empty($bulk->getErrors())) {
\Froxlor\UI\Response::dynamic_error(implode("
", $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_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(
'filename' => $filename,
'action' => '',
@@ -663,7 +674,7 @@ function formatDomainEntry(&$row, &$idna_convert)
$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_css'] = "";
diff --git a/admin_ipsandports.php b/admin_ipsandports.php
index 86a6fb59..853bd09e 100644
--- a/admin_ipsandports.php
+++ b/admin_ipsandports.php
@@ -21,7 +21,6 @@ const AREA = 'admin';
require __DIR__ . '/lib/init.php';
use Froxlor\Api\Commands\IpsAndPorts;
-use Froxlor\Settings;
use Froxlor\UI\Panel\UI;
use Froxlor\UI\Request;
@@ -32,10 +31,10 @@ if ($page == 'ipsandports' || $page == 'overview') {
$log->logAction(\Froxlor\FroxlorLogger::ADM_ACTION, LOG_NOTICE, "viewed admin_ipsandports");
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))
- ->withPagination($ipsandports_list_data['ipsandports_list']['columns']);
- } catch (Exception $e) {
+ ->withPagination($ipsandports_list_data['ipsandports_list']['columns']);
+ } catch (Exception $e) {
\Froxlor\UI\Response::dynamic_error($e->getMessage());
}
diff --git a/lib/Froxlor/UI/Callbacks/Domain.php b/lib/Froxlor/UI/Callbacks/Domain.php
index 5510a496..3c758628 100644
--- a/lib/Froxlor/UI/Callbacks/Domain.php
+++ b/lib/Froxlor/UI/Callbacks/Domain.php
@@ -5,6 +5,7 @@ namespace Froxlor\UI\Callbacks;
use Froxlor\FileDir;
use Froxlor\Settings;
use Froxlor\UI\Panel\UI;
+use Froxlor\Domain\Domain as DDomain;
/**
* This file is part of the Froxlor project.
@@ -22,6 +23,20 @@ use Froxlor\UI\Panel\UI;
*/
class Domain
{
+ public static function domainWithCustomerLink(array $attributes)
+ {
+ $linker = UI::getLinker();
+ $result = '' . $attributes['data'] . '';
+ $result .= ' (' . $attributes['fields']['loginname'] . ')';
+ return $result;
+ }
+
public static function domainTarget(array $attributes)
{
if (empty($attributes['fields']['aliasdomain'])) {
@@ -85,14 +100,31 @@ class Domain
&& 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;
}
- public function canEditAlias(array $attributes): bool
+ public static function canEditAlias(array $attributes): bool
{
return !empty($attributes['fields']['domainaliasid']);
}
+
+ public static function isAssigned(array $attributes): bool
+ {
+ return ($attributes['fields']['parentdomainid'] == 0 && empty($attributes['fields']['domainaliasid']));
+ }
}
diff --git a/lib/formfields/admin/domains/formfield.domains_add.php b/lib/formfields/admin/domains/formfield.domains_add.php
index 018f16df..51b05fd7 100644
--- a/lib/formfields/admin/domains/formfield.domains_add.php
+++ b/lib/formfields/admin/domains/formfield.domains_add.php
@@ -39,6 +39,7 @@ return array(
'label' => $lng['admin']['admin'],
'type' => 'select',
'select_var' => $admins,
+ 'selected' => $userinfo['adminid'],
'mandatory' => true
),
'alias' => array(
@@ -63,7 +64,7 @@ return array(
'label' => $lng['domains']['add_date'],
'desc' => $lng['panel']['dateformat'],
'type' => 'label',
- 'value' => $add_date
+ 'value' => date('Y-m-d')
),
'registration_date' => array(
'label' => $lng['domains']['registration_date'],
@@ -102,7 +103,8 @@ return array(
'label' => $lng['admin']['selectserveralias'],
'desc' => $lng['admin']['selectserveralias_desc'],
'type' => 'select',
- 'select_var' => $serveraliasoptions
+ 'select_var' => $serveraliasoptions,
+ 'selected' => \Froxlor\Settings::Get('system.domaindefaultalias')
),
'speciallogfile' => array(
'label' => $lng['admin']['speciallogfile']['title'],
@@ -223,7 +225,7 @@ return array(
),
array(
'value' => 'TLSv1.3',
- 'label' => 'TLSv1.3<'
+ 'label' => 'TLSv1.3'
)
),
'is_array' => 1
@@ -328,7 +330,7 @@ return array(
'label' => $lng['admin']['phpsettings']['title'],
'type' => 'select',
'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(
'visible' => ((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false),
@@ -380,7 +382,7 @@ return array(
'label' => $lng['admin']['subdomainforemail'],
'type' => 'select',
'select_var' => $subcanemaildomain,
- 'selected' => '@TODO'
+ 'selected' => 0
),
'dkim' => array(
'visible' => (\Froxlor\Settings::Get('dkim.use_dkim') == '1' ? true : false),
diff --git a/lib/formfields/admin/domains/formfield.domains_edit.php b/lib/formfields/admin/domains/formfield.domains_edit.php
index bcf3d32c..6d63b7dd 100644
--- a/lib/formfields/admin/domains/formfield.domains_edit.php
+++ b/lib/formfields/admin/domains/formfield.domains_edit.php
@@ -26,22 +26,23 @@ return array(
'domain' => array(
'label' => 'Domain',
'type' => 'label',
- 'value' => $result['domain'],
- 'mandatory' => true
+ 'value' => $result['domain_ace']
),
'customerid' => array(
'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),
- 'selected' => (isset($result['customername']) ? $result['customername'] : null),
+ 'selected' => $result['customerid'],
+ 'value' => (isset($result['customername']) ? $result['customername'] : null),
'mandatory' => true
),
'adminid' => array(
'visible' => ($userinfo['customers_see_all'] == '1' ? true : false),
'label' => $lng['admin']['admin'],
- 'type' => (\Froxlor\Settings::Get('panel.allow_domain_change_admin') == '1' ? 'select' : 'label'),
- 'select_var' => (isset($admins) ? $admins : null),
- 'selected' => (isset($result['adminname']) ? $result['adminname'] : null),
+ 'type' => (\Froxlor\Settings::Get('panel.allow_domain_change_admin') == '1' ? 'select' : 'infotext'),
+ 'select_var' => (!empty($admins) ? $admins : null),
+ 'selected' => (isset($result['adminid']) ? $result['adminid'] : $userinfo['adminid']),
+ 'value' => (isset($result['adminname']) ? $result['adminname'] : null),
'mandatory' => true
),
'alias' => array(
@@ -49,14 +50,14 @@ return array(
'label' => $lng['domains']['aliasdomain'],
'type' => 'select',
'select_var' => $domains,
- 'selected' => '@TODO'
+ 'selected' => $result['aliasdomain']
),
'issubof' => array(
'label' => $lng['domains']['issubof'],
'desc' => $lng['domains']['issubofinfo'],
'type' => 'select',
'select_var' => $subtodomains,
- 'selected' => '@TODO'
+ 'selected' => $result['ismainbutsubto']
),
'associated_info' => array(
'label' => $lng['domains']['associated_with_domain'],
@@ -74,7 +75,7 @@ return array(
'label' => $lng['domains']['add_date'],
'desc' => $lng['panel']['dateformat'],
'type' => 'label',
- 'value' => $result['add_date']
+ 'value' => date('Y-m-d', (int) $result['add_date'])
),
'registration_date' => array(
'label' => $lng['domains']['registration_date'],
@@ -117,7 +118,7 @@ return array(
'desc' => $lng['admin']['selectserveralias_desc'],
'type' => 'select',
'select_var' => $serveraliasoptions,
- 'selected' => '@TODO'
+ 'selected' => $result['iswildcarddomain'] == '1' ? 0 : ($result['wwwserveralias'] == '1' ? 1 : 2)
),
'speciallogfile' => array(
'label' => $lng['admin']['speciallogfile']['title'],
@@ -229,7 +230,7 @@ return array(
'label' => $lng['serversettings']['ssl']['ssl_protocols']['title'],
'desc' => $lng['serversettings']['ssl']['ssl_protocols']['description'],
'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(
array(
'value' => 'TLSv1',
@@ -255,14 +256,14 @@ return array(
'label' => $lng['serversettings']['ssl']['ssl_cipher_list']['title'],
'desc' => $lng['serversettings']['ssl']['ssl_cipher_list']['description'],
'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(
'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'],
'desc' => $lng['serversettings']['ssl']['tlsv13_cipher_list']['description'],
'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(
'visible' => ($userinfo['change_serversettings'] == '1' ? true : false),
@@ -350,7 +351,7 @@ return array(
'label' => $lng['admin']['phpsettings']['title'],
'type' => 'select',
'select_var' => $phpconfigs,
- 'selected' => '@TODO'
+ 'selected' => $result['phpsettingid']
),
'phpsettingsforsubdomains' => array(
'visible' => ($userinfo['change_serversettings'] == '1' ? true : false),
@@ -364,13 +365,13 @@ return array(
'visible' => ((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false),
'label' => $lng['admin']['mod_fcgid_starter']['title'],
'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(
'visible' => ((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 ? true : false),
'label' => $lng['admin']['mod_fcgid_maxrequests']['title'],
'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'],
'type' => 'select',
'select_var' => $subcanemaildomain,
- 'selected' => '@TODO'
+ 'selected' => $result['subcanemaildomain']
),
'dkim' => array(
'visible' => (\Froxlor\Settings::Get('dkim.use_dkim') == '1' ? true : false),
diff --git a/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php b/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php
index 85fdc27b..05cea69c 100644
--- a/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php
+++ b/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php
@@ -43,14 +43,14 @@ return array(
'image' => 'icons/ipsports_add.png',
'fields' => array(
'listen_statement' => array(
- 'visible' => ! $is_nginx,
+ 'visible' => ! \Froxlor\Settings::Get('system.webserver') == 'nginx',
'label' => $lng['admin']['ipsandports']['create_listen_statement'],
'type' => 'checkbox',
'value' => '1',
'checked' => true
),
'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'],
'type' => 'checkbox',
'value' => '1',
@@ -75,7 +75,7 @@ return array(
'rows' => 12
),
'vhostcontainer_servername_statement' => array(
- 'visible' => $is_apache,
+ 'visible' => \Froxlor\Settings::Get('system.webserver') == 'apache2',
'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'],
'type' => 'checkbox',
'value' => '1',
diff --git a/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php b/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php
index 59bff462..52a4caf8 100644
--- a/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php
+++ b/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php
@@ -44,14 +44,14 @@ return array(
'image' => 'icons/ipsports_edit.png',
'fields' => array(
'listen_statement' => array(
- 'visible' => ! $is_nginx,
+ 'visible' => ! \Froxlor\Settings::Get('system.webserver') == 'nginx',
'label' => $lng['admin']['ipsandports']['create_listen_statement'],
'type' => 'checkbox',
'value' => '1',
'checked' => $result['listen_statement']
),
'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'],
'type' => 'checkbox',
'value' => '1',
@@ -78,7 +78,7 @@ return array(
'value' => $result['specialsettings']
),
'vhostcontainer_servername_statement' => array(
- 'visible' => $is_apache,
+ 'visible' => \Froxlor\Settings::Get('system.webserver') == 'apache2',
'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'],
'type' => 'checkbox',
'value' => '1',
diff --git a/lib/tablelisting/admin/tablelisting.domains.php b/lib/tablelisting/admin/tablelisting.domains.php
index ade40ddd..e20249f3 100644
--- a/lib/tablelisting/admin/tablelisting.domains.php
+++ b/lib/tablelisting/admin/tablelisting.domains.php
@@ -82,10 +82,21 @@ return [
],
'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' => [
'icon' => 'fa fa-shield',
'title' => $lng['panel']['letsencrypt'],
- 'visible' => ':letsencrypt' // @fixme
+ 'visible' => [Domain::class, 'hasLetsEncryptActivated']
],
'delete' => [
'icon' => 'fa fa-trash',
diff --git a/lib/tablelisting/admin/tablelisting.sslcertificates.php b/lib/tablelisting/admin/tablelisting.sslcertificates.php
index 3e7430e0..8d472167 100644
--- a/lib/tablelisting/admin/tablelisting.sslcertificates.php
+++ b/lib/tablelisting/admin/tablelisting.sslcertificates.php
@@ -17,6 +17,7 @@
*/
use Froxlor\Settings;
+use Froxlor\UI\Callbacks\Domain;
use Froxlor\UI\Callbacks\SSLCertificate;
use Froxlor\UI\Callbacks\Text;
use Froxlor\UI\Listing;
@@ -28,7 +29,8 @@ return [
'columns' => [
'd.domain' => [
'label' => $lng['domains']['domainname'],
- 'field' => 'domain',
+ 'field' => 'domains.domain_ace',
+ 'callback' => [Domain::class, 'domainWithCustomerLink'],
],
'c.domain' => [
'label' => $lng['ssl_certificates']['certificate_for'],
diff --git a/lib/tablelisting/customer/tablelisting.domains.php b/lib/tablelisting/customer/tablelisting.domains.php
index 113d432b..364e6fcc 100644
--- a/lib/tablelisting/customer/tablelisting.domains.php
+++ b/lib/tablelisting/customer/tablelisting.domains.php
@@ -70,10 +70,37 @@ return [
],
'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' => [
'icon' => 'fa fa-shield',
'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' => [
'icon' => 'fa fa-trash',
diff --git a/ssl_certificates.php b/ssl_certificates.php
index aa97141d..0d1857a4 100644
--- a/ssl_certificates.php
+++ b/ssl_certificates.php
@@ -1,5 +1,5 @@
$id
- ])->delete();
+ ])->delete();
$success_message = sprintf($lng['domains']['ssl_certificate_removed'], $id);
} catch (Exception $e) {
Response::dynamic_error($e->getMessage());
@@ -50,14 +50,16 @@ if ($action == 'delete') {
$log->logAction(FroxlorLogger::USR_ACTION, LOG_NOTICE, "viewed domains::ssl_certificates");
try {
- $certificates_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.sslcertificates.php';
- $collection = (new Collection(Certificates::class, $userinfo))
- ->withPagination($certificates_list_data['sslcertificates_list']['columns']);
+ $certificates_list_data = include_once dirname(__FILE__) . '/lib/tablelisting/admin/tablelisting.sslcertificates.php';
+ $collection = (new Collection(Certificates::class, $userinfo))
+ ->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) {
- Response::dynamic_error($e->getMessage());
+ Response::dynamic_error($e->getMessage());
}
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();
diff --git a/templates/Froxlor/form/formfields.html.twig b/templates/Froxlor/form/formfields.html.twig
index 977d0782..d9ce6be8 100644
--- a/templates/Froxlor/form/formfields.html.twig
+++ b/templates/Froxlor/form/formfields.html.twig
@@ -82,7 +82,7 @@
{% if field.next_to is defined %}