remove parameter from FroxorLogger class and migrated it to PDO database class, refs #1287

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-11-04 13:28:23 +01:00
parent 222e304c93
commit 3e7df9cb7a
8 changed files with 132 additions and 234 deletions

View File

@@ -266,7 +266,7 @@ if ($action == 'forgotpwd') {
WHERE `loginname`='" . $user['loginname'] . "' WHERE `loginname`='" . $user['loginname'] . "'
AND `email`='" . $user['email'] . "'"); AND `email`='" . $user['email'] . "'");
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings); $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $settings);
$rstlog->logAction(USR_ACTION, LOG_WARNING, "Password for user '" . $user['loginname'] . "' has been reset!"); $rstlog->logAction(USR_ACTION, LOG_WARNING, "Password for user '" . $user['loginname'] . "' has been reset!");
$replace_arr = array( $replace_arr = array(
@@ -299,7 +299,7 @@ if ($action == 'forgotpwd') {
} }
if ($_mailerror) { if ($_mailerror) {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings); $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $settings);
$rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg); $rstlog->logAction(ADM_ACTION, LOG_ERR, "Error sending mail: " . $mailerr_msg);
redirectTo('index.php', Array('showmessage' => '4', 'customermail' => $user['email']), true); redirectTo('index.php', Array('showmessage' => '4', 'customermail' => $user['email']), true);
exit; exit;
@@ -309,7 +309,7 @@ if ($action == 'forgotpwd') {
redirectTo('index.php', Array('showmessage' => '1'), true); redirectTo('index.php', Array('showmessage' => '1'), true);
exit; exit;
} else { } else {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $db, $settings); $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'password_reset'), $settings);
$rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to reset pwd but wasn't found in database!"); $rstlog->logAction(USR_ACTION, LOG_WARNING, "User '" . $loginname . "' tried to reset pwd but wasn't found in database!");
$message = $lng['login']['combination_not_found']; $message = $lng['login']['combination_not_found'];
} }

View File

