lot of formfield corrections; form-adjustments; implementing of add/edit for most customer_* pages
Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
@@ -153,6 +153,7 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
$admin_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_add.php';
|
||||
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'admins')),
|
||||
'formdata' => $admin_add_data['admin_add']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
@@ -200,6 +201,7 @@ if ($page == 'admins' && $userinfo['change_serversettings'] == '1') {
|
||||
$admin_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/admin/formfield.admin_edit.php';
|
||||
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'admins', 'id' => $id)),
|
||||
'formdata' => $admin_edit_data['admin_edit']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
|
||||
@@ -317,6 +317,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
|
||||
$customer_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_add.php';
|
||||
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'customers')),
|
||||
'formdata' => $customer_add_data['customer_add']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
@@ -402,6 +403,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
|
||||
$customer_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php';
|
||||
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'customers', 'id' => $id)),
|
||||
'formdata' => $customer_edit_data['customer_edit']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
|
||||
1
api.php
1
api.php
@@ -1,7 +1,6 @@
|
||||
<?php
|
||||
|
||||
use Froxlor\Api\Api;
|
||||
use voku\helper\AntiXSS;
|
||||
|
||||
require __DIR__ . '/vendor/autoload.php';
|
||||
require __DIR__ . '/lib/tables.inc.php';
|
||||
|
||||
@@ -23,6 +23,7 @@ use Froxlor\Api\Commands\Certificates as Certificates;
|
||||
use Froxlor\Api\Commands\SubDomains as SubDomains;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\UI\Panel\UI;
|
||||
use Froxlor\UI\Request;
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
@@ -67,7 +68,7 @@ if ($page == 'overview') {
|
||||
foreach ($result['list'] as $row) {
|
||||
formatDomainEntry($row, $idna_convert);
|
||||
if ($row['parentdomainid'] == '0' && $row['caneditdomain'] == '1') {
|
||||
$parentdomains_count ++;
|
||||
$parentdomains_count++;
|
||||
}
|
||||
$domain_array[$row['parentdomainname']][] = $row;
|
||||
}
|
||||
@@ -159,13 +160,12 @@ if ($page == 'overview') {
|
||||
Database::pexecute($stmt, array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
$domains = '';
|
||||
|
||||
$domains = [];
|
||||
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row['domain']), $row['domain']);
|
||||
$domains[$row['domain']] = $idna_convert->decode($row['domain']);
|
||||
}
|
||||
|
||||
$aliasdomains = \Froxlor\UI\HTML::makeoption($lng['domains']['noaliasdomain'], 0, NULL, true);
|
||||
$aliasdomains[0] = $lng['domains']['noaliasdomain'];
|
||||
$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`.`id` <> `c`.`standardsubdomain`
|
||||
@@ -179,19 +179,19 @@ if ($page == 'overview') {
|
||||
));
|
||||
|
||||
while ($row_domain = $domains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$aliasdomains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']), $row_domain['id']);
|
||||
$aliasdomains[$row_domain['id']] = $idna_convert->decode($row_domain['domain']);
|
||||
}
|
||||
|
||||
$redirectcode = '';
|
||||
$redirectcode = [];
|
||||
if (Settings::Get('customredirect.enabled') == '1') {
|
||||
$codes = \Froxlor\Domain\Domain::getRedirectCodesArray();
|
||||
foreach ($codes as $rc) {
|
||||
$redirectcode .= \Froxlor\UI\HTML::makeoption($rc['code'] . ' (' . $lng['redirect_desc'][$rc['desc']] . ')', $rc['id']);
|
||||
$redirectcode[$rc['id']] = $rc['code'] . ' (' . $lng['redirect_desc'][$rc['desc']] . ')';
|
||||
}
|
||||
}
|
||||
|
||||
// check if we at least have one ssl-ip/port, #1179
|
||||
$ssl_ipsandports = '';
|
||||
$ssl_ipsandports = false;
|
||||
$ssl_ip_stmt = Database::prepare("
|
||||
SELECT COUNT(*) as countSSL
|
||||
FROM `" . TABLE_PANEL_IPSANDPORTS . "` pip
|
||||
@@ -201,16 +201,17 @@ if ($page == 'overview') {
|
||||
Database::pexecute($ssl_ip_stmt);
|
||||
$resultX = $ssl_ip_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
if (isset($resultX['countSSL']) && (int) $resultX['countSSL'] > 0) {
|
||||
$ssl_ipsandports = 'notempty';
|
||||
$ssl_ipsandports = true;
|
||||
}
|
||||
|
||||
$openbasedir = \Froxlor\UI\HTML::makeoption($lng['domain']['docroot'], 0, NULL, true) . \Froxlor\UI\HTML::makeoption($lng['domain']['homedir'], 1, NULL, true);
|
||||
$openbasedir = [
|
||||
0 => $lng['domain']['docroot'],
|
||||
1 => $lng['domain']['homedir']
|
||||
];
|
||||
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
|
||||
|
||||
$phpconfigs = '';
|
||||
$has_phpconfigs = false;
|
||||
if (isset($userinfo['allowed_phpconfigs']) && ! empty($userinfo['allowed_phpconfigs'])) {
|
||||
$has_phpconfigs = true;
|
||||
$phpconfigs = [];
|
||||
if (isset($userinfo['allowed_phpconfigs']) && !empty($userinfo['allowed_phpconfigs'])) {
|
||||
$allowed_cfg = json_decode($userinfo['allowed_phpconfigs'], JSON_OBJECT_AS_ARRAY);
|
||||
$phpconfigs_result_stmt = Database::query("
|
||||
SELECT c.*, fc.description as interpreter
|
||||
@@ -220,20 +221,20 @@ if ($page == 'overview') {
|
||||
");
|
||||
while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
if ((int) Settings::Get('phpfpm.enabled') == 1) {
|
||||
$phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]", $phpconfigs_row['id'], Settings::Get('phpfpm.defaultini'), true, true);
|
||||
$phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]";
|
||||
} else {
|
||||
$phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'], $phpconfigs_row['id'], Settings::Get('system.mod_fcgid_defaultini'), true, true);
|
||||
$phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$subdomain_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/domains/formfield.domains_add.php';
|
||||
$subdomain_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($subdomain_add_data);
|
||||
|
||||
$title = $subdomain_add_data['domain_add']['title'];
|
||||
$image = $subdomain_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' => $subdomain_add_data['domain_add']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
@@ -261,7 +262,7 @@ if ($page == 'overview') {
|
||||
} else {
|
||||
$result['domain'] = $idna_convert->decode($result['domain']);
|
||||
|
||||
$domains = \Froxlor\UI\HTML::makeoption($lng['domains']['noaliasdomain'], 0, $result['aliasdomain'], true);
|
||||
$domains[0] = $lng['domains']['noaliasdomain'];
|
||||
// also check ip/port combination to be the same, #176
|
||||
$domains_stmt = Database::prepare("SELECT `d`.`id`, `d`.`domain` FROM `" . TABLE_PANEL_DOMAINS . "` `d` , `" . TABLE_PANEL_CUSTOMERS . "` `c` , `" . TABLE_DOMAINTOIP . "` `dip`
|
||||
WHERE `d`.`aliasdomain` IS NULL
|
||||
@@ -282,7 +283,7 @@ if ($page == 'overview') {
|
||||
));
|
||||
|
||||
while ($row_domain = $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']);
|
||||
}
|
||||
|
||||
if (preg_match('/^https?\:\/\//', $result['documentroot']) && \Froxlor\Validate\Validate::validateUrl($result['documentroot'])) {
|
||||
@@ -298,17 +299,17 @@ if ($page == 'overview') {
|
||||
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $result['documentroot']);
|
||||
}
|
||||
|
||||
$redirectcode = '';
|
||||
$redirectcode = [];
|
||||
if (Settings::Get('customredirect.enabled') == '1') {
|
||||
$def_code = \Froxlor\Domain\Domain::getDomainRedirectId($id);
|
||||
$codes = \Froxlor\Domain\Domain::getRedirectCodesArray();
|
||||
foreach ($codes as $rc) {
|
||||
$redirectcode .= \Froxlor\UI\HTML::makeoption($rc['code'] . ' (' . $lng['redirect_desc'][$rc['desc']] . ')', $rc['id'], $def_code);
|
||||
$redirectcode[$rc['id']] = $rc['code'] . ' (' . $lng['redirect_desc'][$rc['desc']] . ')';
|
||||
}
|
||||
}
|
||||
|
||||
// check if we at least have one ssl-ip/port, #1179
|
||||
$ssl_ipsandports = '';
|
||||
$ssl_ipsandports = false;
|
||||
$ssl_ip_stmt = Database::prepare("
|
||||
SELECT COUNT(*) as countSSL
|
||||
FROM `" . TABLE_PANEL_IPSANDPORTS . "` pip
|
||||
@@ -320,26 +321,29 @@ if ($page == 'overview') {
|
||||
));
|
||||
$resultX = $ssl_ip_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
if (isset($resultX['countSSL']) && (int) $resultX['countSSL'] > 0) {
|
||||
$ssl_ipsandports = 'notempty';
|
||||
$ssl_ipsandports = true;
|
||||
}
|
||||
|
||||
// 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);
|
||||
|
||||
$openbasedir = \Froxlor\UI\HTML::makeoption($lng['domain']['docroot'], 0, $result['openbasedir_path'], true) . \Froxlor\UI\HTML::makeoption($lng['domain']['homedir'], 1, $result['openbasedir_path'], true);
|
||||
$openbasedir = [
|
||||
0 => $lng['domain']['docroot'],
|
||||
1 => $lng['domain']['homedir']
|
||||
];
|
||||
|
||||
// create serveralias options
|
||||
$serveraliasoptions = "";
|
||||
$_value = '2';
|
||||
$serveraliasoptions = [];
|
||||
$serveraliasoptions_selected = '2';
|
||||
if ($result['iswildcarddomain'] == '1') {
|
||||
$_value = '0';
|
||||
$serveraliasoptions_selected = '0';
|
||||
} elseif ($result['wwwserveralias'] == '1') {
|
||||
$_value = '1';
|
||||
$serveraliasoptions_selected = '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'];
|
||||
$serveraliasoptions[1] = $lng['domains']['serveraliasoption_www'];
|
||||
$serveraliasoptions[2] = $lng['domains']['serveraliasoption_none'];
|
||||
|
||||
$ips_stmt = Database::prepare("SELECT `p`.`ip` AS `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` `p`
|
||||
LEFT JOIN `" . TABLE_DOMAINTOIP . "` `dip`
|
||||
@@ -349,15 +353,13 @@ if ($page == 'overview') {
|
||||
Database::pexecute($ips_stmt, array(
|
||||
"id_domain" => $result['id']
|
||||
));
|
||||
$result_ipandport['ip'] = '';
|
||||
$domainips = [];
|
||||
while ($rowip = $ips_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$result_ipandport['ip'] .= $rowip['ip'] . "<br />";
|
||||
$domainips[] = ['item' => $rowip['ip']];
|
||||
}
|
||||
|
||||
$phpconfigs = '';
|
||||
$has_phpconfigs = false;
|
||||
if (isset($userinfo['allowed_phpconfigs']) && ! empty($userinfo['allowed_phpconfigs'])) {
|
||||
$has_phpconfigs = true;
|
||||
$phpconfigs = [];
|
||||
if (isset($userinfo['allowed_phpconfigs']) && !empty($userinfo['allowed_phpconfigs'])) {
|
||||
$allowed_cfg = json_decode($userinfo['allowed_phpconfigs'], JSON_OBJECT_AS_ARRAY);
|
||||
$phpconfigs_result_stmt = Database::query("
|
||||
SELECT c.*, fc.description as interpreter
|
||||
@@ -367,9 +369,9 @@ if ($page == 'overview') {
|
||||
");
|
||||
while ($phpconfigs_row = $phpconfigs_result_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
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);
|
||||
$phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'] . " [" . $phpconfigs_row['interpreter'] . "]";
|
||||
} else {
|
||||
$phpconfigs .= \Froxlor\UI\HTML::makeoption($phpconfigs_row['description'], $phpconfigs_row['id'], $result['phpsettingid'], true, true);
|
||||
$phpconfigs[$phpconfigs_row['id']] = $phpconfigs_row['description'];
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -380,16 +382,15 @@ if ($page == 'overview') {
|
||||
));
|
||||
$alias_check = $alias_check['count'];
|
||||
|
||||
$domainip = $result_ipandport['ip'];
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
|
||||
$subdomain_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/domains/formfield.domains_edit.php';
|
||||
$subdomain_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($subdomain_edit_data);
|
||||
|
||||
$title = $subdomain_edit_data['domain_edit']['title'];
|
||||
$image = $subdomain_edit_data['domain_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("domains/domains_edit") . "\";");
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'domains', 'id' => $id)),
|
||||
'formdata' => $subdomain_edit_data['domain_edit']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
} else {
|
||||
\Froxlor\UI\Response::standard_error('domains_canteditdomain');
|
||||
@@ -435,7 +436,7 @@ if ($page == 'overview') {
|
||||
|
||||
$do_insert = false;
|
||||
// if no entry can be found, behave like we have empty values
|
||||
if (! is_array($result) || ! isset($result['ssl_cert_file'])) {
|
||||
if (!is_array($result) || !isset($result['ssl_cert_file'])) {
|
||||
$result = array(
|
||||
'ssl_cert_file' => '',
|
||||
'ssl_key_file' => '',
|
||||
@@ -514,4 +515,3 @@ function formatDomainEntry(&$row, &$idna_convert)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -211,6 +211,7 @@ if ($page == 'overview') {
|
||||
unset($email_add_data['emails_add']['sections']['section_a']['fields']['iscatchall']);
|
||||
}
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'email')),
|
||||
'formdata' => $email_add_data['emails_add']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
@@ -260,6 +261,7 @@ if ($page == 'overview') {
|
||||
}
|
||||
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'email')),
|
||||
'formdata' => $email_edit_data['emails_edit']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
@@ -328,6 +330,7 @@ if ($page == 'overview') {
|
||||
$account_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_addaccount.php';
|
||||
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'email', 'id' => $id)),
|
||||
'formdata' => $account_add_data['emails_addaccount']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
@@ -366,12 +369,12 @@ if ($page == 'overview') {
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
|
||||
$account_changepw_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_accountchangepasswd.php';
|
||||
$account_changepw_form = \Froxlor\UI\HtmlForm::genHTMLForm($account_changepw_data);
|
||||
|
||||
$title = $account_changepw_data['emails_accountchangepasswd']['title'];
|
||||
$image = $account_changepw_data['emails_accountchangepasswd']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/account_changepw") . "\";");
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'email', 'id' => $id)),
|
||||
'formdata' => $account_changepw_data['emails_accountchangepasswd']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'changequota' && Settings::Get('system.mail_quota_enabled') == '1' && $id != 0) {
|
||||
@@ -402,12 +405,12 @@ if ($page == 'overview') {
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
|
||||
$quota_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_accountchangequota.php';
|
||||
$quota_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($quota_edit_data);
|
||||
|
||||
$title = $quota_edit_data['emails_accountchangequota']['title'];
|
||||
$image = $quota_edit_data['emails_accountchangequota']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("email/account_changequota") . "\";");
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'email', 'id' => $id)),
|
||||
'formdata' => $quota_edit_data['emails_accountchangequota']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'delete' && $id != 0) {
|
||||
@@ -474,6 +477,7 @@ if ($page == 'overview') {
|
||||
$forwarder_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/email/formfield.emails_addforwarder.php';
|
||||
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'email', 'id' => $id)),
|
||||
'formdata' => $forwarder_add_data['emails_addforwarder']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
|
||||
@@ -23,6 +23,7 @@ use Froxlor\Api\Commands\CustomerBackups as CustomerBackups;
|
||||
use Froxlor\Api\Commands\DirOptions as DirOptions;
|
||||
use Froxlor\Api\Commands\DirProtections as DirProtections;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\UI\Panel\UI;
|
||||
use Froxlor\UI\Request;
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
@@ -127,12 +128,12 @@ if ($page == 'overview') {
|
||||
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid']);
|
||||
|
||||
$htpasswd_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_add.php';
|
||||
$htpasswd_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($htpasswd_add_data);
|
||||
|
||||
$title = $htpasswd_add_data['htpasswd_add']['title'];
|
||||
$image = $htpasswd_add_data['htpasswd_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_add") . "\";");
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'extras')),
|
||||
'formdata' => $htpasswd_add_data['htpasswd_add']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
try {
|
||||
@@ -159,16 +160,15 @@ if ($page == 'overview') {
|
||||
if (strpos($result['path'], $userinfo['documentroot']) === 0) {
|
||||
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
|
||||
}
|
||||
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
|
||||
$htpasswd_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htpasswd_edit.php';
|
||||
$htpasswd_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($htpasswd_edit_data);
|
||||
|
||||
$title = $htpasswd_edit_data['htpasswd_edit']['title'];
|
||||
$image = $htpasswd_edit_data['htpasswd_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htpasswds_edit") . "\";");
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'extras', 'id' => $id)),
|
||||
'formdata' => $htpasswd_edit_data['htpasswd_edit']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -271,12 +271,12 @@ if ($page == 'overview') {
|
||||
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
|
||||
|
||||
$htaccess_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_add.php';
|
||||
$htaccess_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_add_data);
|
||||
|
||||
$title = $htaccess_add_data['htaccess_add']['title'];
|
||||
$image = $htaccess_add_data['htaccess_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_add") . "\";");
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'extras')),
|
||||
'formdata' => $htaccess_add_data['htaccess_add']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
} elseif (($action == 'edit') && ($id != 0)) {
|
||||
try {
|
||||
@@ -303,24 +303,17 @@ if ($page == 'overview') {
|
||||
if (strpos($result['path'], $userinfo['documentroot']) === 0) {
|
||||
$result['path'] = str_replace($userinfo['documentroot'], "/", $result['path']);
|
||||
}
|
||||
|
||||
$result['error404path'] = $result['error404path'];
|
||||
$result['error403path'] = $result['error403path'];
|
||||
$result['error500path'] = $result['error500path'];
|
||||
$cperlenabled = \Froxlor\Customer\Customer::customerHasPerlEnabled($userinfo['customerid']);
|
||||
/*
|
||||
* $options_indexes = \Froxlor\UI\HTML::makeyesno('options_indexes', '1', '0', $result['options_indexes']);
|
||||
* $options_cgi = \Froxlor\UI\HTML::makeyesno('options_cgi', '1', '0', $result['options_cgi']);
|
||||
*/
|
||||
|
||||
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
|
||||
|
||||
$htaccess_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/extras/formfield.htaccess_edit.php';
|
||||
$htaccess_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($htaccess_edit_data);
|
||||
|
||||
$title = $htaccess_edit_data['htaccess_edit']['title'];
|
||||
$image = $htaccess_edit_data['htaccess_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate("extras/htaccess_edit") . "\";");
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'extras', 'id' => $id)),
|
||||
'formdata' => $htaccess_edit_data['htaccess_edit']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ require __DIR__ . '/lib/init.php';
|
||||
use Froxlor\Api\Commands\Ftps as Ftps;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\UI\Panel\UI;
|
||||
use Froxlor\UI\Request;
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
@@ -71,7 +72,7 @@ if ($page == 'overview') {
|
||||
$row['documentroot'] = \Froxlor\FileDir::makeCorrectDir($row['documentroot']);
|
||||
$row = \Froxlor\PhpHelper::htmlentitiesArray($row);
|
||||
eval("\$accounts.=\"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_account') . "\";");
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts') . "\";");
|
||||
@@ -122,9 +123,7 @@ if ($page == 'overview') {
|
||||
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], '/');
|
||||
|
||||
if (Settings::Get('customer.ftpatdomain') == '1') {
|
||||
$domainlist = array();
|
||||
$domains = '';
|
||||
|
||||
$domainlist = [];
|
||||
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `customerid`= :customerid");
|
||||
Database::pexecute($result_domains_stmt, array(
|
||||
@@ -132,39 +131,27 @@ if ($page == 'overview') {
|
||||
));
|
||||
|
||||
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$domainlist[] = $row_domain['domain'];
|
||||
$domainlist[$row_domain['domain']] = $idna_convert->decode($row_domain['domain']);
|
||||
}
|
||||
|
||||
sort($domainlist);
|
||||
|
||||
if (isset($domainlist[0]) && $domainlist[0] != '') {
|
||||
foreach ($domainlist as $dom) {
|
||||
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($dom), $dom);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings::Get('system.allow_customer_shell') == '1') {
|
||||
$shells = \Froxlor\UI\HTML::makeoption("/bin/false", "/bin/false", "/bin/false");
|
||||
$shells['/bin/false'] = "/bin/false";
|
||||
$shells_avail = Settings::Get('system.available_shells');
|
||||
if (! empty($shells_avail)) {
|
||||
if (!empty($shells_avail)) {
|
||||
$shells_avail = explode(",", $shells_avail);
|
||||
$shells_avail = array_map("trim", $shells_avail);
|
||||
foreach ($shells_avail as $_shell) {
|
||||
$shells .= \Froxlor\UI\HTML::makeoption($_shell, $_shell, "/bin/false");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// $sendinfomail = \Froxlor\UI\HTML::makeyesno('sendinfomail', '1', '0', '0');
|
||||
|
||||
$ftp_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/ftp/formfield.ftp_add.php';
|
||||
$ftp_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($ftp_add_data);
|
||||
|
||||
$title = $ftp_add_data['ftp_add']['title'];
|
||||
$image = $ftp_add_data['ftp_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_add') . "\";");
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'ftp')),
|
||||
'formdata' => $ftp_add_data['ftp_add']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
@@ -198,39 +185,22 @@ if ($page == 'overview') {
|
||||
|
||||
$pathSelect = \Froxlor\FileDir::makePathfield($userinfo['documentroot'], $userinfo['guid'], $userinfo['guid'], $homedir);
|
||||
|
||||
if (Settings::Get('customer.ftpatdomain') == '1') {
|
||||
$domains = '';
|
||||
|
||||
$result_domains_stmt = Database::prepare("SELECT `domain` FROM `" . TABLE_PANEL_DOMAINS . "`
|
||||
WHERE `customerid` = :customerid");
|
||||
Database::pexecute($result_domains_stmt, array(
|
||||
"customerid" => $userinfo['customerid']
|
||||
));
|
||||
|
||||
while ($row_domain = $result_domains_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
$domains .= \Froxlor\UI\HTML::makeoption($idna_convert->decode($row_domain['domain']), $row_domain['domain']);
|
||||
}
|
||||
}
|
||||
|
||||
if (Settings::Get('system.allow_customer_shell') == '1') {
|
||||
$shells = \Froxlor\UI\HTML::makeoption("/bin/false", "/bin/false", $result['shell']);
|
||||
$shells['/bin/false'] = "/bin/false";
|
||||
$shells_avail = Settings::Get('system.available_shells');
|
||||
if (! empty($shells_avail)) {
|
||||
if (!empty($shells_avail)) {
|
||||
$shells_avail = explode(",", $shells_avail);
|
||||
$shells_avail = array_map("trim", $shells_avail);
|
||||
foreach ($shells_avail as $_shell) {
|
||||
$shells .= \Froxlor\UI\HTML::makeoption($_shell, $_shell, $result['shell']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$ftp_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/ftp/formfield.ftp_edit.php';
|
||||
$ftp_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($ftp_edit_data);
|
||||
|
||||
$title = $ftp_edit_data['ftp_edit']['title'];
|
||||
$image = $ftp_edit_data['ftp_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('ftp/accounts_edit') . "\";");
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'ftp', 'id' => $id)),
|
||||
'formdata' => $ftp_edit_data['ftp_edit']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ require __DIR__ . '/lib/init.php';
|
||||
use Froxlor\Api\Commands\SysLog;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\UI\Panel\UI;
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
if (Settings::IsInList('panel.customer_hide_options', 'extras.logger')) {
|
||||
|
||||
@@ -22,6 +22,7 @@ require __DIR__ . '/lib/init.php';
|
||||
use Froxlor\Api\Commands\Mysqls as Mysqls;
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\UI\Panel\UI;
|
||||
use Froxlor\UI\Request;
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
@@ -90,7 +91,7 @@ if ($page == 'overview') {
|
||||
}
|
||||
$row['size'] = \Froxlor\PhpHelper::sizeReadable($mbdata['MB'], 'GiB', 'bi', '%01.' . (int) Settings::Get('panel.decimal_places') . 'f %s');
|
||||
eval("\$mysqls.=\"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_database') . "\";");
|
||||
$count ++;
|
||||
$count++;
|
||||
}
|
||||
Database::needRoot(false);
|
||||
// End root-session
|
||||
@@ -114,7 +115,7 @@ if ($page == 'overview') {
|
||||
$sql_root = Database::getSqlData();
|
||||
Database::needRoot(false);
|
||||
|
||||
if (! isset($sql_root[$result['dbserver']]) || ! is_array($sql_root[$result['dbserver']])) {
|
||||
if (!isset($sql_root[$result['dbserver']]) || !is_array($sql_root[$result['dbserver']])) {
|
||||
$result['dbserver'] = 0;
|
||||
}
|
||||
|
||||
@@ -155,24 +156,22 @@ if ($page == 'overview') {
|
||||
} else {
|
||||
|
||||
$dbservers_stmt = Database::query("SELECT DISTINCT `dbserver` FROM `" . TABLE_PANEL_DATABASES . "`");
|
||||
$mysql_servers = '';
|
||||
$count_mysqlservers = 0;
|
||||
$mysql_servers = [];
|
||||
while ($dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||
Database::needRoot(true, $dbserver['dbserver']);
|
||||
Database::needSqlData();
|
||||
$sql_root = Database::getSqlData();
|
||||
$mysql_servers .= \Froxlor\UI\HTML::makeoption($sql_root['caption'], $dbserver['dbserver']);
|
||||
$count_mysqlservers ++;
|
||||
$mysql_servers[$dbserver['dbserver']] = $sql_root['caption'];
|
||||
}
|
||||
Database::needRoot(false);
|
||||
|
||||
$mysql_add_data = include_once dirname(__FILE__) . '/lib/formfields/customer/mysql/formfield.mysql_add.php';
|
||||
$mysql_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($mysql_add_data);
|
||||
|
||||
$title = $mysql_add_data['mysql_add']['title'];
|
||||
$image = $mysql_add_data['mysql_add']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_add') . "\";");
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'mysql')),
|
||||
'formdata' => $mysql_add_data['mysql_add']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
}
|
||||
} elseif ($action == 'edit' && $id != 0) {
|
||||
@@ -200,7 +199,7 @@ if ($page == 'overview') {
|
||||
|
||||
$dbservers_stmt = Database::query("SELECT COUNT(DISTINCT `dbserver`) as numservers FROM `" . TABLE_PANEL_DATABASES . "`");
|
||||
$dbserver = $dbservers_stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$count_mysqlservers = $dbserver['numservers'];
|
||||
$count_mysql_servers = $dbserver['numservers'];
|
||||
|
||||
Database::needRoot(true, $result['dbserver']);
|
||||
Database::needSqlData();
|
||||
@@ -208,12 +207,12 @@ if ($page == 'overview') {
|
||||
Database::needRoot(false);
|
||||
|
||||
$mysql_edit_data = include_once dirname(__FILE__) . '/lib/formfields/customer/mysql/formfield.mysql_edit.php';
|
||||
$mysql_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($mysql_edit_data);
|
||||
|
||||
$title = $mysql_edit_data['mysql_edit']['title'];
|
||||
$image = $mysql_edit_data['mysql_edit']['image'];
|
||||
|
||||
eval("echo \"" . \Froxlor\UI\Template::getTemplate('mysql/mysqls_edit') . "\";");
|
||||
UI::twigBuffer('user/form.html.twig', [
|
||||
'formaction' => $linker->getLink(array('section' => 'mysql', 'id' => $id)),
|
||||
'formdata' => $mysql_edit_data['mysql_edit']
|
||||
]);
|
||||
UI::twigOutputBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ require __DIR__ . '/lib/init.php';
|
||||
|
||||
use Froxlor\Database\Database;
|
||||
use Froxlor\Settings;
|
||||
use Froxlor\UI\Panel\UI;
|
||||
use Froxlor\UI\Request;
|
||||
|
||||
// redirect if this customer page is hidden via settings
|
||||
|
||||
@@ -394,22 +394,23 @@ class FileDir
|
||||
$value = '/' . $value;
|
||||
}
|
||||
|
||||
$fieldType = \Froxlor\Settings::Get('panel.pathedit');
|
||||
$fieldType = strtolower(\Froxlor\Settings::Get('panel.pathedit'));
|
||||
|
||||
if ($fieldType == 'Manual') {
|
||||
if ($fieldType == 'manual') {
|
||||
|
||||
$field = array(
|
||||
'type' => 'text',
|
||||
'value' => htmlspecialchars($value)
|
||||
);
|
||||
} elseif ($fieldType == 'Dropdown') {
|
||||
|
||||
} elseif ($fieldType == 'dropdown') {
|
||||
|
||||
$dirList = self::findDirs($path, $uid, $gid);
|
||||
natcasesort($dirList);
|
||||
|
||||
if (sizeof($dirList) > 0) {
|
||||
if (sizeof($dirList) <= 100) {
|
||||
$_field = '';
|
||||
$_field = [];
|
||||
foreach ($dirList as $dir) {
|
||||
if (strpos($dir, $path) === 0) {
|
||||
$dir = substr($dir, strlen($path));
|
||||
@@ -419,11 +420,12 @@ class FileDir
|
||||
}
|
||||
$dir = self::makeCorrectDir($dir);
|
||||
}
|
||||
$_field .= \Froxlor\UI\HTML::makeoption($dir, $dir, $value);
|
||||
$_field[$dir] = $dir;
|
||||
}
|
||||
$field = array(
|
||||
'type' => 'select',
|
||||
'value' => $_field
|
||||
'select_var' => $_field,
|
||||
'selected' => $value
|
||||
);
|
||||
} else {
|
||||
// remove starting slash we added
|
||||
|
||||
@@ -2,6 +2,19 @@
|
||||
|
||||
namespace Froxlor\UI;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package UI
|
||||
*/
|
||||
class HTML
|
||||
{
|
||||
|
||||
@@ -12,11 +25,9 @@ class HTML
|
||||
* array navigation data
|
||||
* @param
|
||||
* array userinfo the userinfo of the user
|
||||
* @return array the content of the navigation bar
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @return array the content of the navigation bar according to user-permissions
|
||||
*/
|
||||
public static function buildNavigation($navigation, $userinfo)
|
||||
public static function buildNavigation(array $navigation, array $userinfo)
|
||||
{
|
||||
$returnvalue = [];
|
||||
|
||||
@@ -64,7 +75,7 @@ class HTML
|
||||
$icon = $element['icon'] ?? null;
|
||||
} else {
|
||||
$navlabel = $element['label'];
|
||||
$icon = $element['icon'] ?? null;
|
||||
$icon = $element['icon'] ?? null;
|
||||
}
|
||||
|
||||
$navigation_links[] = [
|
||||
@@ -138,6 +149,8 @@ class HTML
|
||||
* Whether the value may contain html or not
|
||||
*
|
||||
* @return string HTML Code
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public static function makecheckbox($name, $title, $value, $break = false, $selvalue = null, $title_trusted = false, $value_trusted = false)
|
||||
{
|
||||
@@ -183,6 +196,8 @@ class HTML
|
||||
* @param bool $disabled
|
||||
*
|
||||
* @return string HTML Code
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public static function makeoption($title, $value, $selvalue = null, $title_trusted = false, $value_trusted = false, $id = null, $disabled = false)
|
||||
{
|
||||
@@ -229,6 +244,8 @@ class HTML
|
||||
* @return string HTML Code
|
||||
* @author Florian Lippert <flo@syscp.org> (2003-2009)
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
public static function makeyesno($name, $yesvalue, $novalue = '', $yesselected = '', $disabled = false)
|
||||
{
|
||||
@@ -249,7 +266,7 @@ class HTML
|
||||
}
|
||||
|
||||
/**
|
||||
* Prints Question on screen
|
||||
* Output boolean confirm-dialog
|
||||
*
|
||||
* @param string $text
|
||||
* The question
|
||||
@@ -257,69 +274,59 @@ class HTML
|
||||
* File which will be called with POST if user clicks yes
|
||||
* @param array $params
|
||||
* Values which will be given to $yesfile. Format: array(variable1=>value1, variable2=>value2, variable3=>value3)
|
||||
* @param string $targetname
|
||||
* Name of the target eg Domain or eMail address etc.
|
||||
* @param int $back_nr
|
||||
* Number of steps to go back when "No" is pressed
|
||||
* @param string $replacer
|
||||
* value of a possible existing string-replacer in the question
|
||||
*
|
||||
* @author Florian Lippert <flo@syscp.org>
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
*
|
||||
* @return string outputs parsed question_yesno template
|
||||
* @return string
|
||||
*/
|
||||
public static function askYesNo($text, $yesfile, $params = array(), $targetname = '', $back_nr = 1)
|
||||
public static function askYesNo(string $text, string $yesfile, array $params = [], string $replacer = '')
|
||||
{
|
||||
global $userinfo, $s, $header, $footer, $lng, $theme;
|
||||
|
||||
$hiddenparams = '';
|
||||
|
||||
if (is_array($params)) {
|
||||
foreach ($params as $field => $value) {
|
||||
$hiddenparams .= '<input type="hidden" name="' . htmlspecialchars($field) . '" value="' . htmlspecialchars($value) . '" />' . "\n";
|
||||
}
|
||||
}
|
||||
global $lng;
|
||||
|
||||
if (isset($lng['question'][$text])) {
|
||||
$text = $lng['question'][$text];
|
||||
}
|
||||
|
||||
$text = strtr($text, array(
|
||||
'%s' => htmlspecialchars($targetname)
|
||||
'%s' => htmlspecialchars($replacer)
|
||||
));
|
||||
eval("echo \"" . Template::getTemplate('misc/question_yesno', '1') . "\";");
|
||||
|
||||
Panel\UI::twigBuffer('form/yesnoquestion.html.twig', [
|
||||
'action' => $yesfile,
|
||||
'url_params' => $params,
|
||||
'question' => $text
|
||||
]);
|
||||
Panel\UI::twigOutputBuffer();
|
||||
exit();
|
||||
}
|
||||
|
||||
public static function askYesNoWithCheckbox($text, $chk_text, $yesfile, $params = array(), $targetname = '', $show_checkbox = true)
|
||||
public static function askYesNoWithCheckbox(string $text, string $chk_text, string $yesfile, array $params = [], string $replacer = '', bool $show_checkbox = true)
|
||||
{
|
||||
global $userinfo, $s, $header, $footer, $lng, $theme;
|
||||
|
||||
$hiddenparams = '';
|
||||
|
||||
if (is_array($params)) {
|
||||
foreach ($params as $field => $value) {
|
||||
$hiddenparams .= '<input type="hidden" name="' . htmlspecialchars($field) . '" value="' . htmlspecialchars($value) . '" />' . "\n";
|
||||
}
|
||||
}
|
||||
global $lng;
|
||||
|
||||
if (isset($lng['question'][$text])) {
|
||||
$text = $lng['question'][$text];
|
||||
}
|
||||
$text = strtr($text, array(
|
||||
'%s' => htmlspecialchars($replacer)
|
||||
));
|
||||
|
||||
if (isset($lng['question'][$chk_text])) {
|
||||
$chk_text = $lng['question'][$chk_text];
|
||||
}
|
||||
|
||||
if ($show_checkbox) {
|
||||
$checkbox = self::makecheckbox('delete_userfiles', $chk_text, '1', false, '0', true, true);
|
||||
} else {
|
||||
$checkbox = '<input type="hidden" name="delete_userfiles" value="0" />' . "\n";
|
||||
}
|
||||
|
||||
$text = strtr($text, array(
|
||||
'%s' => htmlspecialchars($targetname)
|
||||
));
|
||||
eval("echo \"" . Template::getTemplate('misc/question_yesno_checkbox', '1') . "\";");
|
||||
Panel\UI::twigBuffer('form/yesnoquestion.html.twig', [
|
||||
'action' => $yesfile,
|
||||
'url_params' => $params,
|
||||
'question' => $text,
|
||||
'with_checkbox' => [
|
||||
'chk_text' => $chk_text,
|
||||
'show' => $show_checkbox
|
||||
]
|
||||
]);
|
||||
Panel\UI::twigOutputBuffer();
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,351 +0,0 @@
|
||||
<?php
|
||||
namespace Froxlor\UI;
|
||||
|
||||
/**
|
||||
* This file is part of the Froxlor project.
|
||||
* Copyright (c) 2010 the Froxlor Team (see authors).
|
||||
*
|
||||
* For the full copyright and license information, please view the COPYING
|
||||
* file that was distributed with this source code. You can also view the
|
||||
* COPYING file online at http://files.froxlor.org/misc/COPYING.txt
|
||||
*
|
||||
* @copyright (c) the authors
|
||||
* @author Froxlor team <team@froxlor.org> (2010-)
|
||||
* @license GPLv2 http://files.froxlor.org/misc/COPYING.txt
|
||||
* @package Classes
|
||||
*
|
||||
*/
|
||||
class HtmlForm
|
||||
{
|
||||
|
||||
/**
|
||||
* internal tmp-variable to store form
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $form = '';
|
||||
|
||||
private static $filename = '';
|
||||
|
||||
public static function genHTMLForm($data = array())
|
||||
{
|
||||
global $lng, $theme;
|
||||
$nob = false;
|
||||
|
||||
self::$form = '';
|
||||
|
||||
foreach ($data as $fdata) {
|
||||
$sections = $fdata['sections'];
|
||||
|
||||
foreach ($sections as $section) {
|
||||
/*
|
||||
* here be section title & image
|
||||
*/
|
||||
$title = $section['title'];
|
||||
$image = $section['image'];
|
||||
|
||||
if (isset($section['visible']) && $section['visible'] === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (! isset($section['nobuttons']) || $section['nobuttons'] == false) {
|
||||
eval("self::\$form .= \"" . Template::getTemplate("misc/form/table_section", "1") . "\";");
|
||||
} else {
|
||||
$nob = true;
|
||||
}
|
||||
|
||||
$nexto = false;
|
||||
foreach ($section['fields'] as $fieldname => $fielddata) {
|
||||
if (isset($fielddata['visible']) && $fielddata['visible'] === false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($nexto === false || (isset($fielddata['next_to']) && $nexto['field'] != $fielddata['next_to'])) {
|
||||
$label = $fielddata['label'];
|
||||
$desc = (isset($fielddata['desc']) ? $fielddata['desc'] : '');
|
||||
$style = (isset($fielddata['style']) ? ' class="' . $fielddata['style'] . '"' : '');
|
||||
$mandatory = self::getMandatoryFlag($fielddata);
|
||||
$data_field = self::parseDataField($fieldname, $fielddata);
|
||||
if (isset($fielddata['has_nextto'])) {
|
||||
$nexto = array(
|
||||
'field' => $fieldname
|
||||
);
|
||||
$data_field .= '{NEXTTOFIELD_' . $fieldname . '}';
|
||||
} else {
|
||||
$nexto = false;
|
||||
}
|
||||
eval("self::\$form .= \"" . Template::getTemplate("misc/form/table_row", "1") . "\";");
|
||||
} else {
|
||||
$data_field = self::parseDataField($fieldname, $fielddata);
|
||||
$data_field = str_replace("\t", "", $data_field);
|
||||
$data_field = $fielddata['next_to_prefix'] . $data_field;
|
||||
self::$form = str_replace('{NEXTTOFIELD_' . $fielddata['next_to'] . '}', $data_field, self::$form);
|
||||
$nexto = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add save/reset buttons at the end of the form
|
||||
if (! $nob) {
|
||||
eval("self::\$form .= \"" . Template::getTemplate("misc/form/table_end", "1") . "\";");
|
||||
}
|
||||
|
||||
return self::$form;
|
||||
}
|
||||
|
||||
private static function parseDataField($fieldname, $data = array())
|
||||
{
|
||||
switch ($data['type']) {
|
||||
case 'text':
|
||||
return self::textBox($fieldname, $data);
|
||||
break;
|
||||
case 'textul':
|
||||
return self::textBox($fieldname, $data, 'text', true);
|
||||
break;
|
||||
case 'password':
|
||||
return self::textBox($fieldname, $data, 'password');
|
||||
break;
|
||||
case 'hidden':
|
||||
return self::textBox($fieldname, $data, 'hidden');
|
||||
break;
|
||||
case 'yesno':
|
||||
return self::yesnoBox($data);
|
||||
break;
|
||||
case 'select':
|
||||
return self::selectBox($fieldname, $data);
|
||||
break;
|
||||
case 'label':
|
||||
return self::labelField($data);
|
||||
break;
|
||||
case 'textarea':
|
||||
return self::textArea($fieldname, $data);
|
||||
break;
|
||||
case 'checkbox':
|
||||
return self::checkbox($fieldname, $data);
|
||||
break;
|
||||
case 'file':
|
||||
return self::file($fieldname, $data);
|
||||
break;
|
||||
case 'int':
|
||||
return self::int($fieldname, $data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static function getMandatoryFlag($data = array())
|
||||
{
|
||||
if (isset($data['mandatory'])) {
|
||||
return ' <span class="red">*</span>';
|
||||
} elseif (isset($data['mandatory_ex'])) {
|
||||
return ' <span class="red">**</span>';
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
private static function textBox($fieldname = '', $data = array(), $type = 'text', $unlimited = false)
|
||||
{
|
||||
$return = '';
|
||||
$extras = '';
|
||||
if (isset($data['maxlength'])) {
|
||||
$extras .= ' maxlength="' . $data['maxlength'] . '"';
|
||||
}
|
||||
if (isset($data['size'])) {
|
||||
$extras .= ' size="' . $data['size'] . '"';
|
||||
}
|
||||
if (isset($data['autocomplete'])) {
|
||||
$extras .= ' autocomplete="' . $data['autocomplete'] . '"';
|
||||
}
|
||||
|
||||
// add support to save reloaded forms
|
||||
if (isset($data['value'])) {
|
||||
$value = $data['value'];
|
||||
} elseif (isset($_SESSION['requestData'][$fieldname])) {
|
||||
$value = $_SESSION['requestData'][$fieldname];
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
|
||||
$ulfield = ($unlimited == true ? ' ' . $data['ul_field'] : '');
|
||||
if (isset($data['display']) && $data['display'] != '') {
|
||||
$ulfield = '<strong>' . $data['display'] . '</strong>';
|
||||
}
|
||||
|
||||
eval("\$return = \"" . Template::getTemplate("misc/form/input_text", "1") . "\";");
|
||||
return $return;
|
||||
}
|
||||
|
||||
private static function textArea($fieldname = '', $data = array())
|
||||
{
|
||||
$return = '';
|
||||
$extras = '';
|
||||
if (isset($data['cols'])) {
|
||||
$extras .= ' cols="' . $data['cols'] . '"';
|
||||
}
|
||||
if (isset($data['rows'])) {
|
||||
$extras .= ' rows="' . $data['rows'] . '"';
|
||||
}
|
||||
|
||||
// add support to save reloaded forms
|
||||
if (isset($data['value'])) {
|
||||
$value = $data['value'];
|
||||
} elseif (isset($_SESSION['requestData'][$fieldname])) {
|
||||
$value = $_SESSION['requestData'][$fieldname];
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
trim($value);
|
||||
|
||||
eval("\$return = \"" . Template::getTemplate("misc/form/input_textarea", "1") . "\";");
|
||||
return $return;
|
||||
}
|
||||
|
||||
private static function yesnoBox($data = array())
|
||||
{
|
||||
return $data['yesno_var'];
|
||||
}
|
||||
|
||||
private static function labelField($data = array())
|
||||
{
|
||||
return $data['value'];
|
||||
}
|
||||
|
||||
private static function selectBox($fieldname = '', $data = array())
|
||||
{
|
||||
// add support to save reloaded forms
|
||||
if (isset($data['select_var'])) {
|
||||
$select_var = $data['select_var'];
|
||||
} elseif (isset($_SESSION['requestData'][$fieldname])) {
|
||||
$select_var = $_SESSION['requestData'][$fieldname];
|
||||
} else {
|
||||
$select_var = '';
|
||||
}
|
||||
|
||||
return '<select
|
||||
id="' . $fieldname . '"
|
||||
name="' . $fieldname . '"
|
||||
' . (isset($data['class']) ? ' class="' . $data['class'] . '" ' : '') . '
|
||||
>' . $select_var . '</select>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Function to generate checkboxes.
|
||||
*
|
||||
* <code>
|
||||
* $data = array(
|
||||
* 'label' => $lng['customer']['email_imap'],
|
||||
* 'type' => 'checkbox',
|
||||
* 'values' => array(
|
||||
* array( 'label' => 'active',
|
||||
* 'value' => '1'
|
||||
* )
|
||||
* ),
|
||||
* 'value' => array('1'),
|
||||
* 'mandatory' => true
|
||||
* )
|
||||
* </code>
|
||||
*
|
||||
* @param string $fieldname
|
||||
* contains the fieldname
|
||||
* @param array $data
|
||||
* contains the data array
|
||||
*/
|
||||
private static function checkbox($fieldname = '', $data = array())
|
||||
{
|
||||
// $data['value'] contains checked items
|
||||
$checked = array();
|
||||
if (isset($data['value'])) {
|
||||
$checked = $data['value'];
|
||||
}
|
||||
|
||||
if (isset($_SESSION['requestData'])) {
|
||||
if (isset($_SESSION['requestData'][$fieldname])) {
|
||||
$checked = array(
|
||||
$_SESSION['requestData'][$fieldname]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// default value is none, so the checkbox isn't an array
|
||||
$isArray = '';
|
||||
|
||||
if (count($data['values']) > 1 || (isset($data['is_array']) && $data['is_array'] == 1)) {
|
||||
$isArray = '[]';
|
||||
}
|
||||
|
||||
// will contain the output
|
||||
$output = "";
|
||||
foreach ($data['values'] as $val) {
|
||||
$key = $val['label'];
|
||||
// is this box checked?
|
||||
$isChecked = '';
|
||||
if (is_array($checked) && count($checked) > 0) {
|
||||
foreach ($checked as $tmp) {
|
||||
if ($tmp == $val['value']) {
|
||||
$isChecked = ' checked="checked" ';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$output .= '<label>';
|
||||
if (empty($isArray)) {
|
||||
$output .= '<input type="hidden" name="' . $fieldname . '" value="0" />';
|
||||
}
|
||||
$output .= '<input type="checkbox" name="' . $fieldname . $isArray . '" value="' . $val['value'] . '" ' . $isChecked . '/>';
|
||||
$output .= $key . '</label>';
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
private static function file($fieldname = '', $data = array())
|
||||
{
|
||||
$return = '';
|
||||
$extras = '';
|
||||
if (isset($data['maxlength'])) {
|
||||
$extras .= ' maxlength="' . $data['maxlength'] . '"';
|
||||
}
|
||||
|
||||
// add support to save reloaded forms
|
||||
if (isset($data['value'])) {
|
||||
$value = $data['value'];
|
||||
} elseif (isset($_SESSION['requestData'][$fieldname])) {
|
||||
$value = $_SESSION['requestData'][$fieldname];
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
|
||||
if (isset($data['display']) && $data['display'] != '') {
|
||||
$ulfield = '<strong>' . $data['display'] . '</strong>';
|
||||
}
|
||||
|
||||
eval("\$return = \"" . Template::getTemplate("misc/form/input_file", "1") . "\";");
|
||||
return $return;
|
||||
}
|
||||
|
||||
private static function int($fieldname = '', $data = array())
|
||||
{
|
||||
$return = '';
|
||||
$extras = '';
|
||||
if (isset($data['int_min'])) {
|
||||
$extras .= ' min="' . $data['int_min'] . '"';
|
||||
}
|
||||
if (isset($data['int_max'])) {
|
||||
$extras .= ' max="' . $data['int_max'] . '"';
|
||||
}
|
||||
|
||||
// add support to save reloaded forms
|
||||
if (isset($data['value'])) {
|
||||
$value = $data['value'];
|
||||
} elseif (isset($_SESSION['requestData'][$fieldname])) {
|
||||
$value = $_SESSION['requestData'][$fieldname];
|
||||
} else {
|
||||
$value = '';
|
||||
}
|
||||
|
||||
$type = 'number';
|
||||
$ulfield = '';
|
||||
eval("\$return = \"" . Template::getTemplate("misc/form/input_text", "1") . "\";");
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
@@ -41,10 +41,11 @@ return array(
|
||||
),
|
||||
'path' => array(
|
||||
'label' => $lng['panel']['path'],
|
||||
'desc' => (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescriptionSubdomain'] : null) . (isset($pathSelect['note']) ? $pathSelect['note'] . '<br />' . $pathSelect['value'] : ''),
|
||||
'desc' => (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescriptionSubdomain'] : null),
|
||||
'type' => $pathSelect['type'],
|
||||
'select_var' => $pathSelect['value'],
|
||||
'selected' => $pathSelect['value']
|
||||
'select_var' => $pathSelect['select_var'] ?? '',
|
||||
'value' => $pathSelect['value'],
|
||||
'note' => $pathSelect['note'] ?? '',
|
||||
),
|
||||
'url' => array(
|
||||
'visible' => (\Froxlor\Settings::Get('panel.pathedit') == 'Dropdown' ? true : false),
|
||||
@@ -70,17 +71,18 @@ return array(
|
||||
'select_var' => $openbasedir
|
||||
),
|
||||
'phpsettingid' => array(
|
||||
'visible' => (((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 || (int) \Froxlor\Settings::Get('phpfpm.enabled') == 1) && $has_phpconfigs ? true : false),
|
||||
'visible' => (((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 || (int) \Froxlor\Settings::Get('phpfpm.enabled') == 1) && count($phpconfigs) > 0 ? true : false),
|
||||
'label' => $lng['admin']['phpsettings']['title'],
|
||||
'type' => 'select',
|
||||
'select_var' => $phpconfigs
|
||||
'select_var' => $phpconfigs,
|
||||
'selected' => (int) Settings::Get('phpfpm.enabled') == 1) ? Settings::Get('phpfpm.defaultini') : Settings::Get('system.mod_fcgid_defaultini')
|
||||
)
|
||||
)
|
||||
),
|
||||
'section_bssl' => array(
|
||||
'title' => $lng['admin']['webserversettings_ssl'],
|
||||
'image' => 'icons/domain_add.png',
|
||||
'visible' => \Froxlor\Settings::Get('system.use_ssl') == '1' ? ($ssl_ipsandports != '' ? true : false) : false,
|
||||
'visible' => \Froxlor\Settings::Get('system.use_ssl') == '1' ? ($ssl_ipsandports ? true : false) : false,
|
||||
'fields' => array(
|
||||
'sslenabled' => array(
|
||||
'label' => $lng['admin']['domain_sslenabled'],
|
||||
@@ -104,7 +106,7 @@ return array(
|
||||
'checked' => false
|
||||
),
|
||||
'http2' => array(
|
||||
'visible' => ($ssl_ipsandports != '' ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.http2_support') == '1',
|
||||
'visible' => ($ssl_ipsandports ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.http2_support') == '1',
|
||||
'label' => $lng['admin']['domain_http2']['title'],
|
||||
'desc' => $lng['admin']['domain_http2']['description'],
|
||||
'type' => 'checkbox',
|
||||
|
||||
@@ -30,14 +30,15 @@ return array(
|
||||
),
|
||||
'dns' => array(
|
||||
'label' => $lng['dns']['destinationip'],
|
||||
'type' => 'label',
|
||||
'value' => $domainip
|
||||
'type' => 'itemlist',
|
||||
'values' => $domainips
|
||||
),
|
||||
'alias' => array(
|
||||
'visible' => ($alias_check == '0' ? true : false),
|
||||
'label' => $lng['domains']['aliasdomain'],
|
||||
'type' => 'select',
|
||||
'select_var' => $domains
|
||||
'select_var' => $domains,
|
||||
'selected' => $result['aliasdomain']
|
||||
),
|
||||
'path' => array(
|
||||
'label' => $lng['panel']['path'],
|
||||
@@ -57,14 +58,16 @@ return array(
|
||||
'label' => $lng['domains']['redirectifpathisurl'],
|
||||
'desc' => $lng['domains']['redirectifpathisurlinfo'],
|
||||
'type' => 'select',
|
||||
'select_var' => $redirectcode
|
||||
'select_var' => $redirectcode,
|
||||
'selected' => $def_code
|
||||
),
|
||||
'selectserveralias' => array(
|
||||
'visible' => ((($result['parentdomainid'] == '0' && $userinfo['subdomains'] != '0') || $result['parentdomainid'] != '0') ? true : false),
|
||||
'label' => $lng['admin']['selectserveralias'],
|
||||
'desc' => $lng['admin']['selectserveralias_desc'],
|
||||
'type' => 'select',
|
||||
'select_var' => $serveraliasoptions
|
||||
'select_var' => $serveraliasoptions,
|
||||
'selected' => $serveraliasoptions_selected
|
||||
),
|
||||
'isemaildomain' => array(
|
||||
'visible' => ((($result['subcanemaildomain'] == '1' || $result['subcanemaildomain'] == '2') && $result['parentdomainid'] != '0') ? true : false),
|
||||
@@ -77,20 +80,22 @@ return array(
|
||||
'visible' => ($result['openbasedir'] == '1') ? true : false,
|
||||
'label' => $lng['domain']['openbasedirpath'],
|
||||
'type' => 'select',
|
||||
'select_var' => $openbasedir
|
||||
'select_var' => $openbasedir,
|
||||
'selected' => $result['openbasedir_path']
|
||||
),
|
||||
'phpsettingid' => array(
|
||||
'visible' => (((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 || (int) \Froxlor\Settings::Get('phpfpm.enabled') == 1) && $has_phpconfigs ? true : false),
|
||||
'visible' => (((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 || (int) \Froxlor\Settings::Get('phpfpm.enabled') == 1) && count($phpconfigs) > 0 ? true : false),
|
||||
'label' => $lng['admin']['phpsettings']['title'],
|
||||
'type' => 'select',
|
||||
'select_var' => $phpconfigs
|
||||
'select_var' => $phpconfigs,
|
||||
'selected' => $result['phpsettingid']
|
||||
)
|
||||
)
|
||||
),
|
||||
'section_bssl' => array(
|
||||
'title' => $lng['admin']['webserversettings_ssl'],
|
||||
'image' => 'icons/domain_edit.png',
|
||||
'visible' => \Froxlor\Settings::Get('system.use_ssl') == '1' ? ($ssl_ipsandports != '' ? (\Froxlor\Domain\Domain::domainHasSslIpPort($result['id']) ? true : false) : false) : false,
|
||||
'visible' => \Froxlor\Settings::Get('system.use_ssl') == '1' ? ($ssl_ipsandports ? (\Froxlor\Domain\Domain::domainHasSslIpPort($result['id']) ? true : false) : false) : false,
|
||||
'fields' => array(
|
||||
'sslenabled' => array(
|
||||
'label' => $lng['admin']['domain_sslenabled'],
|
||||
@@ -114,7 +119,7 @@ return array(
|
||||
'checked' => $result['letsencrypt']
|
||||
),
|
||||
'http2' => array(
|
||||
'visible' => ($ssl_ipsandports != '' ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.http2_support') == '1',
|
||||
'visible' => ($ssl_ipsandports ? true : false) && \Froxlor\Settings::Get('system.webserver') != 'lighttpd' && \Froxlor\Settings::Get('system.http2_support') == '1',
|
||||
'label' => $lng['admin']['domain_http2']['title'],
|
||||
'desc' => $lng['admin']['domain_http2']['description'],
|
||||
'type' => 'checkbox',
|
||||
|
||||
@@ -25,10 +25,11 @@ return array(
|
||||
'fields' => array(
|
||||
'path' => array(
|
||||
'label' => $lng['panel']['backuppath']['title'],
|
||||
'desc' => $lng['panel']['backuppath']['description'] . '<br>' . (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null) . (isset($pathSelect['note']) ? '<br />' . $pathSelect['value'] : ''),
|
||||
'desc' => $lng['panel']['backuppath']['description'] . '<br>' . (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null),
|
||||
'type' => $pathSelect['type'],
|
||||
'select_var' => $pathSelect['value'],
|
||||
'value' => $pathSelect['value']
|
||||
'select_var' => $pathSelect['select_var'] ?? '',
|
||||
'value' => $pathSelect['value'],
|
||||
'note' => $pathSelect['note'] ?? '',
|
||||
),
|
||||
'path_protection_info' => array(
|
||||
'label' => $lng['extras']['path_protection_label'],
|
||||
@@ -38,41 +39,20 @@ return array(
|
||||
'backup_web' => array(
|
||||
'label' => $lng['extras']['backup_web'],
|
||||
'type' => 'checkbox',
|
||||
'values' => array(
|
||||
array(
|
||||
'label' => $lng['panel']['yes'],
|
||||
'value' => '1'
|
||||
)
|
||||
),
|
||||
'value' => array(
|
||||
'1'
|
||||
)
|
||||
'value' => '1',
|
||||
'checked' => true
|
||||
),
|
||||
'backup_mail' => array(
|
||||
'label' => $lng['extras']['backup_mail'],
|
||||
'type' => 'checkbox',
|
||||
'values' => array(
|
||||
array(
|
||||
'label' => $lng['panel']['yes'],
|
||||
'value' => '1'
|
||||
)
|
||||
),
|
||||
'value' => array(
|
||||
'1'
|
||||
)
|
||||
'value' => '1',
|
||||
'checked' => true
|
||||
),
|
||||
'backup_dbs' => array(
|
||||
'label' => $lng['extras']['backup_dbs'],
|
||||
'type' => 'checkbox',
|
||||
'values' => array(
|
||||
array(
|
||||
'label' => $lng['panel']['yes'],
|
||||
'value' => '1'
|
||||
)
|
||||
),
|
||||
'value' => array(
|
||||
'1'
|
||||
)
|
||||
'value' => '1',
|
||||
'checked' => true
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -25,21 +25,17 @@ return array(
|
||||
'fields' => array(
|
||||
'path' => array(
|
||||
'label' => $lng['panel']['path'],
|
||||
'desc' => (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null) . (isset($pathSelect['note']) ? '<br />' . $pathSelect['value'] : ''),
|
||||
'desc' => (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null),
|
||||
'type' => $pathSelect['type'],
|
||||
'select_var' => $pathSelect['value'],
|
||||
'value' => $pathSelect['value']
|
||||
'select_var' => $pathSelect['select_var'] ?? '',
|
||||
'value' => $pathSelect['value'],
|
||||
'note' => $pathSelect['note'] ?? '',
|
||||
),
|
||||
'options_indexes' => array(
|
||||
'label' => $lng['extras']['directory_browsing'],
|
||||
'type' => 'checkbox',
|
||||
'values' => array(
|
||||
array(
|
||||
'label' => $lng['panel']['yes'],
|
||||
'value' => '1'
|
||||
)
|
||||
),
|
||||
'value' => array()
|
||||
'value' => '1',
|
||||
'checked' => false
|
||||
),
|
||||
'error404path' => array(
|
||||
'label' => $lng['extras']['errordocument404path'],
|
||||
@@ -62,13 +58,8 @@ return array(
|
||||
'visible' => ($cperlenabled == 1),
|
||||
'label' => $lng['extras']['execute_perl'],
|
||||
'type' => 'checkbox',
|
||||
'values' => array(
|
||||
array(
|
||||
'label' => $lng['panel']['yes'],
|
||||
'value' => '1'
|
||||
)
|
||||
),
|
||||
'value' => array()
|
||||
'value' => '1',
|
||||
'checked' => false
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -31,15 +31,8 @@ return array(
|
||||
'options_indexes' => array(
|
||||
'label' => $lng['extras']['directory_browsing'],
|
||||
'type' => 'checkbox',
|
||||
'values' => array(
|
||||
array(
|
||||
'label' => $lng['panel']['yes'],
|
||||
'value' => '1'
|
||||
)
|
||||
),
|
||||
'value' => array(
|
||||
$result['options_indexes']
|
||||
)
|
||||
'value' => '1',
|
||||
'checked' => $result['options_indexes']
|
||||
),
|
||||
'error404path' => array(
|
||||
'label' => $lng['extras']['errordocument404path'],
|
||||
@@ -65,15 +58,8 @@ return array(
|
||||
'visible' => ($cperlenabled == 1),
|
||||
'label' => $lng['extras']['execute_perl'],
|
||||
'type' => 'checkbox',
|
||||
'values' => array(
|
||||
array(
|
||||
'label' => $lng['panel']['yes'],
|
||||
'value' => '1'
|
||||
)
|
||||
),
|
||||
'value' => array(
|
||||
$result['options_cgi']
|
||||
)
|
||||
'value' => '1',
|
||||
'checked' => $result['options_cgi']
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -25,10 +25,11 @@ return array(
|
||||
'fields' => array(
|
||||
'path' => array(
|
||||
'label' => $lng['panel']['path'],
|
||||
'desc' => (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null) . (isset($pathSelect['note']) ? '<br />' . $pathSelect['value'] : ''),
|
||||
'desc' => (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null),
|
||||
'type' => $pathSelect['type'],
|
||||
'select_var' => $pathSelect['value'],
|
||||
'value' => $pathSelect['value']
|
||||
'select_var' => $pathSelect['select_var'] ?? '',
|
||||
'value' => $pathSelect['value'],
|
||||
'note' => $pathSelect['note'] ?? '',
|
||||
),
|
||||
'username' => array(
|
||||
'label' => $lng['login']['username'],
|
||||
|
||||
@@ -25,24 +25,28 @@ return array(
|
||||
'ftp_username' => array(
|
||||
'visible' => (\Froxlor\Settings::Get('customer.ftpatdomain') == '1' ? true : false),
|
||||
'label' => $lng['login']['username'],
|
||||
'type' => 'text'
|
||||
),
|
||||
'ftp_domain' => array(
|
||||
'visible' => (\Froxlor\Settings::Get('customer.ftpatdomain') == '1' ? true : false),
|
||||
'label' => $lng['domains']['domainname'],
|
||||
'type' => 'select',
|
||||
'select_var' => (isset($domains) ? $domains : "")
|
||||
'type' => 'text',
|
||||
'next_to' => (\Froxlor\Settings::Get('customer.ftpatdomain') == '1' && count($domainlist) > 0 ? [
|
||||
'ftp_domain' => array(
|
||||
'next_to_prefix' => '@',
|
||||
'label' => $lng['domains']['domainname'],
|
||||
'type' => 'select',
|
||||
'select_var' => $domainlist
|
||||
),
|
||||
]
|
||||
: [])
|
||||
),
|
||||
'ftp_description' => array(
|
||||
'label' => $lng['panel']['ftpdesc'] = 'FTP description',
|
||||
'label' => $lng['panel']['ftpdesc'],
|
||||
'type' => 'text'
|
||||
),
|
||||
'path' => array(
|
||||
'label' => $lng['panel']['path'],
|
||||
'desc' => (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null) . (isset($pathSelect['note']) ? '<br />' . $pathSelect['value'] : ''),
|
||||
'desc' => (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null),
|
||||
'type' => $pathSelect['type'],
|
||||
'select_var' => $pathSelect['value'],
|
||||
'value' => $pathSelect['value']
|
||||
'select_var' => $pathSelect['select_var'] ?? '',
|
||||
'value' => $pathSelect['value'],
|
||||
'note' => $pathSelect['note'] ?? '',
|
||||
),
|
||||
'ftp_password' => array(
|
||||
'label' => $lng['login']['password'],
|
||||
@@ -58,19 +62,15 @@ return array(
|
||||
'sendinfomail' => array(
|
||||
'label' => $lng['customer']['sendinfomail'],
|
||||
'type' => 'checkbox',
|
||||
'values' => array(
|
||||
array(
|
||||
'label' => $lng['panel']['yes'],
|
||||
'value' => '1'
|
||||
)
|
||||
),
|
||||
'value' => array()
|
||||
'value' => '1',
|
||||
'checked' => false
|
||||
),
|
||||
'shell' => array(
|
||||
'visible' => (\Froxlor\Settings::Get('system.allow_customer_shell') == '1' ? true : false),
|
||||
'label' => $lng['panel']['shell'],
|
||||
'type' => 'select',
|
||||
'select_var' => (isset($shells) ? $shells : "")
|
||||
'select_var' => $shells_avail,
|
||||
'selected' => '/bin/false'
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -28,16 +28,17 @@ return array(
|
||||
'value' => $result['username']
|
||||
),
|
||||
'ftp_description' => array(
|
||||
'label' => $lng['panel']['ftpdesc'] = 'FTP description',
|
||||
'label' => $lng['panel']['ftpdesc'],
|
||||
'type' => 'text',
|
||||
'value' => $result['description']
|
||||
),
|
||||
'path' => array(
|
||||
'label' => $lng['panel']['path'],
|
||||
'desc' => (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null) . (isset($pathSelect['note']) ? '<br />' . $pathSelect['value'] : ''),
|
||||
'desc' => (\Froxlor\Settings::Get('panel.pathedit') != 'Dropdown' ? $lng['panel']['pathDescription'] : null),
|
||||
'type' => $pathSelect['type'],
|
||||
'select_var' => $pathSelect['value'],
|
||||
'value' => $pathSelect['value']
|
||||
'select_var' => $pathSelect['select_var'] ?? '',
|
||||
'value' => $pathSelect['value'],
|
||||
'note' => $pathSelect['note'] ?? '',
|
||||
),
|
||||
'ftp_password' => array(
|
||||
'label' => $lng['login']['password'],
|
||||
@@ -55,7 +56,8 @@ return array(
|
||||
'visible' => (\Froxlor\Settings::Get('system.allow_customer_shell') == '1' ? true : false),
|
||||
'label' => $lng['panel']['shell'],
|
||||
'type' => 'select',
|
||||
'select_var' => (isset($shells) ? $shells : "")
|
||||
'select_var' => $shells_avail,
|
||||
'selected' => $result['shell'] ?? '/bin/false'
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -34,7 +34,7 @@ return array(
|
||||
'type' => 'text'
|
||||
),
|
||||
'mysql_server' => array(
|
||||
'visible' => (1 < $count_mysqlservers ? true : false),
|
||||
'visible' => (count($mysql_servers) > 1 ? true : false),
|
||||
'label' => $lng['mysql']['mysql_server'],
|
||||
'type' => 'select',
|
||||
'select_var' => $mysql_servers
|
||||
@@ -53,13 +53,8 @@ return array(
|
||||
'sendinfomail' => array(
|
||||
'label' => $lng['customer']['sendinfomail'],
|
||||
'type' => 'checkbox',
|
||||
'values' => array(
|
||||
array(
|
||||
'label' => $lng['panel']['yes'],
|
||||
'value' => '1'
|
||||
)
|
||||
),
|
||||
'value' => array()
|
||||
'value' => '1',
|
||||
'checked' => false
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
@@ -33,7 +33,7 @@ return array(
|
||||
'value' => $result['description']
|
||||
),
|
||||
'mysql_server' => array(
|
||||
'visible' => (1 < $count_mysqlservers ? true : false),
|
||||
'visible' => ($count_mysql_servers > 1 ? true : false),
|
||||
'label' => $lng['mysql']['mysql_server'],
|
||||
'type' => 'label',
|
||||
'value' => $sql_root['caption']
|
||||
|
||||
@@ -2141,3 +2141,4 @@ $lng['serversettings']['acmeshpath']['title'] = 'Path to acme.sh';
|
||||
$lng['serversettings']['acmeshpath']['description'] = 'Set this to where acme.sh is installed to, including the acme.sh script<br>Default is <b>/root/.acme.sh/acme.sh</b>';
|
||||
|
||||
$lng['panel']['usage_statistics'] = 'Resource usage';
|
||||
$lng['panel']['security_question'] = 'Security question';
|
||||
|
||||
@@ -1787,3 +1787,4 @@ $lng['serversettings']['acmeshpath']['title'] = 'Pfad zu acme.sh';
|
||||
$lng['serversettings']['acmeshpath']['description'] = 'Installationspfad zu acme.sh, inklusive acme.sh Script<br>Standard ist <b>/root/.acme.sh/acme.sh</b>';
|
||||
|
||||
$lng['panel']['usage_statistics'] = 'Resourcen-Verbrauch';
|
||||
$lng['panel']['security_question'] = 'Sicherheitsabfrage';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{% macro form(form_data, action, title = "") %}
|
||||
{% macro form(form_data, formaction, title = "") %}
|
||||
|
||||
{% import "Froxlor/form/formfields.html.twig" as formfields %}
|
||||
|
||||
<form action="{{ action|default("") }}" method="post" enctype="application/x-www-form-urlencoded" class="form">
|
||||
<form action="{{ formaction|default("") }}" method="post" enctype="application/x-www-form-urlencoded" class="form">
|
||||
{% if title is not empty %}
|
||||
<h3 class="page-header">
|
||||
{% if form_data.image is not empty %}
|
||||
@@ -29,5 +29,20 @@
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<!-- submit buttons -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-body">
|
||||
<input type="hidden" name="s" value="{{ s }}"/>
|
||||
<input type="hidden" name="page" value="{{ page }}"/>
|
||||
<input type="hidden" name="action" value="{{ action }}"/>
|
||||
<input type="hidden" name="send" value="send"/>
|
||||
|
||||
<div class="col-12 text-center">
|
||||
<button type="reset" class="btn btn-warning">{{ lng('panel.cancel') }}</button>
|
||||
<button type="submit" class="btn btn-success">{{ lng('panel.save') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
{% endmacro %}
|
||||
|
||||
@@ -73,6 +73,9 @@
|
||||
{% if field.type == 'hidden' and field.display is defined %}
|
||||
<input type="text" readonly class="form-control-plaintext" value="{{ field.display }}">
|
||||
{% endif %}
|
||||
{% if field.note is defined and field.note is not empty %}
|
||||
<div class="invalid-feedback">{{ field.note|raw }}</div>
|
||||
{% endif %}
|
||||
{% if field.next_to is defined %}
|
||||
{% for nid, nfield in field.next_to %}
|
||||
{% if nfield.next_to_prefix is defined %}
|
||||
|
||||
34
templates/Froxlor/form/yesnoquestion.html.twig
Normal file
34
templates/Froxlor/form/yesnoquestion.html.twig
Normal file
@@ -0,0 +1,34 @@
|
||||
{% extends "Froxlor/userarea.html.twig" %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<form action="{{ action|default("") }}" method="post" enctype="application/x-www-form-urlencoded" class="form">
|
||||
|
||||
<div class="alert alert-warning" role="alert">
|
||||
<h4 class="alert-heading">{{ lng('panel.security_question') }}</h4>
|
||||
<p>{{ question|raw }}</p>
|
||||
{% if with_checkbox is defined and with_checkbox is iterable %}
|
||||
{% if with_checkbox.show %}
|
||||
<div class="form-check form-switch">
|
||||
<input class="form-check-input" type="checkbox" id="delete_userfiles" name="delete_userfiles" value="1">
|
||||
<label class="form-check-label" for="delete_userfiles">{{ with_checkbox.chk_text|raw }}</label>
|
||||
</div>
|
||||
{% else %}
|
||||
<input type="hidden" name="delete_userfiles" value="0"/>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
<hr>
|
||||
<p class="mb-0">
|
||||
<input type="hidden" name="s" value="{{ s }}"/>
|
||||
<input type="hidden" name="send" value="send"/>
|
||||
{% for id,field in url_params %}
|
||||
<input type="hidden" name="{{ id }}" value="{{ field }}"/>
|
||||
{% endfor %}
|
||||
<button class="btn btn-danger" type="submit" name="submitbutton">{{ lng('panel.yes') }}</button>
|
||||
<a href="javascript:history.back(-1)" class="btn btn-secondary">{{ lng('panel.no') }}</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
{% endblock %}
|
||||
@@ -4,6 +4,6 @@
|
||||
|
||||
{% import "Froxlor/form/form.html.twig" as form %}
|
||||
|
||||
{{ form.form(formdata, '#', formdata.title) }}
|
||||
{{ form.form(formdata, formaction|default('#'), formdata.title) }}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
@@ -46,8 +46,9 @@
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-7">
|
||||
{% if userinfo.adminsession == 1 %}
|
||||
{% if userinfo.adminsession == 1 %}
|
||||
<div
|
||||
class="col-7">
|
||||
{# system infos #}
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
@@ -117,9 +118,134 @@
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="col-5">
|
||||
</div>
|
||||
{% else %}
|
||||
<div
|
||||
class="col-4">
|
||||
{# account info #}
|
||||
<div class="card mb-3">
|
||||
<div class="card-header">
|
||||
<i class="fa-solid fa-user"></i>
|
||||
{{ lng('index.accountdetails') }}
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">{{ lng('login.username') }}</div>
|
||||
{{ userinfo.loginname }}
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">{{ lng('customer.email') }}</div>
|
||||
{{ userinfo.email }}
|
||||
</div>
|
||||
</li>
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">{{ lng('customer.services') }}</div>
|
||||
{% if userinfo.imap == 1 %}
|
||||
<span class="badge bg-success">IMAP</span>
|
||||
{% endif %}
|
||||
{% if userinfo.pop3 == 1 %}
|
||||
<span class="badge bg-success">POP3</span>
|
||||
{% endif %}
|
||||
{% if userinfo.phpenabled == 1 %}
|
||||
<span class="badge bg-success">PHP</span>
|
||||
{% endif %}
|
||||
{% if userinfo.perlenabled == 1 %}
|
||||
<span class="badge bg-success">Perl/CGI</span>
|
||||
{% endif %}
|
||||
{% if userinfo.api_allowed == 1 %}
|
||||
<a href="{{ linker({'section':'index','page':'apikeys'}) }}">
|
||||
<span class="badge bg-success">API</span>
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% if stdsubdomain is not empty %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">{{ lng('admin.stdsubdomain') }}</div>
|
||||
{{ stdsubdomain }}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">{{ lng('customer.domains') }}</div>
|
||||
{% for domain in domains %}
|
||||
{{ domain }}<br>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<span class="badge bg-primary rounded-pill">{{ domains|length }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="col-4">
|
||||
{# customer details #}
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<i class="fa-solid fa-id-card"></i>
|
||||
{{ lng('index.customerdetails') }}
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
{% if userinfo.customernumber is not empty %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">{{ lng('customer.customernumber') }}</div>
|
||||
{{ userinfo.customernumber }}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if userinfo.company is not empty %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">{{ lng('customer.company') }}</div>
|
||||
{{ userinfo.company }}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if userinfo.name is not empty %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">{{ lng('customer.name') }}</div>
|
||||
{{ userinfo.firstname }}
|
||||
{{ userinfo.name }}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if userinfo.street is not empty %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">{{ lng('customer.street') }}</div>
|
||||
{{ userinfo.street }}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if userinfo.city is not empty %}
|
||||
<li class="list-group-item d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
<div class="fw-bold">{{ lng('customer.zipcode') }}/{{ lng('customer.city') }}</div>
|
||||
{{ userinfo.zipcode }}
|
||||
{{ userinfo.city }}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% if userinfo.custom_notes is not empty and userinfo.custom_notes_show == 1 %}
|
||||
<li class="list-group-item list-group-item-info d-flex justify-content-between align-items-start">
|
||||
<div class="ms-2 me-auto">
|
||||
{{ userinfo.custom_notes|nl2br|raw }}
|
||||
</div>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<div class="{% if userinfo.adminsession == 1 %}col-5{% else %}col-4{% endif %}">
|
||||
{% if userinfo.adminsession == 1 %}
|
||||
{# froxlor-details #}
|
||||
<div class="card mb-3">
|
||||
|
||||
Reference in New Issue
Block a user