From 253cb65dd4e1a4b93ad9a4925a79664788156578 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 28 Oct 2005 09:29:18 +0000 Subject: [PATCH] Some checks for ppd files git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1724 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_printerPPDDialog.inc | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/plugins/admin/systems/class_printerPPDDialog.inc b/plugins/admin/systems/class_printerPPDDialog.inc index 4123a0466..162874577 100644 --- a/plugins/admin/systems/class_printerPPDDialog.inc +++ b/plugins/admin/systems/class_printerPPDDialog.inc @@ -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 .= "\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 .= "\n"; } -- 2.30.2