more checkstyle fixes

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2018-12-24 12:02:26 +01:00
parent c3d44b4558
commit 585d42f1b8
25 changed files with 263 additions and 261 deletions

View File

@@ -122,7 +122,7 @@ class PowerDNS extends DnsBase
return $lastid;
}
private function insertRecords($domainid = 0, $records, $origin)
private function insertRecords($domainid = 0, $records = array(), $origin = "")
{
$changedate = date('Ymds', time());

View File

@@ -44,7 +44,7 @@ class Apache extends HttpConfigBase
*
* @var bool
*/
private $_deactivated = false;
private $deactivated = false;
public function reload()
{
@@ -73,7 +73,7 @@ class Apache extends HttpConfigBase
/**
* define a standard <Directory>-statement, bug #32
*/
private function _createStandardDirectoryEntry()
private function createStandardDirectoryEntry()
{
$vhosts_folder = '';
if (is_dir(Settings::Get('system.apacheconf_vhost'))) {
@@ -119,7 +119,7 @@ class Apache extends HttpConfigBase
/**
* define a default ErrorDocument-statement, bug #unknown-yet
*/
private function _createStandardErrorHandler()
private function createStandardErrorHandler()
{
if (Settings::Get('defaultwebsrverrhandler.enabled') == '1' && (Settings::Get('defaultwebsrverrhandler.err401') != '' || Settings::Get('defaultwebsrverrhandler.err403') != '' || Settings::Get('defaultwebsrverrhandler.err404') != '' || Settings::Get('defaultwebsrverrhandler.err500') != '')) {
$vhosts_folder = '';
@@ -539,12 +539,12 @@ class Apache extends HttpConfigBase
/**
* bug #32
*/
$this->_createStandardDirectoryEntry();
$this->createStandardDirectoryEntry();
/**
* bug #unknown-yet
*/
$this->_createStandardErrorHandler();
$this->createStandardErrorHandler();
}
/**
@@ -666,10 +666,10 @@ class Apache extends HttpConfigBase
$webroot_text .= ' allow from all' . "\n";
}
$webroot_text .= ' </Directory>' . "\n";
$this->_deactivated = true;
$this->deactivated = true;
} else {
$webroot_text .= ' DocumentRoot "' . $domain['documentroot'] . "\"\n";
$this->_deactivated = false;
$this->deactivated = false;
}
return $webroot_text;
@@ -1049,7 +1049,7 @@ class Apache extends HttpConfigBase
\Froxlor\FileDir::mkDirWithCorrectOwnership($domain['customerroot'], $domain['documentroot'], $domain['guid'], $domain['guid'], true, true);
$vhost_content .= $this->getWebroot($domain);
if ($this->_deactivated == false) {
if ($this->deactivated == false) {
$vhost_content .= $this->composePhpOptions($domain, $ssl_vhost);
$vhost_content .= $this->getStats($domain);
}

View File

@@ -40,28 +40,28 @@ class ConfigIO
{
// old error logs
$this->_cleanErrLogs();
$this->cleanErrLogs();
// awstats files
$this->_cleanAwstatsFiles();
$this->cleanAwstatsFiles();
// fcgid files
$this->_cleanFcgidFiles();
$this->cleanFcgidFiles();
// php-fpm files
$this->_cleanFpmFiles();
$this->cleanFpmFiles();
// clean webserver-configs
$this->_cleanWebserverConfigs();
$this->cleanWebserverConfigs();
// old htpasswd files
$this->_cleanHtpasswdFiles();
$this->cleanHtpasswdFiles();
// customer-specified ssl-certificates
$this->_cleanCustomerSslCerts();
$this->cleanCustomerSslCerts();
}
private function _cleanErrLogs()
private function cleanErrLogs()
{
$err_dir = \Froxlor\FileDir::makeCorrectDir(\Froxlor\Froxlor::getInstallDir() . "/logs/");
if (@is_dir($err_dir)) {
@@ -78,7 +78,7 @@ class ConfigIO
*
* @return null
*/
private function _cleanCustomerSslCerts()
private function cleanCustomerSslCerts()
{
/*
@@ -86,7 +86,7 @@ class ConfigIO
*/
if (Settings::Get('system.use_ssl') == '1') {
// get correct directory
$configdir = $this->_getFile('system', 'customer_ssl_path');
$configdir = $this->getFile('system', 'customer_ssl_path');
if ($configdir !== false) {
$configdir = \Froxlor\FileDir::makeCorrectDir($configdir);
@@ -106,16 +106,16 @@ class ConfigIO
*
* @return null
*/
private function _cleanWebserverConfigs()
private function cleanWebserverConfigs()
{
// get directories
$configdirs = array();
$dir = $this->_getFile('system', 'apacheconf_vhost');
$dir = $this->getFile('system', 'apacheconf_vhost');
if ($dir !== false)
$configdirs[] = \Froxlor\FileDir::makeCorrectDir($dir);
$dir = $this->_getFile('system', 'apacheconf_diroptions');
$dir = $this->getFile('system', 'apacheconf_diroptions');
if ($dir !== false)
$configdirs[] = \Froxlor\FileDir::makeCorrectDir($dir);
@@ -149,11 +149,11 @@ class ConfigIO
*
* @return null
*/
private function _cleanHtpasswdFiles()
private function cleanHtpasswdFiles()
{
// get correct directory
$configdir = $this->_getFile('system', 'apacheconf_htpasswddir');
$configdir = $this->getFile('system', 'apacheconf_htpasswddir');
if ($configdir !== false) {
$configdir = \Froxlor\FileDir::makeCorrectDir($configdir);
@@ -172,7 +172,7 @@ class ConfigIO
*
* @return null
*/
private function _cleanAwstatsFiles()
private function cleanAwstatsFiles()
{
if (Settings::Get('system.awstats_enabled') == '0') {
return;
@@ -182,7 +182,7 @@ class ConfigIO
$awstatsclean = array();
$awstatsclean['header'] = "## GENERATED BY FROXLOR\n";
$awstatsclean['headerold'] = "## GENERATED BY SYSCP\n";
$awstatsclean['path'] = $this->_getFile('system', 'awstats_conf');
$awstatsclean['path'] = $this->getFile('system', 'awstats_conf');
/**
* don't do anything if the directory does not exist
@@ -218,14 +218,14 @@ class ConfigIO
*
* @return null
*/
private function _cleanFcgidFiles()
private function cleanFcgidFiles()
{
if (Settings::Get('system.mod_fcgid') == '0') {
return;
}
// get correct directory
$configdir = $this->_getFile('system', 'mod_fcgid_configdir');
$configdir = $this->getFile('system', 'mod_fcgid_configdir');
if ($configdir !== false) {
$configdir = \Froxlor\FileDir::makeCorrectDir($configdir);
@@ -258,7 +258,7 @@ class ConfigIO
*
* @return null
*/
private function _cleanFpmFiles()
private function cleanFpmFiles()
{
if (Settings::Get('phpfpm.enabled') == '0') {
return;
@@ -282,7 +282,7 @@ class ConfigIO
}
// also remove aliasconfigdir #1273
$aliasconfigdir = $this->_getFile('phpfpm', 'aliasconfigdir');
$aliasconfigdir = $this->getFile('phpfpm', 'aliasconfigdir');
if ($aliasconfigdir !== false) {
$aliasconfigdir = \Froxlor\FileDir::makeCorrectDir($aliasconfigdir);
if (@is_dir($aliasconfigdir)) {
@@ -304,7 +304,7 @@ class ConfigIO
*
* @return string|boolean complete path including filename if any or false on error
*/
private function _getFile($group, $varname, $check_exists = true)
private function getFile($group, $varname, $check_exists = true)
{
// read from settings

View File

@@ -43,7 +43,7 @@ class Lighttpd extends HttpConfigBase
*
* @var bool
*/
private $_deactivated = false;
private $deactivated = false;
public function reload()
{
@@ -300,13 +300,13 @@ class Lighttpd extends HttpConfigBase
/**
* bug #unknown-yet
*/
$this->_createStandardErrorHandler();
$this->createStandardErrorHandler();
}
/**
* define a default server.error-handler-404-statement, bug #unknown-yet
*/
private function _createStandardErrorHandler()
private function createStandardErrorHandler()
{
if (Settings::Get('defaultwebsrverrhandler.enabled') == '1' && Settings::Get('defaultwebsrverrhandler.err404') != '') {
$vhost_filename = \Froxlor\FileDir::makeCorrectFile(Settings::Get('system.apacheconf_vhost') . '/05_froxlor_default_errorhandler.conf');
@@ -500,7 +500,7 @@ class Lighttpd extends HttpConfigBase
$vhost_content .= $this->getWebroot($domain, $ssl_vhost);
if (! $only_webroot) {
if ($this->_deactivated == false) {
if ($this->deactivated == false) {
$vhost_content .= $this->create_htaccess($domain);
$vhost_content .= $this->create_pathOptions($domain);
$vhost_content .= $this->composePhpOptions($domain);
@@ -870,7 +870,7 @@ class Lighttpd extends HttpConfigBase
if ($domain['deactivated'] == '1' && Settings::Get('system.deactivateddocroot') != '') {
$webroot_text .= ' # Using docroot for deactivated users...' . "\n";
$webroot_text .= ' server.document-root = "' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.deactivateddocroot')) . "\"\n";
$this->_deactivated = true;
$this->deactivated = true;
} else {
if ($ssl === false && $domain['ssl_redirect'] == '1') {
$redirect_domain = $this->idnaConvert->encode('https://' . $domain['domain']);
@@ -889,7 +889,7 @@ class Lighttpd extends HttpConfigBase
} else {
$webroot_text .= ' server.document-root = "' . \Froxlor\FileDir::makeCorrectDir($domain['documentroot']) . "\"\n";
}
$this->_deactivated = false;
$this->deactivated = false;
}
return $webroot_text;

View File

@@ -48,7 +48,7 @@ class Nginx extends HttpConfigBase
*
* @var bool
*/
private $_deactivated = false;
private $deactivated = false;
public function __construct($nginx_server = array())
{
@@ -91,7 +91,7 @@ class Nginx extends HttpConfigBase
/**
* define a default ErrorDocument-statement, bug #unknown-yet
*/
private function _createStandardErrorHandler()
private function createStandardErrorHandler()
{
if (Settings::Get('defaultwebsrverrhandler.enabled') == '1' && (Settings::Get('defaultwebsrverrhandler.err401') != '' || Settings::Get('defaultwebsrverrhandler.err403') != '' || Settings::Get('defaultwebsrverrhandler.err404') != '' || Settings::Get('defaultwebsrverrhandler.err500') != '')) {
$vhosts_folder = '';
@@ -327,7 +327,7 @@ class Nginx extends HttpConfigBase
/**
* standard error pages
*/
$this->_createStandardErrorHandler();
$this->createStandardErrorHandler();
}
/**
@@ -510,7 +510,7 @@ class Nginx extends HttpConfigBase
$vhost_content .= $this->getLogFiles($domain);
$vhost_content .= $this->getWebroot($domain, $ssl_vhost);
if ($this->_deactivated == false) {
if ($this->deactivated == false) {
$vhost_content = $this->mergeVhostCustom($vhost_content, $this->create_pathOptions($domain)) . "\n";
$vhost_content .= $this->composePhpOptions($domain, $ssl_vhost);
@@ -928,10 +928,10 @@ class Nginx extends HttpConfigBase
if ($domain['deactivated'] == '1' && Settings::Get('system.deactivateddocroot') != '') {
$webroot_text .= "\t" . '# Using docroot for deactivated users...' . "\n";
$webroot_text .= "\t" . 'root ' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('system.deactivateddocroot')) . ';' . "\n";
$this->_deactivated = true;
$this->deactivated = true;
} else {
$webroot_text .= "\t" . 'root ' . \Froxlor\FileDir::makeCorrectDir($domain['documentroot']) . ';' . "\n";
$this->_deactivated = false;
$this->deactivated = false;
}
$webroot_text .= "\n\t" . 'location / {' . "\n";

View File

@@ -145,7 +145,7 @@ class Fcgid
$openbasedirc = ';';
}
$admin = $this->_getAdminData($this->_domain['adminid']);
$admin = $this->getAdminData($this->_domain['adminid']);
$php_ini_variables = array(
'SAFE_MODE' => 'Off', // keep this for compatibility, just in case
'PEAR_DIR' => Settings::Get('system.mod_fcgid_peardir'),
@@ -248,7 +248,7 @@ class Fcgid
*
* @return array
*/
private function _getAdminData($adminid)
private function getAdminData($adminid)
{
$adminid = intval($adminid);

View File

@@ -63,11 +63,11 @@ class Fpm
$domain['fpm_config_id'] = 1;
}
$this->_domain = $domain;
$this->_readFpmConfig($domain['fpm_config_id']);
$this->_buildIniMapping();
$this->readFpmConfig($domain['fpm_config_id']);
$this->buildIniMapping();
}
private function _buildIniMapping()
private function buildIniMapping()
{
$this->_ini = array(
'php_flag' => explode("\n", Settings::Get('phpfpm.ini_flags')),
@@ -77,7 +77,7 @@ class Fpm
);
}
private function _readFpmConfig($fpm_config_id)
private function readFpmConfig($fpm_config_id)
{
$stmt = Database::prepare("SELECT * FROM `" . TABLE_PANEL_FPMDAEMONS . "` WHERE `id` = :id");
$this->_fpm_cfg = Database::pexecute_first($stmt, array(
@@ -220,7 +220,7 @@ class Fpm
$fpm_config .= 'php_admin_value[session.save_path] = ' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n";
$fpm_config .= 'php_admin_value[upload_tmp_dir] = ' . \Froxlor\FileDir::makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n";
$admin = $this->_getAdminData($this->_domain['adminid']);
$admin = $this->getAdminData($this->_domain['adminid']);
$php_ini_variables = array(
'SAFE_MODE' => 'Off', // keep this for compatibility, just in case
'PEAR_DIR' => Settings::Get('phpfpm.peardir'),
@@ -393,7 +393,7 @@ pm.max_children = 1
*
* @return array
*/
private function _getAdminData($adminid)
private function getAdminData($adminid)
{
$adminid = intval($adminid);

View File

@@ -52,7 +52,7 @@ class PhpInterface
public function __construct($domain)
{
$this->_domain = $domain;
$this->_setInterface();
$this->setInterface();
}
/**
@@ -69,7 +69,7 @@ class PhpInterface
* php-interface: fcgid or php-fpm
* sets private $_interface variable
*/
private function _setInterface()
private function setInterface()
{
// php-fpm
if ((int) Settings::Get('phpfpm.enabled') == 1) {

View File

@@ -25,17 +25,17 @@ class Extrausers
// passwd
$passwd = '/var/lib/extrausers/passwd';
$sql = "SELECT username,'x' as password,uid,gid,'Froxlor User' as comment,homedir,shell, login_enabled FROM ftp_users ORDER BY uid ASC";
self::_generateFile($passwd, $sql, $cronlog);
self::generateFile($passwd, $sql, $cronlog);
// group
$group = '/var/lib/extrausers/group';
$sql = "SELECT groupname,'x' as password,gid,members FROM ftp_groups ORDER BY gid ASC";
self::_generateFile($group, $sql, $cronlog);
self::generateFile($group, $sql, $cronlog);
// shadow
$shadow = '/var/lib/extrausers/shadow';
$sql = "SELECT username,password FROM ftp_users ORDER BY gid ASC";
self::_generateFile($shadow, $sql, $cronlog);
self::generateFile($shadow, $sql, $cronlog);
// set correct permissions
@chmod('/var/lib/extrausers/', 0755);
@@ -44,7 +44,7 @@ class Extrausers
@chmod('/var/lib/extrausers/shadow', 0640);
}
private static function _generateFile($file, $query, &$cronlog)
private static function generateFile($file, $query, &$cronlog)
{
$type = basename($file);
$cronlog->logAction(CRON_ACTION, LOG_NOTICE, 'Creating ' . $type . ' file');