Code

Fixed errors
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 20 May 2005 16:55:31 +0000 (16:55 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 20 May 2005 16:55:31 +0000 (16:55 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@313 594d385d-05f5-0310-b6e9-bd551577e9d8

contrib/gosa.conf
html/getfax.php
include/functions.inc
plugins/addons/logview/class_logview.inc
plugins/addons/logview/contents.tpl
plugins/gofax/reports/class_faxreport.inc
plugins/gofon/reports/class_fonreport.inc

index f06b7b2ecb60385b6b092ddcad116dfd6e156d6f..7d4976c2032b3df2288ada47f9db51ccb8b5d03f 100644 (file)
                <tab class="csvimport" name="CSV Import" />
        </ldiftab>
        
-       <main default="GONICUS"
+       <main default="{LOCATIONNAME}"
                compile="/var/spool/gosa"
                lang=""
                theme="default"
index cff889f09e357a31adfc48255227d8f84ef13914..61afdd80524298223d65aa0dc88615b6b8e302b6 100644 (file)
@@ -33,7 +33,7 @@ if (!isset($_SESSION['ui'])){
 $ui= $_SESSION["ui"];
 
 /* User object present? */
-if (!isset($_SESSION['userfilter'])){
+if (!isset($_SESSION['fuserfilter'])){
   gosa_log ("Error: getfax.php called without propper session data");
   header ("Location: ../index.php");
   exit;
@@ -59,7 +59,7 @@ mysql_select_db("gofax") or die(_("Could not select database!"));
 $query = "SELECT id,uid FROM faxlog WHERE id = '".validate(stripcslashes($_GET['id']))."'";
 $result = mysql_query($query) or die(_("Database query failed!"));
 $line = mysql_fetch_array($result, MYSQL_ASSOC);
-if (!preg_match ("/'".$line["uid"]."'/", $_SESSION['userfilter'])){
+if (!preg_match ("/'".$line["uid"]."'/", $_SESSION['fuserfilter'])){
   die ("No permissions to view fax!");
 }
 
index badb7d9a5b1a46e07b04f61229fb035564c6aaad..f05510ec3d2a95af81740df039681bb33c40326f 100644 (file)
@@ -1587,5 +1587,9 @@ function gosaRaiseError($errno, $errstr, $errfile, $errline)
   gosa_log ("PHP error: $errstr ($errfile, line $errline)");
 }
 
+function dummy_error_handler()
+{
+}
+
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index dc6a597e53b3a7acbd19b231db3f1830ca52b255..2c1bf15c6d0d1bba2d4c9c8fb5714fe9b95e0d09 100644 (file)
@@ -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.="<tr style=\"$col\">\n";
-               $res.="<td style=\"text-align:center\"><img src=\"".get_template_path('images/log_'.strtolower($line['log_level'])).".png\" title=\"Log level is '".$line['log_level']."'\"></td><td>".$line['host']."</td>";
-               $res.="<td>".$line['time_stamp']."</td><td width=100%>".$line['message']."</td>";
-               $res.="</tr>\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.="<tr style=\"$col\">\n";
+                               $res.="<td style=\"text-align:center\"><img src=\"".get_template_path('images/log_'.strtolower($line['log_level'])).".png\" title=\"Log level is '".$line['log_level']."'\"></td><td>".$line['host']."</td>";
+                               $res.="<td>".$line['time_stamp']."</td><td width=100%>".$line['message']."</td>";
+                               $res.="</tr>\n";
+                       }
+                       mysql_close($link);
+               }
        }
-       mysql_close($link);
 
        /* Show main page */
        $smarty->assign("search_result", $res);
index f84f980b8c30578d4c800153722f4981d77f5954..bf6ea21faafd29126d96387ee9a3026020032a58 100644 (file)
@@ -57,7 +57,7 @@
      <tr>
       <td><img align="center" border=0 src="{$ruleset_image}">&nbsp;{t}Ruleset{/t}</td>
       <td width=100%>
-       <input name="edit_rules" type="submit" value="{t}Edit{/t}">
+       <input name="edit_rules" type="submit" value="{t}Edit{/t}" disabled>
       </td>
      </tr>
      <tr>
index 654aabadaa4f98901b80d39436eeae434fcd1ea1..852af00e45c6856c0d3b68746680ddb6ced410b7 100644 (file)
@@ -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, "<img src=\"images/sort_".$this->sort_direction.
                        ".png\" border=0 align=center>");
         return($smarty->fetch(get_template_path('contents.tpl', TRUE)));
index a508b8be8be5826b2b2253fbbec3dc069e321e04..ee630aed18257acd9f1c187672357c86b4f7859b 100644 (file)
@@ -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, "<img src=\"images/sort_".$this->sort_direction.
                        ".png\" border=0 align=center>");
        return($smarty->fetch(get_template_path('contents.tpl', TRUE)));