@@ -16,46 +16,39 @@
*/ */
// some configs // some configs
$baseLanguage = 'english.lng.php'; $baseLanguage = 'english.lng.php';
// Check if we're in the CLI // Check if we're in the CLI
if(@php_sapi_name() != 'cli'
if(@php_sapi_name() != 'cli') && @php_sapi_name() != 'cgi'
{ && @php_sapi_name() != 'cgi-fcgi'
) {
die('This script will only work in the shell.'); die('This script will only work in the shell.');
} }
// Check argument count // Check argument count
if (sizeof($argv) != 2) {
if(sizeof($argv) != 2)
{
print_help($argv); print_help($argv);
exit; exit;
} }
// Load the contents of the given path // Load the contents of the given path
$path = $argv[1]; $path = $argv[1];
$files = array(); $files = array();
if($dh = opendir($path)) if ($dh = opendir($path)) {
{ while (false !== ($file = readdir($dh))) {
while(false !== ($file = readdir($dh))) if ($file != "."
{
if($file != "."
&& $file != ".." && $file != ".."
&& !is_dir($file) && !is_dir($file)
&& preg_match('/(.+)\.lng\.php/i', $file)) && preg_match('/(.+)\.lng\.php/i', $file)
{ ) {
$files[$file] = str_replace('//', '/', $path . '/' . $file); $files[$file] = str_replace('//', '/', $path . '/' . $file);
} }
} }
closedir($dh); closedir($dh);
} } else {
else
{
print "ERROR: The path you requested cannot be read! \n "; print "ERROR: The path you requested cannot be read! \n ";
print "\n"; print "\n";
print_help(); print_help();
@@ -63,9 +56,7 @@ else
} }
// check if there is the default language defined // check if there is the default language defined
if (!isset($files[$baseLanguage])) {
if(!isset($files[$baseLanguage]))
{
print "ERROR: The baselanguage cannot be found! \n"; print "ERROR: The baselanguage cannot be found! \n";
print "\n"; print "\n";
print_help(); print_help();
@@ -73,49 +64,40 @@ if(!isset($files[$baseLanguage]))
} }
// import the baselanguage // import the baselanguage
$base = import($files[$baseLanguage]); $base = import($files[$baseLanguage]);
// and unset it in the files, because we don't need to compare base to base // and unset it in the files, because we don't need to compare base to base
unset($files[$baseLanguage]); unset($files[$baseLanguage]);
// compare each language with the baselanguage // compare each language with the baselanguage
foreach ($files as $key => $file) {
foreach($files as $key => $file)
{
$comp = import($file); $comp = import($file);
print "\n\nComparing " . $baseLanguage . " to " . $key . "\n"; print "\n\nComparing " . $baseLanguage . " to " . $key . "\n";
$result = compare($base, $comp); $result = compare($base, $comp);
if(is_array($result) if (is_array($result)
&& sizeof($result) > 0) && sizeof($result) > 0
{ ) {
print " found missing strings: \n"; print " found missing strings: \n";
foreach($result as $value) foreach ($result as $value) {
{
print " " . $value . "\n"; print " " . $value . "\n";
} }
} } else {
else
{
print " no missing strings found! \n "; print " no missing strings found! \n ";
} }
print "\nReverse Checking " . $key . " to " . $baseLanguage . "\n"; print "\nReverse Checking " . $key . " to " . $baseLanguage . "\n";
$result = compare($comp, $base); $result = compare($comp, $base);
if(is_array($result) if (is_array($result)
&& sizeof($result) > 0) && sizeof($result) > 0
{ ) {
print " found strings not in basefile: \n"; print " found strings not in basefile: \n";
foreach($result as $key => $value) foreach ($result as $key => $value) {
{
print " " . $value . "\n"; print " " . $value . "\n";
} }
} } else {
else
{
print " There are no strings which are not in the basefile! \n "; print " There are no strings which are not in the basefile! \n ";
} }
} }
@@ -129,56 +111,45 @@ foreach($files as $key => $file)
* *
* @param array $argv * @param array $argv
*/ */
function print_help($argv) {
function print_help($argv)
{
print "Usage: php " . $argv[0] . " /PATH/TO/LNG \n"; print "Usage: php " . $argv[0] . " /PATH/TO/LNG \n";
print " \n "; print " \n ";
} }
function import($file) function import($file) {
{
$input = file($file); $input = file($file);
$return = array(); $return = array();
foreach($input as $key => $value)
{
if(!preg_match('/^\$/', $value))
{
unset($input[$key]);
}
else
{
// generate the key
foreach ($input as $key => $value) {
if (!preg_match('/^\$/', $value)) {
unset($input[$key]);
} else {
// generate the key
$key = preg_replace('/^\$lng\[\'(.*)=(.*)$/U', '\\1', $value); $key = preg_replace('/^\$lng\[\'(.*)=(.*)$/U', '\\1', $value);
$key = str_replace('[\'', '/', $key); $key = str_replace('[\'', '/', $key);
$key = trim(str_replace('\']', '', $key)); $key = trim(str_replace('\']', '', $key));
//generate the value //generate the value
$value = trim($value); $value = trim($value);
// set the result // set the result
$return[$key] = $value; $return[$key] = $value;
} }
} }
return $return; return $return;
} }
function compare($array1, $array2) function compare($array1, $array2) {
{
$result = array(); $result = array();
foreach($array1 as $key => $value)
{ foreach ($array1 as $key => $value) {
if(!isset($array2[$key]))
{ if (!isset($array2[$key])) {
$result[$key] = $value; $result[$key] = $value;
} }
} }
return $result; return $result;
} }
?>

View File

@@ -17,7 +17,7 @@
* *
*/ */
$updatelog = FroxlorLogger::getInstanceOf(array('loginname' => 'updater'), $db, $settings); $updatelog = FroxlorLogger::getInstanceOf(array('loginname' => 'updater'), $settings);
$updatelogfile = validateUpdateLogFile(makeCorrectFile(dirname(__FILE__).'/update.log')); $updatelogfile = validateUpdateLogFile(makeCorrectFile(dirname(__FILE__).'/update.log'));
$filelog = FileLogger::getInstanceOf(array('loginname' => 'updater'), $settings); $filelog = FileLogger::getInstanceOf(array('loginname' => 'updater'), $settings);

