prefer combined operators, refs #999

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-11-05 11:07:18 +01:00
parent b0a66b687d
commit 4a4188a96b
6 changed files with 13 additions and 13 deletions

View File

@@ -262,8 +262,8 @@ class Admins extends ApiCommand implements ResourceEntity
$password = Crypt::validatePassword($password, true);
}
$diskspace = $diskspace * 1024;
$traffic = $traffic * 1024 * 1024;
$diskspace *= 1024;
$traffic *= 1024 * 1024;
// Check if the account already exists
// do not check via api as we skip any permission checks for this task
@@ -576,8 +576,8 @@ class Admins extends ApiCommand implements ResourceEntity
$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;
$traffic = $traffic * 1024 * 1024;
$diskspace *= 1024;
$traffic *= 1024 * 1024;
}
// validation

View File

@@ -409,8 +409,8 @@ class Customers extends ApiCommand implements ResourceEntity
}
$allowed_mysqlserver = array_map('intval', $allowed_mysqlserver);
$diskspace = $diskspace * 1024;
$traffic = $traffic * 1024 * 1024;
$diskspace *= 1024;
$traffic *= 1024 * 1024;
if (((($this->getUserDetail('diskspace_used') + $diskspace) > $this->getUserDetail('diskspace')) && ($this->getUserDetail('diskspace') / 1024) != '-1') || ((($this->getUserDetail('mysqls_used') + $mysqls) > $this->getUserDetail('mysqls')) && $this->getUserDetail('mysqls') != '-1') || ((($this->getUserDetail('emails_used') + $emails) > $this->getUserDetail('emails')) && $this->getUserDetail('emails') != '-1') || ((($this->getUserDetail('email_accounts_used') + $email_accounts) > $this->getUserDetail('email_accounts')) && $this->getUserDetail('email_accounts') != '-1') || ((($this->getUserDetail('email_forwarders_used') + $email_forwarders) > $this->getUserDetail('email_forwarders')) && $this->getUserDetail('email_forwarders') != '-1') || ((($this->getUserDetail('email_quota_used') + $email_quota) > $this->getUserDetail('email_quota')) && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') || ((($this->getUserDetail('ftps_used') + $ftps) > $this->getUserDetail('ftps')) && $this->getUserDetail('ftps') != '-1') || ((($this->getUserDetail('subdomains_used') + $subdomains) > $this->getUserDetail('subdomains')) && $this->getUserDetail('subdomains') != '-1') || (($diskspace / 1024) == '-1' && ($this->getUserDetail('diskspace') / 1024) != '-1') || ($mysqls == '-1' && $this->getUserDetail('mysqls') != '-1') || ($emails == '-1' && $this->getUserDetail('emails') != '-1') || ($email_accounts == '-1' && $this->getUserDetail('email_accounts') != '-1') || ($email_forwarders == '-1' && $this->getUserDetail('email_forwarders') != '-1') || ($email_quota == '-1' && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') || ($ftps == '-1' && $this->getUserDetail('ftps') != '-1') || ($subdomains == '-1' && $this->getUserDetail('subdomains') != '-1')) {
Response::standardError('youcantallocatemorethanyouhave', '', true);
@@ -1107,8 +1107,8 @@ class Customers extends ApiCommand implements ResourceEntity
}
if ($this->isAdmin()) {
$diskspace = $diskspace * 1024;
$traffic = $traffic * 1024 * 1024;
$diskspace *= 1024;
$traffic *= 1024 * 1024;
if (((($this->getUserDetail('diskspace_used') + $diskspace - $result['diskspace']) > $this->getUserDetail('diskspace')) && ($this->getUserDetail('diskspace') / 1024) != '-1') || ((($this->getUserDetail('mysqls_used') + $mysqls - $result['mysqls']) > $this->getUserDetail('mysqls')) && $this->getUserDetail('mysqls') != '-1') || ((($this->getUserDetail('emails_used') + $emails - $result['emails']) > $this->getUserDetail('emails')) && $this->getUserDetail('emails') != '-1') || ((($this->getUserDetail('email_accounts_used') + $email_accounts - $result['email_accounts']) > $this->getUserDetail('email_accounts')) && $this->getUserDetail('email_accounts') != '-1') || ((($this->getUserDetail('email_forwarders_used') + $email_forwarders - $result['email_forwarders']) > $this->getUserDetail('email_forwarders')) && $this->getUserDetail('email_forwarders') != '-1') || ((($this->getUserDetail('email_quota_used') + $email_quota - $result['email_quota']) > $this->getUserDetail('email_quota')) && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') || ((($this->getUserDetail('ftps_used') + $ftps - $result['ftps']) > $this->getUserDetail('ftps')) && $this->getUserDetail('ftps') != '-1') || ((($this->getUserDetail('subdomains_used') + $subdomains - $result['subdomains']) > $this->getUserDetail('subdomains')) && $this->getUserDetail('subdomains') != '-1') || (($diskspace / 1024) == '-1' && ($this->getUserDetail('diskspace') / 1024) != '-1') || ($mysqls == '-1' && $this->getUserDetail('mysqls') != '-1') || ($emails == '-1' && $this->getUserDetail('emails') != '-1') || ($email_accounts == '-1' && $this->getUserDetail('email_accounts') != '-1') || ($email_forwarders == '-1' && $this->getUserDetail('email_forwarders') != '-1') || ($email_quota == '-1' && $this->getUserDetail('email_quota') != '-1' && Settings::Get('system.mail_quota_enabled') == '1') || ($ftps == '-1' && $this->getUserDetail('ftps') != '-1') || ($subdomains == '-1' && $this->getUserDetail('subdomains') != '-1')) {
Response::standardError('youcantallocatemorethanyouhave', '', true);
@@ -1351,7 +1351,7 @@ class Customers extends ApiCommand implements ResourceEntity
'api_allowed' => $api_allowed,
'allowed_mysqlserver' => empty($allowed_mysqlserver) ? "" : json_encode($allowed_mysqlserver)
];
$upd_data = $upd_data + $admin_upd_data;
$upd_data += $admin_upd_data;
}
$upd_query = "UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET

View File

@@ -235,7 +235,7 @@ final class ConfigServices extends CliCommand
$title = $dd->title;
if ($dd->default) {
$default_daemon = $di;
$title = $title . " (default)";
$title .= " (default)";
}
$table_rows[] = [$di, $title];
$valid_options[] = $di;

View File

@@ -143,7 +143,7 @@ class ConfigService
$name = str_replace('.', '', $value);
$versiontag = "[@version='" . $value . "']";
} elseif ($key == 'version' && $name != '') {
$name = $name . str_replace('.', '', $value);
$name .= str_replace('.', '', $value);
$versiontag = "[@version='" . $value . "']";
}
}

View File

@@ -248,7 +248,7 @@ class Database
$replacements = [];
foreach ($substitutions as $search => $replace) {
$replacements = $replacements + self::createShiftedSubstitutions($search, $replace, $minLength);
$replacements += self::createShiftedSubstitutions($search, $replace, $minLength);
}
$content = str_replace(array_keys($replacements), array_values($replacements), $content);

View File

@@ -89,7 +89,7 @@ class FroxlorTwig extends AbstractExtension
public function formatBytesFilter($size, $suffix = "B", $factor = 1)
{
$size = $size * $factor;
$size *= $factor;
$units = [
'',
'K',