From e71e6aafd65eca5e84b5a0d52ee6b59de29d14a6 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 30 Apr 2010 11:20:48 +0000 Subject: [PATCH] Updated PPD parsing - Some properties were not split correctly, due to the fact that they had no '/' in their definition. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17991 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/ppd/class_ppdManager.inc | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/gosa-plugins/goto/admin/systems/ppd/class_ppdManager.inc b/gosa-plugins/goto/admin/systems/ppd/class_ppdManager.inc index 76012c045..bae18536a 100644 --- a/gosa-plugins/goto/admin/systems/ppd/class_ppdManager.inc +++ b/gosa-plugins/goto/admin/systems/ppd/class_ppdManager.inc @@ -303,18 +303,26 @@ class ppdManager /* Possible value? */ if (preg_match("@^\*$eoption\s+@", $line)){ - #*PageSize Letter/US Letter: "<>setpagedevice" - $c= preg_replace("@^\*$eoption\s+([^/]+).*$@", "$1", $line); - $d= preg_replace("@^\*$eoption\s+[^/]+/([^:]+).*$@", "$1", $line); + + // Detect what comes first, the '/' or the ':'. + // We may have entries like this: + // *Resolution 300dpi: "<> setpagedevice" + // and + // *Resolution 300dpi/300: "<> setpagedevice" + $name = $value = preg_replace("@^\*$eoption\s+([^:]+).*$@", "$1", $line); + if(preg_match("/\//", $name)){ + list($name, $value) = preg_split("/\//", $name); + } if(empty($group)){ - $properties["NO_SECTION"][$option][trim($c)]= trim($d); + $properties["NO_SECTION"][$option][$name]= $value; }else{ - $properties[$group][$option][trim($c)]= trim($d); + $properties[$group][$option][$name]= $value; } continue; } } } + gzclose ($fh); return ($properties); } -- 2.30.2