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

View File

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

View File

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