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:
Michael Kaufmann
2022-02-21 17:42:04 +01:00
parent 1e4da4850e
commit 322719fec8
30 changed files with 455 additions and 684 deletions

View File

@@ -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

View File

@@ -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();
}
}

View File

@@ -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 '&nbsp;<span class="red">*</span>';
} elseif (isset($data['mandatory_ex'])) {
return '&nbsp;<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 ? '&nbsp;' . $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;
}
}

View File

@@ -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',

View File

@@ -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',

View File

@@ -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
)
)
)

View File

@@ -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
)
)
)

View File

@@ -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']
)
)
)

View File

@@ -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'],

View File

@@ -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'
)
)
)

View File

@@ -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'
)
)
)

View File

@@ -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
)
)
)

View File

@@ -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']