Code

Added some comments
[gosa.git] / plugins / admin / systems / class_printGeneric.inc
index 39a869fd2b16f3b1121a2c1b6c1d63a6d40062c2..fc743ce969414ae6b89fe9511a60c69e73967518 100644 (file)
@@ -60,7 +60,7 @@ class printgeneric extends plugin
     }
 
     if(isset($this->gotoPrinterPPD)){
-      $this->gotoPrinterPPD = preg_replace("/http.*ppd\//i","",$this->gotoPrinterPPD);
+      $this->gotoPrinterPPD = preg_replace("/^http.*ppd\//i","",$this->gotoPrinterPPD);
     }
 
     /* In case of gotoWorkstation this tab is calles from workstation plugin
@@ -294,6 +294,8 @@ class printgeneric extends plugin
       $this->dialog=NULL;
     }
 
+  
+
     if((isset($_POST['DelUser']))&&(isset($_POST['UserMember']))){
       if(isset($this->member['AddUser'][$_POST['UserMember']])){
         unset($this->member['AddUser'][$_POST['UserMember']]);
@@ -313,7 +315,7 @@ class printgeneric extends plugin
     }
 
     if((isset($_POST['DelAdmin']))&&(isset($_POST['AdminMember']))){
-      if(isset($this->member['AddAdmingroup'][$_POST['AdminMember']])){
+      if(isset($this->member['AddAdminGroup'][$_POST['AdminMember']])){
         unset($this->member['AddAdminGroup'][$_POST['AdminMember']]);
       }
     }
@@ -356,12 +358,18 @@ class printgeneric extends plugin
     require_once ("class_ppdManager.inc");
 
     if((isset($_SESSION['config']->data['MAIN']['PPD_PATH']))&&(is_dir($_SESSION['config']->data['MAIN']['PPD_PATH']))){
-      $ppdManager= new ppdManager($_SESSION['config']->data['MAIN']['PPD_PATH']);
+
+      $path = $_SESSION['config']->data['MAIN']['PPD_PATH'];
+      if(!preg_match("/\/$/",$path)){
+        $path = $path."/";
+      }
+
+      $ppdManager= new ppdManager($path);
       if(!empty($this->gotoPrinterPPD)){
-        if((!file_exists($_SESSION['config']->data['MAIN']['PPD_PATH'].$this->gotoPrinterPPD))){
+        if((!file_exists($path.$this->gotoPrinterPPD))){
           $smarty->assign("driverInfo", "<b>".sprintf(_("Your currently selected PPD file '%s' doesn't exist."),$this->gotoPrinterPPD))."</b>";
         }else{
-          $smarty->assign("driverInfo", $ppdManager->loadDescription($_SESSION['config']->data['MAIN']['PPD_PATH'].$this->gotoPrinterPPD));
+          $smarty->assign("driverInfo", $ppdManager->loadDescription($path.$this->gotoPrinterPPD));
         }
       }else{
         $smarty->assign("driverInfo", _("not defined"));
@@ -519,9 +527,11 @@ class printgeneric extends plugin
     }else{
       $method="http://";
     }
-    
-    $str = $method.$_SERVER['SERVER_NAME']."/ppd/";
-    $this->attrs['gotoPrinterPPD'] = $str.$this->attrs['gotoPrinterPPD'];
+  
+    if(!is_array($this->attrs['gotoPrinterPPD'])) {
+      $this->attrs['gotoPrinterPPD'] = $this->attrs['gotoPrinterPPD'];
+      $this->attrs['gotoPrinterPPD'] = $method.str_replace("//","/",$_SERVER['SERVER_NAME']."/ppd/".$this->attrs['gotoPrinterPPD']);
+    }
 
     /* Append printer user 
      */