Froxlor
Froxlor copied to clipboard
Increase the usage of expressions with combined operators
:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of combined operators accordingly.
diff --git a/admin_configfiles.php b/admin_configfiles.php
index 594b7d2c..fefd5dab 100644
--- a/admin_configfiles.php
+++ b/admin_configfiles.php
@@ -145,7 +145,7 @@ if ($userinfo['change_serversettings'] == '1') {
foreach ($daemons as $di => $dd) {
$title = $dd->title;
if ($dd->default) {
- $title = $title . " (" . strtolower($lng['panel']['default']) . ")";
+ $title .= " (" . strtolower($lng['panel']['default']) . ")";
}
$daemons_select .= \Froxlor\UI\HTML::makeoption($title, $di);
}
diff --git a/admin_opcacheinfo.php b/admin_opcacheinfo.php
index 85b8a8f3..90d4c052 100644
--- a/admin_opcacheinfo.php
+++ b/admin_opcacheinfo.php
@@ -49,7 +49,7 @@ if ($page == 'showinfo') {
$value = '0x' . dechex($value);
}
if ($name == 'opcache.memory_consumption' && is_integer($value) && $value % (1024 * 1024) == 0) {
- $value = $value / (1024 * 1024);
+ $value /= 1024 * 1024;
}
if ($value === null || $value === '') {
$value = $lng['opcacheinfo']['novalue'];
diff --git a/install/updates/froxlor/0.9/update_0.9.inc.php b/install/updates/froxlor/0.9/update_0.9.inc.php
index 156541f3..8f78a2b5 100644
--- a/install/updates/froxlor/0.9/update_0.9.inc.php
+++ b/install/updates/froxlor/0.9/update_0.9.inc.php
@@ -1882,7 +1882,7 @@ if (\Froxlor\Froxlor::isFroxlorVersion('0.9.26')) {
// iterate through all found entries
// and try to guess what value it should be
foreach ($rows as $row) {
- $state = $state | $row['value'];
+ $state |= $row['value'];
}
// now delete all entries
diff --git a/lib/Froxlor/Api/Commands/Admins.php b/lib/Froxlor/Api/Commands/Admins.php
index 747edfc9..e1eb9afa 100644
--- a/lib/Froxlor/Api/Commands/Admins.php
+++ b/lib/Froxlor/Api/Commands/Admins.php
@@ -244,8 +244,8 @@ class Admins extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
$password = \Froxlor\System\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
@@ -522,8 +522,8 @@ class Admins extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\ResourceEnt
$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
diff --git a/lib/Froxlor/Api/Commands/Customers.php b/lib/Froxlor/Api/Commands/Customers.php
index e89031c3..13c60bc3 100644
--- a/lib/Froxlor/Api/Commands/Customers.php
+++ b/lib/Froxlor/Api/Commands/Customers.php
@@ -443,8 +443,8 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
}
$allowed_phpconfigs = array_map('intval', $allowed_phpconfigs);
- $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')) {
\Froxlor\UI\Response::standard_error('youcantallocatemorethanyouhave', '', true);
@@ -1026,8 +1026,8 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
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')) {
\Froxlor\UI\Response::standard_error('youcantallocatemorethanyouhave', '', true);
@@ -1255,7 +1255,7 @@ class Customers extends \Froxlor\Api\ApiCommand implements \Froxlor\Api\Resource
'custom_notes_show' => $custom_notes_show,
'api_allowed' => $api_allowed
);
- $upd_data = $upd_data + $admin_upd_data;
+ $upd_data += $admin_upd_data;
}
$upd_query = "UPDATE `" . TABLE_PANEL_CUSTOMERS . "` SET
diff --git a/lib/Froxlor/Cli/Action/ConfigServicesAction.php b/lib/Froxlor/Cli/Action/ConfigServicesAction.php
index 8d6c5d68..1c27e26b 100644
--- a/lib/Froxlor/Cli/Action/ConfigServicesAction.php
+++ b/lib/Froxlor/Cli/Action/ConfigServicesAction.php
@@ -149,7 +149,7 @@ class ConfigServicesAction extends \Froxlor\Cli\Action
$title = $dd->title;
if ($dd->default) {
$default_daemon = $di;
- $title = $title . " (default)";
+ $title .= " (default)";
}
printf($mask, $di, $title);
}
diff --git a/lib/Froxlor/Config/ConfigService.php b/lib/Froxlor/Config/ConfigService.php
index 9b44993d..484c329a 100644
--- a/lib/Froxlor/Config/ConfigService.php
+++ b/lib/Froxlor/Config/ConfigService.php
@@ -110,7 +110,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 . "']";
}
}
diff --git a/lib/Froxlor/Database/Database.php b/lib/Froxlor/Database/Database.php
index 5235cf11..79c4e2e2 100644
--- a/lib/Froxlor/Database/Database.php
+++ b/lib/Froxlor/Database/Database.php
@@ -502,7 +502,7 @@ class Database
$replacements = array();
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);
diff --git a/lib/Froxlor/UI/HTML.php b/lib/Froxlor/UI/HTML.php
index 84caf1da..96ad4f06 100644
--- a/lib/Froxlor/UI/HTML.php
+++ b/lib/Froxlor/UI/HTML.php
@@ -226,7 +226,7 @@ class HTML
}
if (isset($_SESSION['requestData'])) {
- $yesselected = $yesselected & $_SESSION['requestData'][$name];
+ $yesselected &= $_SESSION['requestData'][$name];
}
return '<select class="dropdown_noborder" id="' . $name . '" name="' . $name . '"' . $d . '>