From: hickert Date: Thu, 8 Jul 2010 16:22:19 +0000 (+0000) Subject: Updated ALL FAI classes - hopefully I havn't missed one - Will test tomorrow X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=58a26051ca03e0fd167da468834cb6370463a4da;p=gosa.git Updated ALL FAI classes - hopefully I havn't missed one - Will test tomorrow -There is no need to handle add_slashes/strip_slashes , encoding anymore. I've replaced all occurences by set_post and get_post and voila, it also work wioth utf9 chars. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@18970 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/fai/admin/fai/class_askClassName.inc b/gosa-plugins/fai/admin/fai/class_askClassName.inc index 945c0d54f..2203198ea 100644 --- a/gosa-plugins/fai/admin/fai/class_askClassName.inc +++ b/gosa-plugins/fai/admin/fai/class_askClassName.inc @@ -120,14 +120,14 @@ class askClassName extends plugin { if(isset($_POST['classSelector']) && $_POST['classSelector'] == 1 && isset($_POST['edit_continue'])){ - $this->ClassName = $_POST['UseTextInputName']; + $this->ClassName = get_post('UseTextInputName'); $this->ClassAlreadyExists = true; } if(isset($_POST['classSelector']) && $_POST['classSelector'] == 2 && isset($_POST['edit_continue'])){ $this->ClassAlreadyExists = false; - $this->ClassName = $_POST['SelectedClass']; + $this->ClassName = get_post('SelectedClass'); } } diff --git a/gosa-plugins/fai/admin/fai/class_debconfTemplate.inc b/gosa-plugins/fai/admin/fai/class_debconfTemplate.inc index ef20d1346..f5bb9ad75 100644 --- a/gosa-plugins/fai/admin/fai/class_debconfTemplate.inc +++ b/gosa-plugins/fai/admin/fai/class_debconfTemplate.inc @@ -143,7 +143,7 @@ class debconf $str = preg_replace("/\,\ $/","",$str); $this->template[$post_name]['Default'] = $str; }else{ - $this->template[$post_name]['Default'] = $_POST[$entry['post_name']]; + $this->template[$post_name]['Default'] = get_post($entry['post_name']); } } } @@ -263,9 +263,9 @@ class debconf $defs = explode(", ",$data['Default']); foreach($choices as $value){ if(in_array($value,$defs)){ - $result.="\n".$value."
"; + $result.="\n".$value."
"; }else{ - $result.="\n".$value."
"; + $result.="\n".$value."
"; } } @@ -321,9 +321,9 @@ class debconf foreach($choices as $value){ if($data['Default'] == $value){ - $result.="\n".htmlentities($value)."
"; + $result.="\n".set_post($value)."
"; }else{ - $result.="\n".htmlentities($value)."
"; + $result.="\n".set_post($value)."
"; } } diff --git a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc index 3beb2426f..965bdb242 100644 --- a/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiDiskEntry.inc @@ -177,7 +177,7 @@ class faiDiskEntry extends plugin // Remove partition from lvm compilation. if(isset($_POST['delLvmPartition']) && isset($_POST['physicalPartition'])){ - $names = $_POST['physicalPartition']; + $names = get_post('physicalPartition'); foreach($names as $name){ if(isset($this->lvmDevices[$name])){ unset($this->lvmDevices[$name]); @@ -234,7 +234,7 @@ class faiDiskEntry extends plugin // Assign checkbox related values. foreach($this->attributes as $attrs){ - $smarty->assign($attrs,$this->$attrs); + $smarty->assign($attrs,set_post($this->$attrs)); if($this->$attrs){ $smarty->assign($attrs."CHK"," "); }else{ @@ -249,15 +249,11 @@ class faiDiskEntry extends plugin $smarty->assign("fstabkeys", array("device" => _("Device"), "label" => _("Label"), "uuid" => _("UUID"))); $smarty->assign("disklabels", array("msdos" => "MSDOS", "gpt" => "GPT")); $smarty->assign("fstabkey", $this->fstabkey); - $smarty->assign("disklabel", $this->disklabel); + $smarty->assign("disklabel", set_post($this->disklabel)); $smarty->assign("FAIdiskType", $this->FAIdiskType); $smarty->assign("plist", $this->getPartitionList()); $smarty->assign("physicalPartitionList", $this->getAvailablePartitions()); - foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); - } - // Assign partitions $tmp = $this->plInfo(); $sacl = ""; @@ -628,10 +624,10 @@ class faiDiskEntry extends plugin // Save posted disk label and fstab key if (isset($_POST['disklabel']) && preg_match("/^(msdos|gpt)$/", $_POST['disklabel'])){ - $this->disklabel= $_POST['disklabel']; + $this->disklabel= get_post('disklabel'); } if (isset($_POST['fstabkey']) && preg_match("/^(device|label|uuid)$/", $_POST['fstabkey'])){ - $this->fstabkey= $_POST['fstabkey']; + $this->fstabkey= get_post('fstabkey'); } } } diff --git a/gosa-plugins/fai/admin/fai/class_faiHook.inc b/gosa-plugins/fai/admin/fai/class_faiHook.inc index 7b4b5d14e..950ee0c75 100644 --- a/gosa-plugins/fai/admin/fai/class_faiHook.inc +++ b/gosa-plugins/fai/admin/fai/class_faiHook.inc @@ -114,8 +114,6 @@ class faiHook extends plugin $var = $ldap->get_attribute($object['dn'], $attrs,$r_array=0); } - /* Fix slashes */ - $var = addslashes($var); $object[$attrs] = $var; } } @@ -295,11 +293,7 @@ class faiHook extends plugin * If we post the escaped strings they will be escaped again */ foreach($this->attributes as $attrs){ - if(get_magic_quotes_gpc()){ - $smarty->assign($attrs,stripslashes($this->$attrs)); - }else{ - $smarty->assign($attrs,($this->$attrs)); - } + $smarty->assign($attrs,set_post($this->$attrs)); } $tmp = $this->plInfo(); @@ -314,31 +308,6 @@ class faiHook extends plugin return($display); } - /* Generate listbox friendly SubObject list - */ - function getList($use_dns=false){ - $a_return=array(); - foreach($this->SubObjects as $obj){ - if($obj['status'] != "delete"){ - - $cn = stripslashes($obj['cn']); - $desc = ""; - - if((isset($obj['description']))&&(!empty($obj['description']))){ - $desc = " [".stripslashes($obj['description'])."]"; - } - - if($use_dns){ - $a_return[$obj['cn']]['name']= $cn.$desc; - $a_return[$obj['cn']]['dn']= $obj['dn']; - }else{ - $a_return[$obj['cn']] = $cn.$desc; - } - } - } - return($a_return); - } - /* Delete me, and all my subtrees */ @@ -426,7 +395,7 @@ class faiHook extends plugin foreach($Objects as $name => $obj){ foreach($this->sub64coded as $codeIt){ - $obj[$codeIt]=base64_encode(stripslashes($obj[$codeIt])); + $obj[$codeIt]=base64_encode($obj[$codeIt]); } $tmp = array(); @@ -436,11 +405,7 @@ class faiHook extends plugin if($obj[$attrs] == ""){ $obj[$attrs] = array(); } - if(!is_array($obj[$attrs])){ - $tmp[$attrs] = stripslashes($obj[$attrs]); - }else{ - $tmp[$attrs] = $obj[$attrs]; - } + $tmp[$attrs] = $obj[$attrs]; } $tmp['objectClass'] = $this->subClasses; @@ -533,7 +498,7 @@ class faiHook extends plugin { $vars = array("cn"); $smarty = get_smarty(); - $smarty->assign("cn", htmlentities($this->cn)); + $smarty->assign("cn", set_post($this->cn)); $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); $ret = array(); $ret['string'] = $str; diff --git a/gosa-plugins/fai/admin/fai/class_faiHookEntry.inc b/gosa-plugins/fai/admin/fai/class_faiHookEntry.inc index c6003f604..850a07a00 100644 --- a/gosa-plugins/fai/admin/fai/class_faiHookEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiHookEntry.inc @@ -64,14 +64,14 @@ class faiHookEntry extends plugin if(($_FILES['ImportFile']['size']==0)){ msg_dialog::display(_("Error"), msgPool::incorrectUpload(_("file is empty")), ERROR_DIALOG); }else{ - $str = utf8_encode(file_get_contents($_FILES['ImportFile']['tmp_name'])); - $this->FAIscript = addslashes ($str); + $str = file_get_contents($_FILES['ImportFile']['tmp_name']); + $this->FAIscript = $str; } } /* File download requested */ if(isset($_POST['download'])){ - send_binary_content(stripslashes($this->FAIscript),$this->cn.".FAIhook"); + send_binary_content($this->FAIscript,$this->cn.".FAIhook"); } /* Create download button*/ @@ -94,11 +94,7 @@ class faiHookEntry extends plugin * If we post the escaped strings they will be escaped again */ foreach($this->attributes as $attrs){ - if(get_magic_quotes_gpc()){ - $smarty->assign($attrs,(stripslashes($this->$attrs))); - }else{ - $smarty->assign($attrs,($this->$attrs)); - } + $smarty->assign($attrs,set_post($this->$attrs)); } $tmp = $this->plInfo(); @@ -107,11 +103,7 @@ class faiHookEntry extends plugin $smarty->assign($name."ACL",$acl); } - if(get_magic_quotes_gpc()){ - $smarty->assign("FAIscript" , htmlentities(stripslashes($this->FAIscript))); - }else{ - $smarty->assign("FAIscript" , htmlentities($this->FAIscript)); - } + $smarty->assign("FAIscript" , set_post($this->FAIscript)); $smarty->assign("freeze" , preg_match("/freeze/",$this->FAIstate)); $display.= $smarty->fetch(get_template_path('faiHookEntry.tpl', TRUE)); return($display); @@ -124,7 +116,7 @@ class faiHookEntry extends plugin foreach($this->attributes as $attrs){ if($this->acl_is_writeable($attrs)){ if(isset($_POST[$attrs])){ - $this->$attrs = $_POST[$attrs]; + $this->$attrs = get_post($attrs); }else{ $this->$attrs = ""; } diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc index 0c77ef80a..2ac9586db 100644 --- a/gosa-plugins/fai/admin/fai/class_faiManagement.inc +++ b/gosa-plugins/fai/admin/fai/class_faiManagement.inc @@ -685,7 +685,7 @@ class faiManagement extends management $this->dispNewFreeze=false; $smarty->assign("iframe",false); if(isset($_POST['BranchName'])){ - $smarty->assign("BranchName", $_POST['BranchName']); + $smarty->assign("BranchName", get_post('BranchName')); }else{ $smarty->assign("BranchName",""); } @@ -708,7 +708,7 @@ class faiManagement extends management $this->dispNewBranch=false; $smarty->assign("iframe",false); if(isset($_POST['BranchName'])){ - $smarty->assign("BranchName", $_POST['BranchName']); + $smarty->assign("BranchName", get_post('BranchName')); }else{ $smarty->assign("BranchName",""); } diff --git a/gosa-plugins/fai/admin/fai/class_faiPackage.inc b/gosa-plugins/fai/admin/fai/class_faiPackage.inc index 2e17931d3..0d797a13d 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPackage.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPackage.inc @@ -460,7 +460,7 @@ class faiPackage extends plugin $lData[$usedName] = array('data'=> array( $configured." ".$removal, - $usedName ,$version,htmlentities($description), $actions)); + $usedName ,$version,set_post($description), $actions)); } } $this->packageList->setAcl($this->getacl("FAIpackage",preg_match('/^freeze/', $this->FAIstate))); @@ -469,7 +469,7 @@ class faiPackage extends plugin /* Assign variables */ foreach($this->attributes as $attrs){ - $smarty->assign($attrs,$this->$attrs); + $smarty->assign($attrs,set_post($this->$attrs)); } $smarty->assign( "FAIinstallMethods", $this->FAIinstallMethods ); @@ -805,7 +805,7 @@ class faiPackage extends plugin { $vars = array("cn"); $smarty = get_smarty(); - $smarty->assign("cn", htmlentities($this->cn)); + $smarty->assign("cn", set_post($this->cn)); $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); $ret = array(); $ret['string'] = $str; diff --git a/gosa-plugins/fai/admin/fai/class_faiPartition.inc b/gosa-plugins/fai/admin/fai/class_faiPartition.inc index 2f3999eba..73f201c1c 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartition.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartition.inc @@ -144,7 +144,7 @@ class faiPartition extends plugin // Remove partition if(isset($_POST['addPhysicalPartition']) && isset($_POST['physicalPartitionAdd'])){ - $name = $_POST['physicalPartitionAdd']; + $name =get_post('physicalPartitionAdd'); $this->raidDevices[$name] = array("name" => $name,"spare"=>false,"missing"=>false); } @@ -210,11 +210,11 @@ class faiPartition extends plugin $smarty->assign("sizeStart_Type", $this->sizeStart_Type); $smarty->assign("sizeStop_Type", $this->sizeStop_Type); - $smarty->assign("sizeStart", $this->sizeStart); - $smarty->assign("sizeStop", $this->sizeStop); + $smarty->assign("sizeStart", set_post($this->sizeStart)); + $smarty->assign("sizeStop", set_post($this->sizeStop)); $smarty->assign("preserveTypes", $preserveTypes); - $smarty->assign("preserveType", $this->preserveType); + $smarty->assign("preserveType", set_post($this->preserveType)); $smarty->assign("FAIfsTypes", $FAIfsTypes); $smarty->assign("cn", $this->cn); @@ -225,7 +225,7 @@ class faiPartition extends plugin $smarty->assign("disablePrimary", $this->disablePrimary); foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); + $smarty->assign($attr,set_post($this->$attr)); } return($smarty->fetch(get_template_path("faiPartition.tpl", TRUE, dirname(__FILE__)))); } diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc index 0665a1c6c..f6eff6267 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc @@ -340,7 +340,7 @@ class faiPartitionTable extends plugin /* Assign all attributes to smarty engine */ foreach($this->attributes as $attrs){ - $smarty->assign($attrs,$this->$attrs); + $smarty->assign($attrs,set_post($this->$attrs)); if($this->$attrs){ $smarty->assign($attrs."CHK"," "); }else{ @@ -455,11 +455,6 @@ class faiPartitionTable extends plugin if(isset($_POST['FAIpartitionTablePosted'])){ if (preg_match("/freeze/", $this->FAIstate)) return; plugin::save_object(); -# foreach($this->attributes as $attrs){ -# if(isset($_POST[$attrs])){ -# $this->$attrs = $_POST[$attrs]; -# } -# } if(!count($this->disks)){ if(isset($_POST['mode'])){ $this->FAIpartitionMethod = "setup-storage"; @@ -812,7 +807,7 @@ class faiPartitionTable extends plugin { $vars = array("cn"); $smarty = get_smarty(); - $smarty->assign("cn", htmlentities($this->cn)); + $smarty->assign("cn", set_post($this->cn)); $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); $ret = array(); $ret['string'] = $str; @@ -853,8 +848,6 @@ class faiPartitionTable extends plugin $var = $ldap->get_attribute($object['dn'], $attrs,$r_array=0); } - /* Fix slashes */ - $var = addslashes($var); $object[$attrs] = $var; } } diff --git a/gosa-plugins/fai/admin/fai/class_faiPartitionTableEntry.inc b/gosa-plugins/fai/admin/fai/class_faiPartitionTableEntry.inc index dc743d172..b194beff1 100644 --- a/gosa-plugins/fai/admin/fai/class_faiPartitionTableEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiPartitionTableEntry.inc @@ -69,7 +69,7 @@ class faiPartitionTableEntry extends plugin * And Checkbox selection */ foreach($this->attributes as $attrs){ - $smarty->assign($attrs,$this->$attrs); + $smarty->assign($attrs,set_post($this->$attrs)); if($this->$attrs){ $smarty->assign($attrs."CHK"," "); }else{ @@ -117,7 +117,7 @@ class faiPartitionTableEntry extends plugin */ $smarty->assign("setup", $this->generateParts()); foreach($this->attributes as $attr){ - $smarty->assign($attr,$this->$attr); + $smarty->assign($attr,set_post($this->$attr)); } $tmp = $this->plInfo(); @@ -300,7 +300,7 @@ class faiPartitionTableEntry extends plugin if($this->acl_is_writeable($attrs)){ if(isset($_POST[$attrs."_".$key])){ - $this->partitions[$key][$attrs] = $_POST[$attrs."_".$key]; + $this->partitions[$key][$attrs] = get_post($attrs."_".$key); }else{ $this->partitions[$key][$attrs] = false; } diff --git a/gosa-plugins/fai/admin/fai/class_faiProfile.inc b/gosa-plugins/fai/admin/fai/class_faiProfile.inc index 796189f15..bb8a8ab73 100644 --- a/gosa-plugins/fai/admin/fai/class_faiProfile.inc +++ b/gosa-plugins/fai/admin/fai/class_faiProfile.inc @@ -212,11 +212,7 @@ class faiProfile extends plugin * If we post the escaped strings they will be escaped again */ foreach($this->attributes as $attrs){ - if(get_magic_quotes_gpc()){ - $smarty->assign($attrs,stripslashes($this->$attrs)); - }else{ - $smarty->assign($attrs,($this->$attrs)); - } + $smarty->assign($attrs,set_post($this->$attrs)); } @@ -389,7 +385,7 @@ class faiProfile extends plugin { $vars = array("cn"); $smarty = get_smarty(); - $smarty->assign("cn", htmlentities($this->cn)); + $smarty->assign("cn", set_post($this->cn)); $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); $ret = array(); $ret['string'] = $str; diff --git a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc index c3c99f607..1653586f0 100644 --- a/gosa-plugins/fai/admin/fai/class_faiTemplate.inc +++ b/gosa-plugins/fai/admin/fai/class_faiTemplate.inc @@ -96,7 +96,6 @@ class faiTemplate extends plugin if(in_array_ics($attrs,$this->sub64coded)){ $var = base64_decode($var); } - $var = stripslashes($var); /* check if this is a binary entry */ if(in_array_ics($attrs,$this->subBinary)){ diff --git a/gosa-plugins/fai/admin/fai/class_faiTemplateEdit.inc b/gosa-plugins/fai/admin/fai/class_faiTemplateEdit.inc index 9cb844e08..dfad47957 100644 --- a/gosa-plugins/fai/admin/fai/class_faiTemplateEdit.inc +++ b/gosa-plugins/fai/admin/fai/class_faiTemplateEdit.inc @@ -34,7 +34,7 @@ class faiTemplateEdit extends plugin /* We now split cn/FAItemplatePath to make things more clear... */ $smarty = get_smarty(); - $smarty->assign("templateValue",htmlspecialchars(($this->value))); + $smarty->assign("templateValue",set_post(($this->value))); $smarty->assign("write_protect",$this->write_protect); $smarty->assign("mb_extension",$this->mb_extension); return($smarty->fetch(get_template_path('faiTemplateEdit.tpl', TRUE))); diff --git a/gosa-plugins/fai/admin/fai/class_faiVariable.inc b/gosa-plugins/fai/admin/fai/class_faiVariable.inc index 870028dba..ca3438e3f 100644 --- a/gosa-plugins/fai/admin/fai/class_faiVariable.inc +++ b/gosa-plugins/fai/admin/fai/class_faiVariable.inc @@ -203,11 +203,7 @@ class faiVariable extends plugin * If we post the escaped strings they will be escaped again */ foreach($this->attributes as $attrs){ - if(get_magic_quotes_gpc()){ - $smarty->assign($attrs,htmlentities (stripslashes(utf8_decode($this->$attrs)))); - }else{ - $smarty->assign($attrs,htmlentities (utf8_decode($this->$attrs))); - } + $smarty->assign($attrs,set_post($this->$attrs)); } $c_dn = $this->acl_base_for_current_object($this->dn); @@ -421,7 +417,7 @@ class faiVariable extends plugin { $vars = array("cn"); $smarty = get_smarty(); - $smarty->assign("cn", htmlentities($this->cn)); + $smarty->assign("cn", set_post($this->cn)); $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE)); $ret = array(); $ret['string'] = $str; @@ -462,8 +458,6 @@ class faiVariable extends plugin $var = $ldap->get_attribute($object['dn'], $attrs,$r_array=0); } - /* Fix slashes */ - $var = addslashes($var); $object[$attrs] = $var; } } diff --git a/gosa-plugins/fai/admin/fai/class_faiVariableEntry.inc b/gosa-plugins/fai/admin/fai/class_faiVariableEntry.inc index dd8873955..aa3159dd9 100644 --- a/gosa-plugins/fai/admin/fai/class_faiVariableEntry.inc +++ b/gosa-plugins/fai/admin/fai/class_faiVariableEntry.inc @@ -24,7 +24,7 @@ class faiVariableEntry extends plugin $this->dn=$object['dn']; foreach($object as $name=>$value){ $oname = $name; - $this->$oname=addslashes($value); + $this->$oname=($value); } }else{ $this->status = "new"; @@ -45,11 +45,7 @@ class faiVariableEntry extends plugin * If we post the escaped strings they will be escaped again */ foreach($this->attributes as $attrs){ - if(get_magic_quotes_gpc()){ - $smarty->assign($attrs,htmlentities (stripslashes(utf8_decode($this->$attrs)))); - }else{ - $smarty->assign($attrs,htmlentities (utf8_decode($this->$attrs))); - } + $smarty->assign($attrs,set_post($this->$attrs)); } $tmp = $this->plInfo(); @@ -71,7 +67,7 @@ class faiVariableEntry extends plugin foreach($this->attributes as $attrs){ if($this->acl_is_writeable($attrs)){ if(isset($_POST[$attrs])){ - $this->$attrs = $_POST[$attrs]; + $this->$attrs = get_post($attrs); }else{ $this->$attrs = ""; } @@ -109,7 +105,7 @@ class faiVariableEntry extends plugin { $tmp=array(); foreach($this->attributes as $attrs){ - $tmp[$attrs] = stripslashes( $this->$attrs); + $tmp[$attrs] = $this->$attrs; } if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){