migrate ipsandports.add/edit

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-02-18 22:33:59 +01:00
parent ef4feb07e6
commit 0b61bd9a79
3 changed files with 40 additions and 141 deletions

View File

@@ -21,6 +21,7 @@ require './lib/init.php';
use Froxlor\Settings;
use Froxlor\Api\Commands\IpsAndPorts;
use Froxlor\UI\Panel\UI;
if (isset($_POST['id'])) {
$id = intval($_POST['id']);
@@ -118,12 +119,11 @@ if ($page == 'ipsandports' || $page == 'overview') {
} else {
$ipsandports_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php';
$ipsandports_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($ipsandports_add_data);
$title = $ipsandports_add_data['ipsandports_add']['title'];
$image = $ipsandports_add_data['ipsandports_add']['image'];
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_add") . "\";");
UI::TwigBuffer('user/form.html.twig', [
'formdata' => $ipsandports_add_data['ipsandports_add']
]);
UI::TwigOutputBuffer();
}
} elseif ($action == 'edit' && $id != 0) {
try {
@@ -152,12 +152,11 @@ if ($page == 'ipsandports' || $page == 'overview') {
$result = \Froxlor\PhpHelper::htmlentitiesArray($result);
$ipsandports_edit_data = include_once dirname(__FILE__) . '/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php';
$ipsandports_edit_form = \Froxlor\UI\HtmlForm::genHTMLForm($ipsandports_edit_data);
$title = $ipsandports_edit_data['ipsandports_edit']['title'];
$image = $ipsandports_edit_data['ipsandports_edit']['image'];
eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_edit") . "\";");
UI::TwigBuffer('user/form.html.twig', [
'formdata' => $ipsandports_edit_data['ipsandports_edit']
]);
UI::TwigOutputBuffer();
}
}
} elseif ($action == 'jqCheckIP') {

View File

@@ -17,7 +17,7 @@
return array(
'ipsandports_add' => array(
'title' => $lng['admin']['ipsandports']['add'],
'image' => 'icons/ipsports_add.png',
'image' => 'fa-solid fa-plus',
'sections' => array(
'section_a' => array(
'title' => $lng['admin']['ipsandports']['ipandport'],
@@ -42,42 +42,21 @@ return array(
'visible' => ! $is_nginx,
'label' => $lng['admin']['ipsandports']['create_listen_statement'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
'1'
)
'value' => '1',
'checked' => true
),
'namevirtualhost_statement' => array(
'visible' => $is_apache && ! $is_apache24,
'label' => $lng['admin']['ipsandports']['create_namevirtualhost_statement'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
'1'
)
'value' => '1',
'checked' => true
),
'vhostcontainer' => array(
'label' => $lng['admin']['ipsandports']['create_vhostcontainer'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
'1'
)
'value' => '1',
'checked' => true
),
'docroot' => array(
'label' => $lng['admin']['ipsandports']['docroot']['title'],
@@ -85,7 +64,6 @@ return array(
'type' => 'text'
),
'specialsettings' => array(
'style' => 'align-top',
'label' => $lng['admin']['ownvhostsettings'],
'desc' => $lng['serversettings']['default_vhostconf']['description'],
'type' => 'textarea',
@@ -96,15 +74,8 @@ return array(
'visible' => $is_apache,
'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
'1'
)
'value' => '1',
'checked' => true
)
)
),
@@ -113,7 +84,6 @@ return array(
'image' => 'icons/ipsports_add.png',
'fields' => array(
'default_vhostconf_domain' => array(
'style' => 'align-top',
'label' => $lng['admin']['ipsandports']['default_vhostconf_domain'],
'desc' => $lng['serversettings']['default_vhostconf_domain']['description'],
'type' => 'textarea',
@@ -122,7 +92,6 @@ return array(
),
'ssl_default_vhostconf_domain' => array(
'visible' => (\Froxlor\Settings::Get('system.use_ssl') == 1 ? true : false),
'style' => 'align-top',
'label' => $lng['admin']['ipsandports']['ssl_default_vhostconf_domain'],
'desc' => $lng['serversettings']['default_vhostconf_domain']['description'],
'type' => 'textarea',
@@ -132,13 +101,8 @@ return array(
'include_default_vhostconf_domain' => array(
'label' => $lng['admin']['include_ownvhostsettings'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array()
'value' => '1',
'checked' => false
)
)
),
@@ -150,13 +114,8 @@ return array(
'ssl' => array(
'label' => $lng['admin']['ipsandports']['enable_ssl'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array()
'value' => '1',
'checked' => false
),
'ssl_cert_file' => array(
'label' => $lng['admin']['ipsandports']['ssl_cert_file'],
@@ -176,7 +135,6 @@ return array(
'type' => 'text'
),
'ssl_specialsettings' => array(
'style' => 'align-top',
'label' => $lng['admin']['ownsslvhostsettings'],
'desc' => $lng['serversettings']['default_vhostconf']['description'],
'type' => 'textarea',
@@ -186,13 +144,8 @@ return array(
'include_specialsettings' => array(
'label' => $lng['admin']['include_ownvhostsettings'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array()
'value' => '1',
'checked' => false
)
)
)

View File

@@ -17,7 +17,7 @@
return array(
'ipsandports_edit' => array(
'title' => $lng['admin']['ipsandports']['edit'],
'image' => 'icons/ipsports_edit.png',
'image' => 'fa-solid fa-pen',
'sections' => array(
'section_a' => array(
'title' => $lng['admin']['ipsandports']['ipandport'],
@@ -44,42 +44,21 @@ return array(
'visible' => ! $is_nginx,
'label' => $lng['admin']['ipsandports']['create_listen_statement'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
$result['listen_statement']
)
'value' => '1',
'checked' => $result['listen_statement']
),
'namevirtualhost_statement' => array(
'visible' => $is_apache && ! $is_apache24,
'label' => $lng['admin']['ipsandports']['create_namevirtualhost_statement'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
$result['namevirtualhost_statement']
)
'value' => '1',
'checked' => $result['namevirtualhost_statement']
),
'vhostcontainer' => array(
'label' => $lng['admin']['ipsandports']['create_vhostcontainer'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
$result['vhostcontainer']
)
'value' => '1',
'checked' => $result['vhostcontainer']
),
'docroot' => array(
'label' => $lng['admin']['ipsandports']['docroot']['title'],
@@ -88,7 +67,6 @@ return array(
'value' => $result['docroot']
),
'specialsettings' => array(
'style' => 'align-top',
'label' => $lng['admin']['ownvhostsettings'],
'desc' => $lng['serversettings']['default_vhostconf']['description'],
'type' => 'textarea',
@@ -100,15 +78,8 @@ return array(
'visible' => $is_apache,
'label' => $lng['admin']['ipsandports']['create_vhostcontainer_servername_statement'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
$result['vhostcontainer_servername_statement']
)
'value' => '1',
'checked' => $result['vhostcontainer_servername_statement']
)
)
),
@@ -117,7 +88,6 @@ return array(
'image' => 'icons/ipsports_edit.png',
'fields' => array(
'default_vhostconf_domain' => array(
'style' => 'align-top',
'label' => $lng['admin']['ipsandports']['default_vhostconf_domain'],
'desc' => $lng['serversettings']['default_vhostconf_domain']['description'],
'type' => 'textarea',
@@ -127,7 +97,6 @@ return array(
),
'ssl_default_vhostconf_domain' => array(
'visible' => (\Froxlor\Settings::Get('system.use_ssl') == 1 ? true : false),
'style' => 'align-top',
'label' => $lng['admin']['ipsandports']['ssl_default_vhostconf_domain'],
'desc' => $lng['serversettings']['default_vhostconf_domain']['description'],
'type' => 'textarea',
@@ -138,15 +107,8 @@ return array(
'include_default_vhostconf_domain' => array(
'label' => $lng['admin']['include_ownvhostsettings'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
$result['include_default_vhostconf_domain']
)
'value' => '1',
'checked' => $result['include_default_vhostconf_domain']
)
)
),
@@ -158,15 +120,8 @@ return array(
'ssl' => array(
'label' => $lng['admin']['ipsandports']['enable_ssl'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
$result['ssl']
)
'value' => '1',
'checked' => $result['ssl']
),
'ssl_cert_file' => array(
'label' => $lng['admin']['ipsandports']['ssl_cert_file'],
@@ -190,7 +145,6 @@ return array(
'value' => $result['ssl_cert_chainfile']
),
'ssl_specialsettings' => array(
'style' => 'align-top',
'label' => $lng['admin']['ownsslvhostsettings'],
'desc' => $lng['serversettings']['default_vhostconf']['description'],
'type' => 'textarea',
@@ -201,15 +155,8 @@ return array(
'include_specialsettings' => array(
'label' => $lng['admin']['include_ownvhostsettings'],
'type' => 'checkbox',
'values' => array(
array(
'label' => $lng['panel']['yes'],
'value' => '1'
)
),
'value' => array(
$result['include_specialsettings']
)
'value' => '1',
'checked' => $result['include_specialsettings']
)
)
)