View File

@@ -26,35 +26,24 @@ class FroxlorLogger
* Userinfo * Userinfo
* @var array * @var array
*/ */
private $userinfo = array(); private $userinfo = array();
/**
* Database handler
* @var db
*/
private $db = false;
/** /**
* Settings array * Settings array
* @var settings * @var settings
*/ */
private $settings = array(); private $settings = array();
/** /**
* LogTypes Array * LogTypes Array
* @var logtypes * @var logtypes
*/ */
static private $logtypes = null; static private $logtypes = null;
/** /**
* Logger-Object-Array * Logger-Object-Array
* @var loggers * @var loggers
*/ */
static private $loggers = null; static private $loggers = null;
/** /**
@@ -63,31 +52,24 @@ class FroxlorLogger
* @param array userinfo * @param array userinfo
* @param array settings * @param array settings
*/ */
protected function __construct($userinfo, $settings) {
protected function __construct($userinfo, $db, $settings)
{
$this->userinfo = $userinfo; $this->userinfo = $userinfo;
$this->db = $db;
$this->settings = $settings; $this->settings = $settings;
self::$logtypes = array(); self::$logtypes = array();
if(!isset($this->settings['logger']['logtypes']) if (!isset($this->settings['logger']['logtypes'])
&& (!isset($this->settings['logger']['logtypes']) || $this->settings['logger']['logtypes'] == '') && (!isset($this->settings['logger']['logtypes']) || $this->settings['logger']['logtypes'] == '')
&& isset($this->settings['logger']['enabled']) && isset($this->settings['logger']['enabled'])
&& $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'])
{ && $this->settings['logger']['logtypes'] != ''
if(isset($this->settings['logger']['logtypes']) ) {
&& $this->settings['logger']['logtypes'] != '')
{
self::$logtypes = explode(',', $this->settings['logger']['logtypes']); self::$logtypes = explode(',', $this->settings['logger']['logtypes']);
} } else {
else
{
self::$logtypes = null; self::$logtypes = null;
} }
} }
@@ -97,40 +79,37 @@ class FroxlorLogger
* Singleton ftw ;-) * Singleton ftw ;-)
* *
*/ */
static public function getInstanceOf($_usernfo, $_settings)
static public function getInstanceOf($_usernfo, $_db, $_settings)
{ {
if(!isset($_usernfo) if (!isset($_usernfo)
|| $_usernfo == null) || $_usernfo == null
{ ) {
$_usernfo = array(); $_usernfo = array();
$_usernfo['loginname'] = 'unknown'; $_usernfo['loginname'] = 'unknown';
} }
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, $_db, $_settings);
} }
return self::$loggers[$_usernfo['loginname']]; return self::$loggers[$_usernfo['loginname']];
} }
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 ($this->settings['logger']['log_cron'] == '0'
&& $action == CRON_ACTION) && $action == CRON_ACTION
{ ) {
return; return;
} }
foreach(self::$logtypes as $logger) foreach (self::$logtypes as $logger) {
{
switch($logger) switch ($logger)
{ {
case 'syslog': case 'syslog':
$_log = SysLogger::getInstanceOf($this->userinfo, $this->settings); $_log = SysLogger::getInstanceOf($this->userinfo, $this->settings);
@@ -140,43 +119,30 @@ class FroxlorLogger
{ {
$_log = FileLogger::getInstanceOf($this->userinfo, $this->settings); $_log = FileLogger::getInstanceOf($this->userinfo, $this->settings);
} }
catch(Exception $e) catch(Exception $e)
{ {
if($action != CRON_ACTION) if ($action != CRON_ACTION) {
{
standard_error('logerror', $e->getMessage()); standard_error('logerror', $e->getMessage());
} } else {
else
{
echo "Log-Error: " . $e->getMessage(); echo "Log-Error: " . $e->getMessage();
} }
} }
break; break;
case 'mysql': case 'mysql':
$_log = MysqlLogger::getInstanceOf($this->userinfo, $this->settings, $this->db); $_log = MysqlLogger::getInstanceOf($this->userinfo, $this->settings);
break; break;
default: default:
$_log = null; $_log = null;
break; break;
} }
if($_log != null) if ($_log != null) {
{ try {
try
{
$_log->logAction($action, $type, $text); $_log->logAction($action, $type, $text);
} } catch(Exception $e) {
if ($action != CRON_ACTION) {
catch(Exception $e)
{
if($action != CRON_ACTION)
{
standard_error('logerror', $e->getMessage()); standard_error('logerror', $e->getMessage());
} } else {
else
{
echo "Log-Error: " . $e->getMessage(); echo "Log-Error: " . $e->getMessage();
} }
} }
@@ -184,20 +150,22 @@ class FroxlorLogger
} }
} }
public function setCronLog($_cronlog = 0) public function setCronLog($_cronlog = 0) {
{
$_cronlog = (int)$_cronlog; $_cronlog = (int)$_cronlog;
if($_cronlog != 0 if ($_cronlog != 0
&& $_cronlog != 1) && $_cronlog != 1
{ ) {
$_cronlog = 0; $_cronlog = 0;
} }
$this->db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "` $stmt = Database::prepare("
SET `value`='" . $this->db->escape($_cronlog) . "' UPDATE `" . TABLE_PANEL_SETTINGS . "` SET
WHERE `settinggroup`='logger' `value` = :value
AND `varname`='log_cron'"); WHERE `settinggroup`='logger' AND `varname`='log_cron'"
);
Database::pexecute($stmt, array('value' => $_cronlog));
return true; return true;
} }
} }

