fix some more checkstyle issues

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann 2018-12-24 13:21:35 +01:00
parent 35c631946d
commit 30f5902b88
No known key found for this signature in database
GPG Key ID: 55284EC83A4823B8
16 changed files with 74 additions and 61 deletions

View File

@ -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";
}

View File

@ -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";
}

View File

@ -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;
}
}
}

View File

@ -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;
}

View File

@ -422,4 +422,4 @@ class Dns
return $zone_dkim;
}
}
}

View File

@ -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);
}
}

View File

@ -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));

View File

@ -126,4 +126,4 @@ class Statistics
\Froxlor\FileDir::safe_exec('chown -R ' . escapeshellarg($user) . ':' . escapeshellarg($group) . ' ' . escapeshellarg(\Froxlor\FileDir::makeCorrectDir($dir)));
}
}
}
}

View File

@ -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;

View File

@ -346,4 +346,4 @@ class Cronjob
die($message);
}
}
}

View File

@ -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;
}
}

View File

@ -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 != '') {

View File

@ -308,4 +308,4 @@ class HTML
eval("echo \"" . Template::getTemplate('misc/question_yesno_checkbox', '1') . "\";");
exit();
}
}
}

View File

@ -178,4 +178,4 @@ class Response
eval("echo \"" . Template::getTemplate('misc/success', '1') . "\";");
exit();
}
}
}

View File

@ -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;
}
}
}
}

View File

@ -9,6 +9,7 @@
<rule ref="PSR2">
<exclude name="Generic.WhiteSpace.DisallowTabIndent" />
<exclude name="Generic.Files.LineLength" />
<exclude name="Generic.ControlStructures.InlineControlStructure.Discouraged" />
<exclude name="PSR1.Classes.ClassDeclaration.MissingNamespace" />
<exclude
name="Squiz.WhiteSpace.ControlStructureSpacing.SpacingAfterOpen" />