From 46182a9fd0b5bdfc3b6feb08307b11e906eebaf8 Mon Sep 17 00:00:00 2001 From: cajus Date: Fri, 20 May 2005 16:55:31 +0000 Subject: [PATCH] Fixed errors git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@313 594d385d-05f5-0310-b6e9-bd551577e9d8 --- contrib/gosa.conf | 2 +- html/getfax.php | 4 +- include/functions.inc | 4 + plugins/addons/logview/class_logview.inc | 195 +++++++++++----------- plugins/addons/logview/contents.tpl | 2 +- plugins/gofax/reports/class_faxreport.inc | 5 +- plugins/gofon/reports/class_fonreport.inc | 3 + 7 files changed, 114 insertions(+), 101 deletions(-) diff --git a/contrib/gosa.conf b/contrib/gosa.conf index f06b7b2ec..7d4976c20 100644 --- a/contrib/gosa.conf +++ b/contrib/gosa.conf @@ -145,7 +145,7 @@ -
diff --git a/plugins/addons/logview/class_logview.inc b/plugins/addons/logview/class_logview.inc index dc6a597e5..2c1bf15c6 100644 --- a/plugins/addons/logview/class_logview.inc +++ b/plugins/addons/logview/class_logview.inc @@ -13,7 +13,7 @@ class logview extends plugin var $sort= 2; var $sort_direction= "down"; var $hostlist= array(); - var $levellist= array(); + var $loglevellist= array(); var $tilist= array(); var $fields= array("log_level", "host", "time_stamp", "message"); @@ -38,9 +38,10 @@ class logview extends plugin } $cfg= $this->config->data['SERVERS']['LOG']; + $tmp= set_error_handler('dummy_error_handler'); $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']); + set_error_handler($tmp); if ($link === FALSE){ - print_red(_("Can't connect to log database, no logs can be shown!")); return; } if (! @mysql_select_db("gomon")){ @@ -125,106 +126,108 @@ class logview extends plugin } /* Query stuff */ + $res= ""; $cfg= $this->config->data['SERVERS']['LOG']; + $tmp= set_error_handler('dummy_error_handler'); $link = @mysql_pconnect($cfg['SERVER'], $cfg['LOGIN'], $cfg['PASSWORD']); + set_error_handler($tmp); if ($link === FALSE){ print_red(_("Can't connect to log database, no logs can be shown!")); - return; - } - if (! @mysql_select_db("gomon")){ - print_red(_("Can't select log database for log generation!")); - return; - } - - /* Get number of entries */ - $query= "SELECT COUNT(*) FROM golog;"; - $result = @mysql_query($query); - $line= mysql_fetch_array($result, MYSQL_ASSOC); - $count= $line['COUNT(*)']; - if ($count > 25){ - $smarty->assign("range_selector", range_selector($count, $this->start, 25)); - } - - /* Assemble time query */ - switch ($logfilter['time']){ - case '0': - $start= date ("YmdHis", time() - 3600); - break; - ;; - case '1': - $start= date ("YmdHis", time() - 21600); - break; - ;; - case '2': - $start= date ("YmdHis", time() - 43200); - break; - ;; - case '3': - $start= date ("YmdHis", time() - 86400); - break; - ;; - case '4': - $start= date ("YmdHis", time() - 172800); - break; - ;; - case '5': - $start= date ("YmdHis", time() - 604800); - break; - ;; - case '6': - $start= date ("YmdHis", time() - 1209600); - break; - ;; - case '7': - $start= date ("YmdHis", time() - 2419200); - break; - ;; - } - - /* Assemble log level query */ - if ($logfilter['log_level'] == '!All'){ - $ll= ""; - } else { - $ll= "AND log_level='".$logfilter['log_level']."'"; - } - if ($logfilter['host'] == '!All'){ - $hf= ""; } else { - $hf= "AND host='".$logfilter['host']."'"; - } - - /* Order setting */ - if ($this->sort_direction == "down"){ - $desc= "DESC"; - } else { - $desc= ""; - } - - $end= date ("YmdHis"); - $query= "SELECT * FROM golog WHERE message like '".$logfilter['regex']."' $ll $hf AND time_stamp <= $end AND time_stamp >= $start ORDER BY ".$this->fields[$this->sort]." $desc LIMIT ".$this->start.",25;"; - @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query"); - $result = @mysql_query($query); - if ($result === false){ - print_red(_("Query for log database failed!")); - return; - } - - /* Display results */ - $res= ""; - $mod= 0; - while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){ - if ( ($mod++) & 1){ - $col= "background-color: #ECECEC;"; - } else { - $col= "background-color: #F5F5F5;"; - } - - $res.="\n"; - $res.="".$line['host'].""; - $res.="".$line['time_stamp']."".$line['message'].""; - $res.="\n"; + if (! @mysql_select_db("gomon")){ + print_red(_("Can't select log database for log generation!")); + } else { + + /* Get number of entries */ + $query= "SELECT COUNT(*) FROM golog;"; + $result = @mysql_query($query); + $line= mysql_fetch_array($result, MYSQL_ASSOC); + $count= $line['COUNT(*)']; + if ($count > 25){ + $smarty->assign("range_selector", range_selector($count, $this->start, 25)); + } + + /* Assemble time query */ + switch ($logfilter['time']){ + case '0': + $start= date ("YmdHis", time() - 3600); + break; + ;; + case '1': + $start= date ("YmdHis", time() - 21600); + break; + ;; + case '2': + $start= date ("YmdHis", time() - 43200); + break; + ;; + case '3': + $start= date ("YmdHis", time() - 86400); + break; + ;; + case '4': + $start= date ("YmdHis", time() - 172800); + break; + ;; + case '5': + $start= date ("YmdHis", time() - 604800); + break; + ;; + case '6': + $start= date ("YmdHis", time() - 1209600); + break; + ;; + case '7': + $start= date ("YmdHis", time() - 2419200); + break; + ;; + } + + /* Assemble log level query */ + if ($logfilter['log_level'] == '!All'){ + $ll= ""; + } else { + $ll= "AND log_level='".$logfilter['log_level']."'"; + } + if ($logfilter['host'] == '!All'){ + $hf= ""; + } else { + $hf= "AND host='".$logfilter['host']."'"; + } + + /* Order setting */ + if ($this->sort_direction == "down"){ + $desc= "DESC"; + } else { + $desc= ""; + } + + $end= date ("YmdHis"); + $query= "SELECT * FROM golog WHERE message like '".$logfilter['regex']."' $ll $hf AND time_stamp <= $end AND time_stamp >= $start ORDER BY ".$this->fields[$this->sort]." $desc LIMIT ".$this->start.",25;"; + @DEBUG (DEBUG_MYSQL, __LINE__, __FUNCTION__, __FILE__, $query, "Database query"); + $result = @mysql_query($query); + if ($result === false){ + print_red(_("Query for log database failed!")); + return; + } + + /* Display results */ + $mod= 0; + while ($line = mysql_fetch_array($result, MYSQL_ASSOC)){ + if ( ($mod++) & 1){ + $col= "background-color: #ECECEC;"; + } else { + $col= "background-color: #F5F5F5;"; + } + + $res.="\n"; + $res.="".$line['host'].""; + $res.="".$line['time_stamp']."".$line['message'].""; + $res.="\n"; + } + mysql_close($link); + } } - mysql_close($link); /* Show main page */ $smarty->assign("search_result", $res); diff --git a/plugins/addons/logview/contents.tpl b/plugins/addons/logview/contents.tpl index f84f980b8..bf6ea21fa 100644 --- a/plugins/addons/logview/contents.tpl +++ b/plugins/addons/logview/contents.tpl @@ -57,7 +57,7 @@  {t}Ruleset{/t} - + diff --git a/plugins/gofax/reports/class_faxreport.inc b/plugins/gofax/reports/class_faxreport.inc index 654aabada..852af00e4 100644 --- a/plugins/gofax/reports/class_faxreport.inc +++ b/plugins/gofax/reports/class_faxreport.inc @@ -130,7 +130,7 @@ class faxreport extends plugin } $queuing_time= $line['queuing_time']; - $_SESSION['userfilter']= $this->userfilter; + $_SESSION['fuserfilter']= $this->userfilter; $smarty->assign("plug", validate($_GET['plug'])); $smarty->assign("detail", validate($_GET['detail'])); @@ -295,6 +295,9 @@ class faxreport extends plugin $smarty->assign("plug", validate($_GET['plug'])); $smarty->assign("launchimage", get_template_path('images/launch.png')); $smarty->assign("search_image", get_template_path('images/search.png')); + for($i= 0; $i<7; $i++){ + $smarty->assign("mode$i", ""); + } $smarty->assign("mode".$this->sort, "sort_direction. ".png\" border=0 align=center>"); return($smarty->fetch(get_template_path('contents.tpl', TRUE))); diff --git a/plugins/gofon/reports/class_fonreport.inc b/plugins/gofon/reports/class_fonreport.inc index a508b8be8..ee630aed1 100644 --- a/plugins/gofon/reports/class_fonreport.inc +++ b/plugins/gofon/reports/class_fonreport.inc @@ -227,6 +227,9 @@ class fonreport extends plugin $smarty->assign("plug", validate($_GET['plug'])); $smarty->assign("launchimage", get_template_path('images/launch.png')); $smarty->assign("search_image", get_template_path('images/search.png')); + for($i= 0; $i<7; $i++){ + $smarty->assign("mode$i", ""); + } $smarty->assign("mode".$this->sort, "sort_direction. ".png\" border=0 align=center>"); return($smarty->fetch(get_template_path('contents.tpl', TRUE))); -- 2.30.2