Code

Udpated FAI object downloading.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Jan 2008 09:42:53 +0000 (09:42 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 23 Jan 2008 09:42:53 +0000 (09:42 +0000)
-Will no longer  use getFAIscript.php.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8554 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_faiHook.inc
gosa-plugins/fai/admin/fai/class_faiHookEntry.inc
gosa-plugins/fai/admin/fai/class_faiScript.inc
gosa-plugins/fai/admin/fai/class_faiScriptEntry.inc
gosa-plugins/fai/admin/fai/class_faiTemplate.inc

index fb64e5d3c56c4e18dc73e245477d5335459b6bcb..f1fec85fcca50681474f10bb2c4d8609f81ac458 100644 (file)
@@ -198,6 +198,15 @@ class faiHook extends plugin
       }
     }
 
+    /* File download requested */
+    if(isset($_GET['getFAIHook'])){
+      if(isset($this->SubObjects[$_GET['getFAIHook']])){
+        $obj = $this->SubObjects[$_GET['getFAIHook']];
+        $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
+        send_binary_content($obj['FAIscript'],$obj['cn'].".FAIhook");
+      }
+    }
+
     /* Edit entries via GET */
     if(isset($_GET['act']) && isset($_GET['id'])){
       if($_GET['act'] == "edit" && isset($this->SubObjects[$_GET['id']])){
@@ -325,7 +334,7 @@ class faiHook extends plugin
       if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
         $down = "";
       }else{
-        $down = "<a href='getFAIscript.php?id=".base64_encode($name['dn'])."'>
+        $down = "<a href='?plug=".$_GET['plug']."&getFAIHook=".$key."'>
           <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0>
           </a>";
       }
index cab96dbf2074f8054f2ffa84e4f21846d80d21f3..282dbcf90c835378c9cdc72f7b6e8c98f40f081b 100644 (file)
@@ -78,9 +78,14 @@ class faiHookEntry extends plugin
       }
     }
 
+    /* File download requested */
+    if(isset($_GET['getFAIHook'])){
+      send_binary_content($this->FAIscript,$this->cn.".FAIhook");
+    }
+
     /* Create download button*/
     if($this->dn != "new" && $this->acl_is_readable("FAIscript")){
-      $smarty->assign("DownMe","<a href='getFAIscript.php?id=".base64_encode($this->dn)."'>
+      $smarty->assign("DownMe","<a href='?plug=".$_GET['plug']."&getFAIHook'>
           <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0 class='center'>
         </a>");
     }else{
index 2233b6ae6c6ca8ec9808a75ca040d5150bb9fdb2..d47ed33c3decee0e89045fea91066c6086163f9d 100644 (file)
@@ -164,6 +164,15 @@ class faiScript extends plugin
       session::set('objectinfo',$this->dn);
     }
 
+    /* File download requested */
+    if(isset($_GET['getFAIscript'])){
+      if(isset($this->SubObjects[$_GET['getFAIscript']])){
+        $obj = $this->SubObjects[$_GET['getFAIscript']];
+        $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
+        send_binary_content($obj['FAIscript'],$obj['cn'].".FAIscript"); 
+      }
+    }
+    
     /* Handle posts */
     $s_action = $s_entry = "";
     foreach($_POST as $name => $value){
@@ -361,7 +370,7 @@ class faiScript extends plugin
       if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
         $down = "";
       }else{
-        $down = "<a href='getFAIscript.php?id=".base64_encode($name['dn'])."' >
+        $down = "<a href='?plug=".$_GET['plug']."&getFAIscript=".$key."'>
           <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0>
           </a>"; 
       } 
index 0321329209825ddaac037fff565a47c70348d085..ab3b589f1276da25447b4ca69a020dffc4950612 100644 (file)
@@ -83,10 +83,15 @@ class faiScriptEntry extends plugin
       } 
     }
 
-     /* Create download button*/
+    /* File download requested */
+    if(isset($_GET['getFAIScript'])){
+      send_binary_content($this->FAIscript,$this->cn.".FAIscript");
+    }
+
+    /* Create download button*/
     if($this->dn != "new" && $this->acl_is_readable("FAIscript")){
-      $smarty->assign("DownMe","<a href='getFAIscript.php?id=".base64_encode($this->dn)."'>
-        <input type='button' value='"._("Download")."'>
+      $smarty->assign("DownMe","<a href='?plug=".$_GET['plug']."&getFAIScript'>
+        <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0 class='center'>
         </a>");
     }else{
       $smarty->assign("DownMe","");
index 54bd8326728984c69c5e1cc89dc396f02a1301cd..50add1a379a38ff3f827b56b257fcea2095e7979 100644 (file)
@@ -176,6 +176,15 @@ class faiTemplate extends plugin
       }
     }
 
+    /* File download requested */
+    if(isset($_GET['getFAItemplate'])){
+      if(isset($this->SubObjects[$_GET['getFAItemplate']])){
+        $obj = $this->SubObjects[$_GET['getFAItemplate']];
+        $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
+        send_binary_content($obj['FAItemplateFile'],$obj['cn'].".FAItemplate");
+      }
+    }
+
     /* Edit entries via GET */
     if(isset($_GET['act']) && isset($_GET['id'])){
       if($_GET['act'] == "edit" && isset($this->SubObjects[$_GET['id']])){
@@ -302,7 +311,7 @@ class faiTemplate extends plugin
       if(($this->SubObjects[$key]['status'] == "new") || ($this->SubObjects[$key]['dn'] == "new") || !preg_match("/r/",$s_acl)){
         $down = "";
       }else{
-        $down = "<a href='getFAIscript.php?is_template&amp;id=".base64_encode($dn)."'>
+        $down = "<a href='?plug=".$_GET['plug']."&getFAItemplate=".$key."'>
           <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0>
           </a>";
       }