diff --git a/lib/Froxlor/Cron/Http/Apache.php b/lib/Froxlor/Cron/Http/Apache.php index ee37940a..0cff428c 100644 --- a/lib/Froxlor/Cron/Http/Apache.php +++ b/lib/Froxlor/Cron/Http/Apache.php @@ -386,8 +386,8 @@ class Apache extends HttpConfigBase 'customerroot' => $mypath ); } - } // end of ssl-redirect check - else { + // end of ssl-redirect check + } else { // fallback of froxlor domain-data for processSpecialConfigTemplate() $domain = array( 'domain' => Settings::Get('system.hostname'), @@ -597,7 +597,9 @@ class Apache extends HttpConfigBase } public function createOwnVhostStarter() - {} + { + return; + } /** * We collect all servernames and Aliases @@ -698,11 +700,11 @@ class Apache extends HttpConfigBase } else { $stats_text .= ' Alias /webalizer "' . \Froxlor\FileDir::makeCorrectFile($domain['customerroot'] . '/webalizer') . '"' . "\n"; } - } // if the docroots are equal, we still have to set an alias for awstats - // because the stats are in /awstats/[domain], not just /awstats/ - // also, the awstats-icons are someplace else too! - // -> webalizer does not need this! - elseif (Settings::Get('system.awstats_enabled') == '1') { + } elseif (Settings::Get('system.awstats_enabled') == '1') { + // if the docroots are equal, we still have to set an alias for awstats + // because the stats are in /awstats/[domain], not just /awstats/ + // also, the awstats-icons are someplace else too! + // -> webalizer does not need this! $stats_text .= ' Alias /awstats "' . \Froxlor\FileDir::makeCorrectFile($domain['documentroot'] . '/awstats/' . $domain['domain']) . '"' . "\n"; $stats_text .= ' Alias /awstats-icon "' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.awstats_icons')) . '"' . "\n"; } diff --git a/lib/Froxlor/Cron/Http/Lighttpd.php b/lib/Froxlor/Cron/Http/Lighttpd.php index fcabf3aa..9ca2f78b 100644 --- a/lib/Froxlor/Cron/Http/Lighttpd.php +++ b/lib/Froxlor/Cron/Http/Lighttpd.php @@ -374,16 +374,24 @@ class Lighttpd extends HttpConfigBase } public function createVirtualHosts() - {} + { + return; + } public function createFileDirOptions() - {} + { + return; + } protected function composePhpOptions($domain) - {} + { + return; + } public function createOwnVhostStarter() - {} + { + return; + } protected function createLighttpdHosts($ipid, $ssl, $vhost_filename) { @@ -441,7 +449,7 @@ class Lighttpd extends HttpConfigBase return $included_vhosts; } - protected function getVhostContent($domain, $ssl_vhost = false, $ipid) + protected function getVhostContent($domain, $ssl_vhost = false, $ipid = 0) { if ($ssl_vhost === true && $domain['ssl'] != '1' && $domain['ssl_redirect'] != '1') { return ''; @@ -924,11 +932,11 @@ class Lighttpd extends HttpConfigBase } else { $stats_text .= ' alias.url = ( "/webalizer/" => "' . \Froxlor\FileDir::makeCorrectFile($domain['customerroot'] . '/webalizer/') . '" )' . "\n"; } - } // if the docroots are equal, we still have to set an alias for awstats - // because the stats are in /awstats/[domain], not just /awstats/ - // also, the awstats-icons are someplace else too! - // -> webalizer does not need this! - elseif (Settings::Get('system.awstats_enabled') == '1') { + } elseif (Settings::Get('system.awstats_enabled') == '1') { + // if the docroots are equal, we still have to set an alias for awstats + // because the stats are in /awstats/[domain], not just /awstats/ + // also, the awstats-icons are someplace else too! + // -> webalizer does not need this! $stats_text .= ' alias.url = ( "/awstats/" => "' . \Froxlor\FileDir::makeCorrectFile($domain['documentroot'] . '/awstats/' . $domain['domain']) . '" )' . "\n"; $stats_text .= ' alias.url += ( "/awstats-icon" => "' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.awstats_icons')) . '" )' . "\n"; } diff --git a/lib/Froxlor/Cron/MasterCron.php b/lib/Froxlor/Cron/MasterCron.php index c678618f..a95483f9 100644 --- a/lib/Froxlor/Cron/MasterCron.php +++ b/lib/Froxlor/Cron/MasterCron.php @@ -74,8 +74,7 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron define('CRON_DEBUG_FLAG', 1); } elseif (strtolower($argv[$x]) == '--no-fork') { define('CRON_NOFORK_FLAG', 1); - } - elseif (substr(strtolower($argv[$x]), 0, 2) == '--') { + } elseif (substr(strtolower($argv[$x]), 0, 2) == '--') { // --[cronname] if (strlen($argv[$x]) > 3) { $cronname = substr(strtolower($argv[$x]), 2); @@ -157,4 +156,4 @@ class MasterCron extends \Froxlor\Cron\FroxlorCron \Froxlor\FroxlorLogger::getInstanceOf()->logAction(CRON_ACTION, LOG_ERROR, "Requested cronjob '" . $cronname . "' could not be found."); return false; } -} \ No newline at end of file +} diff --git a/lib/Froxlor/Database/IntegrityCheck.php b/lib/Froxlor/Database/IntegrityCheck.php index 9b805b83..1f3c2086 100644 --- a/lib/Froxlor/Database/IntegrityCheck.php +++ b/lib/Froxlor/Database/IntegrityCheck.php @@ -81,7 +81,7 @@ class IntegrityCheck * * @return boolean */ - public function DatabaseCharset($fix = false) + public function databaseCharset($fix = false) { // get characterset @@ -108,7 +108,7 @@ class IntegrityCheck } if ($fix) { - return $this->DatabaseCharset(); + return $this->databaseCharset(); } return true; } @@ -119,7 +119,7 @@ class IntegrityCheck * @param bool $fix * Fix everything found directly */ - public function DomainIpTable($fix = false) + public function domainIpTable($fix = false) { $ips = array(); $domains = array(); @@ -217,7 +217,7 @@ class IntegrityCheck } if ($fix) { - return $this->DomainIpTable(); + return $this->domainIpTable(); } else { return true; } @@ -313,7 +313,7 @@ class IntegrityCheck * @param bool $fix * Fix everything found directly */ - public function SubdomainLetsencrypt($fix = false) + public function subdomainLetsencrypt($fix = false) { $ips = array(); $parentdomains = array(); @@ -385,7 +385,7 @@ class IntegrityCheck } if ($fix) { - return $this->SubdomainLetsencrypt(); + return $this->subdomainLetsencrypt(); } else { return true; } @@ -400,7 +400,7 @@ class IntegrityCheck * * @return boolean */ - public function WebserverGroupMemberForFcgidPhpFpm($fix = false) + public function webserverGroupMemberForFcgidPhpFpm($fix = false) { if (Settings::Get('system.mod_fcgid') == 0 && Settings::Get('phpfpm.enabled') == 0) { return true; @@ -437,7 +437,7 @@ class IntegrityCheck } if ($fix) { - return $this->WebserverGroupMemberForFcgidPhpFpm(); + return $this->webserverGroupMemberForFcgidPhpFpm(); } return true; } @@ -452,7 +452,7 @@ class IntegrityCheck * * @return boolean */ - public function FroxlorLocalGroupMemberForFcgidPhpFpm($fix = false) + public function froxlorLocalGroupMemberForFcgidPhpFpm($fix = false) { if (Settings::Get('system.mod_fcgid') == 0 && Settings::Get('phpfpm.enabled') == 0) { return true; @@ -505,7 +505,7 @@ class IntegrityCheck } if ($fix) { - return $this->FroxlorLocalGroupMemberForFcgidPhpFpm(); + return $this->froxlorLocalGroupMemberForFcgidPhpFpm(); } return true; } diff --git a/lib/Froxlor/Dns/Dns.php b/lib/Froxlor/Dns/Dns.php index 77a7cf51..e9cb5968 100644 --- a/lib/Froxlor/Dns/Dns.php +++ b/lib/Froxlor/Dns/Dns.php @@ -422,4 +422,4 @@ class Dns return $zone_dkim; } -} \ No newline at end of file +} diff --git a/lib/Froxlor/Froxlor.php b/lib/Froxlor/Froxlor.php index 23db6ff3..47f12639 100644 --- a/lib/Froxlor/Froxlor.php +++ b/lib/Froxlor/Froxlor.php @@ -264,11 +264,12 @@ final class Froxlor $arr[] = '1'; // svn < dev < rc // number of dev $arr[] = substr($x[1], 3); - } // -svn version are deprecated - elseif (stripos($x[1], 'svn') !== false) { + } elseif (stripos($x[1], 'svn') !== false) { + // -svn version are deprecated $arr[] = '-1'; - $arr[] = '0'; // svn < dev < rc - // number of svn + // svn < dev < rc + $arr[] = '0'; + // number of svn $arr[] = substr($x[1], 3); } } diff --git a/lib/Froxlor/Http/LetsEncrypt/LeScriptV2.php b/lib/Froxlor/Http/LetsEncrypt/LeScriptV2.php index 290cf8d9..a3a38ffa 100644 --- a/lib/Froxlor/Http/LetsEncrypt/LeScriptV2.php +++ b/lib/Froxlor/Http/LetsEncrypt/LeScriptV2.php @@ -119,7 +119,7 @@ class LeScriptV2 $response = $this->postNewReg(); if ($this->client->getLastCode() == 409) { $this->log('The key was already registered. Using existing account.'); - } else if ($this->client->getLastCode() == 201) { + } elseif ($this->client->getLastCode() == 201) { $this->log('New account registered.'); } else { throw new \RuntimeException("Account not initialized, probably due to rate limiting. Whole response: " . json_encode($response)); diff --git a/lib/Froxlor/Http/Statistics.php b/lib/Froxlor/Http/Statistics.php index 8e3b88e8..10103053 100644 --- a/lib/Froxlor/Http/Statistics.php +++ b/lib/Froxlor/Http/Statistics.php @@ -126,4 +126,4 @@ class Statistics \Froxlor\FileDir::safe_exec('chown -R ' . escapeshellarg($user) . ':' . escapeshellarg($group) . ' ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir($dir))); } } -} \ No newline at end of file +} diff --git a/lib/Froxlor/Idna/IdnaWrapper.php b/lib/Froxlor/Idna/IdnaWrapper.php index 940123f0..d452367d 100644 --- a/lib/Froxlor/Idna/IdnaWrapper.php +++ b/lib/Froxlor/Idna/IdnaWrapper.php @@ -98,20 +98,25 @@ class IdnaWrapper $strlen = strlen($string); for ($i = 0; $i < $strlen; $i ++) { $ord = ord($string[$i]); - if ($ord < 0x80) + if ($ord < 0x80) { continue; // 0bbbbbbb - elseif (($ord & 0xE0) === 0xC0 && $ord > 0xC1) + } elseif (($ord & 0xE0) === 0xC0 && $ord > 0xC1) { $n = 1; // 110bbbbb (exkl C0-C1) - elseif (($ord & 0xF0) === 0xE0) + } elseif (($ord & 0xF0) === 0xE0) { $n = 2; // 1110bbbb - elseif (($ord & 0xF8) === 0xF0 && $ord < 0xF5) + } elseif (($ord & 0xF8) === 0xF0 && $ord < 0xF5) { $n = 3; // 11110bbb (exkl F5-FF) - else - return false; // ungültiges UTF-8-Zeichen - for ($c = 0; $c < $n; $c ++) // $n Folgebytes? // 10bbbbbb - if (++ $i === $strlen || (ord($string[$i]) & 0xC0) !== 0x80) + } else { + // ungültiges UTF-8-Zeichen + return false; + } + // $n Folgebytes? // 10bbbbbb + for ($c = 0; $c < $n; $c ++) { + if (++ $i === $strlen || (ord($string[$i]) & 0xC0) !== 0x80) { // ungültiges UTF-8-Zeichen return false; + } + } } // kein ungültiges UTF-8-Zeichen gefunden return true; diff --git a/lib/Froxlor/System/Cronjob.php b/lib/Froxlor/System/Cronjob.php index 1920feee..dabd2d15 100644 --- a/lib/Froxlor/System/Cronjob.php +++ b/lib/Froxlor/System/Cronjob.php @@ -346,4 +346,4 @@ class Cronjob die($message); } -} \ No newline at end of file +} diff --git a/lib/Froxlor/System/Crypt.php b/lib/Froxlor/System/Crypt.php index a88b4c34..b423ca70 100644 --- a/lib/Froxlor/System/Crypt.php +++ b/lib/Froxlor/System/Crypt.php @@ -215,11 +215,8 @@ class Crypt $pwd_check = crypt($password, $pwd_salt); // check whether the hash needs to be updated $hash_type_chk = substr($pwd_hash, 0, 3); - if (($systype == 1 && $hash_type_chk != '$1$') || // MD5 - ($systype == 2 && $hash_type_chk != '$2$') || // BLOWFISH - ($systype == 3 && $hash_type_chk != '$5$') || // SHA256 - ($systype == 4 && $hash_type_chk != '$6$')) // SHA512 - { + // MD5 || BLOWFISH || SHA256 || SHA512 + if (($systype == 1 && $hash_type_chk != '$1$') || ($systype == 2 && $hash_type_chk != '$2$') || ($systype == 3 && $hash_type_chk != '$5$') || ($systype == 4 && $hash_type_chk != '$6$')) { $update_hash = true; } } diff --git a/lib/Froxlor/UI/Form.php b/lib/Froxlor/UI/Form.php index d9242475..9d1131f7 100644 --- a/lib/Froxlor/UI/Form.php +++ b/lib/Froxlor/UI/Form.php @@ -19,7 +19,7 @@ class Form if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) { // Prefetch form fields foreach ($groupdetails['fields'] as $fieldname => $fielddetails) { - $groupdetails['fields'][$fieldname] = self::array_merge_prefix($fielddetails, $fielddetails['type'], self::prefetchFormFieldData($fieldname, $fielddetails)); + $groupdetails['fields'][$fieldname] = self::arrayMergePrefix($fielddetails, $fielddetails['type'], self::prefetchFormFieldData($fieldname, $fielddetails)); $form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname]; } @@ -76,7 +76,7 @@ class Form if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) { // Prefetch form fields foreach ($groupdetails['fields'] as $fieldname => $fielddetails) { - $groupdetails['fields'][$fieldname] = self::array_merge_prefix($fielddetails, $fielddetails['type'], self::prefetchFormFieldData($fieldname, $fielddetails)); + $groupdetails['fields'][$fieldname] = self::arrayMergePrefix($fielddetails, $fielddetails['type'], self::prefetchFormFieldData($fieldname, $fielddetails)); $form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname]; } @@ -104,7 +104,7 @@ class Form if (\Froxlor\Validate\Form::validateFieldDefinition($groupdetails)) { // Prefetch form fields foreach ($groupdetails['fields'] as $fieldname => $fielddetails) { - $groupdetails['fields'][$fieldname] = self::array_merge_prefix($fielddetails, $fielddetails['type'], self::prefetchFormFieldData($fieldname, $fielddetails)); + $groupdetails['fields'][$fieldname] = self::arrayMergePrefix($fielddetails, $fielddetails['type'], self::prefetchFormFieldData($fieldname, $fielddetails)); $form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname]; } } @@ -201,7 +201,7 @@ class Form // Prefetch form fields foreach ($groupdetails['fields'] as $fieldname => $fielddetails) { if (! $only_enabledisable || ($only_enabledisable && isset($fielddetails['overview_option']))) { - $groupdetails['fields'][$fieldname] = self::array_merge_prefix($fielddetails, $fielddetails['type'], self::prefetchFormFieldData($fieldname, $fielddetails)); + $groupdetails['fields'][$fieldname] = self::arrayMergePrefix($fielddetails, $fielddetails['type'], self::prefetchFormFieldData($fieldname, $fielddetails)); $form['groups'][$groupname]['fields'][$fieldname] = $groupdetails['fields'][$fieldname]; } } @@ -508,7 +508,7 @@ class Form return $returnvalue; } - private static function array_merge_prefix($array1, $key_prefix, $array2) + private static function arrayMergePrefix($array1, $key_prefix, $array2) { if (is_array($array1) && is_array($array2)) { if ($key_prefix != '') { diff --git a/lib/Froxlor/UI/HTML.php b/lib/Froxlor/UI/HTML.php index 2ae1e534..b5c991aa 100644 --- a/lib/Froxlor/UI/HTML.php +++ b/lib/Froxlor/UI/HTML.php @@ -308,4 +308,4 @@ class HTML eval("echo \"" . Template::getTemplate('misc/question_yesno_checkbox', '1') . "\";"); exit(); } -} \ No newline at end of file +} diff --git a/lib/Froxlor/UI/Response.php b/lib/Froxlor/UI/Response.php index da7d02aa..86e0e58a 100644 --- a/lib/Froxlor/UI/Response.php +++ b/lib/Froxlor/UI/Response.php @@ -178,4 +178,4 @@ class Response eval("echo \"" . Template::getTemplate('misc/success', '1') . "\";"); exit(); } -} \ No newline at end of file +} diff --git a/lib/Froxlor/User.php b/lib/Froxlor/User.php index 40155d51..d15dbe8e 100644 --- a/lib/Froxlor/User.php +++ b/lib/Froxlor/User.php @@ -337,10 +337,10 @@ class User * * @return void */ - private static function initArrField($field = null, &$arr, $init_value = 0) + private static function initArrField($field = null, &$arr = array(), $init_value = 0) { if (! isset($arr[$field])) { $arr[$field] = $init_value; } } -} \ No newline at end of file +} diff --git a/phpcs.xml b/phpcs.xml index dd119e2f..a0e35d74 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -9,6 +9,7 @@ +