more implementing of new Settings class, refs #1325
Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
@@ -179,8 +179,7 @@ if ($page == 'tickets'
|
|||||||
if (isset($_POST['send'])
|
if (isset($_POST['send'])
|
||||||
&& $_POST['send'] == 'send'
|
&& $_POST['send'] == 'send'
|
||||||
) {
|
) {
|
||||||
// FIXME ticket -> settings
|
$newticket = ticket::getInstanceOf($userinfo, -1);
|
||||||
$newticket = ticket::getInstanceOf($userinfo, $settings, -1);
|
|
||||||
$newticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
|
$newticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
|
||||||
$newticket->Set('priority', validate($_POST['priority'], 'priority'), true, false);
|
$newticket->Set('priority', validate($_POST['priority'], 'priority'), true, false);
|
||||||
$newticket->Set('category', validate($_POST['category'], 'category'), true, false);
|
$newticket->Set('category', validate($_POST['category'], 'category'), true, false);
|
||||||
@@ -271,8 +270,7 @@ if ($page == 'tickets'
|
|||||||
if (isset($_POST['send'])
|
if (isset($_POST['send'])
|
||||||
&& $_POST['send'] == 'send'
|
&& $_POST['send'] == 'send'
|
||||||
) {
|
) {
|
||||||
// FIXME ticket -> settings
|
$replyticket = ticket::getInstanceOf($userinfo, -1);
|
||||||
$replyticket = ticket::getInstanceOf($userinfo, $settings, -1);
|
|
||||||
$replyticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
|
$replyticket->Set('subject', validate($_POST['subject'], 'subject'), true, false);
|
||||||
$replyticket->Set('priority', validate($_POST['priority'], 'priority'), 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);
|
$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'));
|
standard_error(array('stringisempty', 'mymessage'));
|
||||||
} else {
|
} else {
|
||||||
$now = time();
|
$now = time();
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
$replyticket->Set('customer', $mainticket->Get('customer'), true, true);
|
$replyticket->Set('customer', $mainticket->Get('customer'), true, true);
|
||||||
$replyticket->Set('lastchange', $now, true, true);
|
$replyticket->Set('lastchange', $now, true, true);
|
||||||
$replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
|
$replyticket->Set('ip', $_SERVER['REMOTE_ADDR'], true, true);
|
||||||
@@ -308,8 +305,7 @@ if ($page == 'tickets'
|
|||||||
} else {
|
} else {
|
||||||
|
|
||||||
$ticket_replies = '';
|
$ticket_replies = '';
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
$dt = date("d.m.Y H:i\h", $mainticket->Get('dt'));
|
$dt = date("d.m.Y H:i\h", $mainticket->Get('dt'));
|
||||||
$status = ticket::getStatusText($lng, $mainticket->Get('status'));
|
$status = ticket::getStatusText($lng, $mainticket->Get('status'));
|
||||||
|
|
||||||
@@ -352,8 +348,7 @@ if ($page == 'tickets'
|
|||||||
$numrows_andere = Database::num_rows();
|
$numrows_andere = Database::num_rows();
|
||||||
|
|
||||||
while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) {
|
while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
// FIXME ticket -> settings
|
$subticket = ticket::getInstanceOf($userinfo, (int)$row2['id']);
|
||||||
$subticket = ticket::getInstanceOf($userinfo, $settings, (int)$row2['id']);
|
|
||||||
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
|
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
|
||||||
|
|
||||||
if ($subticket->Get('by') == '1') {
|
if ($subticket->Get('by') == '1') {
|
||||||
@@ -400,8 +395,7 @@ if ($page == 'tickets'
|
|||||||
&& $_POST['send'] == 'send'
|
&& $_POST['send'] == 'send'
|
||||||
) {
|
) {
|
||||||
$now = time();
|
$now = time();
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
$mainticket->Set('lastchange', $now, true, true);
|
$mainticket->Set('lastchange', $now, true, true);
|
||||||
$mainticket->Set('lastreplier', '1', true, true);
|
$mainticket->Set('lastreplier', '1', true, true);
|
||||||
$mainticket->Set('status', '3', 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') . "'");
|
$log->logAction(ADM_ACTION, LOG_NOTICE, "closed ticket '" . $mainticket->Get('subject') . "'");
|
||||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||||
} else {
|
} else {
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
ask_yesno('ticket_reallyclose', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
ask_yesno('ticket_reallyclose', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -418,8 +411,7 @@ if ($page == 'tickets'
|
|||||||
&& $id != 0
|
&& $id != 0
|
||||||
) {
|
) {
|
||||||
$now = time();
|
$now = time();
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
$mainticket->Set('lastchange', $now, true, true);
|
$mainticket->Set('lastchange', $now, true, true);
|
||||||
$mainticket->Set('lastreplier', '1', true, true);
|
$mainticket->Set('lastreplier', '1', true, true);
|
||||||
$mainticket->Set('status', '0', true, true);
|
$mainticket->Set('status', '0', true, true);
|
||||||
@@ -434,8 +426,7 @@ if ($page == 'tickets'
|
|||||||
&& $_POST['send'] == 'send'
|
&& $_POST['send'] == 'send'
|
||||||
) {
|
) {
|
||||||
$now = time();
|
$now = time();
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
$mainticket->Set('lastchange', $now, true, true);
|
$mainticket->Set('lastchange', $now, true, true);
|
||||||
$mainticket->Set('lastreplier', '1', true, true);
|
$mainticket->Set('lastreplier', '1', true, true);
|
||||||
$mainticket->Set('status', '3', 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') . "'");
|
$log->logAction(ADM_ACTION, LOG_NOTICE, "archived ticket '" . $mainticket->Get('subject') . "'");
|
||||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||||
} else {
|
} else {
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
ask_yesno('ticket_reallyarchive', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
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'])
|
if (isset($_POST['send'])
|
||||||
&& $_POST['send'] == 'send'
|
&& $_POST['send'] == 'send'
|
||||||
) {
|
) {
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted ticket '" . $mainticket->Get('subject') . "'");
|
$log->logAction(ADM_ACTION, LOG_INFO, "deleted ticket '" . $mainticket->Get('subject') . "'");
|
||||||
$mainticket->Delete();
|
$mainticket->Delete();
|
||||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||||
} else {
|
} else {
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
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);
|
$log->logAction(ADM_ACTION, LOG_NOTICE, "viewed archived-ticket #" . $id);
|
||||||
$ticket_replies = '';
|
$ticket_replies = '';
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
$lastchange = date("d.m.Y H:i\h", $mainticket->Get('lastchange'));
|
$lastchange = date("d.m.Y H:i\h", $mainticket->Get('lastchange'));
|
||||||
$dt = date("d.m.Y H:i\h", $mainticket->Get('dt'));
|
$dt = date("d.m.Y H:i\h", $mainticket->Get('dt'));
|
||||||
$status = ticket::getStatusText($lng, $mainticket->Get('status'));
|
$status = ticket::getStatusText($lng, $mainticket->Get('status'));
|
||||||
@@ -855,8 +842,7 @@ if ($page == 'tickets'
|
|||||||
$numrows_andere = Database::num_rows();
|
$numrows_andere = Database::num_rows();
|
||||||
|
|
||||||
while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) {
|
while ($row2 = $andere_stmt->fetch(PDO::FETCH_ASSOC)) {
|
||||||
// FIXME ticket -> settings
|
$subticket = ticket::getInstanceOf($userinfo, (int)$row2['id']);
|
||||||
$subticket = ticket::getInstanceOf($userinfo, $settings, (int)$row2['id']);
|
|
||||||
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
|
$lastchange = date("d.m.Y H:i\h", $subticket->Get('lastchange'));
|
||||||
|
|
||||||
if ($subticket->Get('by') == '1') {
|
if ($subticket->Get('by') == '1') {
|
||||||
@@ -907,14 +893,12 @@ if ($page == 'tickets'
|
|||||||
if (isset($_POST['send'])
|
if (isset($_POST['send'])
|
||||||
&& $_POST['send'] == 'send'
|
&& $_POST['send'] == 'send'
|
||||||
) {
|
) {
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
$log->logAction(ADM_ACTION, LOG_INFO, "deleted archived ticket '" . $mainticket->Get('subject') . "'");
|
$log->logAction(ADM_ACTION, LOG_INFO, "deleted archived ticket '" . $mainticket->Get('subject') . "'");
|
||||||
$mainticket->Delete();
|
$mainticket->Delete();
|
||||||
redirectTo($filename, array('page' => $page, 's' => $s));
|
redirectTo($filename, array('page' => $page, 's' => $s));
|
||||||
} else {
|
} else {
|
||||||
// FIXME ticket -> settings
|
$mainticket = ticket::getInstanceOf($userinfo, (int)$id);
|
||||||
$mainticket = ticket::getInstanceOf($userinfo, $settings, (int)$id);
|
|
||||||
ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
ask_yesno('ticket_reallydelete', $filename, array('id' => $id, 'page' => $page, 'action' => $action), $mainticket->Get('subject'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -297,7 +297,7 @@ class Database {
|
|||||||
* @param bool $showerror if set to false, the error will be logged but we go on
|
* @param bool $showerror if set to false, the error will be logged but we go on
|
||||||
*/
|
*/
|
||||||
private static function _showerror($error, $showerror = true) {
|
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
|
* log to a file, so we can actually ask people for the error
|
||||||
@@ -336,8 +336,8 @@ class Database {
|
|||||||
|
|
||||||
$err_report_html = '';
|
$err_report_html = '';
|
||||||
if (is_array($userinfo) && (
|
if (is_array($userinfo) && (
|
||||||
($userinfo['adminsession'] == '1' && $settings['system']['allow_error_report_admin'] == '1')
|
($userinfo['adminsession'] == '1' && Settings::Get('system.allow_error_report_admin') == '1')
|
||||||
|| ($userinfo['adminsession'] == '0' && $settings['system']['allow_error_report_customer'] == '1'))
|
|| ($userinfo['adminsession'] == '0' && Settings::Get('system.allow_error_report_customer') == '1'))
|
||||||
) {
|
) {
|
||||||
$err_report_html = '<a href="<LINK>" title="Click here to report error">Report error</a>';
|
$err_report_html = '<a href="<LINK>" title="Click here to report error">Report error</a>';
|
||||||
$err_report_html = str_replace("<LINK>", $linker->getLink(array('section' => 'index', 'page' => 'send_error_report', 'errorid' => $errid)), $err_report_html);
|
$err_report_html = str_replace("<LINK>", $linker->getLink(array('section' => 'index', 'page' => 'send_error_report', 'errorid' => $errid)), $err_report_html);
|
||||||
|
|||||||
@@ -33,68 +33,65 @@ LOG_DEBUG debug-level message
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
abstract class AbstractLogger
|
abstract class AbstractLogger {
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Settings array
|
|
||||||
* @var settings
|
|
||||||
*/
|
|
||||||
|
|
||||||
private $settings = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/Disable Logging
|
* Enable/Disable Logging
|
||||||
* @var logenabled
|
* @var logenabled
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private $logenabled = false;
|
private $logenabled = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enable/Disable Cronjob-Logging
|
* Enable/Disable Cronjob-Logging
|
||||||
* @var logcronjob
|
* @var logcronjob
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private $logcronjob = false;
|
private $logcronjob = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loggin-Severity
|
* Loggin-Severity
|
||||||
* @var severity
|
* @var severity
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private $severity = 1;
|
private $severity = 1;
|
||||||
|
|
||||||
// normal
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setup the main logger
|
* setup the main logger
|
||||||
*
|
|
||||||
* @param array settings
|
|
||||||
*/
|
*/
|
||||||
|
protected function setupLogger() {
|
||||||
protected function setupLogger($settings)
|
$this->logenabled = Settings::Get('logger.enabled');
|
||||||
{
|
$this->logcronjob = Settings::Get('logger.log_cron');
|
||||||
$this->settings = $settings;
|
$this->severity = Settings::Get('logger.severity');
|
||||||
$this->logenabled = $this->settings['logger']['enabled'];
|
|
||||||
$this->logcronjob = $this->settings['logger']['log_cron'];
|
|
||||||
$this->severity = $this->settings['logger']['severity'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function isEnabled()
|
/**
|
||||||
{
|
* return whether this logging is enabled
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function isEnabled() {
|
||||||
return $this->logenabled;
|
return $this->logenabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getSeverity()
|
/**
|
||||||
{
|
* return the log severity
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
protected function getSeverity() {
|
||||||
return $this->severity;
|
return $this->severity;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function logCron()
|
/**
|
||||||
{
|
* whether to log cron-runs or not
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
protected function logCron() {
|
||||||
return $this->logcronjob;
|
return $this->logcronjob;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* logs a given text
|
||||||
|
*/
|
||||||
abstract public function logAction();
|
abstract public function logAction();
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
}
|
||||||
|
|||||||
@@ -20,65 +20,61 @@
|
|||||||
* Logger - File-Logger-Class
|
* Logger - File-Logger-Class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FileLogger extends AbstractLogger
|
class FileLogger extends AbstractLogger {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Userinfo
|
* Userinfo
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private $userinfo = array();
|
private $userinfo = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logfile
|
* Logfile
|
||||||
* @var logfile
|
* @var logfile
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private $logfile = null;
|
private $logfile = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Syslogger Objects Array
|
* Syslogger Objects Array
|
||||||
* @var loggers
|
* @var loggers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static private $loggers = array();
|
static private $loggers = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param array userinfo
|
* @param array userinfo
|
||||||
* @param array settings
|
|
||||||
*/
|
*/
|
||||||
|
protected function __construct($userinfo) {
|
||||||
protected function __construct($userinfo, $settings)
|
parent::setupLogger();
|
||||||
{
|
|
||||||
parent::setupLogger($settings);
|
|
||||||
$this->userinfo = $userinfo;
|
$this->userinfo = $userinfo;
|
||||||
$this->setLogFile($settings['logger']['logfile']);
|
$this->setLogFile(Settings::Get('logger.logfile'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Singleton ftw ;-)
|
* Singleton ftw ;-)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
static public function getInstanceOf($_usernfo) {
|
||||||
static public function getInstanceOf($_usernfo, $_settings)
|
if (!isset(self::$loggers[$_usernfo['loginname']])) {
|
||||||
{
|
self::$loggers[$_usernfo['loginname']] = new FileLogger($_usernfo);
|
||||||
if(!isset(self::$loggers[$_usernfo['loginname']]))
|
|
||||||
{
|
|
||||||
self::$loggers[$_usernfo['loginname']] = new FileLogger($_usernfo, $_settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$loggers[$_usernfo['loginname']];
|
return self::$loggers[$_usernfo['loginname']];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null)
|
/**
|
||||||
{
|
* logs a given text to all enabled logger-facilities
|
||||||
if(parent::isEnabled())
|
*
|
||||||
{
|
* @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
|
if (parent::getSeverity() <= 1
|
||||||
&& $type == LOG_NOTICE)
|
&& $type == LOG_NOTICE
|
||||||
{
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -87,22 +83,25 @@ class FileLogger extends AbstractLogger
|
|||||||
switch($action)
|
switch($action)
|
||||||
{
|
{
|
||||||
case USR_ACTION:
|
case USR_ACTION:
|
||||||
$_action = 'customer';
|
$_action = $lng['admin']['customer'];
|
||||||
break;
|
break;
|
||||||
case RES_ACTION:
|
case RES_ACTION:
|
||||||
$_action = 'reseller';
|
$_action = $lng['logger']['reseller'];
|
||||||
break;
|
break;
|
||||||
case ADM_ACTION:
|
case ADM_ACTION:
|
||||||
$_action = 'administrator';
|
$_action = $lng['logger']['admin'];
|
||||||
break;
|
break;
|
||||||
case CRON_ACTION:
|
case CRON_ACTION:
|
||||||
$_action = 'cronjob';
|
$_action = $lng['logger']['cron'];
|
||||||
|
break;
|
||||||
|
case LOGIN_ACTION:
|
||||||
|
$_action = $lng['logger']['login'];
|
||||||
break;
|
break;
|
||||||
case LOG_ERROR:
|
case LOG_ERROR:
|
||||||
$_action = 'internal';
|
$_action = $lng['logger']['intern'];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$_action = 'unknown';
|
$_action = $lng['logger']['unknown'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,20 +20,14 @@
|
|||||||
* Logger - Froxlor-Base-Logger-Class
|
* Logger - Froxlor-Base-Logger-Class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class FroxlorLogger
|
class FroxlorLogger {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Userinfo
|
* Userinfo
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $userinfo = array();
|
private $userinfo = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings array
|
|
||||||
* @var settings
|
|
||||||
*/
|
|
||||||
private $settings = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* LogTypes Array
|
* LogTypes Array
|
||||||
* @var logtypes
|
* @var logtypes
|
||||||
@@ -50,25 +44,21 @@ class FroxlorLogger
|
|||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param array userinfo
|
* @param array userinfo
|
||||||
* @param array settings
|
|
||||||
*/
|
*/
|
||||||
protected function __construct($userinfo, $settings) {
|
protected function __construct($userinfo) {
|
||||||
$this->userinfo = $userinfo;
|
$this->userinfo = $userinfo;
|
||||||
$this->settings = $settings;
|
|
||||||
self::$logtypes = array();
|
self::$logtypes = array();
|
||||||
|
|
||||||
if (!isset($this->settings['logger']['logtypes'])
|
if ((Settings::Get('logger.logtypes') == null || Settings::Get('logger.logtypes') == '')
|
||||||
&& (!isset($this->settings['logger']['logtypes']) || $this->settings['logger']['logtypes'] == '')
|
&& (Settings::Get('logger.enabled') !== null && Settings::Get('logger.enabled'))
|
||||||
&& isset($this->settings['logger']['enabled'])
|
|
||||||
&& $this->settings['logger']['enabled']
|
|
||||||
) {
|
) {
|
||||||
self::$logtypes[0] = 'syslog';
|
self::$logtypes[0] = 'syslog';
|
||||||
self::$logtypes[1] = 'mysql';
|
self::$logtypes[1] = 'mysql';
|
||||||
} else {
|
} else {
|
||||||
if (isset($this->settings['logger']['logtypes'])
|
if (Settings::Get('logger.logtypes') !== null
|
||||||
&& $this->settings['logger']['logtypes'] != ''
|
&& Settings::Get('logger.logtypes') != ''
|
||||||
) {
|
) {
|
||||||
self::$logtypes = explode(',', $this->settings['logger']['logtypes']);
|
self::$logtypes = explode(',', Settings::Get('logger.logtypes'));
|
||||||
} else {
|
} else {
|
||||||
self::$logtypes = null;
|
self::$logtypes = null;
|
||||||
}
|
}
|
||||||
@@ -79,8 +69,8 @@ class FroxlorLogger
|
|||||||
* Singleton ftw ;-)
|
* Singleton ftw ;-)
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static public function getInstanceOf($_usernfo, $_settings)
|
static public function getInstanceOf($_usernfo) {
|
||||||
{
|
|
||||||
if (!isset($_usernfo)
|
if (!isset($_usernfo)
|
||||||
|| $_usernfo == null
|
|| $_usernfo == null
|
||||||
) {
|
) {
|
||||||
@@ -89,19 +79,26 @@ class FroxlorLogger
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!isset(self::$loggers[$_usernfo['loginname']])) {
|
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']];
|
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) {
|
public function logAction ($action = USR_ACTION, $type = LOG_NOTICE, $text = null) {
|
||||||
|
|
||||||
if (self::$logtypes == null) {
|
if (self::$logtypes == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->settings['logger']['log_cron'] == '0'
|
if (Settings::Get('logger.log_cron') == '0'
|
||||||
&& $action == CRON_ACTION
|
&& $action == CRON_ACTION
|
||||||
) {
|
) {
|
||||||
return;
|
return;
|
||||||
@@ -112,12 +109,12 @@ class FroxlorLogger
|
|||||||
switch ($logger)
|
switch ($logger)
|
||||||
{
|
{
|
||||||
case 'syslog':
|
case 'syslog':
|
||||||
$_log = SysLogger::getInstanceOf($this->userinfo, $this->settings);
|
$_log = SysLogger::getInstanceOf($this->userinfo);
|
||||||
break;
|
break;
|
||||||
case 'file':
|
case 'file':
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$_log = FileLogger::getInstanceOf($this->userinfo, $this->settings);
|
$_log = FileLogger::getInstanceOf($this->userinfo);
|
||||||
}
|
}
|
||||||
catch(Exception $e)
|
catch(Exception $e)
|
||||||
{
|
{
|
||||||
@@ -129,7 +126,7 @@ class FroxlorLogger
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'mysql':
|
case 'mysql':
|
||||||
$_log = MysqlLogger::getInstanceOf($this->userinfo, $this->settings);
|
$_log = MysqlLogger::getInstanceOf($this->userinfo);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$_log = null;
|
$_log = null;
|
||||||
@@ -150,6 +147,13 @@ class FroxlorLogger
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set whether to log cron-runs
|
||||||
|
*
|
||||||
|
* @param bool $_cronlog
|
||||||
|
*
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
public function setCronLog($_cronlog = 0) {
|
public function setCronLog($_cronlog = 0) {
|
||||||
|
|
||||||
$_cronlog = (int)$_cronlog;
|
$_cronlog = (int)$_cronlog;
|
||||||
@@ -159,13 +163,7 @@ class FroxlorLogger
|
|||||||
) {
|
) {
|
||||||
$_cronlog = 0;
|
$_cronlog = 0;
|
||||||
}
|
}
|
||||||
|
Settings::Set('logger.log_cron', $_cronlog);
|
||||||
$stmt = Database::prepare("
|
|
||||||
UPDATE `" . TABLE_PANEL_SETTINGS . "` SET
|
|
||||||
`value` = :value
|
|
||||||
WHERE `settinggroup`='logger' AND `varname`='log_cron'"
|
|
||||||
);
|
|
||||||
Database::pexecute($stmt, array('value' => $_cronlog));
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,25 +38,29 @@ class MysqlLogger extends AbstractLogger {
|
|||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param array userinfo
|
* @param array userinfo
|
||||||
* @param array settings
|
|
||||||
*/
|
*/
|
||||||
protected function __construct($userinfo, $settings) {
|
protected function __construct($userinfo) {
|
||||||
parent::setupLogger($settings);
|
parent::setupLogger();
|
||||||
$this->userinfo = $userinfo;
|
$this->userinfo = $userinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Singleton ftw ;-)
|
* Singleton ftw ;-)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
static public function getInstanceOf($_usernfo, $_settings) {
|
static public function getInstanceOf($_usernfo) {
|
||||||
|
|
||||||
if (!isset(self::$loggers[$_usernfo['loginname']])) {
|
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']];
|
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) {
|
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) {
|
||||||
|
|
||||||
if (parent::isEnabled()) {
|
if (parent::isEnabled()) {
|
||||||
|
|||||||
@@ -20,57 +20,54 @@
|
|||||||
* Logger - SysLog-Logger-Class
|
* Logger - SysLog-Logger-Class
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class SysLogger extends AbstractLogger
|
class SysLogger extends AbstractLogger {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Userinfo
|
* Userinfo
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private $userinfo = array();
|
private $userinfo = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Syslogger Objects Array
|
* Syslogger Objects Array
|
||||||
* @var loggers
|
* @var loggers
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static private $loggers = array();
|
static private $loggers = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param array userinfo
|
* @param array userinfo
|
||||||
* @param array settings
|
|
||||||
*/
|
*/
|
||||||
|
protected function __construct($userinfo) {
|
||||||
protected function __construct($userinfo, $settings)
|
parent::setupLogger();
|
||||||
{
|
|
||||||
parent::setupLogger($settings);
|
|
||||||
$this->userinfo = $userinfo;
|
$this->userinfo = $userinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Singleton ftw ;-)
|
* Singleton ftw ;-)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
static public function getInstanceOf($_usernfo) {
|
||||||
static public function getInstanceOf($_usernfo, $_settings)
|
if (!isset(self::$loggers[$_usernfo['loginname']])) {
|
||||||
{
|
self::$loggers[$_usernfo['loginname']] = new SysLogger($_usernfo);
|
||||||
if(!isset(self::$loggers[$_usernfo['loginname']]))
|
|
||||||
{
|
|
||||||
self::$loggers[$_usernfo['loginname']] = new SysLogger($_usernfo, $_settings);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return self::$loggers[$_usernfo['loginname']];
|
return self::$loggers[$_usernfo['loginname']];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null)
|
/**
|
||||||
{
|
* logs a given text to all enabled logger-facilities
|
||||||
if(parent::isEnabled())
|
*
|
||||||
{
|
* @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
|
if (parent::getSeverity() <= 1
|
||||||
&& $type == LOG_NOTICE)
|
&& $type == LOG_NOTICE
|
||||||
{
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,28 +76,31 @@ class SysLogger extends AbstractLogger
|
|||||||
switch($action)
|
switch($action)
|
||||||
{
|
{
|
||||||
case USR_ACTION:
|
case USR_ACTION:
|
||||||
$_action = 'customer';
|
$_action = $lng['admin']['customer'];
|
||||||
break;
|
break;
|
||||||
case RES_ACTION:
|
case RES_ACTION:
|
||||||
$_action = 'reseller';
|
$_action = $lng['logger']['reseller'];
|
||||||
break;
|
break;
|
||||||
case ADM_ACTION:
|
case ADM_ACTION:
|
||||||
$_action = 'administrator';
|
$_action = $lng['logger']['admin'];
|
||||||
break;
|
break;
|
||||||
case CRON_ACTION:
|
case CRON_ACTION:
|
||||||
$_action = 'cronjob';
|
$_action = $lng['logger']['cron'];
|
||||||
|
break;
|
||||||
|
case LOGIN_ACTION:
|
||||||
|
$_action = $lng['logger']['login'];
|
||||||
break;
|
break;
|
||||||
case LOG_ERROR:
|
case LOG_ERROR:
|
||||||
$_action = 'internal';
|
$_action = $lng['logger']['intern'];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$_action = 'unknown';
|
$_action = $lng['logger']['unknown'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($this->userinfo['loginname'])
|
if (!isset($this->userinfo['loginname'])
|
||||||
|| $this->userinfo['loginname'] == '')
|
|| $this->userinfo['loginname'] == ''
|
||||||
{
|
) {
|
||||||
$name = 'unknown';
|
$name = 'unknown';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -111,12 +111,10 @@ class SysLogger extends AbstractLogger
|
|||||||
openlog("Froxlor", LOG_NDELAY, LOG_USER);
|
openlog("Froxlor", LOG_NDELAY, LOG_USER);
|
||||||
|
|
||||||
if ($text != null
|
if ($text != null
|
||||||
&& $text != '')
|
&& $text != ''
|
||||||
{
|
) {
|
||||||
syslog((int)$type, "[" . ucfirst($_action) . " Action" . $name . "] " . $text);
|
syslog((int)$type, "[" . ucfirst($_action) . " Action" . $name . "] " . $text);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
syslog((int)$type, "[" . ucfirst($_action) . " Action" . $name . "] No text given!!! Check scripts!");
|
syslog((int)$type, "[" . ucfirst($_action) . " Action" . $name . "] No text given!!! Check scripts!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,6 @@
|
|||||||
|
|
||||||
class phpinterface {
|
class phpinterface {
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings array
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $_settings = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Domain-Data array
|
* Domain-Data array
|
||||||
* @var array
|
* @var array
|
||||||
@@ -48,8 +42,7 @@ class phpinterface {
|
|||||||
/**
|
/**
|
||||||
* main constructor
|
* main constructor
|
||||||
*/
|
*/
|
||||||
public function __construct($settings, $domain) {
|
public function __construct($domain) {
|
||||||
$this->_settings = $settings;
|
|
||||||
$this->_domain = $domain;
|
$this->_domain = $domain;
|
||||||
$this->_setInterface();
|
$this->_setInterface();
|
||||||
}
|
}
|
||||||
@@ -69,11 +62,11 @@ class phpinterface {
|
|||||||
*/
|
*/
|
||||||
private function _setInterface() {
|
private function _setInterface() {
|
||||||
// php-fpm
|
// php-fpm
|
||||||
if ((int)$this->_settings['phpfpm']['enabled'] == 1) {
|
if ((int)Settings::Get('phpfpm.enabled') == 1) {
|
||||||
$this->_interface = new phpinterface_fpm($this->_settings, $this->_domain);
|
$this->_interface = new phpinterface_fpm($this->_domain);
|
||||||
|
|
||||||
} elseif ((int)$this->_settings['system']['mod_fcgid'] == 1) {
|
} elseif ((int)Settings::Get('system.mod_fcgid') == 1) {
|
||||||
$this->_interface = new phpinterface_fcgid($this->_settings, $this->_domain);
|
$this->_interface = new phpinterface_fcgid($this->_domain);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,12 +21,6 @@
|
|||||||
|
|
||||||
class phpinterface_fcgid {
|
class phpinterface_fcgid {
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings array
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $_settings = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Domain-Data array
|
* Domain-Data array
|
||||||
* @var array
|
* @var array
|
||||||
@@ -42,11 +36,14 @@ class phpinterface_fcgid {
|
|||||||
/**
|
/**
|
||||||
* main constructor
|
* main constructor
|
||||||
*/
|
*/
|
||||||
public function __construct($settings, $domain) {
|
public function __construct($domain) {
|
||||||
$this->_settings = $settings;
|
|
||||||
$this->_domain = $domain;
|
$this->_domain = $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* create fcgid-starter-file
|
||||||
|
* @param array $phpconfig
|
||||||
|
*/
|
||||||
public function createConfig($phpconfig) {
|
public function createConfig($phpconfig) {
|
||||||
|
|
||||||
// create starter
|
// create starter
|
||||||
@@ -67,7 +64,7 @@ class phpinterface_fcgid {
|
|||||||
if ((int)$phpconfig['mod_fcgid_starter'] != - 1) {
|
if ((int)$phpconfig['mod_fcgid_starter'] != - 1) {
|
||||||
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
|
$starter_file.= "PHP_FCGI_CHILDREN=" . (int)$phpconfig['mod_fcgid_starter'] . "\n";
|
||||||
} else {
|
} 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) {
|
if ((int)$phpconfig['mod_fcgid_maxrequests'] != - 1) {
|
||||||
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
|
$starter_file.= "PHP_FCGI_MAX_REQUESTS=" . (int)$phpconfig['mod_fcgid_maxrequests'] . "\n";
|
||||||
} else {
|
} 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 = '';
|
$openbasedirc = '';
|
||||||
$_phpappendopenbasedir = '';
|
$_phpappendopenbasedir = '';
|
||||||
|
|
||||||
$_custom_openbasedir = explode(':', $this->_settings['system']['mod_fcgid_peardir']);
|
$_custom_openbasedir = explode(':', Settings::Get('system.mod_fcgid_peardir'));
|
||||||
foreach ($_custom_openbasedir as $cobd) {
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_custom_openbasedir = explode(':', $this->_settings['system']['phpappendopenbasedir']);
|
$_custom_openbasedir = explode(':', Settings::Get('system.phpappendopenbasedir'));
|
||||||
foreach ($_custom_openbasedir as $cobd) {
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
@@ -155,10 +152,10 @@ class phpinterface_fcgid {
|
|||||||
$admin = $this->_getAdminData($this->_domain['adminid']);
|
$admin = $this->_getAdminData($this->_domain['adminid']);
|
||||||
$php_ini_variables = array(
|
$php_ini_variables = array(
|
||||||
'SAFE_MODE' => 'Off', // keep this for compatibility, just in case
|
'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' => $openbasedir,
|
||||||
'OPEN_BASEDIR_C' => $openbasedirc,
|
'OPEN_BASEDIR_C' => $openbasedirc,
|
||||||
'OPEN_BASEDIR_GLOBAL' => $this->_settings['system']['phpappendopenbasedir'],
|
'OPEN_BASEDIR_GLOBAL' => Settings::Get('system.hpappendopenbasedir'),
|
||||||
'TMP_DIR' => $this->getTempDir(),
|
'TMP_DIR' => $this->getTempDir(),
|
||||||
'CUSTOMER_EMAIL' => $this->_domain['email'],
|
'CUSTOMER_EMAIL' => $this->_domain['email'],
|
||||||
'ADMIN_EMAIL' => $admin['email'],
|
'ADMIN_EMAIL' => $admin['email'],
|
||||||
@@ -192,7 +189,7 @@ class phpinterface_fcgid {
|
|||||||
*/
|
*/
|
||||||
public function getConfigDir($createifnotexists = true) {
|
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) {
|
if (!is_dir($configdir) && $createifnotexists) {
|
||||||
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
||||||
@@ -211,7 +208,7 @@ class phpinterface_fcgid {
|
|||||||
*/
|
*/
|
||||||
public function getTempDir($createifnotexists = true) {
|
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) {
|
if (!is_dir($tmpdir) && $createifnotexists) {
|
||||||
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
|
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
|
||||||
|
|||||||
@@ -21,12 +21,6 @@
|
|||||||
|
|
||||||
class phpinterface_fpm {
|
class phpinterface_fpm {
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings array
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
private $_settings = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Domain-Data array
|
* Domain-Data array
|
||||||
* @var array
|
* @var array
|
||||||
@@ -96,8 +90,7 @@ class phpinterface_fpm {
|
|||||||
/**
|
/**
|
||||||
* main constructor
|
* main constructor
|
||||||
*/
|
*/
|
||||||
public function __construct($settings, $domain) {
|
public function __construct($domain) {
|
||||||
$this->_settings = $settings;
|
|
||||||
$this->_domain = $domain;
|
$this->_domain = $domain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -111,13 +104,13 @@ class phpinterface_fpm {
|
|||||||
$fh = @fopen($this->getConfigFile(), 'w');
|
$fh = @fopen($this->getConfigFile(), 'w');
|
||||||
|
|
||||||
if ($fh) {
|
if ($fh) {
|
||||||
$fpm_pm = $this->_settings['phpfpm']['pm'];
|
$fpm_pm = Settings::Get('phpfpm.pm');
|
||||||
$fpm_children = (int)$this->_settings['phpfpm']['max_children'];
|
$fpm_children = (int)Settings::Get('phpfpm.max_children');
|
||||||
$fpm_start_servers = (int)$this->_settings['phpfpm']['start_servers'];
|
$fpm_start_servers = (int)Settings::Get('phpfpm.start_servers');
|
||||||
$fpm_min_spare_servers = (int)$this->_settings['phpfpm']['min_spare_servers'];
|
$fpm_min_spare_servers = (int)Settings::Get('phpfpm.min_spare_servers');
|
||||||
$fpm_max_spare_servers = (int)$this->_settings['phpfpm']['max_spare_servers'];
|
$fpm_max_spare_servers = (int)Settings::Get('phpfpm.max_spare_servers');
|
||||||
$fpm_requests = (int)$this->_settings['phpfpm']['max_requests'];
|
$fpm_requests = (int)Settings::Get('phpfpm.max_requests');
|
||||||
$fpm_process_idle_timeout = (int)$this->_settings['phpfpm']['idle_timeout'];
|
$fpm_process_idle_timeout = (int)Settings::Get('phpfpm.idle_timeout');
|
||||||
|
|
||||||
if ($fpm_children == 0) {
|
if ($fpm_children == 0) {
|
||||||
$fpm_children = 1;
|
$fpm_children = 1;
|
||||||
@@ -168,14 +161,14 @@ class phpinterface_fpm {
|
|||||||
if ($phpconfig['fpm_slowlog'] == '1') {
|
if ($phpconfig['fpm_slowlog'] == '1') {
|
||||||
$fpm_config.= 'request_terminate_timeout = ' . $phpconfig['fpm_reqterm'] . "\n";
|
$fpm_config.= 'request_terminate_timeout = ' . $phpconfig['fpm_reqterm'] . "\n";
|
||||||
$fpm_config.= 'request_slowlog_timeout = ' . $phpconfig['fpm_reqslow'] . "\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.= 'slowlog = ' . $slowlog . "\n";
|
||||||
$fpm_config.= 'catch_workers_output = yes' . "\n";
|
$fpm_config.= 'catch_workers_output = yes' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$fpm_config.= ';chroot = '.makeCorrectDir($this->_domain['documentroot'])."\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)) {
|
if (!is_dir($tmpdir)) {
|
||||||
$this->getTempDir();
|
$this->getTempDir();
|
||||||
}
|
}
|
||||||
@@ -188,12 +181,12 @@ class phpinterface_fpm {
|
|||||||
if ($this->_domain['loginname'] != 'froxlor.panel') {
|
if ($this->_domain['loginname'] != 'froxlor.panel') {
|
||||||
if ($this->_domain['openbasedir'] == '1') {
|
if ($this->_domain['openbasedir'] == '1') {
|
||||||
$_phpappendopenbasedir = '';
|
$_phpappendopenbasedir = '';
|
||||||
$_custom_openbasedir = explode(':', $this->_settings['phpfpm']['peardir']);
|
$_custom_openbasedir = explode(':', Settings::Get('phpfpm.peardir'));
|
||||||
foreach ($_custom_openbasedir as $cobd) {
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
|
|
||||||
$_custom_openbasedir = explode(':', $this->_settings['system']['phpappendopenbasedir']);
|
$_custom_openbasedir = explode(':', Settings::Get('system.phpappendopenbasedir'));
|
||||||
foreach ($_custom_openbasedir as $cobd) {
|
foreach ($_custom_openbasedir as $cobd) {
|
||||||
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
$_phpappendopenbasedir .= appendOpenBasedirPath($cobd);
|
||||||
}
|
}
|
||||||
@@ -219,14 +212,14 @@ class phpinterface_fpm {
|
|||||||
$openbasedir = implode(':', $clean_openbasedir);
|
$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[session.save_path] = ' . makeCorrectDir(Settings::Get('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[upload_tmp_dir] = ' . 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(
|
$php_ini_variables = array(
|
||||||
'SAFE_MODE' => 'Off', // keep this for compatibility, just in case
|
'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(),
|
'TMP_DIR' => $this->getTempDir(),
|
||||||
'CUSTOMER_EMAIL' => $this->_domain['email'],
|
'CUSTOMER_EMAIL' => $this->_domain['email'],
|
||||||
'ADMIN_EMAIL' => $admin['email'],
|
'ADMIN_EMAIL' => $admin['email'],
|
||||||
@@ -284,7 +277,7 @@ class phpinterface_fpm {
|
|||||||
*/
|
*/
|
||||||
public function getConfigFile($createifnotexists = true) {
|
public function getConfigFile($createifnotexists = true) {
|
||||||
|
|
||||||
$configdir = makeCorrectDir($this->_settings['phpfpm']['configdir']);
|
$configdir = makeCorrectDir(Settings::Get('phpfpm.configdir'));
|
||||||
$config = makeCorrectFile($configdir.'/'.$this->_domain['domain'].'.conf');
|
$config = makeCorrectFile($configdir.'/'.$this->_domain['domain'].'.conf');
|
||||||
|
|
||||||
if (!is_dir($configdir) && $createifnotexists) {
|
if (!is_dir($configdir) && $createifnotexists) {
|
||||||
@@ -303,14 +296,12 @@ class phpinterface_fpm {
|
|||||||
*/
|
*/
|
||||||
public function getSocketFile($createifnotexists = true) {
|
public function getSocketFile($createifnotexists = true) {
|
||||||
|
|
||||||
// see #1300 why this has changed
|
$socketdir = makeCorrectDir(Settings::Get('phpfpm.fastcgi_ipcdir'));
|
||||||
//$socketdir = makeCorrectDir('/var/run/'.$this->_settings['system']['webserver'].'/');
|
|
||||||
$socketdir = makeCorrectDir($this->_settings['phpfpm']['fastcgi_ipcdir']);
|
|
||||||
$socket = makeCorrectFile($socketdir.'/'.$this->_domain['loginname'].'-'.$this->_domain['domain'].'-php-fpm.socket');
|
$socket = makeCorrectFile($socketdir.'/'.$this->_domain['loginname'].'-'.$this->_domain['domain'].'-php-fpm.socket');
|
||||||
|
|
||||||
if (!is_dir($socketdir) && $createifnotexists) {
|
if (!is_dir($socketdir) && $createifnotexists) {
|
||||||
safe_exec('mkdir -p '.escapeshellarg($socketdir));
|
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;
|
return $socket;
|
||||||
@@ -325,7 +316,7 @@ class phpinterface_fpm {
|
|||||||
*/
|
*/
|
||||||
public function getTempDir($createifnotexists = true) {
|
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) {
|
if (!is_dir($tmpdir) && $createifnotexists) {
|
||||||
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
|
safe_exec('mkdir -p ' . escapeshellarg($tmpdir));
|
||||||
@@ -346,11 +337,11 @@ class phpinterface_fpm {
|
|||||||
public function getAliasConfigDir($createifnotexists = true) {
|
public function getAliasConfigDir($createifnotexists = true) {
|
||||||
|
|
||||||
// ensure default...
|
// ensure default...
|
||||||
if (!isset($this->_settings['phpfpm']['aliasconfigdir'])) {
|
if (Settings::Get('phpfpm.aliasconfigdir') == null) {
|
||||||
$this->_settings['phpfpm']['aliasconfigdir'] = '/var/www/php-fpm';
|
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) {
|
if (!is_dir($configdir) && $createifnotexists) {
|
||||||
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
safe_exec('mkdir -p ' . escapeshellarg($configdir));
|
||||||
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir));
|
safe_exec('chown ' . $this->_domain['guid'] . ':' . $this->_domain['guid'] . ' ' . escapeshellarg($configdir));
|
||||||
|
|||||||
@@ -28,12 +28,6 @@ class ticket {
|
|||||||
*/
|
*/
|
||||||
private $userinfo = array();
|
private $userinfo = array();
|
||||||
|
|
||||||
/**
|
|
||||||
* Settings array
|
|
||||||
* @var settings
|
|
||||||
*/
|
|
||||||
private $settings = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ticket ID
|
* Ticket ID
|
||||||
* @var tid
|
* @var tid
|
||||||
@@ -62,12 +56,10 @@ class ticket {
|
|||||||
* Class constructor.
|
* Class constructor.
|
||||||
*
|
*
|
||||||
* @param array userinfo
|
* @param array userinfo
|
||||||
* @param array settings
|
|
||||||
* @param int ticket id
|
* @param int ticket id
|
||||||
*/
|
*/
|
||||||
private function __construct($userinfo, $settings, $tid = - 1) {
|
private function __construct($userinfo, $tid = - 1) {
|
||||||
$this->userinfo = $userinfo;
|
$this->userinfo = $userinfo;
|
||||||
$this->settings = $settings;
|
|
||||||
$this->tid = $tid;
|
$this->tid = $tid;
|
||||||
|
|
||||||
// initialize purifier
|
// initialize purifier
|
||||||
@@ -88,12 +80,11 @@ class ticket {
|
|||||||
* Singleton ftw ;-)
|
* Singleton ftw ;-)
|
||||||
*
|
*
|
||||||
* @param array userinfo
|
* @param array userinfo
|
||||||
* @param array settings
|
|
||||||
* @param int ticket id
|
* @param int ticket id
|
||||||
*/
|
*/
|
||||||
static public function getInstanceOf($_usernfo, $_settings, $_tid) {
|
static public function getInstanceOf($_usernfo, $_tid) {
|
||||||
if (!isset(self::$tickets[$_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];
|
return self::$tickets[$_tid];
|
||||||
}
|
}
|
||||||
@@ -310,7 +301,7 @@ class ticket {
|
|||||||
if ($customerid != - 1) {
|
if ($customerid != - 1) {
|
||||||
$_mailerror = false;
|
$_mailerror = false;
|
||||||
try {
|
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->Subject = $mail_subject;
|
||||||
$mail->AltBody = $mail_body;
|
$mail->AltBody = $mail_body;
|
||||||
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
||||||
@@ -325,7 +316,7 @@ class ticket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($_mailerror) {
|
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);
|
$rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
||||||
standard_error('errorsendingmail', $usr['email']);
|
standard_error('errorsendingmail', $usr['email']);
|
||||||
}
|
}
|
||||||
@@ -340,7 +331,7 @@ class ticket {
|
|||||||
$admin = Database::pexecute_first($admin_stmt, array('adminid' => $this->userinfo['adminid']));
|
$admin = Database::pexecute_first($admin_stmt, array('adminid' => $this->userinfo['adminid']));
|
||||||
$_mailerror = false;
|
$_mailerror = false;
|
||||||
try {
|
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->Subject = $mail_subject;
|
||||||
$mail->AltBody = $mail_body;
|
$mail->AltBody = $mail_body;
|
||||||
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
$mail->MsgHTML(str_replace("\n", "<br />", $mail_body));
|
||||||
@@ -355,7 +346,7 @@ class ticket {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($_mailerror) {
|
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);
|
$rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
|
||||||
standard_error('errorsendingmail', $admin['email']);
|
standard_error('errorsendingmail', $admin['email']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -21,19 +21,9 @@
|
|||||||
class ConfigIO {
|
class ConfigIO {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* internal settings array
|
* constructor
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $_settings = null;
|
public function __construct() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* constructor gets the froxlor settings
|
|
||||||
* as array
|
|
||||||
*/
|
|
||||||
public function __construct(array $settings = null) {
|
|
||||||
$this->_settings = $settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clean up former created configs, including (if enabled)
|
* clean up former created configs, including (if enabled)
|
||||||
@@ -73,7 +63,7 @@ class ConfigIO {
|
|||||||
/*
|
/*
|
||||||
* only clean up if we're actually using SSL
|
* 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
|
// get correct directory
|
||||||
$configdir = $this->_getFile('system', 'customer_ssl_path');
|
$configdir = $this->_getFile('system', 'customer_ssl_path');
|
||||||
if ($configdir !== false) {
|
if ($configdir !== false) {
|
||||||
@@ -158,7 +148,7 @@ class ConfigIO {
|
|||||||
*/
|
*/
|
||||||
private function _cleanAwstatsFiles() {
|
private function _cleanAwstatsFiles() {
|
||||||
|
|
||||||
if ($this->_settings['system']['awstats_enabled'] == '0') {
|
if (Settings::Get('system.awstats_enabled') == '0') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -204,7 +194,7 @@ class ConfigIO {
|
|||||||
*/
|
*/
|
||||||
private function _cleanFcgidFiles() {
|
private function _cleanFcgidFiles() {
|
||||||
|
|
||||||
if ($this->_settings['system']['mod_fcgid'] == '0') {
|
if (Settings::Get('system.mod_fcgid') == '0') {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,7 +236,7 @@ class ConfigIO {
|
|||||||
*/
|
*/
|
||||||
private function _cleanFpmFiles() {
|
private function _cleanFpmFiles() {
|
||||||
|
|
||||||
if ($this->_settings['phpfpm']['enabled'] == '0') {
|
if (Settings::Get('phpfpm.enabled') == '0') {
|
||||||
return;
|
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 $group settings-group
|
||||||
* @param string $varname var-name
|
* @param string $varname var-name
|
||||||
@@ -287,7 +277,7 @@ class ConfigIO {
|
|||||||
private function _getFile($group, $varname, $check_exists = true) {
|
private function _getFile($group, $varname, $check_exists = true) {
|
||||||
|
|
||||||
// read from settings
|
// read from settings
|
||||||
$file = $this->_settings[$group][$varname];
|
$file = Settings::Get($group.'.'.$varname);
|
||||||
|
|
||||||
// check whether it exists
|
// check whether it exists
|
||||||
if ($check_exists && @file_exists($file) == false) {
|
if ($check_exists && @file_exists($file) == false) {
|
||||||
|
|||||||
@@ -21,18 +21,9 @@
|
|||||||
class DomainSSL {
|
class DomainSSL {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* internal settings array
|
* constructor
|
||||||
*
|
|
||||||
* @var array
|
|
||||||
*/
|
*/
|
||||||
private $_settings = null;
|
public function __construct() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* constructor gets the froxlor settings as array
|
|
||||||
*/
|
|
||||||
public function __construct(array $settings = null) {
|
|
||||||
$this->_settings = $settings;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* read domain-related (or if empty, parentdomain-related) ssl-certificates from the database
|
* read domain-related (or if empty, parentdomain-related) ssl-certificates from the database
|
||||||
@@ -66,7 +57,7 @@ class DomainSSL {
|
|||||||
&& $dom_certs['ssl_cert_file'] != ''
|
&& $dom_certs['ssl_cert_file'] != ''
|
||||||
) {
|
) {
|
||||||
// get destination path
|
// 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
|
// create path if it does not exist
|
||||||
if (!file_exists($sslcertpath)) {
|
if (!file_exists($sslcertpath)) {
|
||||||
safe_exec('mkdir -p '.escapeshellarg($sslcertpath));
|
safe_exec('mkdir -p '.escapeshellarg($sslcertpath));
|
||||||
@@ -77,7 +68,7 @@ class DomainSSL {
|
|||||||
'ssl_key_file' => makeCorrectFile($sslcertpath.'/'.$domain['domain'].'.key')
|
'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.
|
// 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";
|
$dom_certs['ssl_cert_file'] = trim($dom_certs['ssl_cert_file'])."\n".trim($dom_certs['ssl_key_file'])."\n";
|
||||||
$ssl_files['ssl_key_file'] = '';
|
$ssl_files['ssl_key_file'] = '';
|
||||||
@@ -91,7 +82,7 @@ class DomainSSL {
|
|||||||
$ssl_files['ssl_ca_file'] = makeCorrectFile($sslcertpath.'/'.$domain['domain'].'_CA.pem');
|
$ssl_files['ssl_ca_file'] = makeCorrectFile($sslcertpath.'/'.$domain['domain'].'_CA.pem');
|
||||||
}
|
}
|
||||||
if ($dom_certs['ssl_cert_chainfile'] != '') {
|
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.
|
// 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";
|
$dom_certs['ssl_cert_file'] = trim($dom_certs['ssl_cert_file'])."\n".trim($dom_certs['ssl_cert_chainfile'])."\n";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -219,7 +219,7 @@ class apache
|
|||||||
'loginname' => 'froxlor.panel',
|
'loginname' => 'froxlor.panel',
|
||||||
'documentroot' => $mypath
|
'documentroot' => $mypath
|
||||||
);
|
);
|
||||||
$php = new phpinterface($this->settings, $domain);
|
$php = new phpinterface($domain);
|
||||||
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
|
$phpconfig = $php->getPhpConfig($this->settings['system']['mod_fcgid_defaultini_ownvhost']);
|
||||||
|
|
||||||
$starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter');
|
$starter_filename = makeCorrectFile($configdir . '/php-fcgi-starter');
|
||||||
@@ -258,7 +258,7 @@ class apache
|
|||||||
'documentroot' => $mypath,
|
'documentroot' => $mypath,
|
||||||
);
|
);
|
||||||
|
|
||||||
$php = new phpinterface($this->settings, $domain);
|
$php = new phpinterface($domain);
|
||||||
$phpconfig = $php->getPhpConfig($this->settings['phpfpm']['vhost_defaultini']);
|
$phpconfig = $php->getPhpConfig($this->settings['phpfpm']['vhost_defaultini']);
|
||||||
$srvName = substr(md5($ipport),0,4).'.fpm.external';
|
$srvName = substr(md5($ipport),0,4).'.fpm.external';
|
||||||
if ($row_ipsandports['ssl']) {
|
if ($row_ipsandports['ssl']) {
|
||||||
@@ -642,7 +642,7 @@ class apache
|
|||||||
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
|
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
|
||||||
|
|
||||||
// SSL STUFF
|
// SSL STUFF
|
||||||
$dssl = new DomainSSL($this->settings);
|
$dssl = new DomainSSL();
|
||||||
// this sets the ssl-related array-indices in the $domain array
|
// this sets the ssl-related array-indices in the $domain array
|
||||||
// if the domain has customer-defined ssl-certificates
|
// if the domain has customer-defined ssl-certificates
|
||||||
$dssl->setDomainSSLFilesArray($domain);
|
$dssl->setDomainSSLFilesArray($domain);
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class apache_fcgid extends apache
|
|||||||
|
|
||||||
if($domain['phpenabled'] == '1')
|
if($domain['phpenabled'] == '1')
|
||||||
{
|
{
|
||||||
$php = new phpinterface($this->settings, $domain);
|
$php = new phpinterface($domain);
|
||||||
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
||||||
|
|
||||||
if((int)$this->settings['phpfpm']['enabled'] == 1)
|
if((int)$this->settings['phpfpm']['enabled'] == 1)
|
||||||
@@ -141,7 +141,7 @@ class apache_fcgid extends apache
|
|||||||
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
||||||
|
|
||||||
// get php.ini for our own vhost
|
// get php.ini for our own vhost
|
||||||
$php = new phpinterface($this->settings, $domain);
|
$php = new phpinterface($domain);
|
||||||
|
|
||||||
// get php-config
|
// get php-config
|
||||||
if ($this->settings['phpfpm']['enabled'] == '1') {
|
if ($this->settings['phpfpm']['enabled'] == '1') {
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ class lighttpd
|
|||||||
'documentroot' => $mypath
|
'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].= ' fastcgi.server = ( '."\n";
|
||||||
$this->lighttpd_data[$vhost_filename].= "\t".'".php" => ('."\n";
|
$this->lighttpd_data[$vhost_filename].= "\t".'".php" => ('."\n";
|
||||||
@@ -434,7 +434,7 @@ class lighttpd
|
|||||||
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
|
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
|
||||||
|
|
||||||
// SSL STUFF
|
// SSL STUFF
|
||||||
$dssl = new DomainSSL($this->settings);
|
$dssl = new DomainSSL();
|
||||||
// this sets the ssl-related array-indices in the $domain array
|
// this sets the ssl-related array-indices in the $domain array
|
||||||
// if the domain has customer-defined ssl-certificates
|
// if the domain has customer-defined ssl-certificates
|
||||||
$dssl->setDomainSSLFilesArray($domain);
|
$dssl->setDomainSSLFilesArray($domain);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class lighttpd_fcgid extends lighttpd
|
|||||||
|
|
||||||
if($domain['phpenabled'] == '1')
|
if($domain['phpenabled'] == '1')
|
||||||
{
|
{
|
||||||
$php = new phpinterface($this->settings, $domain);
|
$php = new phpinterface($domain);
|
||||||
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
||||||
|
|
||||||
// vhost data for php-fpm
|
// vhost data for php-fpm
|
||||||
@@ -134,7 +134,7 @@ class lighttpd_fcgid extends lighttpd
|
|||||||
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
||||||
|
|
||||||
// get php.ini for our own vhost
|
// get php.ini for our own vhost
|
||||||
$php = new phpinterface($this->settings, $domain);
|
$php = new phpinterface($domain);
|
||||||
|
|
||||||
// get php-config
|
// get php-config
|
||||||
if ($this->settings['phpfpm']['enabled'] == '1') {
|
if ($this->settings['phpfpm']['enabled'] == '1') {
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ class nginx
|
|||||||
'documentroot' => $mypath,
|
'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";
|
$this->nginx_data[$vhost_filename] .= "\t\t".'fastcgi_pass unix:' . $php->getInterface()->getSocketFile() . ';' . "\n";
|
||||||
} else {
|
} else {
|
||||||
$this->nginx_data[$vhost_filename] .= "\t\t".'fastcgi_pass ' . $this->settings['system']['nginx_php_backend'] . ';' . "\n";
|
$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'];
|
$domain['ssl_cert_chainfile'] = $ipandport['ssl_cert_chainfile'];
|
||||||
|
|
||||||
// SSL STUFF
|
// SSL STUFF
|
||||||
$dssl = new DomainSSL($this->settings);
|
$dssl = new DomainSSL();
|
||||||
// this sets the ssl-related array-indices in the $domain array
|
// this sets the ssl-related array-indices in the $domain array
|
||||||
// if the domain has customer-defined ssl-certificates
|
// if the domain has customer-defined ssl-certificates
|
||||||
$dssl->setDomainSSLFilesArray($domain);
|
$dssl->setDomainSSLFilesArray($domain);
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class nginx_phpfpm extends nginx
|
|||||||
|
|
||||||
if($domain['phpenabled'] == '1')
|
if($domain['phpenabled'] == '1')
|
||||||
{
|
{
|
||||||
$php = new phpinterface($this->settings, $domain);
|
$php = new phpinterface($domain);
|
||||||
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
$phpconfig = $php->getPhpConfig((int)$domain['phpsettingid']);
|
||||||
|
|
||||||
$php_options_text = "\t".'location ~ \.php$ {'."\n";
|
$php_options_text = "\t".'location ~ \.php$ {'."\n";
|
||||||
@@ -81,7 +81,7 @@ class nginx_phpfpm extends nginx
|
|||||||
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
safe_exec('chown -R ' . $user . ':' . $group . ' ' . escapeshellarg($mypath));
|
||||||
|
|
||||||
// get php.ini for our own vhost
|
// get php.ini for our own vhost
|
||||||
$php = new phpinterface($this->settings, $domain);
|
$php = new phpinterface($domain);
|
||||||
|
|
||||||
// get php-config
|
// get php-config
|
||||||
if ($this->settings['phpfpm']['enabled'] == '1') {
|
if ($this->settings['phpfpm']['enabled'] == '1') {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ while ($row = $result_tasks_stmt->fetch(PDO::FETCH_ASSOC)) {
|
|||||||
if ($row['type'] == '1') {
|
if ($row['type'] == '1') {
|
||||||
|
|
||||||
// get configuration-I/O object
|
// get configuration-I/O object
|
||||||
$configio = new ConfigIO($settings);
|
$configio = new ConfigIO();
|
||||||
// clean up old configs
|
// clean up old configs
|
||||||
$configio->cleanUp();
|
$configio->cleanUp();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user