diff --git a/admin_customers.php b/admin_customers.php
index 27b98b73..cea78e2e 100644
--- a/admin_customers.php
+++ b/admin_customers.php
@@ -148,7 +148,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
$row['custom_notes'] = ($row['custom_notes'] != '') ? nl2br($row['custom_notes']) : '';
eval("\$customers.=\"" . \Froxlor\UI\Template::getTemplate("customers/customers_customer") . "\";");
- $count ++;
+ $count++;
}
$customercount = $result['count'] . " / " . $paging->getEntries();
@@ -201,7 +201,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
$target = (isset($_GET['target']) ? $_GET['target'] : 'index');
$redirect = "customer_" . $target . ".php";
- if (! file_exists(\Froxlor\Froxlor::getInstallDir() . "/" . $redirect)) {
+ if (!file_exists(\Froxlor\Froxlor::getInstallDir() . "/" . $redirect)) {
$redirect = "customer_index.php";
}
\Froxlor\UI\Response::redirectTo($redirect, array(
@@ -285,17 +285,7 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
));
} else {
- $diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
- $traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
- $subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
- $emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
- $email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
- $email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
- $email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
- $ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
- $mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, '0', true, true);
-
- $phpconfigs = array();
+ $phpconfigs = [];
$configs = Database::query("
SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
@@ -347,23 +337,6 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
}
$result = json_decode($json_result, true)['data'];
- /*
- * information for moving customer
- */
- $available_admins_stmt = Database::prepare("
- SELECT * FROM `" . TABLE_PANEL_ADMINS . "`
- WHERE (`customers` = '-1' OR `customers` > `customers_used`)");
- Database::pexecute($available_admins_stmt);
- $admin_select = \Froxlor\UI\HTML::makeoption("-----", 0, true, true, true);
- $admin_select_cnt = 0;
- while ($available_admin = $available_admins_stmt->fetch()) {
- $admin_select .= \Froxlor\UI\HTML::makeoption($available_admin['name'] . " (" . $available_admin['loginname'] . ")", $available_admin['adminid'], null, true, true);
- $admin_select_cnt ++;
- }
- /*
- * end of moving customer stuff
- */
-
if ($result['loginname'] != '') {
if (isset($_POST['send']) && $_POST['send'] == 'send') {
@@ -377,69 +350,15 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
's' => $s
));
} else {
- $language_options = '';
-
- foreach ($languages as $language_file => $language_name) {
- $language_options .= \Froxlor\UI\HTML::makeoption($language_name, $language_file, $result['def_language'], true);
- }
$dec_places = Settings::Get('panel.decimal_places');
$result['traffic'] = round($result['traffic'] / (1024 * 1024), $dec_places);
$result['diskspace'] = round($result['diskspace'] / 1024, $dec_places);
$result['email'] = $idna_convert->decode($result['email']);
- $diskspace_ul = \Froxlor\UI\HTML::makecheckbox('diskspace_ul', $lng['customer']['unlimited'], '-1', false, $result['diskspace'], true, true);
- if ($result['diskspace'] == '-1') {
- $result['diskspace'] = '';
- }
-
- $traffic_ul = \Froxlor\UI\HTML::makecheckbox('traffic_ul', $lng['customer']['unlimited'], '-1', false, $result['traffic'], true, true);
- if ($result['traffic'] == '-1') {
- $result['traffic'] = '';
- }
-
- $subdomains_ul = \Froxlor\UI\HTML::makecheckbox('subdomains_ul', $lng['customer']['unlimited'], '-1', false, $result['subdomains'], true, true);
- if ($result['subdomains'] == '-1') {
- $result['subdomains'] = '';
- }
-
- $emails_ul = \Froxlor\UI\HTML::makecheckbox('emails_ul', $lng['customer']['unlimited'], '-1', false, $result['emails'], true, true);
- if ($result['emails'] == '-1') {
- $result['emails'] = '';
- }
-
- $email_accounts_ul = \Froxlor\UI\HTML::makecheckbox('email_accounts_ul', $lng['customer']['unlimited'], '-1', false, $result['email_accounts'], true, true);
- if ($result['email_accounts'] == '-1') {
- $result['email_accounts'] = '';
- }
-
- $email_forwarders_ul = \Froxlor\UI\HTML::makecheckbox('email_forwarders_ul', $lng['customer']['unlimited'], '-1', false, $result['email_forwarders'], true, true);
- if ($result['email_forwarders'] == '-1') {
- $result['email_forwarders'] = '';
- }
-
- $email_quota_ul = \Froxlor\UI\HTML::makecheckbox('email_quota_ul', $lng['customer']['unlimited'], '-1', false, $result['email_quota'], true, true);
- if ($result['email_quota'] == '-1') {
- $result['email_quota'] = '';
- }
-
- $ftps_ul = \Froxlor\UI\HTML::makecheckbox('ftps_ul', $lng['customer']['unlimited'], '-1', false, $result['ftps'], true, true);
- if ($result['ftps'] == '-1') {
- $result['ftps'] = '';
- }
-
- $mysqls_ul = \Froxlor\UI\HTML::makecheckbox('mysqls_ul', $lng['customer']['unlimited'], '-1', false, $result['mysqls'], true, true);
- if ($result['mysqls'] == '-1') {
- $result['mysqls'] = '';
- }
-
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
- $gender_options = \Froxlor\UI\HTML::makeoption($lng['gender']['undef'], 0, ($result['gender'] == '0' ? true : false), true, true);
- $gender_options .= \Froxlor\UI\HTML::makeoption($lng['gender']['male'], 1, ($result['gender'] == '1' ? true : false), true, true);
- $gender_options .= \Froxlor\UI\HTML::makeoption($lng['gender']['female'], 2, ($result['gender'] == '2' ? true : false), true, true);
-
- $phpconfigs = array();
+ $phpconfigs = [];
$configs = Database::query("
SELECT c.*, fc.description as interpreter
FROM `" . TABLE_PANEL_PHPCONFIGS . "` c
@@ -448,38 +367,49 @@ if ($page == 'customers' && $userinfo['customers'] != '0') {
while ($row = $configs->fetch(PDO::FETCH_ASSOC)) {
if ((int) Settings::Get('phpfpm.enabled') == 1) {
$phpconfigs[] = array(
- 'label' => $row['description'] . " [" . $row['interpreter'] . "]
",
+ 'label' => $row['description'] . " [" . $row['interpreter'] . "]",
'value' => $row['id']
);
} else {
$phpconfigs[] = array(
- 'label' => $row['description'] . "
",
+ 'label' => $row['description'],
'value' => $row['id']
);
}
}
// hosting plans
- $hosting_plans = "";
$plans = Database::query("
SELECT *
FROM `" . TABLE_PANEL_PLANS . "`
ORDER BY name ASC
");
- if (Database::num_rows() > 0) {
- $hosting_plans .= \Froxlor\UI\HTML::makeoption("---", 0, 0, true, true);
- }
+ $hosting_plans = [
+ 0 => "---"
+ ];
while ($row = $plans->fetch(PDO::FETCH_ASSOC)) {
- $hosting_plans .= \Froxlor\UI\HTML::makeoption($row['name'], $row['id'], 0, true, true);
+ $hosting_plans[$row['id']] = $row['name'];
+ }
+
+ $available_admins_stmt = Database::prepare("
+ SELECT * FROM `" . TABLE_PANEL_ADMINS . "`
+ WHERE (`customers` = '-1' OR `customers` > `customers_used`)
+ AND adminid <> :currentadmin
+ ");
+ Database::pexecute($available_admins_stmt, ['currentadmin' => $result['adminid']]);
+ $admin_select = [
+ 0 => "---"
+ ];
+ while ($available_admin = $available_admins_stmt->fetch()) {
+ $admin_select[$available_admin['adminid']] = $available_admin['name'] . " (" . $available_admin['loginname'] . ")";
}
$customer_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/customer/formfield.customer_edit.php';
- $customer_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($customer_edit_data);
- $title = $customer_edit_data['customer_edit']['title'];
- $image = $customer_edit_data['customer_edit']['image'];
-
- eval("echo \"" . \Froxlor\UI\Template::getTemplate("customers/customers_edit") . "\";");
+ UI::TwigBuffer('user/form.html.twig', [
+ 'formdata' => $customer_edit_data['customer_edit']
+ ]);
+ UI::TwigOutputBuffer();
}
}
}
diff --git a/lib/formfields/admin/customer/formfield.customer_add.php b/lib/formfields/admin/customer/formfield.customer_add.php
index 2cd7c562..7a3e67a1 100644
--- a/lib/formfields/admin/customer/formfield.customer_add.php
+++ b/lib/formfields/admin/customer/formfield.customer_add.php
@@ -132,7 +132,6 @@ return array(
'type' => 'text'
),
'custom_notes' => array(
- 'style' => 'align-top',
'label' => $lng['usersettings']['custom_notes']['title'],
'desc' => $lng['usersettings']['custom_notes']['description'],
'type' => 'textarea',
@@ -168,48 +167,42 @@ return array(
'type' => 'textul',
'value' => 0,
'maxlength' => 16,
- 'mandatory' => true,
- 'ul_field' => $diskspace_ul
+ 'mandatory' => true
),
'traffic' => array(
'label' => $lng['customer']['traffic'] . ' (' . $lng['customer']['gib'] . ')',
'type' => 'textul',
'value' => 0,
'maxlength' => 14,
- 'mandatory' => true,
- 'ul_field' => $traffic_ul
+ 'mandatory' => true
),
'subdomains' => array(
'label' => $lng['customer']['subdomains'],
'type' => 'textul',
'value' => 0,
'maxlength' => 9,
- 'mandatory' => true,
- 'ul_field' => $subdomains_ul
+ 'mandatory' => true
),
'emails' => array(
'label' => $lng['customer']['emails'],
'type' => 'textul',
'value' => 0,
'maxlength' => 9,
- 'mandatory' => true,
- 'ul_field' => $emails_ul
+ 'mandatory' => true
),
'email_accounts' => array(
'label' => $lng['customer']['accounts'],
'type' => 'textul',
'value' => 0,
'maxlength' => 9,
- 'mandatory' => true,
- 'ul_field' => $email_accounts_ul
+ 'mandatory' => true
),
'email_forwarders' => array(
'label' => $lng['customer']['forwarders'],
'type' => 'textul',
'value' => 0,
'maxlength' => 9,
- 'mandatory' => true,
- 'ul_field' => $email_forwarders_ul
+ 'mandatory' => true
),
'email_quota' => array(
'label' => $lng['customer']['email_quota']. ' (' . $lng['customer']['mib'] . ')',
@@ -217,8 +210,7 @@ return array(
'value' => 0,
'maxlength' => 9,
'visible' => (\Froxlor\Settings::Get('system.mail_quota_enabled') == '1' ? true : false),
- 'mandatory' => true,
- 'ul_field' => $email_quota_ul
+ 'mandatory' => true
),
'email_imap' => array(
'label' => $lng['customer']['email_imap'],
@@ -238,16 +230,14 @@ return array(
'label' => $lng['customer']['ftps'],
'type' => 'textul',
'value' => 0,
- 'maxlength' => 9,
- 'ul_field' => $ftps_ul
+ 'maxlength' => 9
),
'mysqls' => array(
'label' => $lng['customer']['mysqls'],
'type' => 'textul',
'value' => 0,
'maxlength' => 9,
- 'mandatory' => true,
- 'ul_field' => $mysqls_ul
+ 'mandatory' => true
),
'phpenabled' => array(
'label' => $lng['admin']['phpenabled'] . '?',
@@ -260,10 +250,10 @@ return array(
'label' => $lng['admin']['phpsettings']['title'],
'type' => 'checkbox',
'values' => $phpconfigs,
- 'value' => ((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 ?
- \Froxlor\Settings::Get('system.mod_fcgid_defaultini')
+ 'value' => ((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 ?
+ [\Froxlor\Settings::Get('system.mod_fcgid_defaultini')]
: ((int) \Froxlor\Settings::Get('phpfpm.enabled') == 1 ?
- \Froxlor\Settings::Get('phpfpm.defaultini')
+ [\Froxlor\Settings::Get('phpfpm.defaultini')]
: null)),
'is_array' => 1
),
diff --git a/lib/formfields/admin/customer/formfield.customer_edit.php b/lib/formfields/admin/customer/formfield.customer_edit.php
index 82d009bf..a1993de1 100644
--- a/lib/formfields/admin/customer/formfield.customer_edit.php
+++ b/lib/formfields/admin/customer/formfield.customer_edit.php
@@ -17,7 +17,7 @@
return array(
'customer_edit' => array(
'title' => $lng['admin']['customer_edit'],
- 'image' => 'icons/user_edit.png',
+ 'image' => 'fa-solid fa-user-pen',
'sections' => array(
'section_a' => array(
'title' => $lng['admin']['accountdata'],
@@ -36,28 +36,14 @@ return array(
'createstdsubdomain' => array(
'label' => $lng['admin']['stdsubdomain_add'] . '?',
'type' => 'checkbox',
- 'values' => array(
- array(
- 'label' => $lng['panel']['yes'],
- 'value' => '1'
- )
- ),
- 'value' => array(
- ($result['standardsubdomain'] != '0') ? '1' : '0'
- )
+ 'value' => '1',
+ 'checked' => ($result['standardsubdomain'] != '0') ? '1' : '0'
),
'deactivated' => array(
'label' => $lng['admin']['deactivated_user'],
'type' => 'checkbox',
- 'values' => array(
- array(
- 'label' => $lng['panel']['yes'],
- 'value' => '1'
- )
- ),
- 'value' => array(
- $result['deactivated']
- )
+ 'value' => '1',
+ 'checked' => $result['deactivated']
),
'new_customer_password' => array(
'label' => $lng['login']['password'] . ' (' . $lng['panel']['emptyfornochanges'] . ')',
@@ -73,21 +59,15 @@ return array(
'def_language' => array(
'label' => $lng['login']['language'],
'type' => 'select',
- 'select_var' => $language_options
+ 'select_var' => $languages,
+ 'selected' => $result['def_language']
),
'api_allowed' => array(
'label' => $lng['usersettings']['api_allowed']['title'],
'desc' => $lng['usersettings']['api_allowed']['description'],
'type' => 'checkbox',
- 'values' => array(
- array(
- 'label' => $lng['panel']['yes'],
- 'value' => '1'
- )
- ),
- 'value' => array(
- $result['api_allowed']
- ),
+ 'value' => '1',
+ 'checked' => $result['api_allowed'],
'visible' => (\Froxlor\Settings::Get('api.enabled') == '1' ? true : false)
)
)
@@ -111,7 +91,12 @@ return array(
'gender' => array(
'label' => $lng['gender']['title'],
'type' => 'select',
- 'select_var' => $gender_options
+ 'select_var' => [
+ 0 => $lng['gender']['undef'],
+ 1 => $lng['gender']['male'],
+ 2 => $lng['gender']['female']
+ ],
+ 'selected' => $result['gender']
),
'company' => array(
'label' => $lng['customer']['company'],
@@ -167,15 +152,8 @@ return array(
'custom_notes_show' => array(
'label' => $lng['usersettings']['custom_notes']['show'],
'type' => 'checkbox',
- 'values' => array(
- array(
- 'label' => $lng['panel']['yes'],
- 'value' => '1'
- )
- ),
- 'value' => array(
- $result['custom_notes_show']
- )
+ 'value' => '1',
+ 'checked' => $result['custom_notes_show']
)
)
),
@@ -200,48 +178,42 @@ return array(
'type' => 'textul',
'value' => $result['diskspace'],
'maxlength' => 16,
- 'mandatory' => true,
- 'ul_field' => $diskspace_ul
+ 'mandatory' => true
),
'traffic' => array(
'label' => $lng['customer']['traffic'] . ' (' . $lng['customer']['gib'] . ')',
'type' => 'textul',
'value' => $result['traffic'],
'maxlength' => 14,
- 'mandatory' => true,
- 'ul_field' => $traffic_ul
+ 'mandatory' => true
),
'subdomains' => array(
'label' => $lng['customer']['subdomains'],
'type' => 'textul',
'value' => $result['subdomains'],
'maxlength' => 9,
- 'mandatory' => true,
- 'ul_field' => $subdomains_ul
+ 'mandatory' => true
),
'emails' => array(
'label' => $lng['customer']['emails'],
'type' => 'textul',
'value' => $result['emails'],
'maxlength' => 9,
- 'mandatory' => true,
- 'ul_field' => $emails_ul
+ 'mandatory' => true
),
'email_accounts' => array(
'label' => $lng['customer']['accounts'],
'type' => 'textul',
'value' => $result['email_accounts'],
'maxlength' => 9,
- 'mandatory' => true,
- 'ul_field' => $email_accounts_ul
+ 'mandatory' => true
),
'email_forwarders' => array(
'label' => $lng['customer']['forwarders'],
'type' => 'textul',
'value' => $result['email_forwarders'],
'maxlength' => 9,
- 'mandatory' => true,
- 'ul_field' => $email_forwarders_ul
+ 'mandatory' => true
),
'email_quota' => array(
'label' => $lng['customer']['email_quota'] . ' (' . $lng['customer']['mib'] . ')',
@@ -249,64 +221,40 @@ return array(
'value' => $result['email_quota'],
'maxlength' => 9,
'visible' => (\Froxlor\Settings::Get('system.mail_quota_enabled') == '1' ? true : false),
- 'mandatory' => true,
- 'ul_field' => $email_quota_ul
+ 'mandatory' => true
),
'email_imap' => array(
'label' => $lng['customer']['email_imap'],
'type' => 'checkbox',
- 'values' => array(
- array(
- 'label' => $lng['panel']['yes'],
- 'value' => '1'
- )
- ),
- 'value' => array(
- $result['imap']
- ),
+ 'value' => '1',
+ 'checked' => $result['imap'],
'mandatory' => true
),
'email_pop3' => array(
'label' => $lng['customer']['email_pop3'],
'type' => 'checkbox',
- 'values' => array(
- array(
- 'label' => $lng['panel']['yes'],
- 'value' => '1'
- )
- ),
- 'value' => array(
- $result['pop3']
- ),
+ 'value' => '1',
+ 'checked' => $result['pop3'],
'mandatory' => true
),
'ftps' => array(
'label' => $lng['customer']['ftps'],
'type' => 'textul',
'value' => $result['ftps'],
- 'maxlength' => 9,
- 'ul_field' => $ftps_ul
+ 'maxlength' => 9
),
'mysqls' => array(
'label' => $lng['customer']['mysqls'],
'type' => 'textul',
'value' => $result['mysqls'],
'maxlength' => 9,
- 'mandatory' => true,
- 'ul_field' => $mysqls_ul
+ 'mandatory' => true
),
'phpenabled' => array(
'label' => $lng['admin']['phpenabled'] . '?',
'type' => 'checkbox',
- 'values' => array(
- array(
- 'label' => $lng['panel']['yes'],
- 'value' => '1'
- )
- ),
- 'value' => array(
- $result['phpenabled']
- )
+ 'value' => '1',
+ 'checked' => $result['phpenabled']
),
'allowed_phpconfigs' => array(
'visible' => (((int) \Froxlor\Settings::Get('system.mod_fcgid') == 1 || (int) \Froxlor\Settings::Get('phpfpm.enabled') == 1) ? true : false),
@@ -319,49 +267,28 @@ return array(
'perlenabled' => array(
'label' => $lng['admin']['perlenabled'] . '?',
'type' => 'checkbox',
- 'values' => array(
- array(
- 'label' => $lng['panel']['yes'],
- 'value' => '1'
- )
- ),
- 'value' => array(
- $result['perlenabled']
- )
+ 'value' => '1',
+ 'checked' => $result['perlenabled']
),
'dnsenabled' => array(
'label' => $lng['admin']['dnsenabled'] . '?',
'type' => 'checkbox',
- 'values' => array(
- array(
- 'label' => $lng['panel']['yes'],
- 'value' => '1'
- )
- ),
- 'value' => array(
- $result['dnsenabled']
- ),
+ 'value' => '1',
+ 'checked' => $result['dnsenabled'],
'visible' => (\Froxlor\Settings::Get('system.dnsenabled') == '1' ? true : false)
),
'logviewenabled' => array(
'label' => $lng['admin']['logviewenabled'] . '?',
'type' => 'checkbox',
- 'values' => array(
- array(
- 'label' => $lng['panel']['yes'],
- 'value' => '1'
- )
- ),
- 'value' => array(
- $result['logviewenabled']
- )
+ 'value' => '1',
+ 'checked' => $result['logviewenabled']
)
)
),
'section_d' => array(
'title' => $lng['admin']['movetoadmin'],
'image' => 'icons/user_edit.png',
- 'visible' => ($admin_select_cnt > 1),
+ 'visible' => count($admin_select) > 0,
'fields' => array(
'move_to_admin' => array(
'label' => $lng['admin']['movecustomertoadmin'],
diff --git a/templates/Froxlor/form/form.html.twig b/templates/Froxlor/form/form.html.twig
index 93da2836..88f56cb5 100644
--- a/templates/Froxlor/form/form.html.twig
+++ b/templates/Froxlor/form/form.html.twig
@@ -35,6 +35,8 @@
{{ formfields.select(id, field) }}
{% elseif field.type == 'textarea' %}
{{ formfields.textarea(id, field) }}
+ {% elseif field.type == 'label' %}
+ {{ formfields.plain(id, field) }}
{% endif %}
{% endfor %}
diff --git a/templates/Froxlor/form/formfields.html.twig b/templates/Froxlor/form/formfields.html.twig
index 25feb5c2..dc8b8f36 100644
--- a/templates/Froxlor/form/formfields.html.twig
+++ b/templates/Froxlor/form/formfields.html.twig
@@ -1,11 +1,14 @@
{% macro bool(id, field) %}