diff --git a/lib/classes/api/abstract.ApiParameter.php b/lib/classes/api/abstract.ApiParameter.php index 574e8c25..bb81df0e 100644 --- a/lib/classes/api/abstract.ApiParameter.php +++ b/lib/classes/api/abstract.ApiParameter.php @@ -121,8 +121,8 @@ abstract class ApiParameter protected function getUlParam($param = null, $ul_field = null, $optional = false, $default = 0) { $param_value = intval_ressource($this->getParam($param, $optional, $default)); - $ul_field_value = $this->getParam($ul_field, true, 0); - if ($ul_field_value != 0) { + $ul_field_value = $this->getBoolParam($ul_field, true, 0); + if ($ul_field_value != '0') { $param_value = - 1; } return $param_value; diff --git a/lib/classes/api/commands/class.Admins.php b/lib/classes/api/commands/class.Admins.php index 413f1c99..4ad593c8 100644 --- a/lib/classes/api/commands/class.Admins.php +++ b/lib/classes/api/commands/class.Admins.php @@ -174,7 +174,7 @@ class Admins extends ApiCommand implements ResourceEntity // parameters $def_language = $this->getParam('def_language', true, Settings::Get('panel.standardlanguage')); $custom_notes = $this->getParam('custom_notes', true, ''); - $custom_notes_show = $this->getParam('custom_notes_show', true, 0); + $custom_notes_show = $this->getBoolParam('custom_notes_show', true, 0); $password = $this->getParam('admin_password', true, ''); $diskspace = $this->getUlParam('diskspace', 'diskspace_ul', true, 0); @@ -190,11 +190,11 @@ class Admins extends ApiCommand implements ResourceEntity $tickets = $this->getUlParam('tickets', 'tickets_ul', true, 0); $mysqls = $this->getUlParam('mysqls', 'mysqls_ul', true, 0); - $customers_see_all = $this->getParam('customers_see_all', true, 0); - $domains_see_all = $this->getParam('domains_see_all', true, 0); - $tickets_see_all = $this->getParam('tickets_see_all', true, 0); - $caneditphpsettings = $this->getParam('caneditphpsettings', true, 0); - $change_serversettings = $this->getParam('change_serversettings', true, 0); + $customers_see_all = $this->getBoolParam('customers_see_all', true, 0); + $domains_see_all = $this->getBoolParam('domains_see_all', true, 0); + $tickets_see_all = $this->getBoolParam('tickets_see_all', true, 0); + $caneditphpsettings = $this->getBoolParam('caneditphpsettings', true, 0); + $change_serversettings = $this->getBoolParam('change_serversettings', true, 0); $ipaddress = $this->getParam('ipaddress', true, - 1); // validation @@ -461,7 +461,7 @@ class Admins extends ApiCommand implements ResourceEntity $password = $this->getParam('admin_password', true, ''); $def_language = $this->getParam('def_language', true, $result['def_language']); $custom_notes = $this->getParam('custom_notes', true, $result['custom_notes']); - $custom_notes_show = $this->getParam('custom_notes_show', true, $result['custom_notes_show']); + $custom_notes_show = $this->getBoolParam('custom_notes_show', true, $result['custom_notes_show']); $theme = $this->getParam('theme', true, $result['theme']); // you cannot edit some of the details of yourself @@ -486,7 +486,7 @@ class Admins extends ApiCommand implements ResourceEntity $traffic = $result['traffic']; $ipaddress = ($result['ip'] != - 1 ? json_decode($result['ip'], true) : - 1); } else { - $deactivated = $this->getParam('deactivated', true, $result['deactivated']); + $deactivated = $this->getBoolParam('deactivated', true, $result['deactivated']); $dec_places = Settings::Get('panel.decimal_places'); $diskspace = $this->getUlParam('diskspace', 'diskspace_ul', true, round($result['diskspace'] / 1024, $dec_places)); @@ -502,11 +502,11 @@ class Admins extends ApiCommand implements ResourceEntity $tickets = $this->getUlParam('tickets', 'tickets_ul', true, $result['tickets']); $mysqls = $this->getUlParam('mysqls', 'mysqls_ul', true, $result['mysqls']); - $customers_see_all = $this->getParam('customers_see_all', true, $result['customers_see_all']); - $domains_see_all = $this->getParam('domains_see_all', true, $result['domains_see_all']); - $tickets_see_all = $this->getParam('tickets_see_all', true, $result['tickets_see_all']); - $caneditphpsettings = $this->getParam('caneditphpsettings', true, $result['caneditphpsettings']); - $change_serversettings = $this->getParam('change_serversettings', true, $result['change_serversettings']); + $customers_see_all = $this->getBoolParam('customers_see_all', true, $result['customers_see_all']); + $domains_see_all = $this->getBoolParam('domains_see_all', true, $result['domains_see_all']); + $tickets_see_all = $this->getBoolParam('tickets_see_all', true, $result['tickets_see_all']); + $caneditphpsettings = $this->getBoolParam('caneditphpsettings', true, $result['caneditphpsettings']); + $change_serversettings = $this->getBoolParam('change_serversettings', true, $result['change_serversettings']); $ipaddress = $this->getParam('ipaddress', true, ($result['ip'] != - 1 ? json_decode($result['ip'], true) : - 1)); $diskspace = $diskspace * 1024; diff --git a/lib/classes/api/commands/class.Cronjobs.php b/lib/classes/api/commands/class.Cronjobs.php index 63bbefe0..0e839f12 100644 --- a/lib/classes/api/commands/class.Cronjobs.php +++ b/lib/classes/api/commands/class.Cronjobs.php @@ -85,7 +85,7 @@ class Cronjobs extends ApiCommand implements ResourceEntity $cur_int = explode(" ", $result['interval']); // parameter - $isactive = $this->getParam('isactive', true, $result['isactive']); + $isactive = $this->getBoolParam('isactive', true, $result['isactive']); $interval_value = $this->getParam('interval_value', true, $cur_int[0]); $interval_interval = $this->getParam('interval_interval', true, $cur_int[1]); diff --git a/lib/classes/api/commands/class.CustomerBackups.php b/lib/classes/api/commands/class.CustomerBackups.php index 5bbc216b..71fcd51d 100644 --- a/lib/classes/api/commands/class.CustomerBackups.php +++ b/lib/classes/api/commands/class.CustomerBackups.php @@ -61,9 +61,9 @@ class CustomerBackups extends ApiCommand implements ResourceEntity $path = $this->getParam('path'); // parameter - $backup_dbs = $this->getParam('backup_dbs', true, 0); - $backup_mail = $this->getParam('backup_mail', true, 0); - $backup_web = $this->getParam('backup_web', true, 0); + $backup_dbs = $this->getBoolParam('backup_dbs', true, 0); + $backup_mail = $this->getBoolParam('backup_mail', true, 0); + $backup_web = $this->getBoolParam('backup_web', true, 0); // get customer data $customer = $this->getCustomerData(); diff --git a/lib/classes/api/commands/class.Customers.php b/lib/classes/api/commands/class.Customers.php index de432a72..5b4bf97e 100644 --- a/lib/classes/api/commands/class.Customers.php +++ b/lib/classes/api/commands/class.Customers.php @@ -229,7 +229,7 @@ class Customers extends ApiCommand implements ResourceEntity $def_language = $this->getParam('def_language', true, Settings::Get('panel.standardlanguage')); $gender = intval_ressource($this->getParam('gender', true, 0)); $custom_notes = $this->getParam('custom_notes', true, ''); - $custom_notes_show = $this->getParam('custom_notes_show', true, 0); + $custom_notes_show = $this->getBoolParam('custom_notes_show', true, 0); $diskspace = $this->getUlParam('diskspace', 'diskspace_ul', true, 0); $traffic = $this->getUlParam('traffic', 'traffic_ul', true, 0); @@ -238,20 +238,20 @@ class Customers extends ApiCommand implements ResourceEntity $email_accounts = $this->getUlParam('email_accounts', 'email_accounts_ul', true, 0); $email_forwarders = $this->getUlParam('email_forwarders', 'email_forwarders_ul', true, 0); $email_quota = $this->getUlParam('email_quota', 'email_quota_ul', true, Settings::Get('system.mail_quota')); - $email_imap = $this->getParam('email_imap', true, 0); - $email_pop3 = $this->getParam('email_pop3', true, 0); + $email_imap = $this->getBoolParam('email_imap', true, 0); + $email_pop3 = $this->getBoolParam('email_pop3', true, 0); $ftps = $this->getUlParam('ftps', 'ftps_ul', true, 0); $tickets = $this->getUlParam('tickets', 'tickets_ul', true, 0); $mysqls = $this->getUlParam('mysqls', 'mysqls_ul', true, 0); - $createstdsubdomain = $this->getParam('createstdsubdomain', true, 0); + $createstdsubdomain = $this->getBoolParam('createstdsubdomain', true, 0); $password = $this->getParam('new_customer_password', true, ''); - $sendpassword = $this->getParam('sendpassword', true, 0); - $phpenabled = $this->getParam('phpenabled', true, 0); + $sendpassword = $this->getBoolParam('sendpassword', true, 0); + $phpenabled = $this->getBoolParam('phpenabled', true, 0); $p_allowed_phpconfigs = $this->getParam('allowed_phpconfigs', true, array()); - $perlenabled = $this->getParam('perlenabled', true, 0); - $dnsenabled = $this->getParam('dnsenabled', true, 0); - $logviewenabled = $this->getParam('logviewenabled', true, 0); - $store_defaultindex = $this->getParam('store_defaultindex', true, 0); + $perlenabled = $this->getBoolParam('perlenabled', true, 0); + $dnsenabled = $this->getBoolParam('dnsenabled', true, 0); + $logviewenabled = $this->getBoolParam('logviewenabled', true, 0); + $store_defaultindex = $this->getBoolParam('store_defaultindex', true, 0); $loginname = $this->getParam('new_loginname', true, ''); // validation @@ -861,7 +861,7 @@ class Customers extends ApiCommand implements ResourceEntity if ($this->isAdmin()) { // parameters - $move_to_admin = intval_ressource($this->getParam('move_to_admin', true, 0)); + $move_to_admin = intval_ressource($this->getBoolParam('move_to_admin', true, 0)); $idna_convert = new idna_convert_wrapper(); $email = $this->getParam('email', true, $idna_convert->decode($result['email'])); @@ -878,7 +878,7 @@ class Customers extends ApiCommand implements ResourceEntity $def_language = $this->getParam('def_language', true, $result['def_language']); $gender = intval_ressource($this->getParam('gender', true, $result['gender'])); $custom_notes = $this->getParam('custom_notes', true, $result['custom_notes']); - $custom_notes_show = $this->getParam('custom_notes_show', true, $result['custom_notes_show']); + $custom_notes_show = $this->getBoolParam('custom_notes_show', true, $result['custom_notes_show']); $dec_places = Settings::Get('panel.decimal_places'); $diskspace = $this->getUlParam('diskspace', 'diskspace_ul', true, round($result['diskspace'] / 1024, $dec_places)); @@ -893,14 +893,14 @@ class Customers extends ApiCommand implements ResourceEntity $ftps = $this->getUlParam('ftps', 'ftps_ul', true, $result['ftps']); $tickets = $this->getUlParam('tickets', 'tickets_ul', true, $result['tickets']); $mysqls = $this->getUlParam('mysqls', 'mysqls_ul', true, $result['mysqls']); - $createstdsubdomain = $this->getParam('createstdsubdomain', true, 0); + $createstdsubdomain = $this->getBoolParam('createstdsubdomain', true, 0); $password = $this->getParam('new_customer_password', true, ''); - $phpenabled = $this->getParam('phpenabled', true, $result['phpenabled']); + $phpenabled = $this->getBoolParam('phpenabled', true, $result['phpenabled']); $allowed_phpconfigs = $this->getParam('allowed_phpconfigs', true, json_decode($result['allowed_phpconfigs'], true)); - $perlenabled = $this->getParam('perlenabled', true, $result['perlenabled']); - $dnsenabled = $this->getParam('dnsenabled', true, $result['dnsenabled']); - $logviewenabled = $this->getParam('logviewenabled', true, $result['logviewenabled']); - $deactivated = $this->getParam('deactivated', true, $result['deactivated']); + $perlenabled = $this->getBoolParam('perlenabled', true, $result['perlenabled']); + $dnsenabled = $this->getBoolParam('dnsenabled', true, $result['dnsenabled']); + $logviewenabled = $this->getBoolParam('logviewenabled', true, $result['logviewenabled']); + $deactivated = $this->getBoolParam('deactivated', true, $result['deactivated']); $theme = $this->getParam('theme', true, $result['theme']); } else { // allowed parameters diff --git a/lib/classes/api/commands/class.DirOptions.php b/lib/classes/api/commands/class.DirOptions.php index 8b951c92..1b8a3f01 100644 --- a/lib/classes/api/commands/class.DirOptions.php +++ b/lib/classes/api/commands/class.DirOptions.php @@ -58,8 +58,8 @@ class DirOptions extends ApiCommand implements ResourceEntity $path = $this->getParam('path'); // parameters - $options_indexes = $this->getParam('options_indexes', true, 0); - $options_cgi = $this->getParam('options_cgi', true, 0); + $options_indexes = $this->getBoolParam('options_indexes', true, 0); + $options_cgi = $this->getBoolParam('options_cgi', true, 0); $error404path = $this->getParam('error404path', true, ''); $error403path = $this->getParam('error403path', true, ''); $error500path = $this->getParam('error500path', true, ''); @@ -69,18 +69,6 @@ class DirOptions extends ApiCommand implements ResourceEntity $userpath = $path; $path = makeCorrectDir($customer['documentroot'] . '/' . $path); - if ($options_indexes != 0) { - $options_indexes = '1'; - } else { - $options_indexes = '0'; - } - - if ($options_cgi != 0) { - $options_cgi = '1'; - } else { - $options_cgi = '0'; - } - if (! empty($error404path)) { $error404path = correctErrorDocument($error404path, true); } @@ -237,24 +225,12 @@ class DirOptions extends ApiCommand implements ResourceEntity $customer = $this->getCustomerData(); // parameters - $options_indexes = $this->getParam('options_indexes', true, $result['options_indexes']); - $options_cgi = $this->getParam('options_cgi', true, $result['options_cgi']); + $options_indexes = $this->getBoolParam('options_indexes', true, $result['options_indexes']); + $options_cgi = $this->getBoolParam('options_cgi', true, $result['options_cgi']); $error404path = $this->getParam('error404path', true, $result['error404path']); $error403path = $this->getParam('error403path', true, $result['error403path']); $error500path = $this->getParam('error500path', true, $result['error500path']); - if ($options_indexes != 0) { - $options_indexes = '1'; - } else { - $options_indexes = '0'; - } - - if ($options_cgi != 0) { - $options_cgi = '1'; - } else { - $options_cgi = '0'; - } - if (! empty($error404path)) { $error404path = correctErrorDocument($error404path, true); } diff --git a/lib/classes/api/commands/class.EmailAccounts.php b/lib/classes/api/commands/class.EmailAccounts.php index d19d827e..3dacdad5 100644 --- a/lib/classes/api/commands/class.EmailAccounts.php +++ b/lib/classes/api/commands/class.EmailAccounts.php @@ -57,7 +57,7 @@ class EmailAccounts extends ApiCommand implements ResourceEntity $email_password = $this->getParam('email_password'); $alternative_email = $this->getParam('alternative_email', true, ''); $quota = $this->getParam('email_quota', true, 0); - $sendinfomail = $this->getParam('sendinfomail', true, 1); + $sendinfomail = $this->getBoolParam('sendinfomail', true, 1); // validation $quota = validate($quota, 'email_quota', '/^\d+$/', 'vmailquotawrong', array(), true); @@ -424,7 +424,7 @@ class EmailAccounts extends ApiCommand implements ResourceEntity $id = $this->getParam('id', true, 0); $ea_optional = ($id <= 0 ? false : true); $emailaddr = $this->getParam('emailaddr', $ea_optional, ''); - $delete_userfiles = $this->getParam('delete_userfiles', true, 0); + $delete_userfiles = $this->getBoolParam('delete_userfiles', true, 0); // validation $result = $this->apiCall('Emails.get', array( diff --git a/lib/classes/api/commands/class.Emails.php b/lib/classes/api/commands/class.Emails.php index c6a496e3..7dbcf37e 100644 --- a/lib/classes/api/commands/class.Emails.php +++ b/lib/classes/api/commands/class.Emails.php @@ -49,7 +49,7 @@ class Emails extends ApiCommand implements ResourceEntity $domain = $this->getParam('domain'); // parameters - $iscatchall = $this->getParam('iscatchall', true, 0); + $iscatchall = $this->getBoolParam('iscatchall', true, 0); // validation if (substr($domain, 0, 4) != 'xn--') { @@ -222,7 +222,7 @@ class Emails extends ApiCommand implements ResourceEntity $id = $result['id']; // parameters - $iscatchall = $this->getParam('iscatchall', true, $result['iscatchall']); + $iscatchall = $this->getBoolParam('iscatchall', true, $result['iscatchall']); // get needed customer info to reduce the email-address-counter by one $customer = $this->getCustomerData(); @@ -326,7 +326,7 @@ class Emails extends ApiCommand implements ResourceEntity $id = $result['id']; // parameters - $delete_userfiles = $this->getParam('delete_userfiles', true, 0); + $delete_userfiles = $this->getBoolParam('delete_userfiles', true, 0); // get needed customer info to reduce the email-address-counter by one $customer = $this->getCustomerData(); diff --git a/lib/classes/api/commands/class.Ftps.php b/lib/classes/api/commands/class.Ftps.php index 60f747ec..4191482d 100644 --- a/lib/classes/api/commands/class.Ftps.php +++ b/lib/classes/api/commands/class.Ftps.php @@ -56,7 +56,7 @@ class Ftps extends ApiCommand implements ResourceEntity // parameters $description = $this->getParam('ftp_description', true, ''); - $sendinfomail = $this->getParam('sendinfomail', true, 0); + $sendinfomail = $this->getBoolParam('sendinfomail', true, 0); $shell = $this->getParam('shell', true, '/bin/false'); $ftpusername = $this->getParam('ftp_username', true, ''); @@ -302,8 +302,6 @@ class Ftps extends ApiCommand implements ResourceEntity * destination path relative to the customers-homedir * @param string $ftp_description * optional, description for ftp-user - * @param bool $sendinfomail - * optional, send created resource-information to customer, default: false * @param string $shell * optional, default /bin/false (not changeable when deactivated) * @param int $customerid @@ -463,7 +461,7 @@ class Ftps extends ApiCommand implements ResourceEntity $id = $this->getParam('id', true, 0); $un_optional = ($id <= 0 ? false : true); $username = $this->getParam('username', $un_optional, ''); - $delete_userfiles = $this->getParam('delete_userfiles', true, 0); + $delete_userfiles = $this->getBoolParam('delete_userfiles', true, 0); if ($this->isAdmin() == false && Settings::IsInList('panel.customer_hide_options', 'ftp')) { throw new Exception("You cannot access this resource", 405); diff --git a/lib/classes/api/commands/class.IpsAndPorts.php b/lib/classes/api/commands/class.IpsAndPorts.php index f7e40018..b7450b41 100644 --- a/lib/classes/api/commands/class.IpsAndPorts.php +++ b/lib/classes/api/commands/class.IpsAndPorts.php @@ -128,16 +128,16 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity 'stringisempty', 'myport' ), array(), true); - $listen_statement = ! empty($this->getParam('listen_statement', true, 0)) ? 1 : 0; - $namevirtualhost_statement = ! empty($this->getParam('namevirtualhost_statement', true, 0)) ? 1 : 0; - $vhostcontainer = ! empty($this->getParam('vhostcontainer', true, 0)) ? 1 : 0; + $listen_statement = ! empty($this->getBoolParam('listen_statement', true, 0)) ? 1 : 0; + $namevirtualhost_statement = ! empty($this->getBoolParam('namevirtualhost_statement', true, 0)) ? 1 : 0; + $vhostcontainer = ! empty($this->getBoolParam('vhostcontainer', true, 0)) ? 1 : 0; $specialsettings = validate(str_replace("\r\n", "\n", $this->getParam('specialsettings', true, '')), 'specialsettings', '/^[^\0]*$/', '', array(), true); - $vhostcontainer_servername_statement = ! empty($this->getParam('vhostcontainer_servername_statement', true, 1)) ? 1 : 0; + $vhostcontainer_servername_statement = ! empty($this->getBoolParam('vhostcontainer_servername_statement', true, 1)) ? 1 : 0; $default_vhostconf_domain = validate(str_replace("\r\n", "\n", $this->getParam('default_vhostconf_domain', true, '')), 'default_vhostconf_domain', '/^[^\0]*$/', '', array(), true); $docroot = validate($this->getParam('docroot', true, ''), 'docroot', '', '', array(), true); if ((int) Settings::Get('system.use_ssl') == 1) { - $ssl = ! empty($this->getParam('ssl', true, 0)) ? intval($this->getParam('ssl', true, 0)) : 0; + $ssl = ! empty($this->getBoolParam('ssl', true, 0)) ? intval($this->getBoolParam('ssl', true, 0)) : 0; $ssl_cert_file = validate($this->getParam('ssl_cert_file', $ssl, ''), 'ssl_cert_file', '', '', array(), true); $ssl_key_file = validate($this->getParam('ssl_key_file', $ssl, ''), 'ssl_key_file', '', '', array(), true); $ssl_ca_file = validate($this->getParam('ssl_ca_file', true, ''), 'ssl_ca_file', '', '', array(), true); @@ -302,16 +302,16 @@ class IpsAndPorts extends ApiCommand implements ResourceEntity 'stringisempty', 'myport' ), array(), true); - $listen_statement = $this->getParam('listen_statement', true, $result['listen_statement']); - $namevirtualhost_statement = $this->getParam('namevirtualhost_statement', true, $result['namevirtualhost_statement']); - $vhostcontainer = $this->getParam('vhostcontainer', true, $result['vhostcontainer']); + $listen_statement = $this->getBoolParam('listen_statement', true, $result['listen_statement']); + $namevirtualhost_statement = $this->getBoolParam('namevirtualhost_statement', true, $result['namevirtualhost_statement']); + $vhostcontainer = $this->getBoolParam('vhostcontainer', true, $result['vhostcontainer']); $specialsettings = validate(str_replace("\r\n", "\n", $this->getParam('specialsettings', true, $result['specialsettings'])), 'specialsettings', '/^[^\0]*$/', '', array(), true); $vhostcontainer_servername_statement = $this->getParam('vhostcontainer_servername_statement', true, $result['vhostcontainer_servername_statement']); $default_vhostconf_domain = validate(str_replace("\r\n", "\n", $this->getParam('default_vhostconf_domain', true, $result['default_vhostconf_domain'])), 'default_vhostconf_domain', '/^[^\0]*$/', '', array(), true); $docroot = validate($this->getParam('docroot', true, $result['docroot']), 'docroot', '', '', array(), true); if ((int) Settings::Get('system.use_ssl') == 1) { - $ssl = $this->getParam('ssl', true, $result['ssl']); + $ssl = $this->getBoolParam('ssl', true, $result['ssl']); $ssl_cert_file = validate($this->getParam('ssl_cert_file', $ssl, $result['ssl_cert_file']), 'ssl_cert_file', '', '', array(), true); $ssl_key_file = validate($this->getParam('ssl_key_file', $ssl, $result['ssl_key_file']), 'ssl_key_file', '', '', array(), true); $ssl_ca_file = validate($this->getParam('ssl_ca_file', true, $result['ssl_ca_file']), 'ssl_ca_file', '', '', array(), true); diff --git a/lib/classes/api/commands/class.Mysqls.php b/lib/classes/api/commands/class.Mysqls.php index e66d407c..b9f10f3f 100644 --- a/lib/classes/api/commands/class.Mysqls.php +++ b/lib/classes/api/commands/class.Mysqls.php @@ -46,7 +46,7 @@ class Mysqls extends ApiCommand implements ResourceEntity // parameters $dbserver = $this->getParam('mysql_server', true, 0); $databasedescription = $this->getParam('description', true, ''); - $sendinfomail = $this->getParam('sendinfomail', true, 0); + $sendinfomail = $this->getBoolParam('sendinfomail', true, 0); // validation $password = validate($password, 'password', '', '', array(), true); diff --git a/lib/classes/api/commands/class.PhpSettings.php b/lib/classes/api/commands/class.PhpSettings.php index 03aeb3b2..e93487b7 100644 --- a/lib/classes/api/commands/class.PhpSettings.php +++ b/lib/classes/api/commands/class.PhpSettings.php @@ -202,12 +202,12 @@ class PhpSettings extends ApiCommand implements ResourceEntity $mod_fcgid_starter = $this->getParam('mod_fcgid_starter', true, - 1); $mod_fcgid_maxrequests = $this->getParam('mod_fcgid_maxrequests', true, - 1); $mod_fcgid_umask = $this->getParam('mod_fcgid_umask', true, "022"); - $fpm_enableslowlog = $this->getParam('phpfpm_enable_slowlog', true, 0); + $fpm_enableslowlog = $this->getBoolParam('phpfpm_enable_slowlog', true, 0); $fpm_reqtermtimeout = $this->getParam('phpfpm_reqtermtimeout', true, "60s"); $fpm_reqslowtimeout = $this->getParam('phpfpm_reqslowtimeout', true, "5s"); - $fpm_pass_authorizationheader = $this->getParam('phpfpm_pass_authorizationheader', true, 0); + $fpm_pass_authorizationheader = $this->getBoolParam('phpfpm_pass_authorizationheader', true, 0); - $override_fpmconfig = $this->getParam('override_fpmconfig', true, 0); + $override_fpmconfig = $this->getBoolParam('override_fpmconfig', true, 0); $def_fpmconfig = $this->apiCall('FpmDaemons.get', array( 'id' => $fpm_config_id )); @@ -401,11 +401,11 @@ class PhpSettings extends ApiCommand implements ResourceEntity $mod_fcgid_starter = $this->getParam('mod_fcgid_starter', true, $result['mod_fcgid_starter']); $mod_fcgid_maxrequests = $this->getParam('mod_fcgid_maxrequests', true, $result['mod_fcgid_maxrequests']); $mod_fcgid_umask = $this->getParam('mod_fcgid_umask', true, $result['mod_fcgid_umask']); - $fpm_enableslowlog = $this->getParam('phpfpm_enable_slowlog', true, $result['fpm_slowlog']); + $fpm_enableslowlog = $this->getBoolParam('phpfpm_enable_slowlog', true, $result['fpm_slowlog']); $fpm_reqtermtimeout = $this->getParam('phpfpm_reqtermtimeout', true, $result['fpm_reqterm']); $fpm_reqslowtimeout = $this->getParam('phpfpm_reqslowtimeout', true, $result['fpm_reqslow']); - $fpm_pass_authorizationheader = $this->getParam('phpfpm_pass_authorizationheader', true, $result['pass_authorizationheader']); - $override_fpmconfig = $this->getParam('override_fpmconfig', true, $result['override_fpmconfig']); + $fpm_pass_authorizationheader = $this->getBoolParam('phpfpm_pass_authorizationheader', true, $result['pass_authorizationheader']); + $override_fpmconfig = $this->getBoolParam('override_fpmconfig', true, $result['override_fpmconfig']); $pmanager = $this->getParam('pm', true, $result['pm']); $max_children = $this->getParam('max_children', true, $result['max_children']); $start_servers = $this->getParam('start_servers', true, $result['start_servers']); diff --git a/lib/classes/api/commands/class.SubDomains.php b/lib/classes/api/commands/class.SubDomains.php index fc422f1f..4ca9a152 100644 --- a/lib/classes/api/commands/class.SubDomains.php +++ b/lib/classes/api/commands/class.SubDomains.php @@ -70,11 +70,11 @@ class SubDomains extends ApiCommand implements ResourceEntity $redirectcode = $this->getParam('redirectcode', true, Settings::Get('customredirect.default')); $isemaildomain = $this->getParam('isemaildomain', true, 0); if (Settings::Get('system.use_ssl')) { - $ssl_redirect = $this->getParam('ssl_redirect', true, 0); - $letsencrypt = $this->getParam('letsencrypt', true, 0); + $ssl_redirect = $this->getBoolParam('ssl_redirect', true, 0); + $letsencrypt = $this->getBoolParam('letsencrypt', true, 0); $hsts_maxage = $this->getParam('hsts_maxage', true, 0); - $hsts_sub = $this->getParam('hsts_sub', true, 0); - $hsts_preload = $this->getParam('hsts_preload', true, 0); + $hsts_sub = $this->getBoolParam('hsts_sub', true, 0); + $hsts_preload = $this->getBoolParam('hsts_preload', true, 0); } else { $ssl_redirect = 0; $letsencrypt = 0; @@ -463,16 +463,16 @@ class SubDomains extends ApiCommand implements ResourceEntity // default: 0 = wildcard, 1 = www-alias, 2 = none $_serveraliasdefault = $result['iswildcarddomain'] == '1' ? 0 : ($result['wwwserveralias'] == '1' ? 1 : 2); $selectserveralias = $this->getParam('selectserveralias', true, $_serveraliasdefault); - $isemaildomain = $this->getParam('isemaildomain', true, $result['isemaildomain']); + $isemaildomain = $this->getBoolParam('isemaildomain', true, $result['isemaildomain']); $openbasedir_path = $this->getParam('openbasedir_path', true, $result['openbasedir_path']); $phpsettingid = $this->getParam('phpsettingid', true, $result['phpsettingid']); $redirectcode = $this->getParam('redirectcode', true, getDomainRedirectId($id)); if (Settings::Get('system.use_ssl')) { - $ssl_redirect = $this->getParam('ssl_redirect', true, $result['ssl_redirect']); - $letsencrypt = $this->getParam('letsencrypt', true, $result['letsencrypt']); + $ssl_redirect = $this->getBoolParam('ssl_redirect', true, $result['ssl_redirect']); + $letsencrypt = $this->getBoolParam('letsencrypt', true, $result['letsencrypt']); $hsts_maxage = $this->getParam('hsts_maxage', true, $result['hsts']); - $hsts_sub = $this->getParam('hsts_sub', true, $result['hsts_sub']); - $hsts_preload = $this->getParam('hsts_preload', true, $result['hsts_preload']); + $hsts_sub = $this->getBoolParam('hsts_sub', true, $result['hsts_sub']); + $hsts_preload = $this->getBoolParam('hsts_preload', true, $result['hsts_preload']); } else { $ssl_redirect = 0; $letsencrypt = 0; diff --git a/lib/classes/api/commands/class.Traffic.php b/lib/classes/api/commands/class.Traffic.php index 73a7761f..7cdad848 100644 --- a/lib/classes/api/commands/class.Traffic.php +++ b/lib/classes/api/commands/class.Traffic.php @@ -73,7 +73,7 @@ class Traffic extends ApiCommand implements ResourceEntity $year = $this->getParam('year', true, ""); $month = $this->getParam('month', true, ""); $day = $this->getParam('day', true, ""); - $customer_traffic = $this->getParam('customer_traffic', true, 0); + $customer_traffic = $this->getBoolParam('customer_traffic', true, 0); $customer_ids = $this->getAllowedCustomerIds(); $result = array(); $params = array(); diff --git a/tests/Backup/CustomerBackupsTest.php b/tests/Backup/CustomerBackupsTest.php index 4c0a6e77..db9b5e16 100644 --- a/tests/Backup/CustomerBackupsTest.php +++ b/tests/Backup/CustomerBackupsTest.php @@ -90,9 +90,9 @@ class CustomerBackupsTest extends TestCase $json_result = CustomerBackups::getLocal($customer_userdata, $data)->add(); $result = json_decode($json_result, true)['data']; $this->assertEquals($customer_userdata['documentroot'] . 'my-backup/', $result['destdir']); - $this->assertEquals('0', $result['backup_dbs']); - $this->assertEquals('0', $result['backup_mail']); - $this->assertEquals('0', $result['backup_web']); + $this->assertEquals('1', $result['backup_dbs']); + $this->assertEquals('1', $result['backup_mail']); + $this->assertEquals('1', $result['backup_web']); } /** @@ -142,9 +142,9 @@ class CustomerBackupsTest extends TestCase $json_result = CustomerBackups::getLocal($admin_userdata)->listing(); $result = json_decode($json_result, true)['data']; $this->assertEquals(1, $result['count']); - $this->assertEquals('0', $result['list'][0]['data']['backup_dbs']); - $this->assertEquals('0', $result['list'][0]['data']['backup_mail']); - $this->assertEquals('0', $result['list'][0]['data']['backup_web']); + $this->assertEquals('1', $result['list'][0]['data']['backup_dbs']); + $this->assertEquals('1', $result['list'][0]['data']['backup_mail']); + $this->assertEquals('1', $result['list'][0]['data']['backup_web']); } /**