Code

Some checks for ppd files
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 28 Oct 2005 09:29:18 +0000 (09:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 28 Oct 2005 09:29:18 +0000 (09:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1724 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_printerPPDDialog.inc

index 4123a0466d0c04c28c886e43b107301b8cb71da0..1628745771c79ec6ba90b53fc00620ee0929392c 100644 (file)
@@ -48,13 +48,17 @@ class printerPPDDialog extends plugin
    /* The user has already a valid PPD assigned
     * Get some informations about this PPD
     */
-   if(($ppdfile!= NULL)&&(strlen($ppdfile)>0)){
-      $tmp2= split("\n", $this->ppdManager->loadDescription($ppdfile));
-      $tmp3['name']   =preg_replace("/^ -/","",$tmp2[1]);
-      $tmp3['link']   =$ppdfile;
-      $tmp3['ppd']    =$this->ppdManager->loadDescription($ppdfile);
-      $this->selectedPPD = $tmp3;
-   }
+    if(($ppdfile!= NULL)&&(strlen($ppdfile)>0))){
+      if(!file_exists($ppdfile)){
+        print_red(sprintf(_("Can't open '%s', ppd settings reseted."),$ppdfile));
+      }else{
+        $tmp2= split("\n", $this->ppdManager->loadDescription($ppdfile));
+        $tmp3['name']   =preg_replace("/^ -/","",$tmp2[1]);
+        $tmp3['link']   =$ppdfile;
+        $tmp3['ppd']    =$this->ppdManager->loadDescription($ppdfile);
+        $this->selectedPPD = $tmp3;
+      }
+    }
   }
 
   function getPrinterReload()
@@ -156,7 +160,7 @@ class printerPPDDialog extends plugin
      */
     if(isset($_POST['SavePPDSelection'])){
       if(!isset($_POST['PPDselection'])){
-        print_red(_("Please select a valid PPD."));
+        print_red(_("Please select a valid ppd."));
       }else{
         $this->selectedPPD['link'] = $_POST['PPDselection'];
         $this->ppdConfig   = false;
@@ -312,7 +316,7 @@ class printerPPDDialog extends plugin
             $str  .=  "</select>\n";
 
           }else{
-            print_red(sprintf(_("Unsupported PPD type '%s' used for '%s' "),$type,$name));
+            print_red(sprintf(_("Unsupported ppd type '%s' used for '%s' "),$type,$name));
           }
           $str .= "</td></tr>\n";
         }