View File

@@ -20,27 +20,18 @@
* Logger - MySQL-Logger-Class * Logger - MySQL-Logger-Class
*/ */
class MysqlLogger extends AbstractLogger class MysqlLogger extends AbstractLogger {
{
/** /**
* Userinfo * Userinfo
* @var array * @var array
*/ */
private $userinfo = array(); private $userinfo = array();
/**
* Database handler
* @var db
*/
private $db = false;
/** /**
* Syslogger Objects Array * Syslogger Objects Array
* @var loggers * @var loggers
*/ */
static private $loggers = array(); static private $loggers = array();
/** /**
@@ -48,66 +39,69 @@ class MysqlLogger extends AbstractLogger
* *
* @param array userinfo * @param array userinfo
* @param array settings * @param array settings
* @param resource database
*/ */
protected function __construct($userinfo, $settings) {
protected function __construct($userinfo, $settings, $db)
{
parent::setupLogger($settings); parent::setupLogger($settings);
$this->userinfo = $userinfo; $this->userinfo = $userinfo;
$this->db = $db;
} }
/** /**
* Singleton ftw ;-) * Singleton ftw ;-)
* *
*/ */
static public function getInstanceOf($_usernfo, $_settings) {
static public function getInstanceOf($_usernfo, $_settings, $_db) if (!isset(self::$loggers[$_usernfo['loginname']])) {
{ self::$loggers[$_usernfo['loginname']] = new MysqlLogger($_usernfo, $_settings);
if(!isset(self::$loggers[$_usernfo['loginname']]))
{
self::$loggers[$_usernfo['loginname']] = new MysqlLogger($_usernfo, $_settings, $_db);
} }
return self::$loggers[$_usernfo['loginname']]; return self::$loggers[$_usernfo['loginname']];
} }
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()) {
{
if(parent::getSeverity() <= 1 if (parent::getSeverity() <= 1
&& $type == LOG_NOTICE) && $type == LOG_NOTICE
{ ) {
return; return;
} }
if(!isset($this->userinfo['loginname']) if (!isset($this->userinfo['loginname'])
|| $this->userinfo['loginname'] == '') || $this->userinfo['loginname'] == ''
{ ) {
$name = 'unknown'; $name = 'unknown';
} } else {
else
{
$name = " (" . $this->userinfo['loginname'] . ")"; $name = " (" . $this->userinfo['loginname'] . ")";
} }
$now = time(); $now = time();
if($text != null $stmt = Database::prepare("
&& $text != '') INSERT INTO `panel_syslog` SET
{ `type` = :type,
$this->db->query("INSERT INTO `panel_syslog` (`type`, `date`, `action`, `user`, `text`) `date` = :now,
VALUES ('" . (int)$type . "', '" . $now . "', '" . (int)$action . "', '" . $this->db->escape($name) . "', '" . $this->db->escape($text) . "')"); `action` = :action,
} `user` = :user,
else `text` = :text"
{ );
$this->db->query("INSERT INTO `panel_syslog` (`type`, `date`, `action`, `userid`, `text`)
VALUES ('" . (int)$type . "', '" . $now . "', '" . (int)$action . "', '" . $this->db->escape($name) . "', 'No text given!!! Check scripts!')"); $ins_data = array(
'type' => $type,
'now' => $now,
'action' => $action,
'user' => $name
);
if ($text != null
&& $text != ''
) {
$ins_data['text'] = $text;
Database::pexecute($stmt, $ins_data);
} else {
$ins_data['text'] = 'No text given!!! Check scripts!';
Database::pexecute($stmt, $ins_data);
} }
} }
} }
} }
?>

