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:
@@ -266,7 +266,7 @@ if ($action == 'forgotpwd') {
|
||||
WHERE `loginname`='" . $user['loginname'] . "'
|
||||
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!");
|
||||
|
||||
$replace_arr = array(
|
||||
@@ -299,7 +299,7 @@ if ($action == 'forgotpwd') {
|
||||
}
|
||||
|
||||
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);
|
||||
redirectTo('index.php', Array('showmessage' => '4', 'customermail' => $user['email']), true);
|
||||
exit;
|
||||
@@ -309,7 +309,7 @@ if ($action == 'forgotpwd') {
|
||||
redirectTo('index.php', Array('showmessage' => '1'), true);
|
||||
exit;
|
||||
} 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!");
|
||||
$message = $lng['login']['combination_not_found'];
|
||||
}
|
||||
|
||||
@@ -16,46 +16,39 @@
|
||||
*/
|
||||
|
||||
// some configs
|
||||
|
||||
$baseLanguage = 'english.lng.php';
|
||||
|
||||
// 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.');
|
||||
}
|
||||
|
||||
// Check argument count
|
||||
|
||||
if(sizeof($argv) != 2)
|
||||
{
|
||||
if (sizeof($argv) != 2) {
|
||||
print_help($argv);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Load the contents of the given path
|
||||
|
||||
$path = $argv[1];
|
||||
$files = array();
|
||||
|
||||
if($dh = opendir($path))
|
||||
{
|
||||
while(false !== ($file = readdir($dh)))
|
||||
{
|
||||
if($file != "."
|
||||
if ($dh = opendir($path)) {
|
||||
while (false !== ($file = readdir($dh))) {
|
||||
if ($file != "."
|
||||
&& $file != ".."
|
||||
&& !is_dir($file)
|
||||
&& preg_match('/(.+)\.lng\.php/i', $file))
|
||||
{
|
||||
&& preg_match('/(.+)\.lng\.php/i', $file)
|
||||
) {
|
||||
$files[$file] = str_replace('//', '/', $path . '/' . $file);
|
||||
}
|
||||
}
|
||||
|
||||
closedir($dh);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print "ERROR: The path you requested cannot be read! \n ";
|
||||
print "\n";
|
||||
print_help();
|
||||
@@ -63,9 +56,7 @@ else
|
||||
}
|
||||
|
||||
// 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 "\n";
|
||||
print_help();
|
||||
@@ -73,49 +64,40 @@ if(!isset($files[$baseLanguage]))
|
||||
}
|
||||
|
||||
// import the baselanguage
|
||||
|
||||
$base = import($files[$baseLanguage]);
|
||||
|
||||
// and unset it in the files, because we don't need to compare base to base
|
||||
|
||||
unset($files[$baseLanguage]);
|
||||
|
||||
// compare each language with the baselanguage
|
||||
|
||||
foreach($files as $key => $file)
|
||||
{
|
||||
foreach ($files as $key => $file) {
|
||||
$comp = import($file);
|
||||
|
||||
print "\n\nComparing " . $baseLanguage . " to " . $key . "\n";
|
||||
$result = compare($base, $comp);
|
||||
|
||||
if(is_array($result)
|
||||
&& sizeof($result) > 0)
|
||||
{
|
||||
if (is_array($result)
|
||||
&& sizeof($result) > 0
|
||||
) {
|
||||
print " found missing strings: \n";
|
||||
foreach($result as $value)
|
||||
{
|
||||
foreach ($result as $value) {
|
||||
print " " . $value . "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " no missing strings found! \n ";
|
||||
}
|
||||
|
||||
print "\nReverse Checking " . $key . " to " . $baseLanguage . "\n";
|
||||
$result = compare($comp, $base);
|
||||
|
||||
if(is_array($result)
|
||||
&& sizeof($result) > 0)
|
||||
{
|
||||
if (is_array($result)
|
||||
&& sizeof($result) > 0
|
||||
) {
|
||||
print " found strings not in basefile: \n";
|
||||
foreach($result as $key => $value)
|
||||
{
|
||||
foreach ($result as $key => $value) {
|
||||
print " " . $value . "\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
print " There are no strings which are not in the basefile! \n ";
|
||||
}
|
||||
}
|
||||
@@ -129,56 +111,45 @@ foreach($files as $key => $file)
|
||||
*
|
||||
* @param array $argv
|
||||
*/
|
||||
|
||||
function print_help($argv)
|
||||
{
|
||||
function print_help($argv) {
|
||||
print "Usage: php " . $argv[0] . " /PATH/TO/LNG \n";
|
||||
print " \n ";
|
||||
}
|
||||
|
||||
function import($file)
|
||||
{
|
||||
function import($file) {
|
||||
|
||||
$input = file($file);
|
||||
$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 = str_replace('[\'', '/', $key);
|
||||
$key = trim(str_replace('\']', '', $key));
|
||||
|
||||
//generate the value
|
||||
|
||||
$value = trim($value);
|
||||
|
||||
// set the result
|
||||
|
||||
$return[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
function compare($array1, $array2)
|
||||
{
|
||||
function compare($array1, $array2) {
|
||||
|
||||
$result = array();
|
||||
foreach($array1 as $key => $value)
|
||||
{
|
||||
if(!isset($array2[$key]))
|
||||
{
|
||||
|
||||
foreach ($array1 as $key => $value) {
|
||||
|
||||
if (!isset($array2[$key])) {
|
||||
$result[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -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'));
|
||||
$filelog = FileLogger::getInstanceOf(array('loginname' => 'updater'), $settings);
|
||||
|
||||
@@ -26,35 +26,24 @@ class FroxlorLogger
|
||||
* Userinfo
|
||||
* @var array
|
||||
*/
|
||||
|
||||
private $userinfo = array();
|
||||
|
||||
/**
|
||||
* Database handler
|
||||
* @var db
|
||||
*/
|
||||
|
||||
private $db = false;
|
||||
|
||||
/**
|
||||
* Settings array
|
||||
* @var settings
|
||||
*/
|
||||
|
||||
private $settings = array();
|
||||
|
||||
/**
|
||||
* LogTypes Array
|
||||
* @var logtypes
|
||||
*/
|
||||
|
||||
static private $logtypes = null;
|
||||
|
||||
/**
|
||||
* Logger-Object-Array
|
||||
* @var loggers
|
||||
*/
|
||||
|
||||
static private $loggers = null;
|
||||
|
||||
/**
|
||||
@@ -63,31 +52,24 @@ class FroxlorLogger
|
||||
* @param array userinfo
|
||||
* @param array settings
|
||||
*/
|
||||
|
||||
protected function __construct($userinfo, $db, $settings)
|
||||
{
|
||||
protected function __construct($userinfo, $settings) {
|
||||
$this->userinfo = $userinfo;
|
||||
$this->db = $db;
|
||||
$this->settings = $settings;
|
||||
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']['enabled'])
|
||||
&& $this->settings['logger']['enabled'])
|
||||
{
|
||||
&& $this->settings['logger']['enabled']
|
||||
) {
|
||||
self::$logtypes[0] = 'syslog';
|
||||
self::$logtypes[1] = 'mysql';
|
||||
}
|
||||
else
|
||||
{
|
||||
if(isset($this->settings['logger']['logtypes'])
|
||||
&& $this->settings['logger']['logtypes'] != '')
|
||||
{
|
||||
} else {
|
||||
if (isset($this->settings['logger']['logtypes'])
|
||||
&& $this->settings['logger']['logtypes'] != ''
|
||||
) {
|
||||
self::$logtypes = explode(',', $this->settings['logger']['logtypes']);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
self::$logtypes = null;
|
||||
}
|
||||
}
|
||||
@@ -97,40 +79,37 @@ class FroxlorLogger
|
||||
* Singleton ftw ;-)
|
||||
*
|
||||
*/
|
||||
|
||||
static public function getInstanceOf($_usernfo, $_db, $_settings)
|
||||
{
|
||||
if(!isset($_usernfo)
|
||||
|| $_usernfo == null)
|
||||
static public function getInstanceOf($_usernfo, $_settings)
|
||||
{
|
||||
if (!isset($_usernfo)
|
||||
|| $_usernfo == null
|
||||
) {
|
||||
$_usernfo = array();
|
||||
$_usernfo['loginname'] = 'unknown';
|
||||
}
|
||||
|
||||
if(!isset(self::$loggers[$_usernfo['loginname']]))
|
||||
{
|
||||
self::$loggers[$_usernfo['loginname']] = new FroxlorLogger($_usernfo, $_db, $_settings);
|
||||
if (!isset(self::$loggers[$_usernfo['loginname']])) {
|
||||
self::$loggers[$_usernfo['loginname']] = new FroxlorLogger($_usernfo, $_settings);
|
||||
}
|
||||
|
||||
return self::$loggers[$_usernfo['loginname']];
|
||||
}
|
||||
|
||||
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null)
|
||||
{
|
||||
if(self::$logtypes == null)
|
||||
{
|
||||
public function logAction ($action = USR_ACTION, $type = LOG_NOTICE, $text = null) {
|
||||
|
||||
if (self::$logtypes == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if($this->settings['logger']['log_cron'] == '0'
|
||||
&& $action == CRON_ACTION)
|
||||
{
|
||||
if ($this->settings['logger']['log_cron'] == '0'
|
||||
&& $action == CRON_ACTION
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach(self::$logtypes as $logger)
|
||||
{
|
||||
switch($logger)
|
||||
foreach (self::$logtypes as $logger) {
|
||||
|
||||
switch ($logger)
|
||||
{
|
||||
case 'syslog':
|
||||
$_log = SysLogger::getInstanceOf($this->userinfo, $this->settings);
|
||||
@@ -140,43 +119,30 @@ class FroxlorLogger
|
||||
{
|
||||
$_log = FileLogger::getInstanceOf($this->userinfo, $this->settings);
|
||||
}
|
||||
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($action != CRON_ACTION)
|
||||
{
|
||||
if ($action != CRON_ACTION) {
|
||||
standard_error('logerror', $e->getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "Log-Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
case 'mysql':
|
||||
$_log = MysqlLogger::getInstanceOf($this->userinfo, $this->settings, $this->db);
|
||||
$_log = MysqlLogger::getInstanceOf($this->userinfo, $this->settings);
|
||||
break;
|
||||
default:
|
||||
$_log = null;
|
||||
break;
|
||||
}
|
||||
|
||||
if($_log != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ($_log != null) {
|
||||
try {
|
||||
$_log->logAction($action, $type, $text);
|
||||
}
|
||||
|
||||
catch(Exception $e)
|
||||
{
|
||||
if($action != CRON_ACTION)
|
||||
{
|
||||
} catch(Exception $e) {
|
||||
if ($action != CRON_ACTION) {
|
||||
standard_error('logerror', $e->getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
echo "Log-Error: " . $e->getMessage();
|
||||
}
|
||||
}
|
||||
@@ -184,20 +150,22 @@ class FroxlorLogger
|
||||
}
|
||||
}
|
||||
|
||||
public function setCronLog($_cronlog = 0)
|
||||
{
|
||||
public function setCronLog($_cronlog = 0) {
|
||||
|
||||
$_cronlog = (int)$_cronlog;
|
||||
|
||||
if($_cronlog != 0
|
||||
&& $_cronlog != 1)
|
||||
{
|
||||
if ($_cronlog != 0
|
||||
&& $_cronlog != 1
|
||||
) {
|
||||
$_cronlog = 0;
|
||||
}
|
||||
|
||||
$this->db->query("UPDATE `" . TABLE_PANEL_SETTINGS . "`
|
||||
SET `value`='" . $this->db->escape($_cronlog) . "'
|
||||
WHERE `settinggroup`='logger'
|
||||
AND `varname`='log_cron'");
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,27 +20,18 @@
|
||||
* Logger - MySQL-Logger-Class
|
||||
*/
|
||||
|
||||
class MysqlLogger extends AbstractLogger
|
||||
{
|
||||
class MysqlLogger extends AbstractLogger {
|
||||
|
||||
/**
|
||||
* Userinfo
|
||||
* @var array
|
||||
*/
|
||||
|
||||
private $userinfo = array();
|
||||
|
||||
/**
|
||||
* Database handler
|
||||
* @var db
|
||||
*/
|
||||
|
||||
private $db = false;
|
||||
|
||||
/**
|
||||
* Syslogger Objects Array
|
||||
* @var loggers
|
||||
*/
|
||||
|
||||
static private $loggers = array();
|
||||
|
||||
/**
|
||||
@@ -48,66 +39,69 @@ class MysqlLogger extends AbstractLogger
|
||||
*
|
||||
* @param array userinfo
|
||||
* @param array settings
|
||||
* @param resource database
|
||||
*/
|
||||
|
||||
protected function __construct($userinfo, $settings, $db)
|
||||
{
|
||||
protected function __construct($userinfo, $settings) {
|
||||
parent::setupLogger($settings);
|
||||
$this->userinfo = $userinfo;
|
||||
$this->db = $db;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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, $_db);
|
||||
if (!isset(self::$loggers[$_usernfo['loginname']])) {
|
||||
self::$loggers[$_usernfo['loginname']] = new MysqlLogger($_usernfo, $_settings);
|
||||
}
|
||||
|
||||
return self::$loggers[$_usernfo['loginname']];
|
||||
}
|
||||
|
||||
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null)
|
||||
{
|
||||
if(parent::isEnabled())
|
||||
{
|
||||
if(parent::getSeverity() <= 1
|
||||
&& $type == LOG_NOTICE)
|
||||
{
|
||||
public function logAction($action = USR_ACTION, $type = LOG_NOTICE, $text = null) {
|
||||
|
||||
if (parent::isEnabled()) {
|
||||
|
||||
if (parent::getSeverity() <= 1
|
||||
&& $type == LOG_NOTICE
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!isset($this->userinfo['loginname'])
|
||||
|| $this->userinfo['loginname'] == '')
|
||||
{
|
||||
if (!isset($this->userinfo['loginname'])
|
||||
|| $this->userinfo['loginname'] == ''
|
||||
) {
|
||||
$name = 'unknown';
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$name = " (" . $this->userinfo['loginname'] . ")";
|
||||
}
|
||||
|
||||
$now = time();
|
||||
|
||||
if($text != null
|
||||
&& $text != '')
|
||||
{
|
||||
$this->db->query("INSERT INTO `panel_syslog` (`type`, `date`, `action`, `user`, `text`)
|
||||
VALUES ('" . (int)$type . "', '" . $now . "', '" . (int)$action . "', '" . $this->db->escape($name) . "', '" . $this->db->escape($text) . "')");
|
||||
}
|
||||
else
|
||||
{
|
||||
$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!')");
|
||||
$stmt = Database::prepare("
|
||||
INSERT INTO `panel_syslog` SET
|
||||
`type` = :type,
|
||||
`date` = :now,
|
||||
`action` = :action,
|
||||
`user` = :user,
|
||||
`text` = :text"
|
||||
);
|
||||
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -26,42 +26,36 @@ class ticket
|
||||
* Userinfo
|
||||
* @var array
|
||||
*/
|
||||
|
||||
private $userinfo = array();
|
||||
|
||||
/**
|
||||
* Database handler
|
||||
* @var db
|
||||
*/
|
||||
|
||||
private $db = false;
|
||||
|
||||
/**
|
||||
* Settings array
|
||||
* @var settings
|
||||
*/
|
||||
|
||||
private $settings = array();
|
||||
|
||||
/**
|
||||
* Ticket ID
|
||||
* @var tid
|
||||
*/
|
||||
|
||||
private $tid = - 1;
|
||||
|
||||
/**
|
||||
* Ticket Data Array
|
||||
* @var t_data
|
||||
*/
|
||||
|
||||
private $t_data = array();
|
||||
|
||||
/**
|
||||
* Ticket-Object-Array
|
||||
* @var tickets
|
||||
*/
|
||||
|
||||
static private $tickets = array();
|
||||
|
||||
/**
|
||||
@@ -78,7 +72,6 @@ class ticket
|
||||
* @param array settings
|
||||
* @param int ticket id
|
||||
*/
|
||||
|
||||
private function __construct($userinfo, $db, $settings, $tid = - 1)
|
||||
{
|
||||
$this->userinfo = $userinfo;
|
||||
@@ -94,11 +87,9 @@ class ticket
|
||||
$this->_purifier = new HTMLPurifier($config);
|
||||
|
||||
// initialize data array
|
||||
|
||||
$this->initData();
|
||||
|
||||
// read data from database
|
||||
|
||||
$this->readData();
|
||||
}
|
||||
|
||||
@@ -107,7 +98,6 @@ class ticket
|
||||
*
|
||||
* @param int ticket id
|
||||
*/
|
||||
|
||||
static public function getInstanceOf($_usernfo, $_db, $_settings, $_tid)
|
||||
{
|
||||
if(!isset(self::$tickets[$_tid]))
|
||||
@@ -121,7 +111,6 @@ class ticket
|
||||
/**
|
||||
* Initialize data-array
|
||||
*/
|
||||
|
||||
private function initData()
|
||||
{
|
||||
$this->Set('customer', 0, true, true);
|
||||
@@ -143,7 +132,6 @@ class ticket
|
||||
/**
|
||||
* Read ticket data from database.
|
||||
*/
|
||||
|
||||
private function readData()
|
||||
{
|
||||
if(isset($this->tid)
|
||||
@@ -170,7 +158,6 @@ class ticket
|
||||
/**
|
||||
* Insert data to database
|
||||
*/
|
||||
|
||||
public function Insert()
|
||||
{
|
||||
$this->db->query("INSERT INTO `" . TABLE_PANEL_TICKETS . "`
|
||||
@@ -208,7 +195,6 @@ class ticket
|
||||
/**
|
||||
* Update data in database
|
||||
*/
|
||||
|
||||
public function Update()
|
||||
{
|
||||
// Update "main" ticket
|
||||
@@ -225,15 +211,12 @@ class ticket
|
||||
/**
|
||||
* Moves a ticket to the archive
|
||||
*/
|
||||
|
||||
public function Archive()
|
||||
{
|
||||
// Update "main" ticket
|
||||
|
||||
$this->db->query('UPDATE `' . TABLE_PANEL_TICKETS . '` SET `archived` = "1" WHERE `id` = "' . (int)$this->tid . '";');
|
||||
|
||||
// Update "answers" to ticket
|
||||
|
||||
$this->db->query('UPDATE `' . TABLE_PANEL_TICKETS . '` SET `archived` = "1" WHERE `answerto` = "' . (int)$this->tid . '";');
|
||||
return true;
|
||||
}
|
||||
@@ -241,15 +224,12 @@ class ticket
|
||||
/**
|
||||
* Remove ticket from database
|
||||
*/
|
||||
|
||||
public function Delete()
|
||||
{
|
||||
// Delete "main" ticket
|
||||
|
||||
$this->db->query('DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `id` = "' . (int)$this->tid . '";');
|
||||
|
||||
// Delete "answers" to ticket"
|
||||
|
||||
$this->db->query('DELETE FROM `' . TABLE_PANEL_TICKETS . '` WHERE `answerto` = "' . (int)$this->tid . '";');
|
||||
return true;
|
||||
}
|
||||
@@ -257,17 +237,14 @@ class ticket
|
||||
/**
|
||||
* Mail notifications
|
||||
*/
|
||||
|
||||
public function sendMail($customerid = - 1, $template_subject = null, $default_subject = null, $template_body = null, $default_body = null)
|
||||
{
|
||||
global $mail, $theme;
|
||||
|
||||
// Some checks are to be made here in the future
|
||||
|
||||
if($customerid != - 1)
|
||||
{
|
||||
// Get e-mail message for customer
|
||||
|
||||
$usr = $this->db->query_first('SELECT `name`, `firstname`, `company`, `email`
|
||||
FROM `' . TABLE_PANEL_CUSTOMERS . '`
|
||||
WHERE `customerid` = "' . (int)$customerid . '"');
|
||||
@@ -318,7 +295,7 @@ class ticket
|
||||
}
|
||||
|
||||
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);
|
||||
standard_error('errorsendingmail', $usr['email']);
|
||||
}
|
||||
@@ -346,7 +323,7 @@ class ticket
|
||||
}
|
||||
|
||||
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);
|
||||
standard_error('errorsendingmail', $admin['email']);
|
||||
}
|
||||
@@ -358,7 +335,6 @@ class ticket
|
||||
/**
|
||||
* Add a support-categories
|
||||
*/
|
||||
|
||||
static public function addCategory($_db, $_category = null, $_admin = 1, $_order = 1)
|
||||
{
|
||||
if($_category != null
|
||||
@@ -381,7 +357,6 @@ class ticket
|
||||
/**
|
||||
* Edit a support-categories
|
||||
*/
|
||||
|
||||
static public function editCategory($_db, $_category = null, $_id = 0, $_order = 1)
|
||||
{
|
||||
if($_category != null
|
||||
@@ -405,7 +380,6 @@ class ticket
|
||||
/**
|
||||
* Delete a support-categories
|
||||
*/
|
||||
|
||||
static public function deleteCategory($_db, $_id = 0)
|
||||
{
|
||||
if($_id != 0)
|
||||
@@ -430,7 +404,6 @@ class ticket
|
||||
/**
|
||||
* Return a support-category-name
|
||||
*/
|
||||
|
||||
static public function getCategoryName($_db, $_id = 0)
|
||||
{
|
||||
if($_id != 0)
|
||||
@@ -463,7 +436,6 @@ class ticket
|
||||
/**
|
||||
* returns the last x archived tickets
|
||||
*/
|
||||
|
||||
static public function getLastArchived($_db, $_num = 10, $_admin = 1)
|
||||
{
|
||||
if($_num > 0)
|
||||
@@ -511,7 +483,6 @@ class ticket
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
$query = 'SELECT `main`.*,
|
||||
@@ -641,7 +612,6 @@ class ticket
|
||||
/**
|
||||
* Get statustext by status-no
|
||||
*/
|
||||
|
||||
static public function getStatusText($_lng, $_status = 0)
|
||||
{
|
||||
switch($_status)
|
||||
@@ -664,7 +634,6 @@ class ticket
|
||||
/**
|
||||
* Get prioritytext by priority-no
|
||||
*/
|
||||
|
||||
static public function getPriorityText($_lng, $_priority = 0)
|
||||
{
|
||||
switch($_priority)
|
||||
@@ -702,7 +671,7 @@ class ticket
|
||||
return $str;
|
||||
}
|
||||
|
||||
/*
|
||||
/**
|
||||
* function customerHasTickets
|
||||
*
|
||||
* @param object mysql-db-object
|
||||
@@ -731,7 +700,6 @@ class ticket
|
||||
/**
|
||||
* Get a data-var
|
||||
*/
|
||||
|
||||
public function Get($_var = '', $_vartrusted = false)
|
||||
{
|
||||
if($_var != '')
|
||||
@@ -766,7 +734,6 @@ class ticket
|
||||
/**
|
||||
* Set a data-var
|
||||
*/
|
||||
|
||||
public function Set($_var = '', $_value = '', $_vartrusted = false, $_valuetrusted = false)
|
||||
{
|
||||
if($_var != ''
|
||||
@@ -791,5 +758,3 @@ class ticket
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -185,5 +185,5 @@ $cronscriptDebug = ($settings['system']['debug_cron'] == '1') ? true : false;
|
||||
$idna_convert = new idna_convert_wrapper();
|
||||
|
||||
// Initialize logging
|
||||
$cronlog = FroxlorLogger::getInstanceOf(array('loginname' => 'cronjob'), $db, $settings);
|
||||
$cronlog = FroxlorLogger::getInstanceOf(array('loginname' => 'cronjob'), $settings);
|
||||
fwrite($debugHandler, 'Logger has been included' . "\n");
|
||||
|
||||
@@ -382,7 +382,7 @@ if (isset($userinfo['loginname'])
|
||||
) {
|
||||
$lng['menue']['main']['username'].= $userinfo['loginname'];
|
||||
//Initialize logging
|
||||
$log = FroxlorLogger::getInstanceOf($userinfo, $db, $settings);
|
||||
$log = FroxlorLogger::getInstanceOf($userinfo, $settings);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user