Code

Make rsyslog plugin work if nothing is defined to make it work
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Dec 2009 09:58:33 +0000 (09:58 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 28 Dec 2009 09:58:33 +0000 (09:58 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14953 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/rsyslog/addons/rsyslog/class_rsyslog.inc

index c2a4dc57122390029ea17ec36d359883a1b08b93..4f51dfe7d4dd4e65f3b2f850e21f74804ad3dc2c 100644 (file)
@@ -2,7 +2,7 @@
 
 class rsyslog extends plugin
 {
-  var $plHeadline= "rSyslog";
+  var $plHeadline= "System logs";
   var $plDescription= "View system logs";
 
   var $servers = array();
@@ -104,13 +104,13 @@ class rsyslog extends plugin
     $smarty->assign("usePrototype", "true");
     $ui = get_userinfo();
     
-    if(!isset($this->servers[$this->selected_server]) || !count($this->servers[$this->selected_server]['Hosts'])){
+    if(!isset($this->servers[$this->selected_server]['Hosts']) || !count($this->servers[$this->selected_server]['Hosts'])){
       $hosts = array('-' => _("-"));
     }else{
       $hosts = array('all' => _("All"));
       $hosts = array_merge($hosts,$this->servers[$this->selected_server]['Hosts']);
     }
-    if(!isset($this->servers[$this->selected_server]) || !count($this->servers[$this->selected_server]['Priorities'])){
+    if(!isset($this->servers[$this->selected_server]['Priorities']) || !count($this->servers[$this->selected_server]['Priorities'])){
       $priorities = array('-' => _("-"));
     }else{
       $priorities = array('all' => _("All"));
@@ -158,8 +158,8 @@ class rsyslog extends plugin
 
     // Check whether the selected server exists.
     if(!isset($this->servers[$this->selected_server])){
-      $this->servers[$name]['status'] = sprintf(_("The selected server '%s' does not exists!"),$this->selected_server);
-      $this->servers[$name]['error']  = $this->servers[$this->selected_server]['error'];
+      $this->servers["unknown"]['status'] = sprintf(_("The selected server '%s' does not exists!"),$this->selected_server);
+      $this->servers["unknown"]["cn"] = "-";
       return($result);
     }
 
@@ -181,7 +181,7 @@ class rsyslog extends plugin
     }
 
     // Get log entries matching the selected filter
-    if(preg_match('/r/', $this->servers[$name]['ACL'])){
+    if(isset($this->servers[$name]['ACL']) && preg_match('/r/', $this->servers[$name]['ACL'])){
 
       $host = "%%";
       if($this->selected_host != "all") $host = $this->selected_host;