index 5b36ec8601f7c9b2b7ab5cca2610f82f7cf5c55d..c73d2e886a54b9820edeac61c0aa99266349e588 100644 (file)
var $orig_cn = "";
var $tasks = array("chboot", "configure", "debconf", "extrbase", "faiend", "finish",
"install", "instsoft", "mirror", "mountdisks", "partition", "prepareapt",
var $orig_cn = "";
var $tasks = array("chboot", "configure", "debconf", "extrbase", "faiend", "finish",
"install", "instsoft", "mirror", "mountdisks", "partition", "prepareapt",
- "savelog", "softupdate", "sysinfo"," updatebase");
+ "savelog", "softupdate", "sysinfo","updatebase");
var $dn = "";
var $cn = "";
var $FAItask = "";
var $FAIscript = "";
var $description = "";
var $status = "new";
var $dn = "";
var $cn = "";
var $FAItask = "";
var $FAIscript = "";
var $description = "";
var $status = "new";
+
+ var $FAIstate = "";
function faiHookEntry ($config, $dn= NULL,$object=false)
{
function faiHookEntry ($config, $dn= NULL,$object=false)
{
$oname = $name;
$this->$oname=$value;
}
$oname = $name;
$this->$oname=$value;
}
- }else{
- $this->status = "new";
- $this->orig_cn = false;
+
+ if(isset($this->attrs['FAIstate'][0])){
+ $this->FAIstate = $this->attrs['FAIstate'][0];
+ }
+
+ }elseif(is_array($object)){
+ if(count($object)){
+ $this->orig_cn= $object['cn'];
+ $this->dn=$object['dn'];
+ foreach($object as $name=>$value){
+ $oname = $name;
+ $this->$oname=$value;
+ }
+ }else{
+
+ $this->status = "new";
+ $this->orig_cn = false;
+ }
}
}
}
}
}
}
}
}
- $used_tasks = $this->parent->getUsedFAItask();
+ /* Create download button*/
+ if($this->dn != "new"){
+ $smarty->assign("DownMe","<a href='getFAIscript.php?id=".base64_encode($this->dn)."'>
+ <input type='button' value='"._("Download")."'>
+ </a>");
+ }else{
+ $smarty->assign("DownMe","");
+ }
+
+ $used_tasks = $this->parent->getUsedFAItask($this->cn);
$tasks = $this->tasks;
foreach($this->tasks as $id => $task){
if(in_array($task,$used_tasks)){
$tasks = $this->tasks;
foreach($this->tasks as $id => $task){
if(in_array($task,$used_tasks)){
*/
foreach($this->attributes as $attrs){
if(get_magic_quotes_gpc()){
*/
foreach($this->attributes as $attrs){
if(get_magic_quotes_gpc()){
- $smarty->assign($attrs,stripslashes($this->$attrs));
+ $smarty->assign($attrs,htmlentities(stripslashes($this->$attrs)));
}else{
}else{
- $smarty->assign($attrs,($this->$attrs));
+ $smarty->assign($attrs,htmlentities($this->$attrs));
+ }
+ }
+
+ foreach($this->attributes as $attr){
+ if(($this->FAIstate == "freeze") || (chkacl($this->acl,$attr)!= "")){
+ $smarty->assign($attr."ACL"," disabled ");
+ }else{
+ $smarty->assign($attr."ACL"," ");
}
}
}
}
/* Save data to object */
function save_object()
{
/* Save data to object */
function save_object()
{
- if(isset($_POST['SubObjectFormSubmitted'])){
+ if((isset($_POST['SubObjectFormSubmitted'])) && ($this->FAIstate != "freeze")){
foreach($this->attributes as $attrs){
if(isset($_POST[$attrs])){
$this->$attrs = $_POST[$attrs];
foreach($this->attributes as $attrs){
if(isset($_POST[$attrs])){
$this->$attrs = $_POST[$attrs];
$this->$attrs = "";
}
}
$this->$attrs = "";
}
}
- $this->FAIscript= recode("DOS..LATIN1", $this->FAIscript);
}
}
/* Check supplied data */
function check()
{
}
}
/* Check supplied data */
function check()
{
- $message= array();
+ /* Call common method to give check the hook */
+ $message= plugin::check();
+
if(empty($this->FAIscript)) {
$message[]=_("Please enter a value for script.");
}
if(empty($this->FAIscript)) {
$message[]=_("Please enter a value for script.");
}
$tmp[$attrs] = $this->$attrs;
}
$tmp[$attrs] = $this->$attrs;
}
+ /* Strip out dos newlines */
+ $tmp['FAIscript']= strtr($this->FAIscript, array("\x0D" => ""));
+
if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
$tmp['remove']['from'] = $this->orig_cn;
$tmp['remove']['to'] = $tmp['cn'];
if(($this->orig_cn)&&($tmp['cn']!=$this->orig_cn)){
$tmp['remove']['from'] = $this->orig_cn;
$tmp['remove']['to'] = $tmp['cn'];