summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 48ea384)
raw | patch | inline | side by side (parent: 48ea384)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 9 Nov 2005 05:59:22 +0000 (05:59 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 9 Nov 2005 05:59:22 +0000 (05:59 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1882 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/systems/class_printGeneric.inc | patch | blob | history | |
plugins/admin/systems/class_printerPPDDialog.inc | patch | blob | history |
diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc
index 7598b4dbe09803982af38fc04695ea59832e30a5..12b5514738b45e4ceed52cc2eece9ac2b92644ff 100644 (file)
require_once ("class_ppdManager.inc");
$ppdManager= new ppdManager('/var/spool/ppd/');
if(!empty($this->gotoPrinterPPD)){
- if((!file_exists($this->gotoPrinterPPD))){
+ if((!file_exists("/var/spool/ppd/".$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($this->gotoPrinterPPD));
+ $smarty->assign("driverInfo", $ppdManager->loadDescription("/var/spool/ppd/".$this->gotoPrinterPPD));
}
}else{
$smarty->assign("driverInfo", _("not defined"));
if($this->PPDdialogToSave){
$this->PPDdialogToSave->save_ppd();
}
-
$dn= $this->dn;
plugin::save();
$ldap= $this->config->get_ldap_link();
diff --git a/plugins/admin/systems/class_printerPPDDialog.inc b/plugins/admin/systems/class_printerPPDDialog.inc
index 0482349e93bc54b2994750436cfef6aab57c5d1b..ead6e8de243397fc245a703fbf61960c3c116b7e 100644 (file)
var $ppdManager = false; // new ppdManager;
var $ppdConfig = false; // $this->ppdManager->loadProperties($this->selectedPPD['link']);
+ var $pathToPPD = "/var/spool/ppd/";
+
function printerPPDDialog ($config, $dn= NULL,$ppdfile=NULL )
{
plugin::plugin ($config, $dn);
/* Load all available PPD files and sort them into an array
*/
require_once ("class_ppdManager.inc");
- $this->ppdManager= new ppdManager('/var/spool/ppd/');
+ $this->ppdManager= new ppdManager($this->pathToPPD);
$tmp = $this->ppdManager->getPrinterList();
/* Sort all available files, and create header (Vendor index) */
$this->ppdListHeader[$tmp2[0]]=0;
}
$tmp3['name'] =preg_replace("/^ -/","",$tmp2[1]." - ".$tmp2[2]);
- $tmp3['link'] =$file;
+ $tmp3['link'] =preg_replace("/".str_replace("/","\/",$this->pathToPPD)."/i","",$file);
$tmp3['ppd'] =$ppd;
$this->ppdListHeader[$tmp2[0]]++;
$this->ppdList[$tmp2[0]][preg_replace("/^ -/","",$tmp2[1]." - ".$tmp2[2])]=$tmp3;
* Get some informations about this PPD
*/
if(($ppdfile!= NULL)&&(strlen($ppdfile)>0)){
- if(!file_exists($ppdfile)){
+ if(!file_exists($this->pathToPPD.$ppdfile)){
print_red(sprintf(_("Can't open '%s', ppd settings resetted."),$ppdfile));
}else{
- $tmp2= split("\n", $this->ppdManager->loadDescription($ppdfile));
+ $tmp2= split("\n", $this->ppdManager->loadDescription($this->pathToPPD.$ppdfile));
$tmp3['name'] =preg_replace("/^ -/","",$tmp2[1]);
$tmp3['link'] =$ppdfile;
- $tmp3['ppd'] =$this->ppdManager->loadDescription($ppdfile);
+ $tmp3['ppd'] =$this->ppdManager->loadDescription($this->pathToPPD.$ppdfile);
$this->selectedPPD = $tmp3;
}
}
if(!empty($name)){
$vendor = trim(preg_replace("/-.*$/i","",$res));
$model = trim(preg_replace("/".$vendor."/","",$name));
- if(!is_dir('/var/spool/ppd/'.$vendor)){
- if(!(@mkdir('/var/spool/ppd/'.$vendor))){
+ if(!is_dir($this->pathToPPD.$vendor)){
+ if(!(@mkdir($this->pathToPPD.$vendor))){
print_red(sprintf(_("Can't create folder '%s' for the uploaded ppd file."),$vendor));
}
}
$this->ppdList[$vendor] = array();
}
- if(is_dir('/var/spool/ppd/'.$vendor)){
+ if(is_dir($this->pathToPPD.$vendor)){
$found = false;
foreach($this->ppdList[$vendor] as $key => $val){
if(preg_match("/".$model.".*/i",$key)){
}
}// Foreach
if(!$found){
- $filename = '/var/spool/ppd/'.$vendor."/".$vendor."-".preg_replace("/^[^ ]/","",str_replace("-","",$model)).".ppd";
+ $filename = $this->pathToPPD.$vendor."/".$vendor."-".preg_replace("/^[^ ]/","",str_replace("-","",$model)).".ppd";
$fp = @fopen($filename,"w+");
if(!$fp){
print_red(sprintf(_("Can't save file '%s'."),$filename));
}
function save_ppd(){
- $this->ppdManager->saveProperties($this->selectedPPD['link'],$this->ppdConfig);
+ $this->ppdManager->saveProperties($this->pathToPPD.$this->selectedPPD['link'],$this->ppdConfig);
}
/* Save to LDAP */
*/
$str = "none";
if(!empty($this->selectedPPD)){
- $str = $this->selectedPPD['link'];
- $str = $this->ppdManager->loadDescription($this->selectedPPD['link']);
+ $str = $this->ppdManager->loadDescription($this->pathToPPD.$this->selectedPPD['link']);
}
return($str) ;
}
$str = "";
$feed= "";
+ $s_ppd = $this->pathToPPD.$this->selectedPPD['link'];
+
/* If ppd exists and is readable */
- if((!empty($this->selectedPPD['link']))&&(file_exists($this->selectedPPD['link']))){
+ if((!empty($this->selectedPPD['link']))&&(file_exists($s_ppd))){
/* If there is no initial Configuration, load it */
if($this->ppdConfig == false){
- $this->ppdConfig = $this->ppdManager->loadProperties($this->selectedPPD['link']);
+ $this->ppdConfig = $this->ppdManager->loadProperties($s_ppd);
}
/* Create a table */