diff --git a/plugins/admin/systems/class_printerPPDDialog.inc b/plugins/admin/systems/class_printerPPDDialog.inc
index 103825ac47b7c51aec9fbc4be19339de542ffe6b..cf36067aea6df1c7f85fb229b9c6cd0ec5a1461d 100644 (file)
$Model = trim(preg_replace("/".$Vendor."/","",$Name));
}
- $PrinterName = $this->cn."-".$Name;
+ $PrinterName = $this->cn."-".preg_replace("/[^a-z0-9-_\.]/i","_",$Name);
$PPDName = $Vendor."/".$PrinterName.".ppd";
/* Create the vendors path, if it doesn't exists already */
/* Check if parse was successfull */
if(empty($name) || empty($vendor)){
- print_red(sprintf(_("The given ppd file '%s' seams to be invalid, can't get any modell or vendor informations."),$_PathOnHdd));
+ print_red(sprintf(_("The given ppd file '%s' seams to be invalid, can't get any model or vendor informations."),$_PathOnHdd));
return(false);
}
$this->ppdList[$vendor] = array();
}
- /* Check if this ppd already exists */
- $found = false;
- foreach($this->ppdList[$vendor] as $key => $val){
- if(preg_match("/".$model.".*/i",$key)){
- $found = true;
- print_red(sprintf(_("There is already a ppd file for this kind of printer.")));
- return;
- }
- }
+ /* Create ppd file and fill in the source contents */
+ $ppdname = $vendor."/".$name.".ppd";
+ $filename = $this->pathToPPD.preg_replace("/[^a-z0-9-_\.\/]/i","_",$ppdname);
+ $filename = $this->pathToPPD.$ppdname;
+ $contents = file_get_contents($_PathOnHdd);
/* Create the vendors path, if it doesn't exists already */
if(!is_dir($this->pathToPPD.$vendor)){
}
}
- /* Create ppd file and fill in the source contents */
- $ppdname = $vendor."/".$name.".ppd";
- $filename = $this->pathToPPD.$ppdname;
+ /* Open file handle */
$fp = fopen($filename,"w+");
- $contents = file_get_contents($_PathOnHdd);
/* Check file handle & contents */
if(!$fp){
function getPrinterReload()
{
if(is_readable($this->pathToPPD)){
- $tmp = $this->ppdManager->getPrinterList(true);
+ $tmp = @$this->ppdManager->getPrinterList(true);
$this->ppdListHeader = $this->ppdList = array();
/* Save modified ppd */
- function save_ppd(){
+ function save_ppd()
+ {
if($this->ppdManager){
$this->ppdManager->saveProperties($this->pathToPPD.$this->pathToModified.$this->selectedPPD['link'],$this->ppdConfig);
}
/* Prepare data */
$values = array();
$name = $settings['_name'];
- $default = $settings['_default'];
+ if (!isset($settings['_default'])){
+ $default = "";
+ } else {
+ $default = $settings['_default'];
+ }
$type = $settings['_type'];
/* Add name to table */
print_red(sprintf(_("Removing old ppd file '%s' failed. File does not exists or is not accessible."),$path));
}
}
+
+ function update_ppd_url()
+ {
+ $this->SelectPPD("modified/".$this->selectedPPD['link']);
+ return("modified/".$this->selectedPPD['link']);
+ }
function check()
{