diff --git a/lib/Froxlor/Bulk/BulkAction.php b/lib/Froxlor/Bulk/BulkAction.php index 1c9cbde6..cd591d20 100644 --- a/lib/Froxlor/Bulk/BulkAction.php +++ b/lib/Froxlor/Bulk/BulkAction.php @@ -175,7 +175,7 @@ abstract class BulkAction * * @return array */ - protected function _parseImportFile($separator = ";") + protected function parseImportFile($separator = ";") { if (empty($this->impFile)) { throw new \Exception("No file was given for import"); @@ -223,7 +223,7 @@ abstract class BulkAction */ protected function preImport() { - $this->_readCustomerData(); + $this->readCustomerData(); if ($this->custId <= 0) { throw new \Exception("Invalid customer selected"); @@ -239,7 +239,7 @@ abstract class BulkAction * * @return bool */ - protected function _readCustomerData() + protected function readCustomerData() { $cust_stmt = \Froxlor\Database\Database::prepare("SELECT * FROM `" . TABLE_PANEL_CUSTOMERS . "` WHERE `customerid` = :cid"); $this->custData = \Froxlor\Database\Database::pexecute_first($cust_stmt, array( diff --git a/lib/Froxlor/Bulk/DomainBulkAction.php b/lib/Froxlor/Bulk/DomainBulkAction.php index b0126265..15bbe2b1 100644 --- a/lib/Froxlor/Bulk/DomainBulkAction.php +++ b/lib/Froxlor/Bulk/DomainBulkAction.php @@ -72,7 +72,7 @@ class DomainBulkAction extends BulkAction } try { - $domain_array = $this->_parseImportFile($separator); + $domain_array = $this->parseImportFile($separator); } catch (\Exception $e) { throw $e; } diff --git a/lib/Froxlor/Config/ConfigParser.php b/lib/Froxlor/Config/ConfigParser.php index a8655bef..ca995d7c 100644 --- a/lib/Froxlor/Config/ConfigParser.php +++ b/lib/Froxlor/Config/ConfigParser.php @@ -147,7 +147,7 @@ class ConfigParser * * @return bool */ - private function _parse() + private function parse() { // We only want to parse the stuff one time if ($this->isparsed == true) { @@ -184,7 +184,7 @@ class ConfigParser public function getServices() { // Let's parse this shit(!) - $this->_parse(); + $this->parse(); // Return our carefully searched for services return $this->services; diff --git a/lib/Froxlor/Config/ConfigService.php b/lib/Froxlor/Config/ConfigService.php index 92e490a7..9b44993d 100644 --- a/lib/Froxlor/Config/ConfigService.php +++ b/lib/Froxlor/Config/ConfigService.php @@ -75,7 +75,7 @@ class ConfigService $service = $this->fullxml->xpath($this->xpath); $attributes = $service[0]->attributes(); if ($attributes['title'] != '') { - $this->title = $this->_parseContent((string) $attributes['title']); + $this->title = $this->parseContent((string) $attributes['title']); } } @@ -84,7 +84,7 @@ class ConfigService * * @return bool */ - private function _parse() + private function parse() { // We only want to parse the stuff one time if ($this->isparsed == true) { @@ -131,9 +131,10 @@ class ConfigService * @param string $content * @return string $content w/o placeholder */ - private function _parseContent($content) + private function parseContent($content) { $content = preg_replace_callback('/\{\{(.*)\}\}/Ui', function ($matches) { + $match = null; if (preg_match('/^settings\.(.*)$/', $matches[1], $match)) { return \Froxlor\Settings::Get($match[1]); } elseif (preg_match('/^lng\.(.*)(?:\.(.*)(?:\.(.*)))$/U', $matches[1], $match)) { @@ -153,7 +154,7 @@ class ConfigService public function getDaemons() { - $this->_parse(); + $this->parse(); return $this->daemons; } } diff --git a/lib/Froxlor/Cron/Dns/PowerDNS.php b/lib/Froxlor/Cron/Dns/PowerDNS.php index 9255256f..ddf09dc8 100644 --- a/lib/Froxlor/Cron/Dns/PowerDNS.php +++ b/lib/Froxlor/Cron/Dns/PowerDNS.php @@ -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()); diff --git a/lib/Froxlor/Cron/Http/Apache.php b/lib/Froxlor/Cron/Http/Apache.php index 37182ea3..ee37940a 100644 --- a/lib/Froxlor/Cron/Http/Apache.php +++ b/lib/Froxlor/Cron/Http/Apache.php @@ -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 -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 .= ' ' . "\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); } diff --git a/lib/Froxlor/Cron/Http/ConfigIO.php b/lib/Froxlor/Cron/Http/ConfigIO.php index 72babc11..0d8a8630 100644 --- a/lib/Froxlor/Cron/Http/ConfigIO.php +++ b/lib/Froxlor/Cron/Http/ConfigIO.php @@ -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 diff --git a/lib/Froxlor/Cron/Http/Lighttpd.php b/lib/Froxlor/Cron/Http/Lighttpd.php index e9c435b4..feb5ad3c 100644 --- a/lib/Froxlor/Cron/Http/Lighttpd.php +++ b/lib/Froxlor/Cron/Http/Lighttpd.php @@ -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; diff --git a/lib/Froxlor/Cron/Http/Nginx.php b/lib/Froxlor/Cron/Http/Nginx.php index 552f7832..63a29f1e 100644 --- a/lib/Froxlor/Cron/Http/Nginx.php +++ b/lib/Froxlor/Cron/Http/Nginx.php @@ -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"; diff --git a/lib/Froxlor/Cron/Http/Php/Fcgid.php b/lib/Froxlor/Cron/Http/Php/Fcgid.php index e917d073..44060ea7 100644 --- a/lib/Froxlor/Cron/Http/Php/Fcgid.php +++ b/lib/Froxlor/Cron/Http/Php/Fcgid.php @@ -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); diff --git a/lib/Froxlor/Cron/Http/Php/Fpm.php b/lib/Froxlor/Cron/Http/Php/Fpm.php index ab8d7559..8ea7af32 100644 --- a/lib/Froxlor/Cron/Http/Php/Fpm.php +++ b/lib/Froxlor/Cron/Http/Php/Fpm.php @@ -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); diff --git a/lib/Froxlor/Cron/Http/Php/PhpInterface.php b/lib/Froxlor/Cron/Http/Php/PhpInterface.php index 769e3747..0be9b440 100644 --- a/lib/Froxlor/Cron/Http/Php/PhpInterface.php +++ b/lib/Froxlor/Cron/Http/Php/PhpInterface.php @@ -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) { diff --git a/lib/Froxlor/Cron/System/Extrausers.php b/lib/Froxlor/Cron/System/Extrausers.php index f1219684..16d4ac41 100644 --- a/lib/Froxlor/Cron/System/Extrausers.php +++ b/lib/Froxlor/Cron/System/Extrausers.php @@ -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'); diff --git a/lib/Froxlor/Database/Database.php b/lib/Froxlor/Database/Database.php index e36fa5d6..466a948e 100644 --- a/lib/Froxlor/Database/Database.php +++ b/lib/Froxlor/Database/Database.php @@ -43,29 +43,29 @@ class Database * * @var object */ - private static $_link = null; + private static $link = null; /** * indicator whether to use root-connection or not */ - private static $_needroot = false; + private static $needroot = false; /** * indicator which database-server we're on (not really used) */ - private static $_dbserver = 0; + private static $dbserver = 0; /** * used database-name */ - private static $_dbname = null; + private static $dbname = null; /** * sql-access data */ - private static $_needsqldata = false; + private static $needsqldata = false; - private static $_sqldata = null; + private static $sqldata = null; /** * Wrapper for PDOStatement::execute so we can catch the PDOException @@ -82,7 +82,7 @@ class Database try { $stmt->execute($params); } catch (\PDOException $e) { - self::_showerror($e, $showerror, $json_response, $stmt); + self::showerror($e, $showerror, $json_response, $stmt); } } @@ -122,7 +122,7 @@ class Database */ public static function getDbName() { - return self::$_dbname; + return self::$dbname; } /** @@ -139,8 +139,8 @@ class Database { // force re-connecting to the db with corresponding user // and set the $dbserver (mostly to 0 = default) - self::_setServer($dbserver); - self::$_needroot = $needroot; + self::setServer($dbserver); + self::$needroot = $needroot; } /** @@ -153,9 +153,9 @@ class Database */ public static function needSqlData() { - self::$_needsqldata = true; - self::$_sqldata = array(); - self::$_link = null; + self::$needsqldata = true; + self::$sqldata = array(); + self::$link = null; // we need a connection here because // if getSqlData() is called RIGHT after // this function and no "real" PDO @@ -174,11 +174,11 @@ class Database public static function getSqlData() { $return = false; - if (self::$_sqldata !== null && is_array(self::$_sqldata) && isset(self::$_sqldata['user'])) { - $return = self::$_sqldata; + if (self::$sqldata !== null && is_array(self::$sqldata) && isset(self::$sqldata['user'])) { + $return = self::$sqldata; // automatically disable sql-data - self::$_sqldata = null; - self::$_needsqldata = false; + self::$sqldata = null; + self::$needsqldata = false; } return $return; } @@ -202,7 +202,7 @@ class Database try { $result = call_user_func_array($callback, $args); } catch (\PDOException $e) { - self::_showerror($e); + self::showerror($e); } return $result; } @@ -212,10 +212,10 @@ class Database * * @param int $dbserver */ - private static function _setServer($dbserver = 0) + private static function setServer($dbserver = 0) { - self::$_dbserver = $dbserver; - self::$_link = null; + self::$dbserver = $dbserver; + self::$link = null; } /** @@ -229,20 +229,20 @@ class Database private static function getDB() { if (! extension_loaded('pdo') || in_array("mysql", \PDO::getAvailableDrivers()) == false) { - self::_showerror(new \Exception("The php PDO extension or PDO-MySQL driver is not available")); + self::showerror(new \Exception("The php PDO extension or PDO-MySQL driver is not available")); } // do we got a connection already? - if (self::$_link) { + if (self::$link) { // return it - return self::$_link; + return self::$link; } // include userdata.inc.php require \Froxlor\Froxlor::getInstallDir() . "/lib/userdata.inc.php"; // le format - if (self::$_needroot == true && isset($sql['root_user']) && isset($sql['root_password']) && (! isset($sql_root) || ! is_array($sql_root))) { + if (self::$needroot == true && isset($sql['root_user']) && isset($sql['root_password']) && (! isset($sql_root) || ! is_array($sql_root))) { $sql_root = array( 0 => array( 'caption' => 'Default', @@ -257,13 +257,13 @@ class Database } // either root or unprivileged user - if (self::$_needroot) { - $caption = $sql_root[self::$_dbserver]['caption']; - $user = $sql_root[self::$_dbserver]['user']; - $password = $sql_root[self::$_dbserver]['password']; - $host = $sql_root[self::$_dbserver]['host']; - $socket = isset($sql_root[self::$_dbserver]['socket']) ? $sql_root[self::$_dbserver]['socket'] : null; - $port = isset($sql_root[self::$_dbserver]['port']) ? $sql_root[self::$_dbserver]['port'] : '3306'; + if (self::$needroot) { + $caption = $sql_root[self::$dbserver]['caption']; + $user = $sql_root[self::$dbserver]['user']; + $password = $sql_root[self::$dbserver]['password']; + $host = $sql_root[self::$dbserver]['host']; + $socket = isset($sql_root[self::$dbserver]['socket']) ? $sql_root[self::$dbserver]['socket'] : null; + $port = isset($sql_root[self::$dbserver]['port']) ? $sql_root[self::$dbserver]['port'] : '3306'; } else { $caption = 'localhost'; $user = $sql["user"]; @@ -274,8 +274,8 @@ class Database } // save sql-access-data if needed - if (self::$_needsqldata) { - self::$_sqldata = array( + if (self::$needsqldata) { + self::$sqldata = array( 'user' => $user, 'passwd' => $password, 'host' => $host, @@ -308,7 +308,7 @@ class Database $dbconf["dsn"]['port'] = $port; } - self::$_dbname = $sql["db"]; + self::$dbname = $sql["db"]; // add options to dsn-string foreach ($dbconf["dsn"] as $k => $v) { @@ -320,25 +320,25 @@ class Database // try to connect try { - self::$_link = new \PDO($dsn, $user, $password, $options); + self::$link = new \PDO($dsn, $user, $password, $options); } catch (\PDOException $e) { - self::_showerror($e); + self::showerror($e); } // set attributes foreach ($attributes as $k => $v) { - self::$_link->setAttribute(constant("PDO::" . $k), constant("PDO::" . $v)); + self::$link->setAttribute(constant("PDO::" . $k), constant("PDO::" . $v)); } - $version_server = self::$_link->getAttribute(\PDO::ATTR_SERVER_VERSION); + $version_server = self::$link->getAttribute(\PDO::ATTR_SERVER_VERSION); $sql_mode = 'NO_ENGINE_SUBSTITUTION'; if (version_compare($version_server, '8.0.11', '<')) { $sql_mode .= ',NO_AUTO_CREATE_USER'; } - self::$_link->exec('SET sql_mode = "' . $sql_mode . '"'); + self::$link->exec('SET sql_mode = "' . $sql_mode . '"'); // return PDO instance - return self::$_link; + return self::$link; } /** @@ -348,7 +348,7 @@ class Database * @param bool $showerror * if set to false, the error will be logged but we go on */ - private static function _showerror($error, $showerror = true, $json_response = false, \PDOStatement $stmt = null) + private static function showerror($error, $showerror = true, $json_response = false, \PDOStatement $stmt = null) { global $userinfo, $theme, $linker; @@ -377,9 +377,9 @@ class Database $error_message = $error->getMessage(); $error_trace = $error->getTraceAsString(); // error-message - $error_message = self::_substitute($error_message, $substitutions); + $error_message = self::substitute($error_message, $substitutions); // error-trace - $error_trace = self::_substitute($error_trace, $substitutions); + $error_trace = self::substitute($error_trace, $substitutions); if ($error->getCode() == 2003) { $error_message = "Unable to connect to database. Either the mysql-server is not running or your user/password is wrong."; @@ -471,12 +471,12 @@ class Database * @param int $minLength * @return string */ - private static function _substitute($content, array $substitutions, $minLength = 6) + private static function substitute($content, array $substitutions, $minLength = 6) { $replacements = array(); foreach ($substitutions as $search => $replace) { - $replacements = $replacements + self::_createShiftedSubstitutions($search, $replace, $minLength); + $replacements = $replacements + self::createShiftedSubstitutions($search, $replace, $minLength); } $content = str_replace(array_keys($replacements), array_values($replacements), $content); @@ -501,7 +501,7 @@ class Database * @param int $minLength * @return array */ - private static function _createShiftedSubstitutions($search, $replace, $minLength) + private static function createShiftedSubstitutions($search, $replace, $minLength) { $substitutions = array(); $length = strlen($search); diff --git a/lib/Froxlor/Database/DbManager.php b/lib/Froxlor/Database/DbManager.php index dc9d1345..742cd03d 100644 --- a/lib/Froxlor/Database/DbManager.php +++ b/lib/Froxlor/Database/DbManager.php @@ -41,14 +41,14 @@ class DbManager * * @var object */ - private $_log = null; + private $log = null; /** * Manager object * * @var object */ - private $_manager = null; + private $manager = null; /** * main constructor @@ -57,8 +57,8 @@ class DbManager */ public function __construct($log = null) { - $this->_log = $log; - $this->_setManager(); + $this->log = $log; + $this->setManager(); } /** @@ -98,12 +98,12 @@ class DbManager // now create the database itself $this->getManager()->createDatabase($username); - $this->_log->logAction(USR_ACTION, LOG_INFO, "created database '" . $username . "'"); + $this->log->logAction(USR_ACTION, LOG_INFO, "created database '" . $username . "'"); // and give permission to the user on every access-host we have foreach (array_map('trim', explode(',', Settings::Get('system.mysql_access_host'))) as $mysql_access_host) { $this->getManager()->grantPrivilegesTo($username, $password, $mysql_access_host); - $this->_log->logAction(USR_ACTION, LOG_NOTICE, "grant all privileges for '" . $username . "'@'" . $mysql_access_host . "'"); + $this->log->logAction(USR_ACTION, LOG_NOTICE, "grant all privileges for '" . $username . "'@'" . $mysql_access_host . "'"); } $this->getManager()->flushPrivileges(); @@ -119,7 +119,7 @@ class DbManager */ public function getManager() { - return $this->_manager; + return $this->manager; } /** @@ -128,10 +128,10 @@ class DbManager * * sets private $_manager variable */ - private function _setManager() + private function setManager() { // TODO read different dbms from settings later - $this->_manager = new \Froxlor\Database\Manager\DbManagerMySQL($this->_log); + $this->manager = new \Froxlor\Database\Manager\DbManagerMySQL($this->log); } public static function correctMysqlUsers($mysql_access_host_array) diff --git a/lib/Froxlor/Database/IntegrityCheck.php b/lib/Froxlor/Database/IntegrityCheck.php index 050e5f9a..9b805b83 100644 --- a/lib/Froxlor/Database/IntegrityCheck.php +++ b/lib/Froxlor/Database/IntegrityCheck.php @@ -27,7 +27,7 @@ class IntegrityCheck public $available = array(); // logger object - private $_log = null; + private $log = null; /** * Constructor @@ -41,7 +41,7 @@ class IntegrityCheck 'loginname' => 'integrity-check' ); } - $this->_log = \Froxlor\FroxlorLogger::getInstanceOf($userinfo); + $this->log = \Froxlor\FroxlorLogger::getInstanceOf($userinfo); $this->available = get_class_methods($this); unset($this->available[array_search('__construct', $this->available)]); unset($this->available[array_search('checkAll', $this->available)]); @@ -91,7 +91,7 @@ class IntegrityCheck )); $charset = isset($resp['default_character_set_name']) ? $resp['default_character_set_name'] : null; if (! empty($charset) && strtolower($charset) != 'utf8') { - $this->_log->logAction(ADM_ACTION, LOG_NOTICE, "database charset seems to be different from UTF-8, integrity-check can fix that"); + $this->log->logAction(ADM_ACTION, LOG_NOTICE, "database charset seems to be different from UTF-8, integrity-check can fix that"); if ($fix) { // fix database Database::query('ALTER DATABASE `' . Database::getDbName() . '` CHARACTER SET utf8 COLLATE utf8_general_ci'); @@ -101,7 +101,7 @@ class IntegrityCheck $table = $row[0]; Database::query('ALTER TABLE `' . $table . '` CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;'); } - $this->_log->logAction(ADM_ACTION, LOG_WARNING, "database charset was different from UTF-8, integrity-check fixed that"); + $this->log->logAction(ADM_ACTION, LOG_WARNING, "database charset was different from UTF-8, integrity-check fixed that"); } else { return false; } @@ -176,9 +176,9 @@ class IntegrityCheck 'domainid' => $row['id_domain'], 'ipandportid' => $row['id_ipandports'] )); - $this->_log->logAction(ADM_ACTION, LOG_WARNING, "found an ip/port-id in domain <> ip table which does not exist, integrity check fixed this"); + $this->log->logAction(ADM_ACTION, LOG_WARNING, "found an ip/port-id in domain <> ip table which does not exist, integrity check fixed this"); } else { - $this->_log->logAction(ADM_ACTION, LOG_NOTICE, "found an ip/port-id in domain <> ip table which does not exist, integrity check can fix this"); + $this->log->logAction(ADM_ACTION, LOG_NOTICE, "found an ip/port-id in domain <> ip table which does not exist, integrity check can fix this"); return false; } } @@ -188,9 +188,9 @@ class IntegrityCheck 'domainid' => $row['id_domain'], 'ipandportid' => $row['id_ipandports'] )); - $this->_log->logAction(ADM_ACTION, LOG_WARNING, "found a domain-id in domain <> ip table which does not exist, integrity check fixed this"); + $this->log->logAction(ADM_ACTION, LOG_WARNING, "found a domain-id in domain <> ip table which does not exist, integrity check fixed this"); } else { - $this->_log->logAction(ADM_ACTION, LOG_NOTICE, "found a domain-id in domain <> ip table which does not exist, integrity check can fix this"); + $this->log->logAction(ADM_ACTION, LOG_NOTICE, "found a domain-id in domain <> ip table which does not exist, integrity check can fix this"); return false; } } @@ -208,9 +208,9 @@ class IntegrityCheck 'ipandportid' => $defaultip )); } - $this->_log->logAction(ADM_ACTION, LOG_WARNING, "found a domain-id with no entry in domain <> ip table, integrity check fixed this"); + $this->log->logAction(ADM_ACTION, LOG_WARNING, "found a domain-id with no entry in domain <> ip table, integrity check fixed this"); } else { - $this->_log->logAction(ADM_ACTION, LOG_NOTICE, "found a domain-id with no entry in domain <> ip table, integrity check can fix this"); + $this->log->logAction(ADM_ACTION, LOG_NOTICE, "found a domain-id with no entry in domain <> ip table, integrity check can fix this"); return false; } } @@ -292,10 +292,10 @@ class IntegrityCheck Database::pexecute($upd_stmt, array( 'domainid' => $id )); - $this->_log->logAction(ADM_ACTION, LOG_WARNING, "found a subdomain with ssl_redirect=1 but parent-domain has ssl=0, integrity check fixed this"); + $this->log->logAction(ADM_ACTION, LOG_WARNING, "found a subdomain with ssl_redirect=1 but parent-domain has ssl=0, integrity check fixed this"); } else { // It's just the check, let the function fail - $this->_log->logAction(ADM_ACTION, LOG_NOTICE, "found a subdomain with ssl_redirect=1 but parent-domain has ssl=0, integrity check can fix this"); + $this->log->logAction(ADM_ACTION, LOG_NOTICE, "found a subdomain with ssl_redirect=1 but parent-domain has ssl=0, integrity check can fix this"); return false; } } @@ -376,10 +376,10 @@ class IntegrityCheck Database::pexecute($upd_stmt, array( 'domainid' => $id )); - $this->_log->logAction(ADM_ACTION, LOG_WARNING, "found a subdomain with letsencrypt=1 but parent-domain has ssl=0, integrity check fixed this"); + $this->log->logAction(ADM_ACTION, LOG_WARNING, "found a subdomain with letsencrypt=1 but parent-domain has ssl=0, integrity check fixed this"); } else { // It's just the check, let the function fail - $this->_log->logAction(ADM_ACTION, LOG_NOTICE, "found a subdomain with letsencrypt=1 but parent-domain has ssl=0, integrity check can fix this"); + $this->log->logAction(ADM_ACTION, LOG_NOTICE, "found a subdomain with letsencrypt=1 but parent-domain has ssl=0, integrity check can fix this"); return false; } } @@ -415,7 +415,7 @@ class IntegrityCheck )); if ($cwg_stmt->rowCount() > 0) { - $this->_log->logAction(ADM_ACTION, LOG_NOTICE, "Customers are missing the webserver-user as group-member, integrity-check can fix that"); + $this->log->logAction(ADM_ACTION, LOG_NOTICE, "Customers are missing the webserver-user as group-member, integrity-check can fix that"); if ($fix) { // prepare update statement $upd_stmt = Database::prepare(" @@ -430,7 +430,7 @@ class IntegrityCheck $upd_data['id'] = $cwg_row['id']; Database::pexecute($upd_stmt, $upd_data); } - $this->_log->logAction(ADM_ACTION, LOG_NOTICE, "Customers were missing the webserver-user as group-member, integrity-check fixed that"); + $this->log->logAction(ADM_ACTION, LOG_NOTICE, "Customers were missing the webserver-user as group-member, integrity-check fixed that"); } else { return false; } @@ -483,7 +483,7 @@ class IntegrityCheck )); if ($cwg_stmt->rowCount() > 0) { - $this->_log->logAction(ADM_ACTION, LOG_NOTICE, "Customers are missing the local froxlor-user as group-member, integrity-check can fix that"); + $this->log->logAction(ADM_ACTION, LOG_NOTICE, "Customers are missing the local froxlor-user as group-member, integrity-check can fix that"); if ($fix) { // prepare update statement $upd_stmt = Database::prepare(" @@ -498,7 +498,7 @@ class IntegrityCheck $upd_data['id'] = $cwg_row['id']; Database::pexecute($upd_stmt, $upd_data); } - $this->_log->logAction(ADM_ACTION, LOG_NOTICE, "Customers were missing the local froxlor-user as group-member, integrity-check fixed that"); + $this->log->logAction(ADM_ACTION, LOG_NOTICE, "Customers were missing the local froxlor-user as group-member, integrity-check fixed that"); } else { return false; } diff --git a/lib/Froxlor/Froxlor.php b/lib/Froxlor/Froxlor.php index 072231e4..b48b9205 100644 --- a/lib/Froxlor/Froxlor.php +++ b/lib/Froxlor/Froxlor.php @@ -217,8 +217,8 @@ final class Froxlor $a = explode(".", $a); $b = explode(".", $b); - self::_parseVersionArray($a); - self::_parseVersionArray($b); + self::parseVersionArray($a); + self::parseVersionArray($b); while (count($a) != count($b)) { if (count($a) < count($b)) { @@ -248,7 +248,7 @@ final class Froxlor return (count($a) < count($b)) ? - 1 : 0; } - private static function _parseVersionArray(&$arr = null) + private static function parseVersionArray(&$arr = null) { // -svn or -dev or -rc ? if (stripos($arr[count($arr) - 1], '-') !== false) { diff --git a/lib/Froxlor/FroxlorLogger.php b/lib/Froxlor/FroxlorLogger.php index 693e99fa..c4182349 100644 --- a/lib/Froxlor/FroxlorLogger.php +++ b/lib/Froxlor/FroxlorLogger.php @@ -16,7 +16,7 @@ class FroxlorLogger * * @var \Monolog\Logger */ - private static $_ml = null; + private static $ml = null; /** * LogTypes Array @@ -55,10 +55,10 @@ class FroxlorLogger switch ($logger) { case 'syslog': - self::$_ml->pushHandler(new SyslogHandler('froxlor', LOG_USER, Logger::DEBUG)); + self::$ml->pushHandler(new SyslogHandler('froxlor', LOG_USER, Logger::DEBUG)); break; case 'file': - self::$_ml->pushHandler(new StreamHandler(Settings::Get('logger.logfile'), Logger::DEBUG)); + self::$ml->pushHandler(new StreamHandler(Settings::Get('logger.logfile'), Logger::DEBUG)); break; case 'mysql': // @fixme add MySQL-Handler @@ -87,11 +87,11 @@ class FroxlorLogger */ private function initMonolog() { - if (empty(self::$_ml)) { + if (empty(self::$ml)) { // get Theme object - self::$_ml = new Logger('froxlor'); + self::$ml = new Logger('froxlor'); } - return self::$_ml; + return self::$ml; } /** @@ -108,7 +108,7 @@ class FroxlorLogger return; } - if (empty(self::$_ml)) { + if (empty(self::$ml)) { $this->initMonolog(); } @@ -123,32 +123,32 @@ class FroxlorLogger switch ($type) { case LOG_DEBUG: - self::$_ml->addDebug($text, array( + self::$ml->addDebug($text, array( 'source' => $this->getActionTypeDesc($action) )); break; case LOG_INFO: - self::$_ml->addInfo($text, array( + self::$ml->addInfo($text, array( 'source' => $this->getActionTypeDesc($action) )); break; case LOG_NOTICE: - self::$_ml->addNotice($text, array( + self::$ml->addNotice($text, array( 'source' => $this->getActionTypeDesc($action) )); break; case LOG_WARNING: - self::$_ml->addWarning($text, array( + self::$ml->addWarning($text, array( 'source' => $this->getActionTypeDesc($action) )); break; case LOG_ERR: - self::$_ml->addError($text, array( + self::$ml->addError($text, array( 'source' => $this->getActionTypeDesc($action) )); break; default: - self::$_ml->addDebug($text, array( + self::$ml->addDebug($text, array( 'source' => $this->getActionTypeDesc($action) )); } diff --git a/lib/Froxlor/MailLogParser.php b/lib/Froxlor/MailLogParser.php index 5870d021..1463da2f 100644 --- a/lib/Froxlor/MailLogParser.php +++ b/lib/Froxlor/MailLogParser.php @@ -54,19 +54,19 @@ class MailLogParser // Parse MTA traffic if (Settings::Get("system.mtaserver") == "postfix") { - $this->_parsePostfixLog(Settings::Get("system.mtalog")); - $this->_parsePostfixLog(Settings::Get("system.mtalog") . ".1"); + $this->parsePostfixLog(Settings::Get("system.mtalog")); + $this->parsePostfixLog(Settings::Get("system.mtalog") . ".1"); } elseif (Settings::Get("system.mtaserver") == "exim4") { - $this->_parseExim4Log(Settings::Get("system.mtalog")); + $this->parseExim4Log(Settings::Get("system.mtalog")); } // Parse MDA traffic if (Settings::Get("system.mdaserver") == "dovecot") { - $this->_parseDovecotLog(Settings::Get("system.mdalog")); - $this->_parsePostfixLog(Settings::Get("system.mdalog") . ".1"); + $this->parseDovecotLog(Settings::Get("system.mdalog")); + $this->parsePostfixLog(Settings::Get("system.mdalog") . ".1"); } elseif (Settings::Get("system.mdaserver") == "courier") { - $this->_parseCourierLog(Settings::Get("system.mdalog")); - $this->_parsePostfixLog(Settings::Get("system.mdalog") . ".1"); + $this->parseCourierLog(Settings::Get("system.mdalog")); + $this->parsePostfixLog(Settings::Get("system.mdalog") . ".1"); } } @@ -74,10 +74,10 @@ class MailLogParser * parsePostfixLog * parses the traffic from a postfix logfile * - * @param + * @param string $logFile * logFile */ - private function _parsePostfixLog($logFile) + private function parsePostfixLog($logFile) { // Check if file exists if (! file_exists($logFile)) { @@ -99,7 +99,7 @@ class MailLogParser unset($matches); $line = fgets($file_handle); - $timestamp = $this->_getLogTimestamp($line); + $timestamp = $this->getLogTimestamp($line); if ($this->startTime < $timestamp) { if (preg_match("/postfix\/qmgr.*(?::|\])\s([A-Z\d]+).*from=?, size=(\d+),/", $line, $matches)) { // Postfix from @@ -117,12 +117,12 @@ class MailLogParser if (in_array($mail["domainFrom"], $this->myDomains) || in_array($mail["domainTo"], $this->myDomains)) { // Outgoing traffic if (array_key_exists("domainFrom", $mail)) { - $this->_addDomainTraffic($mail["domainFrom"], $mail["size"], $timestamp); + $this->addDomainTraffic($mail["domainFrom"], $mail["size"], $timestamp); } // Incoming traffic if (array_key_exists("domainTo", $mail) && in_array($mail["domainTo"], $this->myDomains)) { - $this->_addDomainTraffic($mail["domainTo"], $mail["size"], $timestamp); + $this->addDomainTraffic($mail["domainTo"], $mail["size"], $timestamp); } } unset($mail); @@ -138,10 +138,10 @@ class MailLogParser * parseExim4Log * parses the smtp traffic from a exim4 logfile * - * @param + * @param string $logFile * logFile */ - private function _parseExim4Log($logFile) + private function parseExim4Log($logFile) { // Check if file exists if (! file_exists($logFile)) { @@ -163,14 +163,14 @@ class MailLogParser unset($matches); $line = fgets($file_handle); - $timestamp = $this->_getLogTimestamp($line); + $timestamp = $this->getLogTimestamp($line); if ($this->startTime < $timestamp) { if (preg_match("/<= .*@([a-z0-9.\-]+) .*S=(\d+)/i", $line, $matches)) { // Outgoing traffic - $this->_addDomainTraffic($matches[1], $matches[2], $timestamp); + $this->addDomainTraffic($matches[1], $matches[2], $timestamp); } elseif (preg_match("/=> .*? .*S=(\d+)/i", $line, $matches)) { // Incoming traffic - $this->_addDomainTraffic($matches[1], $matches[2], $timestamp); + $this->addDomainTraffic($matches[1], $matches[2], $timestamp); } } } @@ -182,10 +182,10 @@ class MailLogParser * parseDovecotLog * parses the dovecot imap/pop3 traffic from logfile * - * @param + * @param string $logFile * logFile */ - private function _parseDovecotLog($logFile) + private function parseDovecotLog($logFile) { // Check if file exists if (! file_exists($logFile)) { @@ -207,14 +207,14 @@ class MailLogParser unset($matches); $line = fgets($file_handle); - $timestamp = $this->_getLogTimestamp($line); + $timestamp = $this->getLogTimestamp($line); if ($this->startTime < $timestamp) { if (preg_match("/dovecot.*(?::|\]) imap\(.*@([a-z0-9\.\-]+)\):.*(?:in=(\d+) out=(\d+)|bytes=(\d+)\/(\d+))/i", $line, $matches)) { // Dovecot IMAP - $this->_addDomainTraffic($matches[1], (int) $matches[2] + (int) $matches[3], $timestamp); + $this->addDomainTraffic($matches[1], (int) $matches[2] + (int) $matches[3], $timestamp); } elseif (preg_match("/dovecot.*(?::|\]) pop3\(.*@([a-z0-9\.\-]+)\):.*in=(\d+).*out=(\d+)/i", $line, $matches)) { // Dovecot POP3 - $this->_addDomainTraffic($matches[1], (int) $matches[2] + (int) $matches[3], $timestamp); + $this->addDomainTraffic($matches[1], (int) $matches[2] + (int) $matches[3], $timestamp); } } } @@ -226,10 +226,10 @@ class MailLogParser * parseCourierLog * parses the dovecot imap/pop3 traffic from logfile * - * @param + * @param string $logFile * logFile */ - private function _parseCourierLog($logFile) + private function parseCourierLog($logFile) { // Check if file exists if (! file_exists($logFile)) { @@ -251,11 +251,11 @@ class MailLogParser unset($matches); $line = fgets($file_handle); - $timestamp = $this->_getLogTimestamp($line); + $timestamp = $this->getLogTimestamp($line); if ($this->startTime < $timestamp) { if (preg_match("/(?:imapd|pop3d)(?:-ssl)?.*(?::|\]).*user=.*@([a-z0-9\.\-]+),.*rcvd=(\d+), sent=(\d+),/i", $line, $matches)) { // Courier IMAP & POP3 - $this->_addDomainTraffic($matches[1], (int) $matches[2] + (int) $matches[3], $timestamp); + $this->addDomainTraffic($matches[1], (int) $matches[2] + (int) $matches[3], $timestamp); } } } @@ -272,7 +272,7 @@ class MailLogParser * @param * int traffic */ - private function _addDomainTraffic($domain, $traffic, $timestamp) + private function addDomainTraffic($domain, $traffic, $timestamp) { $date = date("Y-m-d", $timestamp); if (in_array($domain, $this->myDomains)) { @@ -294,8 +294,9 @@ class MailLogParser * string line * return int */ - private function _getLogTimestamp($line) + private function getLogTimestamp($line) { + $matches = null; if (preg_match("/((?:[A-Z]{3}\s{1,2}\d{1,2}|\d{4}-\d{2}-\d{2}) \d{2}:\d{2}:\d{2})/i", $line, $matches)) { $timestamp = strtotime($matches[1]); if ($timestamp > ($this->startTime + 60 * 60 * 24)) { diff --git a/lib/Froxlor/SImExporter.php b/lib/Froxlor/SImExporter.php index 469e4e27..7120aaad 100644 --- a/lib/Froxlor/SImExporter.php +++ b/lib/Froxlor/SImExporter.php @@ -40,7 +40,7 @@ class SImExporter * * @var array */ - private static $_no_export = [ + private static $no_export = [ 'panel.adminmail', 'admin.show_news_feed', 'system.lastaccountnumber', @@ -66,7 +66,7 @@ class SImExporter $_data = array(); while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) { $index = $row['settinggroup'] . "." . $row['varname']; - if (! in_array($index, self::$_no_export)) { + if (! in_array($index, self::$no_export)) { $_data[$index] = $row['value']; } } diff --git a/lib/Froxlor/Settings.php b/lib/Froxlor/Settings.php index 211b1fde..88edf132 100644 --- a/lib/Froxlor/Settings.php +++ b/lib/Froxlor/Settings.php @@ -41,14 +41,14 @@ class Settings * * @var array */ - private static $_data = null; + private static $data = null; /** * changed and unsaved settings data * * @var array */ - private static $_updatedata = null; + private static $updatedata = null; /** * prepared statement for updating the @@ -56,19 +56,19 @@ class Settings * * @var \PDOStatement */ - private static $_updstmt = null; + private static $updstmt = null; /** * private constructor, reads in all settings */ private static function init() { - if (empty(self::$_data)) { - self::_readSettings(); - self::$_updatedata = array(); + if (empty(self::$data)) { + self::readSettings(); + self::$updatedata = array(); // prepare statement - self::$_updstmt = Database::prepare(" + self::$updstmt = Database::prepare(" UPDATE `" . TABLE_PANEL_SETTINGS . "` SET `value` = :value WHERE `settinggroup` = :group AND `varname` = :varname "); @@ -79,15 +79,15 @@ class Settings * Read in all settings from the database * and set the internal $_data array */ - private static function _readSettings() + private static function readSettings() { $result_stmt = Database::query(" SELECT `settingid`, `settinggroup`, `varname`, `value` FROM `" . TABLE_PANEL_SETTINGS . "` "); - self::$_data = array(); + self::$data = array(); while ($row = $result_stmt->fetch(\PDO::FETCH_ASSOC)) { - self::$_data[$row['settinggroup']][$row['varname']] = $row['value']; + self::$data[$row['settinggroup']][$row['varname']] = $row['value']; } return true; } @@ -99,14 +99,14 @@ class Settings * @param string $varname * @param string $value */ - private static function _storeSetting($group = null, $varname = null, $value = null) + private static function storeSetting($group = null, $varname = null, $value = null) { $upd_data = array( 'group' => $group, 'varname' => $varname, 'value' => $value ); - Database::pexecute(self::$_updstmt, $upd_data); + Database::pexecute(self::$updstmt, $upd_data); } /** @@ -126,8 +126,8 @@ class Settings return null; } $result = null; - if (isset(self::$_data[$sstr[0]][$sstr[1]])) { - $result = self::$_data[$sstr[0]][$sstr[1]]; + if (isset(self::$data[$sstr[0]][$sstr[1]])) { + $result = self::$data[$sstr[0]][$sstr[1]]; } return $result; } @@ -173,21 +173,21 @@ class Settings if (! isset($sstr[1])) { return false; } - self::$_data[$sstr[0]][$sstr[1]] = $value; + self::$data[$sstr[0]][$sstr[1]] = $value; // should we store to db instantly? if ($instant_save) { - self::_storeSetting($sstr[0], $sstr[1], $value); + self::storeSetting($sstr[0], $sstr[1], $value); } else { // set temporary data for usage - if (! isset(self::$_data[$sstr[0]]) || ! is_array(self::$_data[$sstr[0]])) { - self::$_data[$sstr[0]] = array(); + if (! isset(self::$data[$sstr[0]]) || ! is_array(self::$data[$sstr[0]])) { + self::$data[$sstr[0]] = array(); } - self::$_data[$sstr[0]][$sstr[1]] = $value; + self::$data[$sstr[0]][$sstr[1]] = $value; // set update-data when invoking Flush() - if (! isset(self::$_updatedata[$sstr[0]]) || ! is_array(self::$_updatedata[$sstr[0]])) { - self::$_updatedata[$sstr[0]] = array(); + if (! isset(self::$updatedata[$sstr[0]]) || ! is_array(self::$updatedata[$sstr[0]])) { + self::$updatedata[$sstr[0]] = array(); } - self::$_updatedata[$sstr[0]][$sstr[1]] = $value; + self::$updatedata[$sstr[0]][$sstr[1]] = $value; } return true; } @@ -227,7 +227,7 @@ class Settings ); Database::pexecute($ins_stmt, $ins_data); // also set new value to internal array and make it available - self::$_data[$sstr[0]][$sstr[1]] = $value; + self::$data[$sstr[0]][$sstr[1]] = $value; return true; } return false; @@ -240,17 +240,17 @@ class Settings public static function Flush() { self::init(); - if (is_array(self::$_updatedata) && count(self::$_updatedata) > 0) { + if (is_array(self::$updatedata) && count(self::$updatedata) > 0) { // save all un-saved changes to the settings - foreach (self::$_updatedata as $group => $vargroup) { + foreach (self::$updatedata as $group => $vargroup) { foreach ($vargroup as $varname => $value) { - self::_storeSetting($group, $varname, $value); + self::storeSetting($group, $varname, $value); } } // now empty the array - self::$_updatedata = array(); + self::$updatedata = array(); // re-read in all settings - return self::_readSettings(); + return self::readSettings(); } return false; } @@ -262,7 +262,7 @@ class Settings { self::init(); // empty update array - self::$_updatedata = array(); + self::$updatedata = array(); } public static function loadSettingsInto(&$settings_data) diff --git a/lib/Froxlor/UI/HtmlForm.php b/lib/Froxlor/UI/HtmlForm.php index b62ea78a..74ec5398 100644 --- a/lib/Froxlor/UI/HtmlForm.php +++ b/lib/Froxlor/UI/HtmlForm.php @@ -23,16 +23,16 @@ class HtmlForm * * @var string */ - private static $_form = ''; + private static $form = ''; - private static $_filename = ''; + private static $filename = ''; public static function genHTMLForm($data = array()) { global $lng, $theme; $nob = false; - self::$_form = ''; + self::$form = ''; foreach ($data as $fdata) { $sections = $fdata['sections']; @@ -64,8 +64,8 @@ class HtmlForm $label = $fielddata['label']; $desc = (isset($fielddata['desc']) ? $fielddata['desc'] : ''); $style = (isset($fielddata['style']) ? ' class="' . $fielddata['style'] . '"' : ''); - $mandatory = self::_getMandatoryFlag($fielddata); - $data_field = self::_parseDataField($fieldname, $fielddata); + $mandatory = self::getMandatoryFlag($fielddata); + $data_field = self::parseDataField($fieldname, $fielddata); if (isset($fielddata['has_nextto'])) { $nexto = array( 'field' => $fieldname @@ -76,10 +76,10 @@ class HtmlForm } eval("self::\$_form .= \"" . Template::getTemplate("misc/form/table_row", "1") . "\";"); } else { - $data_field = self::_parseDataField($fieldname, $fielddata); + $data_field = self::parseDataField($fieldname, $fielddata); $data_field = str_replace("\t", "", $data_field); $data_field = $fielddata['next_to_prefix'] . $data_field; - self::$_form = str_replace('{NEXTTOFIELD_' . $fielddata['next_to'] . '}', $data_field, self::$_form); + self::$form = str_replace('{NEXTTOFIELD_' . $fielddata['next_to'] . '}', $data_field, self::$form); $nexto = false; } } @@ -91,49 +91,49 @@ class HtmlForm eval("self::\$_form .= \"" . Template::getTemplate("misc/form/table_end", "1") . "\";"); } - return self::$_form; + return self::$form; } - private static function _parseDataField($fieldname, $data = array()) + private static function parseDataField($fieldname, $data = array()) { switch ($data['type']) { case 'text': - return self::_textBox($fieldname, $data); + return self::textBox($fieldname, $data); break; case 'textul': - return self::_textBox($fieldname, $data, 'text', true); + return self::textBox($fieldname, $data, 'text', true); break; case 'password': - return self::_textBox($fieldname, $data, 'password'); + return self::textBox($fieldname, $data, 'password'); break; case 'hidden': - return self::_textBox($fieldname, $data, 'hidden'); + return self::textBox($fieldname, $data, 'hidden'); break; case 'yesno': - return self::_yesnoBox($data); + return self::yesnoBox($data); break; case 'select': - return self::_selectBox($fieldname, $data); + return self::selectBox($fieldname, $data); break; case 'label': - return self::_labelField($data); + return self::labelField($data); break; case 'textarea': - return self::_textArea($fieldname, $data); + return self::textArea($fieldname, $data); break; case 'checkbox': return self::_checkbox($fieldname, $data); break; case 'file': - return self::_file($fieldname, $data); + return self::file($fieldname, $data); break; case 'int': - return self::_int($fieldname, $data); + return self::int($fieldname, $data); break; } } - private static function _getMandatoryFlag($data = array()) + private static function getMandatoryFlag($data = array()) { if (isset($data['mandatory'])) { return ' *'; @@ -143,7 +143,7 @@ class HtmlForm return ''; } - private static function _textBox($fieldname = '', $data = array(), $type = 'text', $unlimited = false) + private static function textBox($fieldname = '', $data = array(), $type = 'text', $unlimited = false) { $return = ''; $extras = ''; @@ -175,7 +175,7 @@ class HtmlForm return $return; } - private static function _textArea($fieldname = '', $data = array()) + private static function textArea($fieldname = '', $data = array()) { $return = ''; $extras = ''; @@ -200,17 +200,17 @@ class HtmlForm return $return; } - private static function _yesnoBox($data = array()) + private static function yesnoBox($data = array()) { return $data['yesno_var']; } - private static function _labelField($data = array()) + private static function labelField($data = array()) { return $data['value']; } - private static function _selectBox($fieldname = '', $data = array()) + private static function selectBox($fieldname = '', $data = array()) { // add support to save reloaded forms if (isset($data['select_var'])) { @@ -298,7 +298,7 @@ class HtmlForm return $output; } - private static function _file($fieldname = '', $data = array()) + private static function file($fieldname = '', $data = array()) { $return = ''; $extras = ''; @@ -323,7 +323,7 @@ class HtmlForm return $return; } - private static function _int($fieldname = '', $data = array()) + private static function int($fieldname = '', $data = array()) { $return = ''; $extras = ''; diff --git a/lib/Froxlor/UI/Paging.php b/lib/Froxlor/UI/Paging.php index bdf31249..635f9ffd 100644 --- a/lib/Froxlor/UI/Paging.php +++ b/lib/Froxlor/UI/Paging.php @@ -103,7 +103,7 @@ class Paging */ private $natSorting = false; - private $_limit = 0; + private $limit = 0; /** * Class constructor. @@ -226,7 +226,7 @@ class Paging ); \Froxlor\Database\Database::pexecute($upd_stmt, $upd_data); - $this->_limit = $limit; + $this->limit = $limit; } /** @@ -384,9 +384,9 @@ class Paging */ public function getSqlLimit() { - if ($this->_limit > 0) { - $_offset = ($this->pageno - 1) * $this->_limit; - return ' LIMIT ' . $_offset . ',' . $this->_limit; + if ($this->limit > 0) { + $_offset = ($this->pageno - 1) * $this->limit; + return ' LIMIT ' . $_offset . ',' . $this->limit; } /** * currently not in use diff --git a/lib/Froxlor/UI/Template.php b/lib/Froxlor/UI/Template.php index ac51654a..4d327ff9 100644 --- a/lib/Froxlor/UI/Template.php +++ b/lib/Froxlor/UI/Template.php @@ -71,17 +71,17 @@ class Template $filename = \Froxlor\Froxlor::getInstallDir() . 'templates/' . $theme . '/' . $template . '.tpl'; // check the current selected theme for the template - $templatefile = self::_checkAndParseTpl($filename); + $templatefile = self::checkAndParseTpl($filename); if ($templatefile == false && $theme != $fallback_theme) { // check fallback $_filename = \Froxlor\Froxlor::getInstallDir() . 'templates/' . $fallback_theme . '/' . $template . '.tpl'; - $templatefile = self::_checkAndParseTpl($_filename); + $templatefile = self::checkAndParseTpl($_filename); if ($templatefile == false) { // check for old layout $_filename = \Froxlor\Froxlor::getInstallDir() . 'templates/' . $template . '.tpl'; - $templatefile = self::_checkAndParseTpl($_filename); + $templatefile = self::checkAndParseTpl($_filename); if ($templatefile == false) { // not found @@ -104,7 +104,7 @@ class Template * * @return string|bool content on success, else false */ - private static function _checkAndParseTpl($filename) + private static function checkAndParseTpl($filename) { $templatefile = ""; diff --git a/lib/Froxlor/User.php b/lib/Froxlor/User.php index 94b52ee3..40155d51 100644 --- a/lib/Froxlor/User.php +++ b/lib/Froxlor/User.php @@ -111,8 +111,8 @@ class User $admin_resources[$cur_adm] = array(); } - self::_addResourceCountEx($admin_resources[$cur_adm], $customer, 'diskspace_used', 'diskspace'); - self::_addResourceCountEx($admin_resources[$cur_adm], $customer, 'traffic_used', 'traffic_used'); // !!! yes, USED and USED + self::addResourceCountEx($admin_resources[$cur_adm], $customer, 'diskspace_used', 'diskspace'); + self::addResourceCountEx($admin_resources[$cur_adm], $customer, 'traffic_used', 'traffic_used'); // !!! yes, USED and USED foreach (array( 'mysqls', @@ -123,7 +123,7 @@ class User 'email_quota', 'subdomains' ) as $field) { - self::_addResourceCount($admin_resources[$cur_adm], $customer, $field . '_used', $field); + self::addResourceCount($admin_resources[$cur_adm], $customer, $field . '_used', $field); } $customer_mysqls_stmt = Database::prepare('SELECT COUNT(*) AS `number_mysqls` FROM `' . TABLE_PANEL_DATABASES . '` @@ -241,7 +241,7 @@ class User 'email_quota_used', 'subdomains_used' ) as $field) { - self::_initArrField($field, $admin_resources[$cur_adm], 0); + self::initArrField($field, $admin_resources[$cur_adm], 0); $admin[$field . '_new'] = $admin_resources[$cur_adm][$field]; } @@ -295,9 +295,9 @@ class User * * @return void */ - private static function _addResourceCount(&$arr, $customer_arr, $used_field = null, $field = null) + private static function addResourceCount(&$arr, $customer_arr, $used_field = null, $field = null) { - self::_initArrField($used_field, $arr, 0); + self::initArrField($used_field, $arr, 0); if ($customer_arr[$field] != '-1') { $arr[$used_field] += intval($customer_arr[$used_field]); } @@ -317,9 +317,9 @@ class User * * @return void */ - private static function _addResourceCountEx(&$arr, $customer_arr, $used_field = null, $field = null) + private static function addResourceCountEx(&$arr, $customer_arr, $used_field = null, $field = null) { - self::_initArrField($used_field, $arr, 0); + self::initArrField($used_field, $arr, 0); if ($field == 'diskspace' && ($customer_arr[$field] / 1024) != '-1') { $arr[$used_field] += intval($customer_arr[$used_field]); } elseif ($field == 'traffic_used') { @@ -337,7 +337,7 @@ class User * * @return void */ - private static function _initArrField($field = null, &$arr, $init_value = 0) + private static function initArrField($field = null, &$arr, $init_value = 0) { if (! isset($arr[$field])) { $arr[$field] = $init_value;