diff --git a/admin_ipsandports.php b/admin_ipsandports.php index 84006fb0..8b24c72b 100644 --- a/admin_ipsandports.php +++ b/admin_ipsandports.php @@ -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']); @@ -68,7 +69,7 @@ if ($page == 'ipsandports' || $page == 'overview') { $row['ip'] = '[' . $row['ip'] . ']'; } eval("\$ipsandports.=\"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports_ipandport") . "\";"); - $count ++; + $count++; } eval("echo \"" . \Froxlor\UI\Template::getTemplate("ipsandports/ipsandports") . "\";"); } elseif ($action == 'delete' && $id != 0) { @@ -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') { diff --git a/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php b/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php index 3d10f7c3..2ddd60ba 100644 --- a/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php +++ b/lib/formfields/admin/ipsandports/formfield.ipsandports_add.php @@ -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 ) ) ) diff --git a/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php b/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php index b9148678..65cb0984 100644 --- a/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php +++ b/lib/formfields/admin/ipsandports/formfield.ipsandports_edit.php @@ -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'] ) ) )