View File

@@ -26,42 +26,36 @@ class ticket
* Userinfo * Userinfo
* @var array * @var array
*/ */
private $userinfo = array(); private $userinfo = array();
/** /**
* Database handler * Database handler
* @var db * @var db
*/ */
private $db = false; private $db = false;
/** /**
* Settings array * Settings array
* @var settings * @var settings
*/ */
private $settings = array(); private $settings = array();
/** /**
* Ticket ID * Ticket ID
* @var tid * @var tid
*/ */
private $tid = - 1; private $tid = - 1;
/** /**
* Ticket Data Array * Ticket Data Array
* @var t_data * @var t_data
*/ */
private $t_data = array(); private $t_data = array();
/** /**
* Ticket-Object-Array * Ticket-Object-Array
* @var tickets * @var tickets
*/ */
static private $tickets = array(); static private $tickets = array();
/** /**
@@ -78,7 +72,6 @@ class ticket
* @param array settings * @param array settings
* @param int ticket id * @param int ticket id
*/ */
private function __construct($userinfo, $db, $settings, $tid = - 1) private function __construct($userinfo, $db, $settings, $tid = - 1)
{ {
$this->userinfo = $userinfo; $this->userinfo = $userinfo;
@@ -94,11 +87,9 @@ class ticket
$this->_purifier = new HTMLPurifier($config); $this->_purifier = new HTMLPurifier($config);
// initialize data array // initialize data array
$this->initData(); $this->initData();
// read data from database // read data from database
$this->readData(); $this->readData();
} }
@@ -107,7 +98,6 @@ class ticket
* *
* @param int ticket id * @param int ticket id
*/ */
static public function getInstanceOf($_usernfo, $_db, $_settings, $_tid) static public function getInstanceOf($_usernfo, $_db, $_settings, $_tid)
{ {
if(!isset(self::$tickets[$_tid])) if(!isset(self::$tickets[$_tid]))
@@ -121,7 +111,6 @@ class ticket
/** /**
* Initialize data-array * Initialize data-array
*/ */
private function initData() private function initData()
{ {
$this->Set('customer', 0, true, true); $this->Set('customer', 0, true, true);
@@ -143,7 +132,6 @@ class ticket
/** /**
* Read ticket data from database. * Read ticket data from database.
*/ */
private function readData() private function readData()
{ {
if(isset($this->tid) if(isset($this->tid)
@@ -170,7 +158,6 @@ class ticket
/** /**
* Insert data to database * Insert data to database
*/ */
public function Insert() public function Insert()
{ {
$this->db->query("INSERT INTO `" . TABLE_PANEL_TICKETS . "` $this->db->query("INSERT INTO `" . TABLE_PANEL_TICKETS . "`
@@ -208,7 +195,6 @@ class ticket
/** /**
* Update data in database * Update data in database
*/ */
public function Update() public function Update()
{ {
// Update "main" ticket // Update "main" ticket
@@ -225,15 +211,12 @@ class ticket
/** /**
* Moves a ticket to the archive * Moves a ticket to the archive
*/ */
public function Archive() public function Archive()
{ {
// Update "main" ticket // Update "main" ticket
$this->db->query('UPDATE `' . TABLE_PANEL_TICKETS . '` SET `archived` = "1" WHERE `id` = "' . (int)$this->tid . '";'); $this->db->query('UPDATE `' . TABLE_PANEL_TICKETS . '` SET `archived` = "1" WHERE `id` = "' . (int)$this->tid . '";');
// Update "answers" to ticket // Update "answers" to ticket
$this->db->query('UPDATE `' . TABLE_PANEL_TICKETS . '` SET `archived` = "1" WHERE `answerto` = "' . (int)$this->tid . '";'); $this->db->query('UPDATE `' . TABLE_PANEL_TICKETS . '` SET `archived` = "1" WHERE `answerto` = "' . (int)$this->tid . '";');
return true; return true;
} }
@@ -241,15 +224,12 @@ class ticket
/** /**
* Remove ticket from database * Remove ticket from database
*/ */
public function Delete() public function Delete()
{ {
// Delete "main" ticket // Delete "main" ticket
$this->db->query('DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = "' . (int)$this->tid . '";'); $this->db->query('DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = "' . (int)$this->tid . '";');
// Delete "answers" to ticket" // Delete "answers" to ticket"
$this->db->query('DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto` = "' . (int)$this->tid . '";'); $this->db->query('DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto` = "' . (int)$this->tid . '";');
return true; return true;
} }
@@ -257,17 +237,14 @@ class ticket
/** /**
* Mail notifications * Mail notifications
*/ */
public function sendMail($customerid = - 1, $template_subject = null, $default_subject = null, $template_body = null, $default_body = null) public function sendMail($customerid = - 1, $template_subject = null, $default_subject = null, $template_body = null, $default_body = null)
{ {
global $mail, $theme; global $mail, $theme;
// Some checks are to be made here in the future // Some checks are to be made here in the future
if($customerid != - 1) if($customerid != - 1)
{ {
// Get e-mail message for customer // Get e-mail message for customer
$usr = $this->db->query_first('SELECT `name`, `firstname`, `company`, `email` $usr = $this->db->query_first('SELECT `name`, `firstname`, `company`, `email`
FROM `' . TABLE_PANEL_CUSTOMERS . '` FROM `' . TABLE_PANEL_CUSTOMERS . '`
WHERE `customerid` = "' . (int)$customerid . '"'); WHERE `customerid` = "' . (int)$customerid . '"');
@@ -318,7 +295,7 @@ class ticket
} }
if ($_mailerror) { if ($_mailerror) {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class'), $this->db, $this->settings); $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class'), $this->settings);
$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']);
} }
@@ -346,7 +323,7 @@ class ticket
} }
if ($_mailerror) { if ($_mailerror) {
$rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class'), $this->db, $this->settings); $rstlog = FroxlorLogger::getInstanceOf(array('loginname' => 'ticket_class'), $this->settings);
$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']);
} }
@@ -358,7 +335,6 @@ class ticket
/** /**
* Add a support-categories * Add a support-categories
*/ */
static public function addCategory($_db, $_category = null, $_admin = 1, $_order = 1) static public function addCategory($_db, $_category = null, $_admin = 1, $_order = 1)
{ {
if($_category != null if($_category != null
@@ -381,7 +357,6 @@ class ticket
/** /**
* Edit a support-categories * Edit a support-categories
*/ */
static public function editCategory($_db, $_category = null, $_id = 0, $_order = 1) static public function editCategory($_db, $_category = null, $_id = 0, $_order = 1)
{ {
if($_category != null if($_category != null
@@ -405,7 +380,6 @@ class ticket
/** /**
* Delete a support-categories * Delete a support-categories
*/ */
static public function deleteCategory($_db, $_id = 0) static public function deleteCategory($_db, $_id = 0)
{ {
if($_id != 0) if($_id != 0)
@@ -430,7 +404,6 @@ class ticket
/** /**
* Return a support-category-name * Return a support-category-name
*/ */
static public function getCategoryName($_db, $_id = 0) static public function getCategoryName($_db, $_id = 0)
{ {
if($_id != 0) if($_id != 0)
@@ -463,7 +436,6 @@ class ticket
/** /**
* returns the last x archived tickets * returns the last x archived tickets
*/ */
static public function getLastArchived($_db, $_num = 10, $_admin = 1) static public function getLastArchived($_db, $_num = 10, $_admin = 1)
{ {
if($_num > 0) if($_num > 0)
@@ -511,7 +483,6 @@ class ticket
/** /**
* Returns a sql-statement to search the archive * Returns a sql-statement to search the archive
*/ */
static public function getArchiveSearchStatement($db, $subject = NULL, $priority = NULL, $fromdate = NULL, $todate = NULL, $message = NULL, $customer = - 1, $admin = 1, $categories = NULL) static public function getArchiveSearchStatement($db, $subject = NULL, $priority = NULL, $fromdate = NULL, $todate = NULL, $message = NULL, $customer = - 1, $admin = 1, $categories = NULL)
{ {
$query = 'SELECT `main`.*, $query = 'SELECT `main`.*,
@@ -641,7 +612,6 @@ class ticket
/** /**
* Get statustext by status-no * Get statustext by status-no
*/ */
static public function getStatusText($_lng, $_status = 0) static public function getStatusText($_lng, $_status = 0)
{ {
switch($_status) switch($_status)
@@ -664,7 +634,6 @@ class ticket
/** /**
* Get prioritytext by priority-no * Get prioritytext by priority-no
*/ */
static public function getPriorityText($_lng, $_priority = 0) static public function getPriorityText($_lng, $_priority = 0)
{ {
switch($_priority) switch($_priority)
@@ -702,7 +671,7 @@ class ticket
return $str; return $str;
} }
/* /**
* function customerHasTickets * function customerHasTickets
* *
* @param object mysql-db-object * @param object mysql-db-object
@@ -731,7 +700,6 @@ class ticket
/** /**
* Get a data-var * Get a data-var
*/ */
public function Get($_var = '', $_vartrusted = false) public function Get($_var = '', $_vartrusted = false)
{ {
if($_var != '') if($_var != '')
@@ -766,7 +734,6 @@ class ticket
/** /**
* Set a data-var * Set a data-var
*/ */
public function Set($_var = '', $_value = '', $_vartrusted = false, $_valuetrusted = false) public function Set($_var = '', $_value = '', $_vartrusted = false, $_valuetrusted = false)
{ {
if($_var != '' if($_var != ''
@@ -791,5 +758,3 @@ class ticket
} }
} }
} }
?>

View File

@@ -185,5 +185,5 @@ $cronscriptDebug = ($settings['system']['debug_cron'] == '1') ? true : false;
$idna_convert = new idna_convert_wrapper(); $idna_convert = new idna_convert_wrapper();
// Initialize logging // Initialize logging
$cronlog = FroxlorLogger::getInstanceOf(array('loginname' => 'cronjob'), $db, $settings); $cronlog = FroxlorLogger::getInstanceOf(array('loginname' => 'cronjob'), $settings);
fwrite($debugHandler, 'Logger has been included' . "\n"); fwrite($debugHandler, 'Logger has been included' . "\n");

View File

@@ -382,7 +382,7 @@ if (isset($userinfo['loginname'])
) { ) {
$lng['menue']['main']['username'].= $userinfo['loginname']; $lng['menue']['main']['username'].= $userinfo['loginname'];
//Initialize logging //Initialize logging
$log = FroxlorLogger::getInstanceOf($userinfo, $db, $settings); $log = FroxlorLogger::getInstanceOf($userinfo, $settings);
} }
/** /**