From 6dad29cae79dc7ef9e0900f6cf34baf002549366 Mon Sep 17 00:00:00 2001 From: "Roman Schmerold (BNoiZe)" Date: Mon, 16 Feb 2015 17:56:37 +0100 Subject: [PATCH] Even more HTMLform2 migrations Signed-off-by: Roman Schmerold (BNoiZe) --- admin_phpsettings.php | 26 +++-- lib/formfields/admin/formfield.phpconfig.php | 92 ++++++++++++++++++ .../phpconfig/formfield.phpconfig_add.php | 92 ------------------ .../phpconfig/formfield.phpconfig_edit.php | 95 ------------------- 4 files changed, 104 insertions(+), 201 deletions(-) create mode 100644 lib/formfields/admin/formfield.phpconfig.php delete mode 100644 lib/formfields/admin/phpconfig/formfield.phpconfig_add.php delete mode 100644 lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php diff --git a/admin_phpsettings.php b/admin_phpsettings.php index 5f10145c..348abd9f 100644 --- a/admin_phpsettings.php +++ b/admin_phpsettings.php @@ -121,9 +121,9 @@ if ($page == 'overview') { $fpm_reqslowtimeout = 0; } elseif (Settings::Get('phpfpm.enabled') == 1) { - $fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0; - $fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/'); - $fpm_reqslowtimeout = validate($_POST['phpfpm_reqslowtimeout'], 'phpfpm_reqslowtimeout', '/^([0-9]+)(|s|m|h|d)$/'); + $fpm_enableslowlog = isset($_POST['fpm_slowlog']) ? (int)$_POST['fpm_slowlog'] : 0; + $fpm_reqtermtimeout = validate($_POST['fpm_reqterm'], 'fpm_reqterm', '/^([0-9]+)(|s|m|h|d)$/'); + $fpm_reqslowtimeout = validate($_POST['fpm_reqslow'], 'fpm_reqslow', '/^([0-9]+)(|s|m|h|d)$/'); // disable fcgid stuff $binary = '/usr/bin/php-cgi'; $file_extensions = 'php'; @@ -171,11 +171,10 @@ if ($page == 'overview') { $result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1"); $result = $result_stmt->fetch(PDO::FETCH_ASSOC); - $phpconfig_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php'; - $phpconfig_add_form = htmlform::genHTMLForm($phpconfig_add_data); + $phpconfig_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/formfield.phpconfig.php'; + $phpconfig_add_form = HTMLform2::genHTMLForm($phpconfig_add_data); - $title = $phpconfig_add_data['phpconfig_add']['title']; - $image = $phpconfig_add_data['phpconfig_add']['image']; + $title = $lng['admin']['phpsettings']['addsettings']; eval("echo \"" . getTemplate("phpconfig/overview_add") . "\";"); } @@ -271,9 +270,9 @@ if ($page == 'overview') { $fpm_reqslowtimeout = 0; } elseif (Settings::Get('phpfpm.enabled') == 1) { - $fpm_enableslowlog = isset($_POST['phpfpm_enable_slowlog']) ? (int)$_POST['phpfpm_enable_slowlog'] : 0; - $fpm_reqtermtimeout = validate($_POST['phpfpm_reqtermtimeout'], 'phpfpm_reqtermtimeout', '/^([0-9]+)(|s|m|h|d)$/'); - $fpm_reqslowtimeout = validate($_POST['phpfpm_reqslowtimeout'], 'phpfpm_reqslowtimeout', '/^([0-9]+)(|s|m|h|d)$/'); + $fpm_enableslowlog = isset($_POST['fpm_slowlog']) ? (int)$_POST['fpm_slowlog'] : 0; + $fpm_reqtermtimeout = validate($_POST['fpm_reqterm'], 'fpm_reqterm', '/^([0-9]+)(|s|m|h|d)$/'); + $fpm_reqslowtimeout = validate($_POST['fpm_reqslow'], 'fpm_reqslow', '/^([0-9]+)(|s|m|h|d)$/'); // disable fcgid stuff $binary = '/usr/bin/php-cgi'; $file_extensions = 'php'; @@ -320,11 +319,10 @@ if ($page == 'overview') { } else { - $phpconfig_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php'; - $phpconfig_edit_form = htmlform::genHTMLForm($phpconfig_edit_data); + $phpconfig_edit_data = include_once dirname(__FILE__).'/lib/formfields/admin/formfield.phpconfig.php'; + $phpconfig_edit_form = HTMLform2::genHTMLForm($phpconfig_edit_data, $result); - $title = $phpconfig_edit_data['phpconfig_edit']['title']; - $image = $phpconfig_edit_data['phpconfig_edit']['image']; + $title = $lng['admin']['phpsettings']['editsettings']; eval("echo \"" . getTemplate("phpconfig/overview_edit") . "\";"); } diff --git a/lib/formfields/admin/formfield.phpconfig.php b/lib/formfields/admin/formfield.phpconfig.php new file mode 100644 index 00000000..86f7e5cc --- /dev/null +++ b/lib/formfields/admin/formfield.phpconfig.php @@ -0,0 +1,92 @@ + (2010-) + * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt + * @package Formfields + * + */ + +return array( + 'section_a' => array( + 'title' => $lng['admin']['phpsettings']['addsettings'], + 'fields' => array( + 'description' => array( + 'label' => $lng['admin']['phpsettings']['description'], + 'type' => 'text', + 'attributes' => array( + 'maxlength' => 50 + ) + ), + 'binary' => array( + 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), + 'label' => $lng['admin']['phpsettings']['binary'], + 'type' => 'text', + 'value' => '/usr/bin/php-cgi', + 'attributes' => array( + 'maxlength' => 255 + ) + ), + 'file_extensions' => array( + 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), + 'label' => $lng['admin']['phpsettings']['file_extensions'], + 'desc' => $lng['admin']['phpsettings']['file_extensions_note'], + 'type' => 'text', + 'value' => 'php', + 'attributes' => array( + 'maxlength' => 255 + ) + ), + 'mod_fcgid_starter' => array( + 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), + 'label' => $lng['admin']['mod_fcgid_starter']['title'], + 'type' => 'text' + ), + 'mod_fcgid_maxrequests' => array( + 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), + 'label' => $lng['admin']['mod_fcgid_maxrequests']['title'], + 'type' => 'text' + ), + 'fpm_slowlog' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['admin']['phpsettings']['enable_slowlog'], + 'type' => 'checkbox', + 'value' => '1' + ), + 'fpm_reqterm' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['admin']['phpsettings']['request_terminate_timeout'], + 'type' => 'text', + 'value' => '60s', + 'attributes' => array( + 'maxlength' => 10 + ) + ), + 'fpm_reqslow' => array( + 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), + 'label' => $lng['admin']['phpsettings']['request_slowlog_timeout'], + 'type' => 'text', + 'maxlength' => 10, + 'value' => '5s' + ), + 'phpsettings' => array( + 'style' => 'align-top', + 'label' => $lng['admin']['phpsettings']['phpinisettings'], + 'type' => 'textarea', + 'value' => $result['phpsettings'], + 'attributes' => array( + 'cols' => 80, + 'rows' => 20 + ) + ) + ) + ) +); diff --git a/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php b/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php deleted file mode 100644 index bbad9529..00000000 --- a/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php +++ /dev/null @@ -1,92 +0,0 @@ - (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Formfields - * - */ - -return array( - 'phpconfig_add' => array( - 'title' => $lng['admin']['phpsettings']['addsettings'], - 'image' => 'icons/phpsettings_add.png', - 'sections' => array( - 'section_a' => array( - 'title' => $lng['admin']['phpsettings']['addsettings'], - 'image' => 'icons/phpsettings_add.png', - 'fields' => array( - 'description' => array( - 'label' => $lng['admin']['phpsettings']['description'], - 'type' => 'text', - 'maxlength' => 50 - ), - 'binary' => array( - 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), - 'label' => $lng['admin']['phpsettings']['binary'], - 'type' => 'text', - 'maxlength' => 255, - 'value' => '/usr/bin/php-cgi' - ), - 'file_extensions' => array( - 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), - 'label' => $lng['admin']['phpsettings']['file_extensions'], - 'desc' => $lng['admin']['phpsettings']['file_extensions_note'], - 'type' => 'text', - 'maxlength' => 255, - 'value' => 'php' - ), - 'mod_fcgid_starter' => array( - 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), - 'label' => $lng['admin']['mod_fcgid_starter']['title'], - 'type' => 'text' - ), - 'mod_fcgid_maxrequests' => array( - 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), - 'label' => $lng['admin']['mod_fcgid_maxrequests']['title'], - 'type' => 'text' - ), - 'phpfpm_enable_slowlog' => array( - 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), - 'label' => $lng['admin']['phpsettings']['enable_slowlog'], - 'type' => 'checkbox', - 'values' => array( - array ('label' => $lng['panel']['yes'], 'value' => '1') - ), - 'value' => array() - ), - 'phpfpm_reqtermtimeout' => array( - 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), - 'label' => $lng['admin']['phpsettings']['request_terminate_timeout'], - 'type' => 'text', - 'maxlength' => 10, - 'value' => '60s' - ), - 'phpfpm_reqslowtimeout' => array( - 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), - 'label' => $lng['admin']['phpsettings']['request_slowlog_timeout'], - 'type' => 'text', - 'maxlength' => 10, - 'value' => '5s' - ), - 'phpsettings' => array( - 'style' => 'align-top', - 'label' => $lng['admin']['phpsettings']['phpinisettings'], - 'type' => 'textarea', - 'cols' => 80, - 'rows' => 20, - 'value' => $result['phpsettings'] - ) - ) - ) - ) - ) -); diff --git a/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php b/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php deleted file mode 100644 index 83dbbd44..00000000 --- a/lib/formfields/admin/phpconfig/formfield.phpconfig_edit.php +++ /dev/null @@ -1,95 +0,0 @@ - (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Formfields - * - */ - -return array( - 'phpconfig_edit' => array( - 'title' => $lng['admin']['phpsettings']['editsettings'], - 'image' => 'icons/phpsettings_edit.png', - 'sections' => array( - 'section_a' => array( - 'title' => $lng['admin']['phpsettings']['editsettings'], - 'image' => 'icons/phpsettings_edit.png', - 'fields' => array( - 'description' => array( - 'label' => $lng['admin']['phpsettings']['description'], - 'type' => 'text', - 'maxlength' => 50, - 'value' => $result['description'] - ), - 'binary' => array( - 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), - 'label' => $lng['admin']['phpsettings']['binary'], - 'type' => 'text', - 'maxlength' => 255, - 'value' => $result['binary'] - ), - 'file_extensions' => array( - 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), - 'label' => $lng['admin']['phpsettings']['file_extensions'], - 'desc' => $lng['admin']['phpsettings']['file_extensions_note'], - 'type' => 'text', - 'maxlength' => 255, - 'value' => $result['file_extensions'] - ), - 'mod_fcgid_starter' => array( - 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), - 'label' => $lng['admin']['mod_fcgid_starter']['title'], - 'type' => 'text', - 'value' => ((int)$result['mod_fcgid_starter'] != - 1 ? $result['mod_fcgid_starter'] : '') - ), - 'mod_fcgid_maxrequests' => array( - 'visible' => (Settings::Get('system.mod_fcgid') == 1 ? true : false), - 'label' => $lng['admin']['mod_fcgid_maxrequests']['title'], - 'type' => 'text', - 'value' => ((int)$result['mod_fcgid_maxrequests'] != - 1 ? $result['mod_fcgid_maxrequests'] : '') - ), - 'phpfpm_enable_slowlog' => array( - 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), - 'label' => $lng['admin']['phpsettings']['enable_slowlog'], - 'type' => 'checkbox', - 'values' => array( - array ('label' => $lng['panel']['yes'], 'value' => '1') - ), - 'value' => array($result['fpm_slowlog']) - ), - 'phpfpm_reqtermtimeout' => array( - 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), - 'label' => $lng['admin']['phpsettings']['request_terminate_timeout'], - 'type' => 'text', - 'maxlength' => 10, - 'value' => $result['fpm_reqterm'] - ), - 'phpfpm_reqslowtimeout' => array( - 'visible' => (Settings::Get('phpfpm.enabled') == 1 ? true : false), - 'label' => $lng['admin']['phpsettings']['request_slowlog_timeout'], - 'type' => 'text', - 'maxlength' => 10, - 'value' => $result['fpm_reqslow'] - ), - 'phpsettings' => array( - 'style' => 'align-top', - 'label' => $lng['admin']['phpsettings']['phpinisettings'], - 'type' => 'textarea', - 'cols' => 80, - 'rows' => 20, - 'value' => $result['phpsettings'] - ) - ) - ) - ) - ) -);