fix unlimited flags when adding customer; add debug flag to log all api-requests for testing purposes now

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2018-02-16 14:34:55 +01:00
parent 8978dd3a4b
commit 60defd3cdf
2 changed files with 73 additions and 68 deletions

View File

@@ -3,6 +3,8 @@
abstract class ApiCommand abstract class ApiCommand
{ {
private $debug = true;
private $is_admin = false; private $is_admin = false;
private $user_data = null; private $user_data = null;
@@ -27,6 +29,9 @@ abstract class ApiCommand
throw new Exception("Invalid user data", 500); throw new Exception("Invalid user data", 500);
} }
$this->logger = FroxlorLogger::getInstanceOf($this->user_data); $this->logger = FroxlorLogger::getInstanceOf($this->user_data);
if ($this->debug) {
$this->logger()->logAction(LOG_ERROR, LOG_DEBUG, json_encode($params, JSON_UNESCAPED_SLASHES));
}
$this->initLang(); $this->initLang();
$this->initMail(); $this->initMail();

View File

@@ -80,32 +80,32 @@ class Customers extends ApiCommand
$custom_notes_show = $this->getParam('custom_notes_show', 0); $custom_notes_show = $this->getParam('custom_notes_show', 0);
$diskspace = intval_ressource($this->getParam('diskspace', 0)); $diskspace = intval_ressource($this->getParam('diskspace', 0));
if ($this->getParam('diskspace_ul', 0) == 1) { if ($this->getParam('diskspace_ul', 0) == -1) {
$diskspace = - 1; $diskspace = - 1;
} }
$traffic = doubleval_ressource($this->getParam('traffic', 0)); $traffic = doubleval_ressource($this->getParam('traffic', 0));
if ($this->getParam('traffic_ul', 0) == 1) { if ($this->getParam('traffic_ul', 0) == -1) {
$traffic = - 1; $traffic = - 1;
} }
$subdomains = intval_ressource($this->getParam('subdomains', 0)); $subdomains = intval_ressource($this->getParam('subdomains', 0));
if ($this->getParam('subdomains_ul', 0) == 1) { if ($this->getParam('subdomains_ul', 0) == -1) {
$subdomains = - 1; $subdomains = - 1;
} }
$emails = intval_ressource($this->getParam('emails', 0)); $emails = intval_ressource($this->getParam('emails', 0));
if ($this->getParam('emails_ul', 0) == 1) { if ($this->getParam('emails_ul', 0) == -1) {
$emails = - 1; $emails = - 1;
} }
$email_accounts = intval_ressource($this->getParam('email_accounts', 0)); $email_accounts = intval_ressource($this->getParam('email_accounts', 0));
if ($this->getParam('email_accounts_ul', 0) == 1) { if ($this->getParam('email_accounts_ul', 0) == -1) {
$email_accounts = - 1; $email_accounts = - 1;
} }
$email_forwarders = intval_ressource($this->getParam('email_forwarders', 0)); $email_forwarders = intval_ressource($this->getParam('email_forwarders', 0));
if ($this->getParam('email_forwarders_ul', 0) == 1) { if ($this->getParam('email_forwarders_ul', 0) == -1) {
$email_forwarders = - 1; $email_forwarders = - 1;
} }
@@ -114,7 +114,7 @@ class Customers extends ApiCommand
'0', '0',
'' ''
), true); ), true);
if ($this->getParam('email_quota_ul', 0) == 1) { if ($this->getParam('email_quota_ul', 0) == -1) {
$email_quota = - 1; $email_quota = - 1;
} }
} else { } else {
@@ -125,13 +125,13 @@ class Customers extends ApiCommand
$email_pop3 = $this->getParam('email_pop3', 0); $email_pop3 = $this->getParam('email_pop3', 0);
$ftps = intval_ressource($this->getParam('ftps', 0)); $ftps = intval_ressource($this->getParam('ftps', 0));
if ($this->getParam('ftps_ul', 0) == 1) { if ($this->getParam('ftps_ul', 0) == -1) {
$ftps = - 1; $ftps = - 1;
} }
if (Settings::Get('ticket.enabled') == '1') { if (Settings::Get('ticket.enabled') == '1') {
$tickets = intval_ressource($this->getParam('tickets', 0)); $tickets = intval_ressource($this->getParam('tickets', 0));
if ($this->getParam('tickets_ul', 0) == 1) { if ($this->getParam('tickets_ul', 0) == -1) {
$tickets = - 1; $tickets = - 1;
} }
} else { } else {
@@ -139,7 +139,7 @@ class Customers extends ApiCommand
} }
$mysqls = intval_ressource($this->getParam('mysqls', 0)); $mysqls = intval_ressource($this->getParam('mysqls', 0));
if ($this->getParam('mysqls_ul', 0) == 1) { if ($this->getParam('mysqls_ul', 0) == -1) {
$mysqls = - 1; $mysqls = - 1;
} }
@@ -553,7 +553,7 @@ class Customers extends ApiCommand
$srv_hostname = Settings::Get('system.hostname'); $srv_hostname = Settings::Get('system.hostname');
if (Settings::Get('system.froxlordirectlyviahostname') == '0') { if (Settings::Get('system.froxlordirectlyviahostname') == '0') {
$srv_hostname .= '/froxlor'; $srv_hostname .= '/'.basename(FROXLOR_INSTALL_DIR);
} }
$srv_ip_stmt = Database::prepare(" $srv_ip_stmt = Database::prepare("