diff --git a/admin_phpsettings.php b/admin_phpsettings.php index 75c99fa6..df09de82 100644 --- a/admin_phpsettings.php +++ b/admin_phpsettings.php @@ -81,8 +81,16 @@ if ($page == 'overview') { )); } else { - $result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1"); - $result = $result_stmt->fetch(PDO::FETCH_ASSOC); + if (file_exists(\Froxlor\Froxlor::getInstallDir() . '/templates/misc/php/default.ini.php')) { + require_once \Froxlor\Froxlor::getInstallDir() . '/templates/misc/php/default.ini.php'; + $result = [ + 'phpsettings' => DEFAULT_PHPINI + ]; + } else { + // use first php-config as fallback + $result_stmt = Database::query("SELECT * FROM `" . TABLE_PANEL_PHPCONFIGS . "` WHERE `id` = 1"); + $result = $result_stmt->fetch(PDO::FETCH_ASSOC); + } $fpmconfigs = ''; $configs = Database::query("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` ORDER BY `description` ASC"); @@ -90,9 +98,9 @@ if ($page == 'overview') { $fpmconfigs .= \Froxlor\UI\HTML::makeoption($row['description'], $row['id'], 1, true, true); } - $pm_select = \Froxlor\UI\HTML::makeoption('static', 'static', 'static', true, true); - $pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', 'static', true, true); - $pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', 'static', true, true); + $pm_select = \Froxlor\UI\HTML::makeoption('static', 'static', 'dynamic', true, true); + $pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', 'dynamic', true, true); + $pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', 'dynamic', true, true); $phpconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php'; $phpconfig_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($phpconfig_add_data); @@ -234,9 +242,9 @@ if ($page == 'overview') { )); } else { - $pm_select = \Froxlor\UI\HTML::makeoption('static', 'static', 'static', true, true); - $pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', 'static', true, true); - $pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', 'static', true, true); + $pm_select = \Froxlor\UI\HTML::makeoption('static', 'static', 'dynamic', true, true); + $pm_select .= \Froxlor\UI\HTML::makeoption('dynamic', 'dynamic', 'dynamic', true, true); + $pm_select .= \Froxlor\UI\HTML::makeoption('ondemand', 'ondemand', 'dynamic', true, true); $fpmconfig_add_data = include_once dirname(__FILE__) . '/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php'; $fpmconfig_add_form = \Froxlor\UI\HtmlForm::genHTMLForm($fpmconfig_add_data); diff --git a/install/froxlor.sql b/install/froxlor.sql index 4ac8f477..a0ff604e 100644 --- a/install/froxlor.sql +++ b/install/froxlor.sql @@ -703,7 +703,7 @@ opcache.interned_strings_buffer'), ('panel', 'password_special_char', '!?<>ยง$%+#=@'), ('panel', 'customer_hide_options', ''), ('panel', 'is_configured', '0'), - ('panel', 'version', '0.10.12'), + ('panel', 'version', '0.10.13'), ('panel', 'db_version', '201912313'); @@ -842,13 +842,13 @@ CREATE TABLE `panel_fpmdaemons` ( `description` varchar(50) NOT NULL, `reload_cmd` varchar(255) NOT NULL, `config_dir` varchar(255) NOT NULL, - `pm` varchar(15) NOT NULL DEFAULT 'static', - `max_children` int(4) NOT NULL DEFAULT '1', - `start_servers` int(4) NOT NULL DEFAULT '20', - `min_spare_servers` int(4) NOT NULL DEFAULT '5', - `max_spare_servers` int(4) NOT NULL DEFAULT '35', + `pm` varchar(15) NOT NULL DEFAULT 'dynamic', + `max_children` int(4) NOT NULL DEFAULT '5', + `start_servers` int(4) NOT NULL DEFAULT '2', + `min_spare_servers` int(4) NOT NULL DEFAULT '1', + `max_spare_servers` int(4) NOT NULL DEFAULT '3', `max_requests` int(4) NOT NULL DEFAULT '0', - `idle_timeout` int(4) NOT NULL DEFAULT '30', + `idle_timeout` int(4) NOT NULL DEFAULT '10', `limit_extensions` varchar(255) NOT NULL default '.php', `custom_config` text, PRIMARY KEY (`id`), @@ -859,7 +859,7 @@ CREATE TABLE `panel_fpmdaemons` ( INSERT INTO `panel_fpmdaemons` (`id`, `description`, `reload_cmd`, `config_dir`) VALUES -(1, 'System default', 'service php7.0-fpm restart', '/etc/php/7.0/fpm/pool.d/'); +(1, 'System default', 'service php7.3-fpm restart', '/etc/php/7.3/fpm/pool.d/'); @@ -879,13 +879,13 @@ CREATE TABLE `panel_phpconfigs` ( `fpmsettingid` int(11) NOT NULL DEFAULT '1', `pass_authorizationheader` tinyint(1) NOT NULL default '0', `override_fpmconfig` tinyint(1) NOT NULL DEFAULT '0', - `pm` varchar(15) NOT NULL DEFAULT 'static', - `max_children` int(4) NOT NULL DEFAULT '1', - `start_servers` int(4) NOT NULL DEFAULT '20', - `min_spare_servers` int(4) NOT NULL DEFAULT '5', - `max_spare_servers` int(4) NOT NULL DEFAULT '35', + `pm` varchar(15) NOT NULL DEFAULT 'dynamic', + `max_children` int(4) NOT NULL DEFAULT '5', + `start_servers` int(4) NOT NULL DEFAULT '2', + `min_spare_servers` int(4) NOT NULL DEFAULT '1', + `max_spare_servers` int(4) NOT NULL DEFAULT '3', `max_requests` int(4) NOT NULL DEFAULT '0', - `idle_timeout` int(4) NOT NULL DEFAULT '30', + `idle_timeout` int(4) NOT NULL DEFAULT '10', `limit_extensions` varchar(255) NOT NULL default '.php', PRIMARY KEY (`id`), KEY `fpmsettingid` (`fpmsettingid`) @@ -894,8 +894,8 @@ CREATE TABLE `panel_phpconfigs` ( INSERT INTO `panel_phpconfigs` (`id`, `description`, `binary`, `file_extensions`, `mod_fcgid_starter`, `mod_fcgid_maxrequests`, `phpsettings`) VALUES -(1, 'Default Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_call_time_pass_reference = Off\r\nallow_url_fopen = Off\r\nasp_tags = Off\r\ndisable_classes =\r\ndisable_functions = curl_exec,curl_multi_exec,exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\ncgi.force_redirect = 1\r\ngpc_order = "GPC"\r\nhtml_errors = Off\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmagic_quotes_gpc = Off\r\nmagic_quotes_runtime = Off\r\nmagic_quotes_sybase = Off\r\nmax_execution_time = 30\r\nmax_input_time = 60\r\nmemory_limit = 128M\r\n{OPEN_BASEDIR_C}open_basedir = "{OPEN_BASEDIR}"\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nregister_globals = Off\r\nreport_memleaks = On\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nsession.auto_start = 0\r\nsession.bug_compat_42 = 0\r\nsession.bug_compat_warn = 1\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.entropy_file = /dev/urandom\r\nsession.entropy_length = 16\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 1\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.use_cookies = 1\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nsuhosin.mail.protect = 1\r\nsuhosin.simulation = Off\r\ntrack_errors = Off\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\n;mail.add_x_header = On\r\n;mail.log = "/var/log/phpmail.log"\r\nopcache.restrict_api = "{DOCUMENT_ROOT}"\r\n'), -(2, 'Froxlor Vhost Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_call_time_pass_reference = Off\r\nallow_url_fopen = On\r\nasp_tags = Off\r\ndisable_classes =\r\ndisable_functions = curl_multi_exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\ncgi.force_redirect = 1\r\ngpc_order = "GPC"\r\nhtml_errors = Off\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmagic_quotes_gpc = Off\r\nmagic_quotes_runtime = Off\r\nmagic_quotes_sybase = Off\r\nmax_execution_time = 60\r\nmax_input_time = 60\r\nmemory_limit = 128M\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nregister_globals = Off\r\nreport_memleaks = On\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nsession.auto_start = 0\r\nsession.bug_compat_42 = 0\r\nsession.bug_compat_warn = 1\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.entropy_file = /dev/urandom\r\nsession.entropy_length = 16\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 1\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.use_cookies = 1\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nsuhosin.mail.protect = 1\r\nsuhosin.simulation = Off\r\ntrack_errors = Off\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\n;mail.add_x_header = On\r\n;mail.log = "/var/log/phpmail.log"\r\nopcache.restrict_api = ""\r\n'); +(1, 'Default Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_url_fopen = Off\r\nallow_url_include = Off\r\nauto_append_file =\r\nauto_globals_jit = On\r\nauto_prepend_file =\r\nbcmath.scale = 0\r\ncli_server.color = On\r\ndefault_charset = "UTF-8"\r\ndefault_mimetype = "text/html"\r\ndefault_socket_timeout = 60\r\nasp_tags = Off\r\ndisable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,curl_exec,curl_multi_exec,exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\ndoc_root =\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\nhtml_errors = On\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nimplicit_flush = Off\r\nldap.max_links = -1\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmail.add_x_header = Off\r\nmax_execution_time = 30\r\nmax_file_uploads = 20\r\nmax_input_time = 60\r\nmemory_limit = 128M\r\n{OPEN_BASEDIR_C}open_basedir = "{OPEN_BASEDIR}"\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nreport_memleaks = On\r\nrequest_order = "GP"\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nserialize_precision = -1\r\nsession.auto_start = 0\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_httponly =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.cookie_samesite =\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 0\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.sid_bits_per_character = 5\r\nsession.sid_length = 26\r\nsession.trans_sid_tags = "a=href,area=href,frame=src,form="\r\nsession.use_cookies = 1\r\nsession.use_only_cookies = 1\r\nsession.use_strict_mode = 0\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\nopcache.restrict_api = "{DOCUMENT_ROOT}"\r\n'), +(2, 'Froxlor Vhost Config', '/usr/bin/php-cgi', 'php', '-1', '-1', 'allow_url_fopen = On\r\nallow_url_include = Off\r\nauto_append_file =\r\nauto_globals_jit = On\r\nauto_prepend_file =\r\nbcmath.scale = 0\r\ncli_server.color = On\r\ndefault_charset = "UTF-8"\r\ndefault_mimetype = "text/html"\r\ndefault_socket_timeout = 60\r\nasp_tags = Off\r\ndisable_functions = pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,curl_multi_exec,parse_ini_file,passthru,popen,proc_close,proc_get_status,proc_nice,proc_open,proc_terminate,shell_exec,show_source,system\r\ndisplay_errors = Off\r\ndisplay_startup_errors = Off\r\ndoc_root =\r\nenable_dl = Off\r\nerror_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE\r\nexpose_php = Off\r\nfile_uploads = On\r\nhtml_errors = On\r\nignore_repeated_errors = Off\r\nignore_repeated_source = Off\r\ninclude_path = ".:{PEAR_DIR}"\r\nimplicit_flush = Off\r\nldap.max_links = -1\r\nlog_errors = On\r\nlog_errors_max_len = 1024\r\nmail.add_x_header = Off\r\nmax_execution_time = 60\r\nmax_file_uploads = 20\r\nmax_input_time = 60\r\nmemory_limit = 128M\r\noutput_buffering = 4096\r\npost_max_size = 16M\r\nprecision = 14\r\nregister_argc_argv = Off\r\nreport_memleaks = On\r\nrequest_order = "GP"\r\nsendmail_path = "/usr/sbin/sendmail -t -i -f {CUSTOMER_EMAIL}"\r\nserialize_precision = -1\r\nsession.auto_start = 0\r\nsession.cache_expire = 180\r\nsession.cache_limiter = nocache\r\nsession.cookie_domain =\r\nsession.cookie_httponly =\r\nsession.cookie_lifetime = 0\r\nsession.cookie_path = /\r\nsession.cookie_samesite =\r\nsession.gc_divisor = 1000\r\nsession.gc_maxlifetime = 1440\r\nsession.gc_probability = 0\r\nsession.name = PHPSESSID\r\nsession.referer_check =\r\nsession.save_handler = files\r\nsession.save_path = "{TMP_DIR}"\r\nsession.serialize_handler = php\r\nsession.sid_bits_per_character = 5\r\nsession.sid_length = 26\r\nsession.trans_sid_tags = "a=href,area=href,frame=src,form="\r\nsession.use_cookies = 1\r\nsession.use_only_cookies = 1\r\nsession.use_strict_mode = 0\r\nsession.use_trans_sid = 0\r\nshort_open_tag = On\r\nupload_max_filesize = 32M\r\nupload_tmp_dir = "{TMP_DIR}"\r\nvariables_order = "GPCS"\r\nopcache.restrict_api = ""\r\n'); DROP TABLE IF EXISTS `cronjobs_run`; diff --git a/install/updates/froxlor/0.10/update_0.10.inc.php b/install/updates/froxlor/0.10/update_0.10.inc.php index a3ba9ee5..3da2dea7 100644 --- a/install/updates/froxlor/0.10/update_0.10.inc.php +++ b/install/updates/froxlor/0.10/update_0.10.inc.php @@ -566,3 +566,8 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.10.11')) { showUpdateStep("Updating from 0.10.11 to 0.10.12", false); \Froxlor\Froxlor::updateToVersion('0.10.12'); } + +if (\Froxlor\Froxlor::isFroxlorVersion('0.10.12')) { + showUpdateStep("Updating from 0.10.12 to 0.10.13", false); + \Froxlor\Froxlor::updateToVersion('0.10.13'); +} diff --git a/lib/Froxlor/Api/ApiCommand.php b/lib/Froxlor/Api/ApiCommand.php index 9b7dcc6e..065a9090 100644 --- a/lib/Froxlor/Api/ApiCommand.php +++ b/lib/Froxlor/Api/ApiCommand.php @@ -583,8 +583,12 @@ abstract class ApiCommand extends ApiParameter "group" => $group, "var" => $varname ), true, true); + $content = $default; + if ($result) { + $content = $result['value'] ?? $default; + } // @fixme html_entity_decode - $content = html_entity_decode(\Froxlor\PhpHelper::replaceVariables((($result['value'] != '') ? $result['value'] : $default), $replace_arr)); + $content = html_entity_decode(\Froxlor\PhpHelper::replaceVariables($content, $replace_arr)); return $content; } diff --git a/lib/Froxlor/Api/Commands/Admins.php b/lib/Froxlor/Api/Commands/Admins.php index ab48ed42..dec4d09f 100644 --- a/lib/Froxlor/Api/Commands/Admins.php +++ b/lib/Froxlor/Api/Commands/Admins.php @@ -265,7 +265,7 @@ class Admins extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt 'login' => $loginname ), true, true); - if (strtolower($loginname_check['loginname']) == strtolower($loginname) || strtolower($loginname_check_admin['loginname']) == strtolower($loginname)) { + if (($loginname_check && strtolower($loginname_check['loginname']) == strtolower($loginname)) || ($loginname_check_admin && strtolower($loginname_check_admin['loginname']) == strtolower($loginname))) { \Froxlor\UI\Response::standard_error('loginnameexists', $loginname, true); } elseif (preg_match('/^' . preg_quote(Settings::Get('customer.accountprefix'), '/') . '([0-9]+)/', $loginname)) { // Accounts which match systemaccounts are not allowed, filtering them diff --git a/lib/Froxlor/Api/Commands/Customers.php b/lib/Froxlor/Api/Commands/Customers.php index c7c0e2e8..cb815c92 100644 --- a/lib/Froxlor/Api/Commands/Customers.php +++ b/lib/Froxlor/Api/Commands/Customers.php @@ -411,7 +411,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource ), true, true); $mysql_maxlen = \Froxlor\Database\Database::getSqlUsernameLength() - strlen(Settings::Get('customer.mysqlprefix')); - if (strtolower($loginname_check['loginname']) == strtolower($loginname) || strtolower($loginname_check_admin['loginname']) == strtolower($loginname)) { + if (($loginname_check && strtolower($loginname_check['loginname']) == strtolower($loginname)) || ($loginname_check_admin && strtolower($loginname_check_admin['loginname']) == strtolower($loginname))) { \Froxlor\UI\Response::standard_error('loginnameexists', $loginname, true); } elseif (! \Froxlor\Validate\Validate::validateUsername($loginname, Settings::Get('panel.unix_names'), $mysql_maxlen)) { if (strlen($loginname) > $mysql_maxlen) { diff --git a/lib/Froxlor/Api/Commands/DirOptions.php b/lib/Froxlor/Api/Commands/DirOptions.php index 2ce1a425..6da29a4c 100644 --- a/lib/Froxlor/Api/Commands/DirOptions.php +++ b/lib/Froxlor/Api/Commands/DirOptions.php @@ -96,7 +96,7 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc ), true, true); // duplicate check - if ($path_dupe_check['path'] == $path) { + if ($path_dupe_check && $path_dupe_check['path'] == $path) { \Froxlor\UI\Response::standard_error('errordocpathdupe', $userpath, true); } @@ -309,8 +309,7 @@ class DirOptions extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc $query_fields = array(); $result_stmt = Database::prepare(" SELECT * FROM `" . TABLE_PANEL_HTACCESS . "` - WHERE `customerid` IN (" . implode(', ', $customer_ids) . ")" . $this->getSearchWhere($query_fields, true) . $this->getOrderBy() . $this->getLimit() - ); + WHERE `customerid` IN (" . implode(', ', $customer_ids) . ")" . $this->getSearchWhere($query_fields, true) . $this->getOrderBy() . $this->getLimit()); Database::pexecute($result_stmt, $query_fields, true, true); while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) { $result[] = $row; diff --git a/lib/Froxlor/Api/Commands/DirProtections.php b/lib/Froxlor/Api/Commands/DirProtections.php index c609c377..04b48e69 100644 --- a/lib/Froxlor/Api/Commands/DirProtections.php +++ b/lib/Froxlor/Api/Commands/DirProtections.php @@ -81,7 +81,7 @@ class DirProtections extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Res $password_enc = \Froxlor\System\Crypt::makeCryptPassword($password, true); // duplicate check - if ($username_path_check['username'] == $username && $username_path_check['path'] == $path) { + if ($username_path_check && $username_path_check['username'] == $username && $username_path_check['path'] == $path) { \Froxlor\UI\Response::standard_error('userpathcombinationdupe', '', true); } elseif ($password == $username) { \Froxlor\UI\Response::standard_error('passwordshouldnotbeusername', '', true); diff --git a/lib/Froxlor/Api/Commands/Domains.php b/lib/Froxlor/Api/Commands/Domains.php index f65c882c..c9e6dfda 100644 --- a/lib/Froxlor/Api/Commands/Domains.php +++ b/lib/Froxlor/Api/Commands/Domains.php @@ -674,9 +674,9 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn ), '', true); } elseif ($customerid == 0) { \Froxlor\UI\Response::standard_error('adduserfirst', '', true); - } elseif (strtolower($domain_check['domain']) == strtolower($domain)) { + } elseif ($domain_check && strtolower($domain_check['domain']) == strtolower($domain)) { \Froxlor\UI\Response::standard_error('domainalreadyexists', $idna_convert->decode($domain), true); - } elseif ($aliasdomain_check['id'] != $aliasdomain) { + } elseif ($aliasdomain_check && $aliasdomain_check['id'] != $aliasdomain) { \Froxlor\UI\Response::standard_error('domainisaliasorothercustomer', '', true); } else { $wwwserveralias = ($serveraliasoption == '1') ? '1' : '0'; @@ -1223,7 +1223,7 @@ class Domains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEn $writeaccesslog = $result['writeaccesslog']; $writeerrorlog = $result['writeerrorlog']; $documentroot = $result['documentroot']; - + $ssl_protocols = $p_ssl_protocols; $override_tls = $result['override_tls']; } diff --git a/lib/Froxlor/Api/Commands/FpmDaemons.php b/lib/Froxlor/Api/Commands/FpmDaemons.php index a926429a..09ef8091 100644 --- a/lib/Froxlor/Api/Commands/FpmDaemons.php +++ b/lib/Froxlor/Api/Commands/FpmDaemons.php @@ -32,7 +32,7 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc * optional specify offset for resultset * @param array $sql_orderby * optional array with index = fieldname and value = ASC|DESC to order the resultset by one or more fields - * + * * @access admin * @throws \Exception * @return string json-encoded array count|list @@ -135,19 +135,19 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc * @param string $reload_cmd * @param string $config_dir * @param string $pm - * optional, process-manager, one of 'static', 'dynamic' or 'ondemand', default 'static' + * optional, process-manager, one of 'static', 'dynamic' or 'ondemand', default 'dynamic' * @param int $max_children - * optional, default 0 + * optional, default 5 * @param int $start_servers - * optional, default 0 + * optional, default 2 * @param int $min_spare_servers - * optional, default 0 + * optional, default 1 * @param int $max_spare_servers - * optional, default 0 + * optional, default 3 * @param int $max_requests * optional, default 0 * @param int $idle_timeout - * optional, default 0 + * optional, default 10 * @param string $limit_extensions * optional, limit execution to the following extensions, default '.php' * @param string $custom_config @@ -167,13 +167,13 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc $config_dir = $this->getParam('config_dir'); // parameters - $pmanager = $this->getParam('pm', true, 'static'); - $max_children = $this->getParam('max_children', true, 0); - $start_servers = $this->getParam('start_servers', true, 0); - $min_spare_servers = $this->getParam('min_spare_servers', true, 0); - $max_spare_servers = $this->getParam('max_spare_servers', true, 0); + $pmanager = $this->getParam('pm', true, 'dynamic'); + $max_children = $this->getParam('max_children', true, 5); + $start_servers = $this->getParam('start_servers', true, 2); + $min_spare_servers = $this->getParam('min_spare_servers', true, 1); + $max_spare_servers = $this->getParam('max_spare_servers', true, 3); $max_requests = $this->getParam('max_requests', true, 0); - $idle_timeout = $this->getParam('idle_timeout', true, 0); + $idle_timeout = $this->getParam('idle_timeout', true, 10); $limit_extensions = $this->getParam('limit_extensions', true, '.php'); $custom_config = $this->getParam('custom_config', true, ''); @@ -251,19 +251,19 @@ class FpmDaemons extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc * @param string $config_dir * optional * @param string $pm - * optional, process-manager, one of 'static', 'dynamic' or 'ondemand', default 'static' + * optional, process-manager, one of 'static', 'dynamic' or 'ondemand', default 'dynamic' * @param int $max_children - * optional, default 0 + * optional, default 5 * @param int $start_servers - * optional, default 0 + * optional, default 2 * @param int $min_spare_servers - * optional, default 0 + * optional, default 1 * @param int $max_spare_servers - * optional, default 0 + * optional, default 3 * @param int $max_requests * optional, default 0 * @param int $idle_timeout - * optional, default 0 + * optional, default 10 * @param string $limit_extensions * optional, limit execution to the following extensions, default '.php' * @param string $custom_config diff --git a/lib/Froxlor/Api/Commands/IpsAndPorts.php b/lib/Froxlor/Api/Commands/IpsAndPorts.php index 73df49b1..2e690833 100644 --- a/lib/Froxlor/Api/Commands/IpsAndPorts.php +++ b/lib/Froxlor/Api/Commands/IpsAndPorts.php @@ -255,7 +255,7 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour 'port' => $port )); - if ($result_checkfordouble['id'] != '') { + if ($result_checkfordouble && $result_checkfordouble['id'] != '') { \Froxlor\UI\Response::standard_error('myipnotdouble', '', true); } @@ -462,9 +462,9 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour $docroot = ''; } - if ($result['ip'] != $ip && $result['ip'] == Settings::Get('system.ipaddress') && $result_sameipotherport['id'] == '') { + if ($result['ip'] != $ip && $result['ip'] == Settings::Get('system.ipaddress') && $result_sameipotherport == false) { \Froxlor\UI\Response::standard_error('cantchangesystemip', '', true); - } elseif ($result_checkfordouble['id'] != '' && $result_checkfordouble['id'] != $id) { + } elseif ($result_checkfordouble && $result_checkfordouble['id'] != '' && $result_checkfordouble['id'] != $id) { \Froxlor\UI\Response::standard_error('myipnotdouble', '', true); } else { @@ -560,7 +560,7 @@ class IpsAndPorts extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour 'ip' => $result['ip'] )); - if (($result['ip'] != Settings::Get('system.ipaddress')) || ($result['ip'] == Settings::Get('system.ipaddress') && $result_sameipotherport['id'] != '')) { + if (($result['ip'] != Settings::Get('system.ipaddress')) || ($result['ip'] == Settings::Get('system.ipaddress') && $result_sameipotherport == false)) { $del_stmt = Database::prepare(" DELETE FROM `" . TABLE_PANEL_IPSANDPORTS . "` diff --git a/lib/Froxlor/Api/Commands/Mysqls.php b/lib/Froxlor/Api/Commands/Mysqls.php index 60ed33c1..f9fd1b41 100644 --- a/lib/Froxlor/Api/Commands/Mysqls.php +++ b/lib/Froxlor/Api/Commands/Mysqls.php @@ -252,7 +252,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt ), true, true); $mbdata = $mbdata_stmt->fetch(\PDO::FETCH_ASSOC); Database::needRoot(false); - $result['size'] = $mbdata['MB']; + $result['size'] = $mbdata['MB'] ?? 0; $this->logger()->logAction($this->isAdmin() ? \Froxlor\FroxlorLogger::ADM_ACTION : \Froxlor\FroxlorLogger::USR_ACTION, LOG_NOTICE, "[API] get database '" . $result['databasename'] . "'"); return $this->response(200, "successfull", $result); } @@ -411,7 +411,7 @@ class Mysqls extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt "table_schema" => $row['databasename'] ), true, true); $mbdata = $mbdata_stmt->fetch(\PDO::FETCH_ASSOC); - $row['size'] = $mbdata['MB']; + $row['size'] = $mbdata['MB'] ?? 0; $result[] = $row; } Database::needRoot(false); diff --git a/lib/Froxlor/Api/Commands/PhpSettings.php b/lib/Froxlor/Api/Commands/PhpSettings.php index c43c25ff..a77d8e02 100644 --- a/lib/Froxlor/Api/Commands/PhpSettings.php +++ b/lib/Froxlor/Api/Commands/PhpSettings.php @@ -50,8 +50,7 @@ class PhpSettings extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resour $result_stmt = Database::prepare(" SELECT c.*, fd.description as fpmdesc FROM `" . TABLE_PANEL_PHPCONFIGS . "` c - LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fd ON fd.id = c.fpmsettingid" . $this->getSearchWhere($query_fields) . $this->getOrderBy() . $this->getLimit() - ); + LEFT JOIN `" . TABLE_PANEL_FPMDAEMONS . "` fd ON fd.id = c.fpmsettingid" . $this->getSearchWhere($query_fields) . $this->getOrderBy() . $this->getLimit()); Database::pexecute($result_stmt, $query_fields, true, true); $phpconfigs = array(); while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) { diff --git a/lib/Froxlor/Api/Commands/SubDomains.php b/lib/Froxlor/Api/Commands/SubDomains.php index 73cd7772..91addb6d 100644 --- a/lib/Froxlor/Api/Commands/SubDomains.php +++ b/lib/Froxlor/Api/Commands/SubDomains.php @@ -195,7 +195,7 @@ class SubDomains extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resourc } elseif ($subdomain == 'www' && $domain_check['wwwserveralias'] == '1') { // you cannot add 'www' as subdomain when the maindomain generates a www-alias \Froxlor\UI\Response::standard_error('wwwnotallowed', '', true); - } elseif (strtolower($completedomain_check['domain']) == strtolower($completedomain)) { + } elseif ($completedomain_check && strtolower($completedomain_check['domain']) == strtolower($completedomain)) { // the domain does already exist as main-domain \Froxlor\UI\Response::standard_error('domainexistalready', $completedomain, true); } diff --git a/lib/Froxlor/Cron/Dns/Bind.php b/lib/Froxlor/Cron/Dns/Bind.php index a556eef5..2c2ae9f9 100644 --- a/lib/Froxlor/Cron/Dns/Bind.php +++ b/lib/Froxlor/Cron/Dns/Bind.php @@ -112,7 +112,10 @@ class Bind extends DnsBase if (count($this->ns) > 0) { foreach ($this->ns as $ns) { foreach ($ns["ips"] as $ip) { - $bindconf_file .= ' ' . $ip . ";\n"; + $ip = \Froxlor\Validate\Validate::validate_ip2($ip, true, 'invalidip', true, true, true); + if ($ip) { + $bindconf_file .= ' ' . $ip . ";\n"; + } } } } diff --git a/lib/Froxlor/Dns/Dns.php b/lib/Froxlor/Dns/Dns.php index 2bf9c371..ba8518a9 100644 --- a/lib/Froxlor/Dns/Dns.php +++ b/lib/Froxlor/Dns/Dns.php @@ -160,7 +160,7 @@ class Dns // unset special CAA required-entry unset($required_entries[$entry['type']][md5("@CAA@")]); } - if (Settings::Get('spf.use_spf') == '1' && $entry['type'] == 'TXT' && $entry['record'] == '@' && strtolower(substr($entry['content'], 0, 7)) == '"v=spf1') { + if (Settings::Get('spf.use_spf') == '1' && $entry['type'] == 'TXT' && $entry['record'] == '@' && (strtolower(substr($entry['content'], 0, 7)) == '"v=spf1' || strtolower(substr($entry['content'], 0, 6)) == 'v=spf1') ) { // unset special spf required-entry unset($required_entries[$entry['type']][md5("@SPF@")]); } diff --git a/lib/Froxlor/Froxlor.php b/lib/Froxlor/Froxlor.php index b2cc3df6..3131a078 100644 --- a/lib/Froxlor/Froxlor.php +++ b/lib/Froxlor/Froxlor.php @@ -7,7 +7,7 @@ final class Froxlor { // Main version variable - const VERSION = '0.10.12'; + const VERSION = '0.10.13'; // Database version (YYYYMMDDC where C is a daily counter) const DBVERSION = '201912313'; diff --git a/lib/Froxlor/Settings/FroxlorVhostSettings.php b/lib/Froxlor/Settings/FroxlorVhostSettings.php index 5ed2502c..6c4068ec 100644 --- a/lib/Froxlor/Settings/FroxlorVhostSettings.php +++ b/lib/Froxlor/Settings/FroxlorVhostSettings.php @@ -12,5 +12,4 @@ class FroxlorVhostSettings $result = Database::pexecute_first($sel_stmt); return $result['vcentries'] > 0 ? true : false; } - } diff --git a/lib/Froxlor/User.php b/lib/Froxlor/User.php index 2cec316b..e8e8eac3 100644 --- a/lib/Froxlor/User.php +++ b/lib/Froxlor/User.php @@ -79,8 +79,8 @@ class User /** * Function which updates all counters of used ressources in panel_admins and panel_customers * - * @param - * bool Set to true to get an array with debug information + * @param bool $returndebuginfo + * Set to true to get an array with debug information * @return array Contains debug information if parameter 'returndebuginfo' is set to true * * @author Florian Lippert (2003-2009) @@ -100,17 +100,17 @@ class User // Customers $customers_stmt = Database::prepare('SELECT * FROM `' . TABLE_PANEL_CUSTOMERS . '` ORDER BY `customerid`'); Database::pexecute($customers_stmt); - + // array to store currently used resources per admin $admin_resources = array(); while ($customer = $customers_stmt->fetch(\PDO::FETCH_ASSOC)) { - + // set current admin $cur_adm = $customer['adminid']; - // initialize admin-resources array for admin $customer['adminid'] if (! isset($admin_resources[$cur_adm])) { $admin_resources[$cur_adm] = array(); } + // fill admin resource usage array with customer data self::addResourceCountEx($admin_resources[$cur_adm], $customer, 'diskspace_used', 'diskspace'); self::addResourceCountEx($admin_resources[$cur_adm], $customer, 'traffic_used', 'traffic_used'); // !!! yes, USED and USED @@ -126,6 +126,7 @@ class User self::addResourceCount($admin_resources[$cur_adm], $customer, $field . '_used', $field); } + // calculate real usage $customer_mysqls_stmt = Database::prepare('SELECT COUNT(*) AS `number_mysqls` FROM `' . TABLE_PANEL_DATABASES . '` WHERE `customerid` = :cid'); $customer_mysqls = Database::pexecute_first($customer_mysqls_stmt, array( @@ -181,6 +182,7 @@ class User )); $customer['email_quota_used_new'] = (int) $customer_email_quota['email_quota']; + // update database accordingly $stmt = Database::prepare('UPDATE `' . TABLE_PANEL_CUSTOMERS . '` SET `mysqls_used` = :mysqls_used, `emails_used` = :emails_used, @@ -211,63 +213,56 @@ class User $admins_stmt = Database::prepare('SELECT * FROM `' . TABLE_PANEL_ADMINS . '` ORDER BY `adminid`'); Database::pexecute($admins_stmt, array()); + $resource_fields = array( + 'diskspace_used', + 'traffic_used', + 'mysqls_used', + 'ftps_used', + 'emails_used', + 'email_accounts_used', + 'email_forwarders_used', + 'email_quota_used', + 'subdomains_used' + ); + + $admin_customers_stmt = Database::prepare('SELECT * FROM `' . TABLE_PANEL_CUSTOMERS . '` WHERE `adminid` = :aid'); while ($admin = $admins_stmt->fetch(\PDO::FETCH_ASSOC)) { - $admin_customers_stmt = Database::prepare('SELECT * FROM `' . TABLE_PANEL_CUSTOMERS . '` WHERE `adminid` = :aid'); Database::pexecute($admin_customers_stmt, array( "aid" => $admin['adminid'] )); $admin_customers = $admin_customers_stmt->fetchAll(\PDO::FETCH_ASSOC); $admin['customers_used_new'] = count($admin_customers); - $admin_domains_stmt = Database::prepare('SELECT COUNT(*) AS `number_domains` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `adminid` = :aid'); + $admin_domains_stmt = Database::prepare('SELECT COUNT(*) AS `number_domains` FROM `' . TABLE_PANEL_DOMAINS . '` WHERE `adminid` = :aid AND `parentdomainid` = "0"'); $admin_domains = Database::pexecute_first($admin_domains_stmt, array( "aid" => $admin['adminid'] )); - // substract the amount of domains that are std-subdomains later when we iterated through all customers and now for sure + // substract the amount of domains that are std-subdomains later when we iterated through all customers and know for sure $admin['domains_used_new'] = $admin_domains['number_domains']; - + // set current admin $cur_adm = $admin['adminid']; - + // if there's an admin without any customers it might be possible that the id is not yet known in $admin_resources if (! isset($admin_resources[$cur_adm])) { $admin_resources[$cur_adm] = array(); } - - foreach (array( - 'diskspace_used', - 'traffic_used', - 'mysqls_used', - 'ftps_used', - 'emails_used', - 'email_accounts_used', - 'email_forwarders_used', - 'email_quota_used', - 'subdomains_used' - ) as $field) { + // be sure that all fields are set in the array + foreach ($resource_fields as $field) { self::initArrField($field, $admin_resources[$cur_adm], 0); - $admin[$field . '_new'] = $admin_resources[$cur_adm][$field]; + // initialize new values + $admin[$field . '_new'] = 0; } - + // now get the customer resource usage which we have re-calculated previously foreach ($admin_customers as $acustomer) { - foreach (array( - 'diskspace_used', - 'traffic_used', - 'mysqls_used', - 'ftps_used', - 'emails_used', - 'email_accounts_used', - 'email_forwarders_used', - 'email_quota_used', - 'subdomains_used' - ) as $field) { + foreach ($resource_fields as $field) { $admin[$field . '_new'] += $acustomer[$field]; } // check for std-subdomain if ($acustomer['standardsubdomain'] > 0) { - // std-subdomain does not count to assign resource - $admin['domains_used_new']--; + // std-subdomain does not count as assigned resource + $admin['domains_used_new'] --; } } - + // update database entry accordingly $stmt = Database::prepare('UPDATE `' . TABLE_PANEL_ADMINS . '` SET `customers_used` = :customers_used, `domains_used` = :domains_used, diff --git a/lib/configfiles/bionic.xml b/lib/configfiles/bionic.xml index b4ec2066..9d66426d 100644 --- a/lib/configfiles/bionic.xml +++ b/lib/configfiles/bionic.xml @@ -4625,7 +4625,7 @@ aliases: files - + diff --git a/lib/configfiles/buster.xml b/lib/configfiles/buster.xml index 699d67fa..47107c6f 100644 --- a/lib/configfiles/buster.xml +++ b/lib/configfiles/buster.xml @@ -4827,7 +4827,7 @@ aliases: files - + diff --git a/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php b/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php index b2aa0c04..11fcba4a 100644 --- a/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php +++ b/lib/formfields/admin/phpconfig/formfield.fpmconfig_add.php @@ -32,13 +32,13 @@ return array( 'label' => $lng['serversettings']['phpfpm_settings']['reload'], 'type' => 'text', 'maxlength' => 255, - 'value' => 'service php7.0-fpm restart' + 'value' => 'service php7.3-fpm restart' ), 'config_dir' => array( 'label' => $lng['serversettings']['phpfpm_settings']['configdir'], 'type' => 'text', 'maxlength' => 255, - 'value' => '/etc/php/7.0/fpm/pool.d/' + 'value' => '/etc/php/7.3/fpm/pool.d/' ), 'pm' => array( 'label' => $lng['serversettings']['phpfpm_settings']['pm'], @@ -49,25 +49,25 @@ return array( 'label' => $lng['serversettings']['phpfpm_settings']['max_children']['title'], 'desc' => $lng['serversettings']['phpfpm_settings']['max_children']['description'], 'type' => 'int', - 'value' => 1 + 'value' => 5 ), 'start_servers' => array( 'label' => $lng['serversettings']['phpfpm_settings']['start_servers']['title'], 'desc' => $lng['serversettings']['phpfpm_settings']['start_servers']['description'], 'type' => 'int', - 'value' => 20 + 'value' => 2 ), 'min_spare_servers' => array( 'label' => $lng['serversettings']['phpfpm_settings']['min_spare_servers']['title'], 'desc' => $lng['serversettings']['phpfpm_settings']['min_spare_servers']['description'], 'type' => 'int', - 'value' => 5 + 'value' => 1 ), 'max_spare_servers' => array( 'label' => $lng['serversettings']['phpfpm_settings']['max_spare_servers']['title'], 'desc' => $lng['serversettings']['phpfpm_settings']['max_spare_servers']['description'], 'type' => 'int', - 'value' => 35 + 'value' => 3 ), 'max_requests' => array( 'label' => $lng['serversettings']['phpfpm_settings']['max_requests']['title'], @@ -79,7 +79,7 @@ return array( 'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['title'], 'desc' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['description'], 'type' => 'int', - 'value' => 30 + 'value' => 10 ), 'limit_extensions' => array( 'label' => $lng['serversettings']['phpfpm_settings']['limit_extensions']['title'], diff --git a/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php b/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php index 4c032912..41506df2 100644 --- a/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php +++ b/lib/formfields/admin/phpconfig/formfield.phpconfig_add.php @@ -163,7 +163,7 @@ return array( 'label' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['title'], 'desc' => $lng['serversettings']['phpfpm_settings']['idle_timeout']['description'] . $lng['serversettings']['phpfpm_settings']['override_fpmconfig_addinfo'], 'type' => 'int', - 'value' => 30 + 'value' => 10 ), 'limit_extensions' => array( 'visible' => (\Froxlor\Settings::Get('phpfpm.enabled') == 1 ? true : false), diff --git a/templates/misc/php/default.ini.php b/templates/misc/php/default.ini.php new file mode 100644 index 00000000..24bec2f4 --- /dev/null +++ b/templates/misc/php/default.ini.php @@ -0,0 +1,74 @@ +assertEquals(2, $result['subcanemaildomain']); } + /** + * + * @depends testAdminDomainsAdd + */ + public function testResellerDomainsUpdate() + { + global $admin_userdata; + // get reseller + $json_result = Admins::getLocal($admin_userdata, array( + 'loginname' => 'reseller' + ))->get(); + $reseller_userdata = json_decode($json_result, true)['data']; + $reseller_userdata['adminsession'] = 1; + $data = [ + 'domainname' => 'test2.local', + 'ssl_protocols' => 'TLSv1' + ]; + $json_result = Domains::getLocal($reseller_userdata, $data)->update(); + $result = json_decode($json_result, true)['data']; + $this->assertEmpty($result['ssl_protocols']); + } + public function testAdminDomainsAddSysHostname() { global $admin_userdata; diff --git a/tests/IpsAndPorts/IpsAndPortsTest.php b/tests/IpsAndPorts/IpsAndPortsTest.php index 36b1a76f..f5e59614 100644 --- a/tests/IpsAndPorts/IpsAndPortsTest.php +++ b/tests/IpsAndPorts/IpsAndPortsTest.php @@ -246,7 +246,7 @@ class IpsAndPortsTest extends TestCase 'ip' => '123.123.123.123' ]; $this->expectExceptionMessage("You cannot change the last system IP, either create another new IP/Port combination for the system IP or change the system IP."); - $json_result = IpsAndPorts::getLocal($admin_userdata, $data)->update(); + IpsAndPorts::getLocal($admin_userdata, $data)->update(); } public function testResellerIpsAndPortsEditNoDuplicate() diff --git a/tests/PhpAndFpm/FpmDaemonsTest.php b/tests/PhpAndFpm/FpmDaemonsTest.php index 82d187ab..88a5647e 100644 --- a/tests/PhpAndFpm/FpmDaemonsTest.php +++ b/tests/PhpAndFpm/FpmDaemonsTest.php @@ -27,7 +27,8 @@ class FpmDaemonsTest extends TestCase $json_result = FpmDaemons::getLocal($admin_userdata, $data)->add(); $result = json_decode($json_result, true)['data']; $this->assertEquals('/etc/php/7.1/fpm/pool.d/', $result['config_dir']); - $this->assertEquals(0, $result['max_children']); + $this->assertEquals('dynamic', $result['pm']); + $this->assertEquals(5, $result['max_children']); $this->assertEquals('.php', $result['limit_extensions']); self::$id = $result['id']; }