summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: f870846)
raw | patch | inline | side by side (parent: f870846)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 27 Oct 2005 20:58:41 +0000 (20:58 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 27 Oct 2005 20:58:41 +0000 (20:58 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1710 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_ppdManager.inc | patch | blob | history |
index f9318195185e1993f51d9c1b22e6a718e5fd75bb..1852a3e5fbb45c8ab9230ff4c1340c2a55c1cc61 100644 (file)
function ppdManager($path)
{
$this->path= $path;
- echo "Path set to $path<br>";
}
return ($list);
}
+
+ function updateAttribute($file, $section, $attribute, $value)
+ {
+ $fsection= false;
+ $fattribute= false;
+ $section= preg_replace('/^\*/', '', $section);
+ $attribute= preg_replace('/^\*/', '', $attribute);
+
+ $rp= fopen($file, "r");
+ $wp= fopen("$file.tmp", "w");
+
+ while (!feof($rp)){
+ $line= fgets($rp, 1024);
+
+ if (preg_match("/\*OpenGroup:*\s+\**$section\/*/", $line)){
+ $fsection= true;
+ continue;
+ }
+
+ if ($fsection){
+ if (preg_match("/^\*CloseGroup:*\s+\**$section\/*/", $line)){
+ $fsection= false;
+ fwrite ($wp, $line);
+ continue;
+ }
+
+ if (preg_match("/^\*OpenUI:*\s+\**$attribute\/*/", $line)){
+ $fattribute= true;
+ fwrite ($wp, $line);
+ continue;
+ }
+
+ if ($fattribute){
+ if (preg_match("/^\*CloseUI:*\s+\**$attribute\/*/", $line)){
+ $fattribute= false;
+ fwrite ($wp, $line);
+ continue;
+ }
+
+ if (preg_match("/^\*Default$attribute:*\s+/", $line)){
+ $line= "*Default$attribute: $value\n";
+ }
+ }
+ }
+ fwrite ($wp, $line);
+ }
+
+ fclose($wp);
+ fclose($rp);
+
+ echo "Move $file.tmp to $file<br>";
+ }
+
function saveProperties($ppdFile, $properties)
{
- echo "<pre>";
- print_r ($properties);
- echo "</pre>";
+ foreach ($properties as $name => $section){
+ foreach ($section as $attribute => $value){
+ if (is_array($value)){
+ $this->updateAttribute($ppdFile, $name, $attribute, $value['_default']);
+ }
+ }
+ }
}