diff --git a/admin_tickets.php b/admin_tickets.php index 3dda9c88..c7077dee 100644 --- a/admin_tickets.php +++ b/admin_tickets.php @@ -179,8 +179,7 @@ if ($page == 'tickets' if (isset($_POST['send']) && $_POST['send'] == 'send' ) { - // FIXME ticket -> settings - $newticket = ticket::getInstanceOf($userinfo, $settings, -1); + $newticket = ticket::getInstanceOf($userinfo, -1); $newticket->Set('subject', validate($_POST['subject'], 'subject'), true, false); $newticket->Set('priority', validate($_POST['priority'], 'priority'), true, false); $newticket->Set('category', validate($_POST['category'], 'category'), true, false); @@ -271,8 +270,7 @@ if ($page == 'tickets' if (isset($_POST['send']) && $_POST['send'] == 'send' ) { - // FIXME ticket -> settings - $replyticket = ticket::getInstanceOf($userinfo, $settings, -1); + $replyticket = ticket::getInstanceOf($userinfo, -1); $replyticket->Set('subject', validate($_POST['subject'], 'subject'), true, false); $replyticket->Set('priority', validate($_POST['priority'], 'priority'), true, false); $replyticket->Set('message', validate(htmlentities(str_replace("\r\n", "\n", $_POST['message'])), 'message', '/^[^\0]*$/'), true, false); @@ -281,8 +279,7 @@ if ($page == 'tickets' standard_error(array('stringisempty', 'mymessage')); } else { $now = time(); - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); $replyticket->Set('customer', $mainticket->Get('customer'), true, true); $replyticket->Set('lastchange', $now, true, true); $replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true); @@ -308,8 +305,7 @@ if ($page == 'tickets' } else { $ticket_replies = ''; - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); $dt = date("d.m.Y H:i\h", $mainticket->Get('dt')); $status = ticket::getStatusText($lng, $mainticket->Get('status')); @@ -352,8 +348,7 @@ if ($page == 'tickets' $numrows_andere = Database::num_rows(); while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) { - // FIXME ticket -> settings - $subticket = ticket::getInstanceOf($userinfo, $settings, (int)$row2['id']); + $subticket = ticket::getInstanceOf($userinfo, (int)$row2['id']); $lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange')); if ($subticket->Get('by') == '1') { @@ -400,8 +395,7 @@ if ($page == 'tickets' && $_POST['send'] == 'send' ) { $now = time(); - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); $mainticket->Set('lastchange', $now, true, true); $mainticket->Set('lastreplier', '1', true, true); $mainticket->Set('status', '3', true, true); @@ -409,8 +403,7 @@ if ($page == 'tickets' $log->logAction(ADM_ACTION, LOG_NOTICE, "closed ticket '" . $mainticket->Get('subject') . "'"); redirectTo($filename, array('page' => $page, 's' => $s)); } else { - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); ask_yesno('ticket_reallyclose', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject')); } @@ -418,8 +411,7 @@ if ($page == 'tickets' && $id != 0 ) { $now = time(); - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); $mainticket->Set('lastchange', $now, true, true); $mainticket->Set('lastreplier', '1', true, true); $mainticket->Set('status', '0', true, true); @@ -434,8 +426,7 @@ if ($page == 'tickets' && $_POST['send'] == 'send' ) { $now = time(); - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); $mainticket->Set('lastchange', $now, true, true); $mainticket->Set('lastreplier', '1', true, true); $mainticket->Set('status', '3', true, true); @@ -444,8 +435,7 @@ if ($page == 'tickets' $log->logAction(ADM_ACTION, LOG_NOTICE, "archived ticket '" . $mainticket->Get('subject') . "'"); redirectTo($filename, array('page' => $page, 's' => $s)); } else { - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); ask_yesno('ticket_reallyarchive', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject')); } @@ -455,14 +445,12 @@ if ($page == 'tickets' if (isset($_POST['send']) && $_POST['send'] == 'send' ) { - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); $log->logAction(ADM_ACTION, LOG_INFO, "deleted ticket '" . $mainticket->Get('subject') . "'"); $mainticket->Delete(); redirectTo($filename, array('page' => $page, 's' => $s)); } else { - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject')); } } @@ -804,8 +792,7 @@ if ($page == 'tickets' ) { $log->logAction(ADM_ACTION, LOG_NOTICE, "viewed archived-ticket #" . $id); $ticket_replies = ''; - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); $lastchange = date("d.m.Y H:i\h", $mainticket->Get('lastchange')); $dt = date("d.m.Y H:i\h", $mainticket->Get('dt')); $status = ticket::getStatusText($lng, $mainticket->Get('status')); @@ -855,8 +842,7 @@ if ($page == 'tickets' $numrows_andere = Database::num_rows(); while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) { - // FIXME ticket -> settings - $subticket = ticket::getInstanceOf($userinfo, $settings, (int)$row2['id']); + $subticket = ticket::getInstanceOf($userinfo, (int)$row2['id']); $lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange')); if ($subticket->Get('by') == '1') { @@ -907,14 +893,12 @@ if ($page == 'tickets' if (isset($_POST['send']) && $_POST['send'] == 'send' ) { - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); $log->logAction(ADM_ACTION, LOG_INFO, "deleted archived ticket '" . $mainticket->Get('subject') . "'"); $mainticket->Delete(); redirectTo($filename, array('page' => $page, 's' => $s)); } else { - // FIXME ticket -> settings - $mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id); + $mainticket = ticket::getInstanceOf($userinfo, (int)$id); ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject')); } } diff --git a/lib/classes/database/class.Database.php b/lib/classes/database/class.Database.php index 71cf51ce..f15ee212 100644 --- a/lib/classes/database/class.Database.php +++ b/lib/classes/database/class.Database.php @@ -297,7 +297,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) { - global $userinfo, $settings, $theme, $linker; + global $userinfo, $theme, $linker; /** * log to a file, so we can actually ask people for the error @@ -336,8 +336,8 @@ class Database { $err_report_html = ''; if (is_array($userinfo) && ( - ($userinfo['adminsession'] == '1' && $settings['system']['allow_error_report_admin'] == '1') - || ($userinfo['adminsession'] == '0' && $settings['system']['allow_error_report_customer'] == '1')) + ($userinfo['adminsession'] == '1' && Settings::Get('system.allow_error_report_admin') == '1') + || ($userinfo['adminsession'] == '0' && Settings::Get('system.allow_error_report_customer') == '1')) ) { $err_report_html = 'Report error'; $err_report_html = str_replace("", $linker->getLink(array('section' => 'index', 'page' => 'send_error_report', 'errorid' => $errid)), $err_report_html); diff --git a/lib/classes/logger/abstract.AbstractLogger.php b/lib/classes/logger/abstract.AbstractLogger.php index 01f178d2..c3a1eeca 100644 --- a/lib/classes/logger/abstract.AbstractLogger.php +++ b/lib/classes/logger/abstract.AbstractLogger.php @@ -33,68 +33,65 @@ LOG_DEBUG debug-level message */ -abstract class AbstractLogger -{ - /** - * Settings array - * @var settings - */ - - private $settings = array(); +abstract class AbstractLogger { /** * Enable/Disable Logging * @var logenabled */ - private $logenabled = false; /** * Enable/Disable Cronjob-Logging * @var logcronjob */ - private $logcronjob = false; /** * Loggin-Severity * @var severity */ - private $severity = 1; - // normal - /** * setup the main logger - * - * @param array settings */ - - protected function setupLogger($settings) - { - $this->settings = $settings; - $this->logenabled = $this->settings['logger']['enabled']; - $this->logcronjob = $this->settings['logger']['log_cron']; - $this->severity = $this->settings['logger']['severity']; + protected function setupLogger() { + $this->logenabled = Settings::Get('logger.enabled'); + $this->logcronjob = Settings::Get('logger.log_cron'); + $this->severity = Settings::Get('logger.severity'); } - protected function isEnabled() - { + /** + * return whether this logging is enabled + * + * @return bool + */ + protected function isEnabled() { return $this->logenabled; } - protected function getSeverity() - { + /** + * return the log severity + * + * @return int + */ + protected function getSeverity() { return $this->severity; } - protected function logCron() - { + /** + * whether to log cron-runs or not + * + * @return bool + */ + protected function logCron() { return $this->logcronjob; } + /** + * logs a given text + */ abstract public function logAction(); -} -?> \ No newline at end of file +} diff --git a/lib/classes/logger/class.FileLogger.php b/lib/classes/logger/class.FileLogger.php index 14898d34..e27dd46a 100644 --- a/lib/classes/logger/class.FileLogger.php +++ b/lib/classes/logger/class.FileLogger.php @@ -16,69 +16,65 @@ * @package Logger * * @link http://www.nutime.de/ - * + * * Logger - File-Logger-Class */ -class FileLogger extends AbstractLogger -{ +class FileLogger extends AbstractLogger { + /** * Userinfo * @var array */ - private $userinfo = array(); - /** + /** * Logfile * @var logfile - */ - + */ private $logfile = null; /** * Syslogger Objects Array * @var loggers */ - static private $loggers = array(); /** * Class constructor. * * @param array userinfo - * @param array settings - */ - - protected function __construct($userinfo, $settings) - { - parent::setupLogger($settings); + */ + protected function __construct($userinfo) { + parent::setupLogger(); $this->userinfo = $userinfo; - $this->setLogFile($settings['logger']['logfile']); + $this->setLogFile(Settings::Get('logger.logfile')); } /** * Singleton ftw ;-) - * */ - - static public function getInstanceOf($_usernfo, $_settings) - { - if(!isset(self::$loggers[$_usernfo['loginname']])) - { - self::$loggers[$_usernfo['loginname']] = new FileLogger($_usernfo, $_settings); + static public function getInstanceOf($_usernfo) { + if (!isset(self::$loggers[$_usernfo['loginname']])) { + self::$loggers[$_usernfo['loginname']] = new FileLogger($_usernfo); } - return self::$loggers[$_usernfo['loginname']]; } - public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) - { - if(parent::isEnabled()) - { - if(parent::getSeverity() <= 1 - && $type == LOG_NOTICE) - { + /** + * logs a given text to all enabled logger-facilities + * + * @param int $action + * @param int $type + * @param string $text + */ + public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) { + + if (parent::isEnabled()) { + + if (parent::getSeverity() <= 1 + && $type == LOG_NOTICE + ) { return; } @@ -87,22 +83,25 @@ class FileLogger extends AbstractLogger switch($action) { case USR_ACTION: - $_action = 'customer'; + $_action = $lng['admin']['customer']; break; case RES_ACTION: - $_action = 'reseller'; + $_action = $lng['logger']['reseller']; break; case ADM_ACTION: - $_action = 'administrator'; + $_action = $lng['logger']['admin']; break; case CRON_ACTION: - $_action = 'cronjob'; + $_action = $lng['logger']['cron']; + break; + case LOGIN_ACTION: + $_action = $lng['logger']['login']; break; case LOG_ERROR: - $_action = 'internal'; + $_action = $lng['logger']['intern']; break; default: - $_action = 'unknown'; + $_action = $lng['logger']['unknown']; break; } @@ -131,7 +130,7 @@ class FileLogger extends AbstractLogger } if(!isset($this->userinfo['loginname']) - || $this->userinfo['loginname'] == '') + || $this->userinfo['loginname'] == '') { $name = 'unknown'; } @@ -147,7 +146,7 @@ class FileLogger extends AbstractLogger $now = time(); if($text != null - && $text != '') + && $text != '') { fwrite($fp, date("d.m.Y H:i:s", $now) . " [" . $_type . "] [" . $_action . "-action" . $name . "] " . $text . "\n"); } @@ -161,7 +160,7 @@ class FileLogger extends AbstractLogger else { if($this->logfile != null - || $this->logfile != '') + || $this->logfile != '') { throw new Exception("Cannot open logfile '" . $this->logfile . "' for writing!"); } @@ -172,10 +171,10 @@ class FileLogger extends AbstractLogger public function setLogFile($filename = null) { if($filename != null - && $filename != '' - && $filename != "." - && $filename != ".." - && !is_dir($filename)) + && $filename != '' + && $filename != "." + && $filename != ".." + && !is_dir($filename)) { $this->logfile = $filename; return true; diff --git a/lib/classes/logger/class.FroxlorLogger.php b/lib/classes/logger/class.FroxlorLogger.php index 3b4ac62f..6b4a87a0 100644 --- a/lib/classes/logger/class.FroxlorLogger.php +++ b/lib/classes/logger/class.FroxlorLogger.php @@ -16,24 +16,18 @@ * @package Logger * * @link http://www.nutime.de/ - * + * * Logger - Froxlor-Base-Logger-Class */ -class FroxlorLogger -{ +class FroxlorLogger { + /** * Userinfo * @var array */ private $userinfo = array(); - /** - * Settings array - * @var settings - */ - private $settings = array(); - /** * LogTypes Array * @var logtypes @@ -50,25 +44,21 @@ class FroxlorLogger * Class constructor. * * @param array userinfo - * @param array settings */ - protected function __construct($userinfo, $settings) { + protected function __construct($userinfo) { $this->userinfo = $userinfo; - $this->settings = $settings; self::$logtypes = array(); - if (!isset($this->settings['logger']['logtypes']) - && (!isset($this->settings['logger']['logtypes']) || $this->settings['logger']['logtypes'] == '') - && isset($this->settings['logger']['enabled']) - && $this->settings['logger']['enabled'] + if ((Settings::Get('logger.logtypes') == null || Settings::Get('logger.logtypes') == '') + && (Settings::Get('logger.enabled') !== null && Settings::Get('logger.enabled')) ) { self::$logtypes[0] = 'syslog'; self::$logtypes[1] = 'mysql'; } else { - if (isset($this->settings['logger']['logtypes']) - && $this->settings['logger']['logtypes'] != '' + if (Settings::Get('logger.logtypes') !== null + && Settings::Get('logger.logtypes') != '' ) { - self::$logtypes = explode(',', $this->settings['logger']['logtypes']); + self::$logtypes = explode(',', Settings::Get('logger.logtypes')); } else { self::$logtypes = null; } @@ -79,8 +69,8 @@ class FroxlorLogger * Singleton ftw ;-) * */ - static public function getInstanceOf($_usernfo, $_settings) - { + static public function getInstanceOf($_usernfo) { + if (!isset($_usernfo) || $_usernfo == null ) { @@ -89,19 +79,26 @@ class FroxlorLogger } if (!isset(self::$loggers[$_usernfo['loginname']])) { - self::$loggers[$_usernfo['loginname']] = new FroxlorLogger($_usernfo, $_settings); + self::$loggers[$_usernfo['loginname']] = new FroxlorLogger($_usernfo); } return self::$loggers[$_usernfo['loginname']]; } + /** + * logs a given text to all enabled logger-facilities + * + * @param int $action + * @param int $type + * @param string $text + */ public function logAction ($action = USR_ACTION, $type = LOG_NOTICE, $text = null) { if (self::$logtypes == null) { return; } - if ($this->settings['logger']['log_cron'] == '0' + if (Settings::Get('logger.log_cron') == '0' && $action == CRON_ACTION ) { return; @@ -112,12 +109,12 @@ class FroxlorLogger switch ($logger) { case 'syslog': - $_log = SysLogger::getInstanceOf($this->userinfo, $this->settings); + $_log = SysLogger::getInstanceOf($this->userinfo); break; case 'file': try { - $_log = FileLogger::getInstanceOf($this->userinfo, $this->settings); + $_log = FileLogger::getInstanceOf($this->userinfo); } catch(Exception $e) { @@ -129,7 +126,7 @@ class FroxlorLogger } break; case 'mysql': - $_log = MysqlLogger::getInstanceOf($this->userinfo, $this->settings); + $_log = MysqlLogger::getInstanceOf($this->userinfo); break; default: $_log = null; @@ -150,6 +147,13 @@ class FroxlorLogger } } + /** + * Set whether to log cron-runs + * + * @param bool $_cronlog + * + * @return boolean + */ public function setCronLog($_cronlog = 0) { $_cronlog = (int)$_cronlog; @@ -159,13 +163,7 @@ class FroxlorLogger ) { $_cronlog = 0; } - - $stmt = Database::prepare(" - UPDATE `" . TABLE_PANEL_SETTINGS . "` SET - `value` = :value - WHERE `settinggroup`='logger' AND `varname`='log_cron'" - ); - Database::pexecute($stmt, array('value' => $_cronlog)); + Settings::Set('logger.log_cron', $_cronlog); return true; } } diff --git a/lib/classes/logger/class.MysqlLogger.php b/lib/classes/logger/class.MysqlLogger.php index 360db6f7..b21ed392 100644 --- a/lib/classes/logger/class.MysqlLogger.php +++ b/lib/classes/logger/class.MysqlLogger.php @@ -38,25 +38,29 @@ class MysqlLogger extends AbstractLogger { * Class constructor. * * @param array userinfo - * @param array settings */ - protected function __construct($userinfo, $settings) { - parent::setupLogger($settings); + protected function __construct($userinfo) { + parent::setupLogger(); $this->userinfo = $userinfo; } /** * Singleton ftw ;-) - * */ - static public function getInstanceOf($_usernfo, $_settings) { - + static public function getInstanceOf($_usernfo) { if (!isset(self::$loggers[$_usernfo['loginname']])) { - self::$loggers[$_usernfo['loginname']] = new MysqlLogger($_usernfo, $_settings); + self::$loggers[$_usernfo['loginname']] = new MysqlLogger($_usernfo); } return self::$loggers[$_usernfo['loginname']]; } + /** + * logs a given text to all enabled logger-facilities + * + * @param int $action + * @param int $type + * @param string $text + */ public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) { if (parent::isEnabled()) { diff --git a/lib/classes/logger/class.SysLogger.php b/lib/classes/logger/class.SysLogger.php index c6aeba28..0bfc5747 100644 --- a/lib/classes/logger/class.SysLogger.php +++ b/lib/classes/logger/class.SysLogger.php @@ -16,61 +16,58 @@ * @package Logger * * @link http://www.nutime.de/ - * + * * Logger - SysLog-Logger-Class */ -class SysLogger extends AbstractLogger -{ +class SysLogger extends AbstractLogger { + /** * Userinfo * @var array */ - private $userinfo = array(); /** * Syslogger Objects Array * @var loggers - */ - + */ static private $loggers = array(); /** * Class constructor. * * @param array userinfo - * @param array settings - */ - - protected function __construct($userinfo, $settings) - { - parent::setupLogger($settings); + */ + protected function __construct($userinfo) { + parent::setupLogger(); $this->userinfo = $userinfo; } /** * Singleton ftw ;-) - * */ - - static public function getInstanceOf($_usernfo, $_settings) - { - if(!isset(self::$loggers[$_usernfo['loginname']])) - { - self::$loggers[$_usernfo['loginname']] = new SysLogger($_usernfo, $_settings); + static public function getInstanceOf($_usernfo) { + if (!isset(self::$loggers[$_usernfo['loginname']])) { + self::$loggers[$_usernfo['loginname']] = new SysLogger($_usernfo); } - return self::$loggers[$_usernfo['loginname']]; } - public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) - { - if(parent::isEnabled()) - { - if(parent::getSeverity() <= 1 - && $type == LOG_NOTICE) - { + /** + * logs a given text to all enabled logger-facilities + * + * @param int $action + * @param int $type + * @param string $text + */ + public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) { + + if (parent::isEnabled()) { + + if (parent::getSeverity() <= 1 + && $type == LOG_NOTICE + ) { return; } @@ -79,28 +76,31 @@ class SysLogger extends AbstractLogger switch($action) { case USR_ACTION: - $_action = 'customer'; + $_action = $lng['admin']['customer']; break; case RES_ACTION: - $_action = 'reseller'; + $_action = $lng['logger']['reseller']; break; case ADM_ACTION: - $_action = 'administrator'; + $_action = $lng['logger']['admin']; break; case CRON_ACTION: - $_action = 'cronjob'; + $_action = $lng['logger']['cron']; + break; + case LOGIN_ACTION: + $_action = $lng['logger']['login']; break; case LOG_ERROR: - $_action = 'internal'; + $_action = $lng['logger']['intern']; break; default: - $_action = 'unknown'; + $_action = $lng['logger']['unknown']; break; } - if(!isset($this->userinfo['loginname']) - || $this->userinfo['loginname'] == '') - { + if (!isset($this->userinfo['loginname']) + || $this->userinfo['loginname'] == '' + ) { $name = 'unknown'; } else @@ -110,13 +110,11 @@ class SysLogger extends AbstractLogger openlog("Froxlor", LOG_NDELAY, LOG_USER); - if($text != null - && $text != '') - { + if ($text != null + && $text != '' + ) { syslog((int)$type, "[" . ucfirst($_action) . " Action" . $name . "] " . $text); - } - else - { + } else { syslog((int)$type, "[" . ucfirst($_action) . " Action" . $name . "] No text given!!! Check scripts!"); } diff --git a/lib/classes/phpinterface/class.phpinterface.php b/lib/classes/phpinterface/class.phpinterface.php index 579bdc80..9bf6bf41 100644 --- a/lib/classes/phpinterface/class.phpinterface.php +++ b/lib/classes/phpinterface/class.phpinterface.php @@ -21,12 +21,6 @@ class phpinterface { - /** - * Settings array - * @var array - */ - private $_settings = array(); - /** * Domain-Data array * @var array @@ -48,8 +42,7 @@ class phpinterface { /** * main constructor */ - public function __construct($settings, $domain) { - $this->_settings = $settings; + public function __construct($domain) { $this->_domain = $domain; $this->_setInterface(); } @@ -69,11 +62,11 @@ class phpinterface { */ private function _setInterface() { // php-fpm - if ((int)$this->_settings['phpfpm']['enabled'] == 1) { - $this->_interface = new phpinterface_fpm($this->_settings, $this->_domain); + if ((int)Settings::Get('phpfpm.enabled') == 1) { + $this->_interface = new phpinterface_fpm($this->_domain); - } elseif ((int)$this->_settings['system']['mod_fcgid'] == 1) { - $this->_interface = new phpinterface_fcgid($this->_settings, $this->_domain); + } elseif ((int)Settings::Get('system.mod_fcgid') == 1) { + $this->_interface = new phpinterface_fcgid($this->_domain); } } diff --git a/lib/classes/phpinterface/class.phpinterface_fcgid.php b/lib/classes/phpinterface/class.phpinterface_fcgid.php index 8b998561..b20ebbe5 100644 --- a/lib/classes/phpinterface/class.phpinterface_fcgid.php +++ b/lib/classes/phpinterface/class.phpinterface_fcgid.php @@ -21,12 +21,6 @@ class phpinterface_fcgid { - /** - * Settings array - * @var array - */ - private $_settings = array(); - /** * Domain-Data array * @var array @@ -42,11 +36,14 @@ class phpinterface_fcgid { /** * main constructor */ - public function __construct($settings, $domain) { - $this->_settings = $settings; + public function __construct($domain) { $this->_domain = $domain; } + /** + * create fcgid-starter-file + * @param array $phpconfig + */ public function createConfig($phpconfig) { // create starter @@ -67,7 +64,7 @@ class phpinterface_fcgid { if ((int)$phpconfig['mod_fcgid_starter'] != - 1) { $starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n"; } else { - $starter_file.= "PHP_FCGI_CHILDREN=" . (int)$this->_settings['system']['mod_fcgid_starter'] . "\n"; + $starter_file.= "PHP_FCGI_CHILDREN=" . (int)Settings::Get('system.mod_fcgid_starter') . "\n"; } } @@ -80,7 +77,7 @@ class phpinterface_fcgid { if ((int)$phpconfig['mod_fcgid_maxrequests'] != - 1) { $starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n"; } else { - $starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$this->_settings['system']['mod_fcgid_maxrequests'] . "\n"; + $starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)Settings::Get('system.mod_fcgid_maxrequests') . "\n"; } } @@ -117,12 +114,12 @@ class phpinterface_fcgid { $openbasedirc = ''; $_phpappendopenbasedir = ''; - $_custom_openbasedir = explode(':', $this->_settings['system']['mod_fcgid_peardir']); + $_custom_openbasedir = explode(':', Settings::Get('system.mod_fcgid_peardir')); foreach ($_custom_openbasedir as $cobd) { $_phpappendopenbasedir .= appendOpenBasedirPath($cobd); } - $_custom_openbasedir = explode(':', $this->_settings['system']['phpappendopenbasedir']); + $_custom_openbasedir = explode(':', Settings::Get('system.phpappendopenbasedir')); foreach ($_custom_openbasedir as $cobd) { $_phpappendopenbasedir .= appendOpenBasedirPath($cobd); } @@ -155,10 +152,10 @@ class phpinterface_fcgid { $admin = $this->_getAdminData($this->_domain['adminid']); $php_ini_variables = array( 'SAFE_MODE' => 'Off', // keep this for compatibility, just in case - 'PEAR_DIR' => $this->_settings['system']['mod_fcgid_peardir'], + 'PEAR_DIR' => Settings::Get('system.mod_fcgid_peardir'), 'OPEN_BASEDIR' => $openbasedir, 'OPEN_BASEDIR_C' => $openbasedirc, - 'OPEN_BASEDIR_GLOBAL' => $this->_settings['system']['phpappendopenbasedir'], + 'OPEN_BASEDIR_GLOBAL' => Settings::Get('system.hpappendopenbasedir'), 'TMP_DIR' => $this->getTempDir(), 'CUSTOMER_EMAIL' => $this->_domain['email'], 'ADMIN_EMAIL' => $admin['email'], @@ -192,7 +189,7 @@ class phpinterface_fcgid { */ public function getConfigDir($createifnotexists = true) { - $configdir = makeCorrectDir($this->_settings['system']['mod_fcgid_configdir'] . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/'); + $configdir = makeCorrectDir(Settings::Get('system.mod_fcgid_configdir') . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/'); if (!is_dir($configdir) && $createifnotexists) { safe_exec('mkdir -p ' . escapeshellarg($configdir)); @@ -211,7 +208,7 @@ class phpinterface_fcgid { */ public function getTempDir($createifnotexists = true) { - $tmpdir = makeCorrectDir($this->_settings['system']['mod_fcgid_tmpdir'] . '/' . $this->_domain['loginname'] . '/'); + $tmpdir = makeCorrectDir(Settings::Get('system.mod_fcgid_tmpdir') . '/' . $this->_domain['loginname'] . '/'); if (!is_dir($tmpdir) && $createifnotexists) { safe_exec('mkdir -p ' . escapeshellarg($tmpdir)); diff --git a/lib/classes/phpinterface/class.phpinterface_fpm.php b/lib/classes/phpinterface/class.phpinterface_fpm.php index be273494..42093a44 100644 --- a/lib/classes/phpinterface/class.phpinterface_fpm.php +++ b/lib/classes/phpinterface/class.phpinterface_fpm.php @@ -21,12 +21,6 @@ class phpinterface_fpm { - /** - * Settings array - * @var array - */ - private $_settings = array(); - /** * Domain-Data array * @var array @@ -96,8 +90,7 @@ class phpinterface_fpm { /** * main constructor */ - public function __construct($settings, $domain) { - $this->_settings = $settings; + public function __construct($domain) { $this->_domain = $domain; } @@ -111,13 +104,13 @@ class phpinterface_fpm { $fh = @fopen($this->getConfigFile(), 'w'); if ($fh) { - $fpm_pm = $this->_settings['phpfpm']['pm']; - $fpm_children = (int)$this->_settings['phpfpm']['max_children']; - $fpm_start_servers = (int)$this->_settings['phpfpm']['start_servers']; - $fpm_min_spare_servers = (int)$this->_settings['phpfpm']['min_spare_servers']; - $fpm_max_spare_servers = (int)$this->_settings['phpfpm']['max_spare_servers']; - $fpm_requests = (int)$this->_settings['phpfpm']['max_requests']; - $fpm_process_idle_timeout = (int)$this->_settings['phpfpm']['idle_timeout']; + $fpm_pm = Settings::Get('phpfpm.pm'); + $fpm_children = (int)Settings::Get('phpfpm.max_children'); + $fpm_start_servers = (int)Settings::Get('phpfpm.start_servers'); + $fpm_min_spare_servers = (int)Settings::Get('phpfpm.min_spare_servers'); + $fpm_max_spare_servers = (int)Settings::Get('phpfpm.max_spare_servers'); + $fpm_requests = (int)Settings::Get('phpfpm.max_requests'); + $fpm_process_idle_timeout = (int)Settings::Get('phpfpm.idle_timeout'); if ($fpm_children == 0) { $fpm_children = 1; @@ -168,14 +161,14 @@ class phpinterface_fpm { if ($phpconfig['fpm_slowlog'] == '1') { $fpm_config.= 'request_terminate_timeout = ' . $phpconfig['fpm_reqterm'] . "\n"; $fpm_config.= 'request_slowlog_timeout = ' . $phpconfig['fpm_reqslow'] . "\n"; - $slowlog = makeCorrectFile($this->_settings['system']['logfiles_directory'] . '/' . $this->_domain['loginname'] . '-php-slow.log'); + $slowlog = makeCorrectFile(Settings::Get('system.logfiles_directory') . '/' . $this->_domain['loginname'] . '-php-slow.log'); $fpm_config.= 'slowlog = ' . $slowlog . "\n"; $fpm_config.= 'catch_workers_output = yes' . "\n"; } $fpm_config.= ';chroot = '.makeCorrectDir($this->_domain['documentroot'])."\n"; - $tmpdir = makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/'); + $tmpdir = makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/'); if (!is_dir($tmpdir)) { $this->getTempDir(); } @@ -188,12 +181,12 @@ class phpinterface_fpm { if ($this->_domain['loginname'] != 'froxlor.panel') { if ($this->_domain['openbasedir'] == '1') { $_phpappendopenbasedir = ''; - $_custom_openbasedir = explode(':', $this->_settings['phpfpm']['peardir']); + $_custom_openbasedir = explode(':', Settings::Get('phpfpm.peardir')); foreach ($_custom_openbasedir as $cobd) { $_phpappendopenbasedir .= appendOpenBasedirPath($cobd); } - $_custom_openbasedir = explode(':', $this->_settings['system']['phpappendopenbasedir']); + $_custom_openbasedir = explode(':', Settings::Get('system.phpappendopenbasedir')); foreach ($_custom_openbasedir as $cobd) { $_phpappendopenbasedir .= appendOpenBasedirPath($cobd); } @@ -219,14 +212,14 @@ class phpinterface_fpm { $openbasedir = implode(':', $clean_openbasedir); } } - $fpm_config.= 'php_admin_value[session.save_path] = ' . makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/') . "\n"; - $fpm_config.= 'php_admin_value[upload_tmp_dir] = ' . makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/') . "\n"; + $fpm_config.= 'php_admin_value[session.save_path] = ' . makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n"; + $fpm_config.= 'php_admin_value[upload_tmp_dir] = ' . makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/') . "\n"; $admin = $this->_getAdminData($this->_domain['adminid']); $php_ini_variables = array( 'SAFE_MODE' => 'Off', // keep this for compatibility, just in case - 'PEAR_DIR' => $this->_settings['system']['mod_fcgid_peardir'], + 'PEAR_DIR' => Settings::Get('system.mod_fcgid_peardir'), 'TMP_DIR' => $this->getTempDir(), 'CUSTOMER_EMAIL' => $this->_domain['email'], 'ADMIN_EMAIL' => $admin['email'], @@ -284,7 +277,7 @@ class phpinterface_fpm { */ public function getConfigFile($createifnotexists = true) { - $configdir = makeCorrectDir($this->_settings['phpfpm']['configdir']); + $configdir = makeCorrectDir(Settings::Get('phpfpm.configdir')); $config = makeCorrectFile($configdir.'/'.$this->_domain['domain'].'.conf'); if (!is_dir($configdir) && $createifnotexists) { @@ -303,14 +296,12 @@ class phpinterface_fpm { */ public function getSocketFile($createifnotexists = true) { - // see #1300 why this has changed - //$socketdir = makeCorrectDir('/var/run/'.$this->_settings['system']['webserver'].'/'); - $socketdir = makeCorrectDir($this->_settings['phpfpm']['fastcgi_ipcdir']); + $socketdir = makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir')); $socket = makeCorrectFile($socketdir.'/'.$this->_domain['loginname'].'-'.$this->_domain['domain'].'-php-fpm.socket'); if (!is_dir($socketdir) && $createifnotexists) { safe_exec('mkdir -p '.escapeshellarg($socketdir)); - safe_exec('chown -R '.$this->_settings['system']['httpuser'].':'.$this->_settings['system']['httpgroup'].' '.escapeshellarg($socketdir)); + safe_exec('chown -R '.Settings::Get('system.httpuser').':'.Settings::Get('system.httpgroup').' '.escapeshellarg($socketdir)); } return $socket; @@ -325,7 +316,7 @@ class phpinterface_fpm { */ public function getTempDir($createifnotexists = true) { - $tmpdir = makeCorrectDir($this->_settings['phpfpm']['tmpdir'] . '/' . $this->_domain['loginname'] . '/'); + $tmpdir = makeCorrectDir(Settings::Get('phpfpm.tmpdir') . '/' . $this->_domain['loginname'] . '/'); if (!is_dir($tmpdir) && $createifnotexists) { safe_exec('mkdir -p ' . escapeshellarg($tmpdir)); @@ -346,11 +337,11 @@ class phpinterface_fpm { public function getAliasConfigDir($createifnotexists = true) { // ensure default... - if (!isset($this->_settings['phpfpm']['aliasconfigdir'])) { - $this->_settings['phpfpm']['aliasconfigdir'] = '/var/www/php-fpm'; + if (Settings::Get('phpfpm.aliasconfigdir') == null) { + Settings::Set('phpfpm.aliasconfigdir', '/var/www/php-fpm'); } - $configdir = makeCorrectDir($this->_settings['phpfpm']['aliasconfigdir'] . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/'); + $configdir = makeCorrectDir(Settings::Get('phpfpm.aliasconfigdir') . '/' . $this->_domain['loginname'] . '/' . $this->_domain['domain'] . '/'); if (!is_dir($configdir) && $createifnotexists) { safe_exec('mkdir -p ' . escapeshellarg($configdir)); safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir)); diff --git a/lib/classes/ticket/class.ticket.php b/lib/classes/ticket/class.ticket.php index 5f742cae..1ff0916e 100644 --- a/lib/classes/ticket/class.ticket.php +++ b/lib/classes/ticket/class.ticket.php @@ -28,12 +28,6 @@ class ticket { */ private $userinfo = array(); - /** - * Settings array - * @var settings - */ - private $settings = array(); - /** * Ticket ID * @var tid @@ -62,12 +56,10 @@ class ticket { * Class constructor. * * @param array userinfo - * @param array settings * @param int ticket id */ - private function __construct($userinfo, $settings, $tid = - 1) { + private function __construct($userinfo, $tid = - 1) { $this->userinfo = $userinfo; - $this->settings = $settings; $this->tid = $tid; // initialize purifier @@ -88,12 +80,11 @@ class ticket { * Singleton ftw ;-) * * @param array userinfo - * @param array settings * @param int ticket id */ - static public function getInstanceOf($_usernfo, $_settings, $_tid) { + static public function getInstanceOf($_usernfo, $_tid) { if (!isset(self::$tickets[$_tid])) { - self::$tickets[$_tid] = new ticket($_usernfo, $_settings, $_tid); + self::$tickets[$_tid] = new ticket($_usernfo, $_tid); } return self::$tickets[$_tid]; } @@ -310,7 +301,7 @@ class ticket { if ($customerid != - 1) { $_mailerror = false; try { - $mail->SetFrom($this->settings['ticket']['noreply_email'], $this->settings['ticket']['noreply_name']); + $mail->SetFrom(Settings::Get('ticket.noreply_email'), Settings::Get('ticket.noreply_name')); $mail->Subject = $mail_subject; $mail->AltBody = $mail_body; $mail->MsgHTML(str_replace("\n", "
", $mail_body)); @@ -325,7 +316,7 @@ class ticket { } if ($_mailerror) { - $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class'), $this->settings); + $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class')); $rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg); standard_error('errorsendingmail', $usr['email']); } @@ -340,7 +331,7 @@ class ticket { $admin = Database::pexecute_first($admin_stmt, array('adminid' => $this->userinfo['adminid'])); $_mailerror = false; try { - $mail->SetFrom($this->settings['ticket']['noreply_email'], $this->settings['ticket']['noreply_name']); + $mail->SetFrom(Settings::Get('ticket.noreply_email'), Settings::Get('ticket.noreply_name')); $mail->Subject = $mail_subject; $mail->AltBody = $mail_body; $mail->MsgHTML(str_replace("\n", "
", $mail_body)); @@ -355,7 +346,7 @@ class ticket { } if ($_mailerror) { - $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class'), $this->settings); + $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class')); $rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg); standard_error('errorsendingmail', $admin['email']); } diff --git a/lib/classes/webserver/class.ConfigIO.php b/lib/classes/webserver/class.ConfigIO.php index 3d13b9f6..1a7f4ecd 100644 --- a/lib/classes/webserver/class.ConfigIO.php +++ b/lib/classes/webserver/class.ConfigIO.php @@ -21,19 +21,9 @@ class ConfigIO { /** - * internal settings array - * - * @var array + * constructor */ - private $_settings = null; - - /** - * constructor gets the froxlor settings - * as array - */ - public function __construct(array $settings = null) { - $this->_settings = $settings; - } + public function __construct() {} /** * clean up former created configs, including (if enabled) @@ -73,7 +63,7 @@ class ConfigIO { /* * only clean up if we're actually using SSL */ - if ($this->_settings['system']['use_ssl'] == '1') { + if (Settings::Get('system.use_ssl') == '1') { // get correct directory $configdir = $this->_getFile('system', 'customer_ssl_path'); if ($configdir !== false) { @@ -158,7 +148,7 @@ class ConfigIO { */ private function _cleanAwstatsFiles() { - if ($this->_settings['system']['awstats_enabled'] == '0') { + if (Settings::Get('system.awstats_enabled') == '0') { return; } @@ -204,7 +194,7 @@ class ConfigIO { */ private function _cleanFcgidFiles() { - if ($this->_settings['system']['mod_fcgid'] == '0') { + if (Settings::Get('system.mod_fcgid') == '0') { return; } @@ -246,7 +236,7 @@ class ConfigIO { */ private function _cleanFpmFiles() { - if ($this->_settings['phpfpm']['enabled'] == '0') { + if (Settings::Get('phpfpm.enabled') == '0') { return; } @@ -276,7 +266,7 @@ class ConfigIO { } /** - * returns a file/direcotry from the settings array and checks whether it exists + * returns a file/direcotry from the settings and checks whether it exists * * @param string $group settings-group * @param string $varname var-name @@ -287,7 +277,7 @@ class ConfigIO { private function _getFile($group, $varname, $check_exists = true) { // read from settings - $file = $this->_settings[$group][$varname]; + $file = Settings::Get($group.'.'.$varname); // check whether it exists if ($check_exists && @file_exists($file) == false) { diff --git a/lib/classes/webserver/class.DomainSSL.php b/lib/classes/webserver/class.DomainSSL.php index ce1c272f..dbf0d487 100644 --- a/lib/classes/webserver/class.DomainSSL.php +++ b/lib/classes/webserver/class.DomainSSL.php @@ -21,18 +21,9 @@ class DomainSSL { /** - * internal settings array - * - * @var array + * constructor */ - private $_settings = null; - - /** - * constructor gets the froxlor settings as array - */ - public function __construct(array $settings = null) { - $this->_settings = $settings; - } + public function __construct() {} /** * read domain-related (or if empty, parentdomain-related) ssl-certificates from the database @@ -66,7 +57,7 @@ class DomainSSL { && $dom_certs['ssl_cert_file'] != '' ) { // get destination path - $sslcertpath = makeCorrectDir($this->_settings['system']['customer_ssl_path']); + $sslcertpath = makeCorrectDir(Settings::Get('system.customer_ssl_path')); // create path if it does not exist if (!file_exists($sslcertpath)) { safe_exec('mkdir -p '.escapeshellarg($sslcertpath)); @@ -77,7 +68,7 @@ class DomainSSL { 'ssl_key_file' => makeCorrectFile($sslcertpath.'/'.$domain['domain'].'.key') ); - if ($this->_settings['system']['webserver'] == 'lighttpd') { + if (Settings::Get('system.webserver') == 'lighttpd') { // put my.crt and my.key together for lighty. $dom_certs['ssl_cert_file'] = trim($dom_certs['ssl_cert_file'])."\n".trim($dom_certs['ssl_key_file'])."\n"; $ssl_files['ssl_key_file'] = ''; @@ -91,7 +82,7 @@ class DomainSSL { $ssl_files['ssl_ca_file'] = makeCorrectFile($sslcertpath.'/'.$domain['domain'].'_CA.pem'); } if ($dom_certs['ssl_cert_chainfile'] != '') { - if ($this->_settings['system']['webserver'] == 'nginx') { + if (Settings::Get('system.webserver') == 'nginx') { // put ca.crt in my.crt, as nginx does not support a separate chain file. $dom_certs['ssl_cert_file'] = trim($dom_certs['ssl_cert_file'])."\n".trim($dom_certs['ssl_cert_chainfile'])."\n"; } else { @@ -117,4 +108,4 @@ class DomainSSL { return; } -} \ No newline at end of file +} diff --git a/lib/functions/filedir/function.makeChownWithNewStats.php b/lib/functions/filedir/function.makeChownWithNewStats.php index b0b1b5dc..6ead2c50 100644 --- a/lib/functions/filedir/function.makeChownWithNewStats.php +++ b/lib/functions/filedir/function.makeChownWithNewStats.php @@ -24,34 +24,30 @@ * * @return void */ -function makeChownWithNewStats($row) -{ - global $settings; +function makeChownWithNewStats($row) { // get correct user - if($settings['system']['mod_fcgid'] == '1' && isset($row['deactivated']) && $row['deactivated'] == '0') - { + if ((Settings::Get('system.mod_fcgid') == '1' || Settings::Get('phpfpm.enabled') == '1') + && isset($row['deactivated']) + && $row['deactivated'] == '0' + ) { $user = $row['loginname']; $group = $row['loginname']; - } - else - { + } else { $user = $row['guid']; $group = $row['guid']; } // get correct directory $dir = $row['documentroot']; - if($settings['system']['awstats_enabled'] == '1') - { + if (Settings::Get('system.awstats_enabled') == '1') { $dir .= '/awstats/'; } else { $dir .= '/webalizer/'; } // only run chown if directory exists - if (file_exists($dir)) - { + if (file_exists($dir)) { // run chown safe_exec('chown -R '.escapeshellarg($user).':'.escapeshellarg($group).' '.escapeshellarg(makeCorrectDir($dir))); } diff --git a/lib/functions/filedir/function.storeDefaultIndex.php b/lib/functions/filedir/function.storeDefaultIndex.php index 98c3af5f..93acffb7 100644 --- a/lib/functions/filedir/function.storeDefaultIndex.php +++ b/lib/functions/filedir/function.storeDefaultIndex.php @@ -27,10 +27,8 @@ */ function storeDefaultIndex($loginname = null, $destination = null, $logger = null, $force = false) { - global $settings; - if ($force - || (int)$settings['system']['store_index_file_subs'] == 1 + || (int)Settings::Get('system.store_index_file_subs') == 1 ) { $result_stmt = Database::prepare(" SELECT `t`.`value`, `c`.`email` AS `customer_email`, `a`.`email` AS `admin_email`, `c`.`loginname` AS `customer_login`, `a`.`loginname` AS `admin_login` @@ -46,7 +44,7 @@ function storeDefaultIndex($loginname = null, $destination = null, $logger = nul $template = $result_stmt->fetch(PDO::FETCH_ASSOC); $replace_arr = array( - 'SERVERNAME' => $settings['system']['hostname'], + 'SERVERNAME' => Settings::Get('system.hostname'), 'CUSTOMER' => $template['customer_login'], 'ADMIN' => $template['admin_login'], 'CUSTOMER_EMAIL' => $template['customer_email'], @@ -54,12 +52,12 @@ function storeDefaultIndex($loginname = null, $destination = null, $logger = nul ); $htmlcontent = replace_variables($template['value'], $replace_arr); - $indexhtmlpath = makeCorrectFile($destination . '/index.' . $settings['system']['index_file_extension']); + $indexhtmlpath = makeCorrectFile($destination . '/index.' . Settings::Get('system.index_file_extension')); $index_html_handler = fopen($indexhtmlpath, 'w'); fwrite($index_html_handler, $htmlcontent); fclose($index_html_handler); if ($logger !== null) { - $logger->logAction(CRON_ACTION, LOG_NOTICE, 'Creating \'index.' . $settings['system']['index_file_extension'] . '\' for Customer \'' . $template['customer_login'] . '\' based on template in directory ' . escapeshellarg($indexhtmlpath)); + $logger->logAction(CRON_ACTION, LOG_NOTICE, 'Creating \'index.' . Settings::Get('system.index_file_extension') . '\' for Customer \'' . $template['customer_login'] . '\' based on template in directory ' . escapeshellarg($indexhtmlpath)); } } else { diff --git a/lib/functions/froxlor/function.CorrectErrorDocument.php b/lib/functions/froxlor/function.CorrectErrorDocument.php index 71835639..bb25bb4d 100644 --- a/lib/functions/froxlor/function.CorrectErrorDocument.php +++ b/lib/functions/froxlor/function.CorrectErrorDocument.php @@ -26,7 +26,7 @@ */ function correctErrorDocument($errdoc = null) { - global $settings, $idna_convert; + global $idna_convert; if ($errdoc !== null && $errdoc != '') { // not a URL @@ -45,15 +45,14 @@ function correctErrorDocument($errdoc = null) { // a string (check for ending ") else { // string won't work for lighty - if ($settings['system']['webserver'] == 'lighttpd') { + if (Settings::Get('system.webserver') == 'lighttpd') { standard_error('stringerrordocumentnotvalidforlighty'); - } elseif(substr($errdoc, -1) != '"') { $errdoc .= '"'; } } } else { - if ($settings['system']['webserver'] == 'lighttpd') { + if (Settings::Get('system.webserver') == 'lighttpd') { standard_error('urlerrordocumentnotvalidforlighty'); } } diff --git a/lib/functions/froxlor/function.createAWStatsConf.php b/lib/functions/froxlor/function.createAWStatsConf.php index 2338ebe9..cc848f8b 100644 --- a/lib/functions/froxlor/function.createAWStatsConf.php +++ b/lib/functions/froxlor/function.createAWStatsConf.php @@ -28,8 +28,6 @@ */ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot, $awstats_params = array()) { - global $settings; - // Generation header $header = "## GENERATED BY FROXLOR\n"; $header2 = "## Do not remove the line above! This tells Froxlor to update this configuration\n## If you wish to manually change this configuration file, remove the first line to make sure Froxlor won't rebuild this file\n## Generated for domain {SITE_DOMAIN} on " . date('l dS \of F Y h:i:s A') . "\n"; @@ -42,8 +40,8 @@ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot makeChownWithNewStats($awstats_params); // weird but could happen... - if (!is_dir($settings['system']['awstats_conf'])) { - safe_exec('mkdir -p '.escapeshellarg($settings['system']['awstats_conf'])); + if (!is_dir(Settings::Get('system.awstats_conf'))) { + safe_exec('mkdir -p '.escapeshellarg(Settings::Get('system.awstats_conf'))); } // These are the variables we will replace @@ -59,11 +57,11 @@ function createAWStatsConf($logFile, $siteDomain, $hostAliases, $customerDocroot $siteDomain, $hostAliases, $awstats_dir, - makeCorrectDir($settings['system']['awstats_conf']) + makeCorrectDir(Settings::Get('system.awstats_conf')) ); // File names - $domain_file = makeCorrectFile($settings['system']['awstats_conf'].'/awstats.' . $siteDomain . '.conf'); + $domain_file = makeCorrectFile(Settings::Get('system.awstats_conf').'/awstats.' . $siteDomain . '.conf'); $model_file = FROXLOR_INSTALL_DIR.'/templates/misc/awstatsmodel/awstats.froxlor.model.conf'; $model_file = makeCorrectFile($model_file); diff --git a/lib/functions/froxlor/function.createAWStatsVhost.php b/lib/functions/froxlor/function.createAWStatsVhost.php deleted file mode 100644 index 55713bb9..00000000 --- a/lib/functions/froxlor/function.createAWStatsVhost.php +++ /dev/null @@ -1,49 +0,0 @@ - (2003-2009) - * @author Froxlor team (2010-) - * @license GPLv2 http://files.froxlor.org/misc/COPYING.txt - * @package Functions - * - */ - -/** - * This function generates the VHost configuration for AWStats - * This will enable the /awstats url and enable security on these folders - * @author Berend Dekens - * - * @param siteDomain Name of the domain we want stats for - * - * @return String with configuration for use in vhost file - */ -function createAWStatsVhost($siteDomain, $settings = null) { - - if ($settings['system']['mod_fcgid'] != '1') { - - $vhosts_file = ' # AWStats statistics' . "\n"; - $vhosts_file.= ' RewriteEngine On' . "\n"; - $vhosts_file.= ' RewriteRule ^/awstats(/.*)?$ /awstats/awstats.pl?config=' . $siteDomain . ' [L,PT]' . "\n"; - $vhosts_file.= ' RewriteRule ^/awstats.pl(.*)$ /awstats/awstats.pl$1 [QSA,L,PT]' . "\n"; - - } else { - - $vhosts_file = ' ' . "\n"; - $vhosts_file.= ' RewriteEngine On' . "\n"; - $vhosts_file.= ' RewriteRule awstats.pl(.*)$ http://' . $settings['system']['hostname'] . '/cgi-bin/awstats.pl$1 [R,P]' . "\n"; - $vhosts_file.= ' RewriteRule awstats$ http://' . $settings['system']['hostname'] . '/cgi-bin/awstats.pl?config=' . $siteDomain . ' [R,P]' . "\n"; - $vhosts_file.= ' ' . "\n"; - - } - - return $vhosts_file; -} diff --git a/lib/functions/froxlor/function.generatePassword.php b/lib/functions/froxlor/function.generatePassword.php index 3653cffb..47241993 100644 --- a/lib/functions/froxlor/function.generatePassword.php +++ b/lib/functions/froxlor/function.generatePassword.php @@ -19,9 +19,8 @@ * Generates a random password */ function generatePassword() { - global $settings; return substr( base64_encode(sha1(md5(uniqid(microtime(), 1))).md5(uniqid(microtime(), 1)).sha1(md5(uniqid(microtime(), 1)))), - rand(5, 50), ($settings['panel']['password_min_length'] > 0 ? $settings['panel']['password_min_length'] : 10) + rand(5, 50), (Settings::Get('panel.password_min_length') > 0 ? Settings::Get('panel.password_min_length') : 10) ); } diff --git a/lib/functions/froxlor/function.getFilesystemQuota.php b/lib/functions/froxlor/function.getFilesystemQuota.php index d7063172..6738967a 100644 --- a/lib/functions/froxlor/function.getFilesystemQuota.php +++ b/lib/functions/froxlor/function.getFilesystemQuota.php @@ -15,38 +15,34 @@ * */ -function getFilesystemQuota() -{ - global $settings, $theme; - if ($settings['system']['diskquota_enabled']) - { - # Fetch all quota in the desired partition - exec($settings['system']['diskquota_repquota_path'] . " -np " . escapeshellarg($settings['system']['diskquota_customer_partition']), $repquota); +function getFilesystemQuota() { + + if (Settings::Get('system.diskquota_enabled')) { + + // Fetch all quota in the desired partition + exec(Settings::Get('system.diskquota_repquota_path') . " -np " . escapeshellarg(Settings::Get('system.diskquota_customer_partition')), $repquota); $usedquota = array(); - foreach ($repquota as $tmpquota) - { - # Let's see if the line matches a quota - line - if (preg_match('/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)/i', $tmpquota, $matches)) - { - # It matches - put it into an array with userid as key (for easy lookup later) + foreach ($repquota as $tmpquota) { + // Let's see if the line matches a quota - line + if (preg_match('/^#([0-9]+)\s*[+-]{2}\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)\s*(\d+)/i', $tmpquota, $matches)) { + // It matches - put it into an array with userid as key (for easy lookup later) $usedquota[$matches[1]] = array( 'block' => array( - 'used' => $matches[2], - 'soft' => $matches[3], - 'hard' => $matches[4], - 'grace' => $matches[5] - ), + 'used' => $matches[2], + 'soft' => $matches[3], + 'hard' => $matches[4], + 'grace' => $matches[5] + ), 'file' => array( - 'used' => $matches[6], - 'soft' => $matches[7], - 'hard' => $matches[8], - 'grace' => $matches[9] - ), + 'used' => $matches[6], + 'soft' => $matches[7], + 'hard' => $matches[8], + 'grace' => $matches[9] + ), ); } } - return $usedquota; } return false; diff --git a/lib/functions/froxlor/function.inserttask.php b/lib/functions/froxlor/function.inserttask.php index f8807d30..a51c76fa 100644 --- a/lib/functions/froxlor/function.inserttask.php +++ b/lib/functions/froxlor/function.inserttask.php @@ -29,8 +29,6 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = '') { - global $settings; - if ($type == '1' || $type == '3' || $type == '4' @@ -38,11 +36,11 @@ function inserttask($type, $param1 = '', $param2 = '', $param3 = '', $param4 = ' || $type == '10' ) { // 4 = bind -> if bind disabled -> no task - if ($type == '4' && $settings['system']['bind_enable'] == '0') { + if ($type == '4' && Settings::Get('system.bind_enable') == '0') { return; } // 10 = quota -> if quota disabled -> no task - if ($type == '10' && $settings['system']['diskquota_enabled'] == '0') { + if ($type == '10' && Settings::Get('system.diskquota_enabled') == '0') { return; } $del_stmt = Database::prepare(" diff --git a/lib/functions/system/function.checklastguid.php b/lib/functions/system/function.checklastguid.php index de15dae2..615fa4bb 100644 --- a/lib/functions/system/function.checklastguid.php +++ b/lib/functions/system/function.checklastguid.php @@ -28,8 +28,8 @@ */ function checkLastGuid() { - global $log, $cronlog, $settings; - + global $log, $cronlog; + $mylog = null; if (isset($cronlog) && $cronlog instanceof FroxlorLogger) { $mylog = $cronlog; @@ -86,10 +86,9 @@ function checkLastGuid() { } // now check if it differs from our settings - if ($update_to_guid != $settings['system']['lastguid']) { + if ($update_to_guid != Settings::Get('system.lastguid')) { $mylog->logAction(CRON_ACTION, LOG_NOTICE, 'Updating froxlor last guid to '.$update_to_guid); - saveSetting('system', 'lastguid', $update_to_guid); - $settings['system']['lastguid'] = $update_to_guid; + Settings::Set('system.lastguid', $update_to_guid); } } else { $mylog->logAction(CRON_ACTION, LOG_NOTICE, 'File /etc/group not readable; cannot check for latest guid'); diff --git a/lib/functions/system/function.makeCryptPassword.php b/lib/functions/system/function.makeCryptPassword.php index 923b6cff..5758a279 100644 --- a/lib/functions/system/function.makeCryptPassword.php +++ b/lib/functions/system/function.makeCryptPassword.php @@ -34,9 +34,7 @@ */ function makeCryptPassword ($password) { - global $settings; - - $type = isset($settings['system']['passwordcryptfunc']) ? (int)$settings['system']['passwordcryptfunc'] : 1; + $type = isset(Settings::Get('system.passwordcryptfunc')) ? (int)Settings::Get('system.passwordcryptfunc') : 1; switch ($type) { case 0: diff --git a/lib/functions/validate/function.checkFcgidPhpFpm.php b/lib/functions/validate/function.checkFcgidPhpFpm.php index 43dbfec1..f8178795 100644 --- a/lib/functions/validate/function.checkFcgidPhpFpm.php +++ b/lib/functions/validate/function.checkFcgidPhpFpm.php @@ -15,27 +15,21 @@ * */ -function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) -{ - global $settings, $theme; +function checkFcgidPhpFpm($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) { $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK); - /* - * check whether fcgid should be enabled but php-fpm is - */ + // check whether fcgid should be enabled but php-fpm is if($fieldname == 'system_mod_fcgid_enabled' && (int)$newfieldvalue == 1 - && (int)$settings['phpfpm']['enabled'] == 1 + && (int)Settings::Get('phpfpm.enabled') == 1 ) { $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'phpfpmstillenabled'); } - /* - * check whether php-fpm should be enabled but fcgid is - */ + // check whether php-fpm should be enabled but fcgid is elseif($fieldname == 'system_phpfpm_enabled' && (int)$newfieldvalue == 1 - && (int)$settings['system']['mod_fcgid'] == 1 + && (int)Settings::Get('system.mod_fcgid') == 1 ) { $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenabled'); } diff --git a/lib/functions/validate/function.checkPathConflicts.php b/lib/functions/validate/function.checkPathConflicts.php index df87a070..da58eb03 100644 --- a/lib/functions/validate/function.checkPathConflicts.php +++ b/lib/functions/validate/function.checkPathConflicts.php @@ -15,44 +15,30 @@ * */ -function checkPathConflicts($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) -{ - global $settings, $theme; - if((int)$settings['system']['mod_fcgid'] == 1) - { - /** - * fcgid-configdir has changed -> - * check against customer-doc-prefix - */ - if($fieldname == "system_mod_fcgid_configdir") - { +function checkPathConflicts($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) { + + if((int)Settings::Get('system.mod_fcgid') == 1) { + // fcgid-configdir has changed -> check against customer-doc-prefix + if ($fieldname == "system_mod_fcgid_configdir") { $newdir = makeCorrectDir($newfieldvalue); - $cdir = makeCorrectDir($settings['system']['documentroot_prefix']); + $cdir = makeCorrectDir(Settings::Get('system.documentroot_prefix')); } - /** - * customer-doc-prefix has changed -> - * check against fcgid-configdir - */ - elseif($fieldname == "system_documentroot_prefix") - { + // customer-doc-prefix has changed -> check against fcgid-configdir + elseif ($fieldname == "system_documentroot_prefix") { $newdir = makeCorrectDir($newfieldvalue); - $cdir = makeCorrectDir($settings['system']['mod_fcgid_configdir']); + $cdir = makeCorrectDir(Settings::Get('system.mod_fcgid_configdir')); } // neither dir can be within the other nor can they be equal - if(substr($newdir, 0, strlen($cdir)) == $cdir - || substr($cdir, 0, strlen($newdir)) == $newdir - || $newdir == $cdir + if (substr($newdir, 0, strlen($cdir)) == $cdir + || substr($cdir, 0, strlen($newdir)) == $newdir + || $newdir == $cdir ) { $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidpathcannotbeincustomerdoc'); - } - else - { + } else { $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK); } - } - else - { + } else { $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK); } diff --git a/lib/functions/validate/function.checkPhpInterfaceSetting.php b/lib/functions/validate/function.checkPhpInterfaceSetting.php index be13f268..3f525634 100644 --- a/lib/functions/validate/function.checkPhpInterfaceSetting.php +++ b/lib/functions/validate/function.checkPhpInterfaceSetting.php @@ -18,11 +18,9 @@ function checkPhpInterfaceSetting($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) { - global $settings; - $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK); - if ((int)$settings['system']['mod_fcgid'] == 1) { + if ((int)Settings::Get('system.mod_fcgid') == 1) { // now check if we enable a webserver != apache if (strtolower($newfieldvalue) != 'apache2') { $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'fcgidstillenableddeadlock'); diff --git a/lib/functions/validate/function.checkUsername.php b/lib/functions/validate/function.checkUsername.php index ba26c275..f00ea977 100644 --- a/lib/functions/validate/function.checkUsername.php +++ b/lib/functions/validate/function.checkUsername.php @@ -17,20 +17,20 @@ * */ -function checkUsername($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) -{ - global $settings, $theme; - if(!isset($allnewfieldvalues['customer_mysqlprefix'])) - { - $allnewfieldvalues['customer_mysqlprefix'] = $settings['customer']['mysqlprefix']; +function checkUsername($fieldname, $fielddata, $newfieldvalue, $allnewfieldvalues) { + + if (!isset($allnewfieldvalues['customer_mysqlprefix'])) { + $allnewfieldvalues['customer_mysqlprefix'] = Settings::Get('customer.mysqlprefix'); } + $returnvalue = array(); - if(validateUsername($newfieldvalue, $settings['panel']['unix_names'], 14 - strlen($allnewfieldvalues['customer_mysqlprefix'])) === true) - { + if (validateUsername( + $newfieldvalue, + Settings::Get('panel.unix_names'), + 14 - strlen($allnewfieldvalues['customer_mysqlprefix'])) === true + ) { $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_OK); - } - else - { + } else { $returnvalue = array(FORMFIELDS_PLAUSIBILITY_CHECK_ERROR, 'accountprefixiswrong'); } return $returnvalue; diff --git a/lib/functions/validate/function.validatePassword.php b/lib/functions/validate/function.validatePassword.php index 84481fcd..94bb26b8 100644 --- a/lib/functions/validate/function.validatePassword.php +++ b/lib/functions/validate/function.validatePassword.php @@ -26,24 +26,22 @@ * * @return string either the password or an errormessage+exit */ -function validatePassword($password = null) -{ - global $settings, $theme; +function validatePassword($password = null) { - if ($settings['panel']['password_min_length'] > 0) { + if (Settings::Get('panel.password_min_length') > 0) { $password = validate( $password, - $settings['panel']['password_min_length'], /* replacer needs to be password length, not the fieldname */ - '/^.{'.(int)$settings['panel']['password_min_length'].',}$/D', + Settings::Get('panel.password_min_length'), + '/^.{'.(int)Settings::Get('panel.password_min_length').',}$/D', 'notrequiredpasswordlength' ); } - if ($settings['panel']['password_regex'] != '') { + if (Settings::Get('panel.password_regex') != '') { $password = validate( $password, - $settings['panel']['password_regex'], - $settings['panel']['password_regex'], + Settings::Get('panel.password_regex'), + Settings::Get('panel.password_regex'), 'notrequiredpasswordcomplexity' ); } diff --git a/scripts/jobs/cron_tasks.inc.http.10.apache.php b/scripts/jobs/cron_tasks.inc.http.10.apache.php index c478168d..61a10e25 100644 --- a/scripts/jobs/cron_tasks.inc.http.10.apache.php +++ b/scripts/jobs/cron_tasks.inc.http.10.apache.php @@ -219,7 +219,7 @@ class apache 'loginname' => 'froxlor.panel', 'documentroot' => $mypath ); - $php = new phpinterface($this->settings, $domain); + $php = new phpinterface($domain); $phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']); $starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter'); @@ -258,7 +258,7 @@ class apache 'documentroot' => $mypath, ); - $php = new phpinterface($this->settings, $domain); + $php = new phpinterface($domain); $phpconfig = $php->getPhpConfig($this->settings['phpfpm']['vhost_defaultini']); $srvName = substr(md5($ipport),0,4).'.fpm.external'; if ($row_ipsandports['ssl']) { @@ -642,7 +642,7 @@ class apache $domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile']; // SSL STUFF - $dssl = new DomainSSL($this->settings); + $dssl = new DomainSSL(); // this sets the ssl-related array-indices in the $domain array // if the domain has customer-defined ssl-certificates $dssl->setDomainSSLFilesArray($domain); diff --git a/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php b/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php index c331a944..41e9d6aa 100644 --- a/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php +++ b/scripts/jobs/cron_tasks.inc.http.15.apache_fcgid.php @@ -25,7 +25,7 @@ class apache_fcgid extends apache if($domain['phpenabled'] == '1') { - $php = new phpinterface($this->settings, $domain); + $php = new phpinterface($domain); $phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']); if((int)$this->settings['phpfpm']['enabled'] == 1) @@ -141,7 +141,7 @@ class apache_fcgid extends apache safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath)); // get php.ini for our own vhost - $php = new phpinterface($this->settings, $domain); + $php = new phpinterface($domain); // get php-config if ($this->settings['phpfpm']['enabled'] == '1') { diff --git a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php index f485b839..b4625887 100644 --- a/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php +++ b/scripts/jobs/cron_tasks.inc.http.20.lighttpd.php @@ -135,7 +135,7 @@ class lighttpd 'documentroot' => $mypath ); - $php = new phpinterface($this->settings, $domain); + $php = new phpinterface($domain); $this->lighttpd_data[$vhost_filename].= ' fastcgi.server = ( '."\n"; $this->lighttpd_data[$vhost_filename].= "\t".'".php" => ('."\n"; @@ -434,7 +434,7 @@ class lighttpd $domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile']; // SSL STUFF - $dssl = new DomainSSL($this->settings); + $dssl = new DomainSSL(); // this sets the ssl-related array-indices in the $domain array // if the domain has customer-defined ssl-certificates $dssl->setDomainSSLFilesArray($domain); diff --git a/scripts/jobs/cron_tasks.inc.http.25.lighttpd_fcgid.php b/scripts/jobs/cron_tasks.inc.http.25.lighttpd_fcgid.php index 117902a7..8dd69b59 100644 --- a/scripts/jobs/cron_tasks.inc.http.25.lighttpd_fcgid.php +++ b/scripts/jobs/cron_tasks.inc.http.25.lighttpd_fcgid.php @@ -23,7 +23,7 @@ class lighttpd_fcgid extends lighttpd if($domain['phpenabled'] == '1') { - $php = new phpinterface($this->settings, $domain); + $php = new phpinterface($domain); $phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']); // vhost data for php-fpm @@ -134,7 +134,7 @@ class lighttpd_fcgid extends lighttpd safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath)); // get php.ini for our own vhost - $php = new phpinterface($this->settings, $domain); + $php = new phpinterface($domain); // get php-config if ($this->settings['phpfpm']['enabled'] == '1') { diff --git a/scripts/jobs/cron_tasks.inc.http.30.nginx.php b/scripts/jobs/cron_tasks.inc.http.30.nginx.php index f3c9485a..87e7c23f 100644 --- a/scripts/jobs/cron_tasks.inc.http.30.nginx.php +++ b/scripts/jobs/cron_tasks.inc.http.30.nginx.php @@ -228,7 +228,7 @@ class nginx 'documentroot' => $mypath, ); - $php = new phpinterface($this->settings, $domain); + $php = new phpinterface($domain); $this->nginx_data[$vhost_filename] .= "\t\t".'fastcgi_pass unix:' . $php->getInterface()->getSocketFile() . ';' . "\n"; } else { $this->nginx_data[$vhost_filename] .= "\t\t".'fastcgi_pass ' . $this->settings['system']['nginx_php_backend'] . ';' . "\n"; @@ -351,7 +351,7 @@ class nginx $domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile']; // SSL STUFF - $dssl = new DomainSSL($this->settings); + $dssl = new DomainSSL(); // this sets the ssl-related array-indices in the $domain array // if the domain has customer-defined ssl-certificates $dssl->setDomainSSLFilesArray($domain); diff --git a/scripts/jobs/cron_tasks.inc.http.35.nginx_phpfpm.php b/scripts/jobs/cron_tasks.inc.http.35.nginx_phpfpm.php index fc3101da..28de91fc 100644 --- a/scripts/jobs/cron_tasks.inc.http.35.nginx_phpfpm.php +++ b/scripts/jobs/cron_tasks.inc.http.35.nginx_phpfpm.php @@ -23,7 +23,7 @@ class nginx_phpfpm extends nginx if($domain['phpenabled'] == '1') { - $php = new phpinterface($this->settings, $domain); + $php = new phpinterface($domain); $phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']); $php_options_text = "\t".'location ~ \.php$ {'."\n"; @@ -81,7 +81,7 @@ class nginx_phpfpm extends nginx safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath)); // get php.ini for our own vhost - $php = new phpinterface($this->settings, $domain); + $php = new phpinterface($domain); // get php-config if ($this->settings['phpfpm']['enabled'] == '1') { diff --git a/scripts/jobs/cron_tasks.php b/scripts/jobs/cron_tasks.php index 2ec26564..cae0f840 100644 --- a/scripts/jobs/cron_tasks.php +++ b/scripts/jobs/cron_tasks.php @@ -51,7 +51,7 @@ while ($row = $result_tasks_stmt->fetch(PDO::FETCH_ASSOC)) { if ($row['type'] == '1') { // get configuration-I/O object - $configio = new ConfigIO($settings); + $configio = new ConfigIO(); // clean up old configs $configio->cleanUp();