Code

Updated templates
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 30 Mar 2010 14:24:15 +0000 (14:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 30 Mar 2010 14:24:15 +0000 (14:24 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17402 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/fai/admin/fai/class_faiPackage.inc
gosa-plugins/fai/admin/fai/class_faiPartitionTable.inc
gosa-plugins/fai/admin/fai/class_faiScript.inc
gosa-plugins/fai/admin/fai/class_faiTemplate.inc

index 22aa7889fa2c138a38bd57ad50e3ca5a023d9def..71b9770b6e344a0ff339cd68ae152d52fa470578 100644 (file)
@@ -432,7 +432,7 @@ class faiPackage extends plugin
         /* Get description */
         $description = "&nbsp;";
         if(isset($this->list[$usedName]['DESCRIPTION'])){
-          $description = postDecode($this->list[$usedName]['DESCRIPTION']);
+          $description = base64_decode($this->list[$usedName]['DESCRIPTION']);
         }
  
         if(!preg_match('/^freeze/', $this->FAIstate) && $this->acl_is_writeable("FAIpackage")){
index 2087089f4cebb505e563a1c75d0caf8efca43b1a..fe760476c7cd174aaef0c80b324718e3752b3b29 100644 (file)
@@ -838,7 +838,7 @@ class faiPartitionTable extends plugin
 
         /* Check if we must decode some attributes */
         if(in_array_ics($attrs,$this->sub64coded)){
-          $var = postDecode($var);
+          $var = base64_decode($var);
         }
 
         /*  check if this is a binary entry */
index 750d1d77c4a4ac322fa976f7c1b2dc5cca48d597..a311eb1403c989759c0170b545230e91fa02bfda 100644 (file)
@@ -113,7 +113,7 @@ class faiScript extends plugin
 
         /* Check if we must decode some attributes */
         if(in_array_ics($attrs,$this->sub64coded)){
-          $var = postDecode($var);
+          $var = base64_decode($var);
         }
 
         /*  check if this is a binary entry */
@@ -440,7 +440,7 @@ class faiScript extends plugin
     foreach($Objects as $name => $obj){
 
       foreach($this->sub64coded as $codeIt){
-        $obj[$codeIt]=postEncode(stripslashes($obj[$codeIt]));
+        $obj[$codeIt]=base64_encode(stripslashes($obj[$codeIt]));
       }
 
       $tmp = array();
index 1a46f050dfc4b5da18688fe81a6e710593be9ca4..3821653247ec78f57fff78d5dbcd452b3a8a6f27 100644 (file)
@@ -120,7 +120,7 @@ class faiTemplate extends plugin
       if(preg_match("/^editscript_/",$name)&&($once)){
         $once = false;
         $entry = preg_replace("/^editscript_/","",$name);
-        $entry = base64_decode(preg_replace("/_.*/","",$entry));
+        $entry = postDecode(preg_replace("/^editscript_/","",$name));
         $obj  = $this->SubObjects[$entry];
 
         $acl_dn = $this->acl_base_for_current_object($obj['dn']);
@@ -142,7 +142,7 @@ class faiTemplate extends plugin
       if(preg_match("/^deletescript_/",$name)&&($once) && !preg_match("/freeze/",$this->FAIstate)){
         $once = false;
         $entry = preg_replace("/^deletescript_/","",$name);
-        $entry = base64_decode(preg_replace("/_.*/","",$entry));
+        $entry = postDecode(preg_replace("/^deletescript_/","",$name));
         $obj  = $this->SubObjects[$entry];
 
         $acl_dn = $this->acl_base_for_current_object($obj['dn']);
@@ -156,15 +156,18 @@ class faiTemplate extends plugin
           }
         }
       }
-    }
 
-    /* File download requested */
-    if(isset($_GET['getFAItemplate'])){
-      if(isset($this->SubObjects[$_GET['getFAItemplate']])){
-        $obj = $this->SubObjects[$_GET['getFAItemplate']];
+      if(preg_match("/^download_/",$name)&&($once) && !preg_match("/freeze/",$this->FAIstate)){
+        $once = false;
+        $entry = postDecode(preg_replace("/^download_/","",$name));
+        $obj  = $this->SubObjects[$entry];
         $obj  = $this->get_object_attributes($obj,$this->sub_Load_Later);
-        send_binary_content($obj['FAItemplateFile'],$obj['cn'].".FAItemplate");
-      }
+        if(!isset($obj['cn'])){
+          trigger_error("Something wen't wrong here!");
+        }else{
+          send_binary_content($obj['FAItemplateFile'],$obj['cn'].".FAItemplate");
+        }
+      } 
     }
 
     /* Edit entries via GET */
@@ -283,11 +286,11 @@ class faiTemplate extends plugin
 
       /* Hide delete icon if this object is freezed */
       if(preg_match("/freeze/",$this->FAIstate)){
-        $act .= "<input type='image' src='images/lists/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
+        $act .= image('images/lists/edit.png','editscript_%s', msgPool::editButton());
       }else{
-        $act .= "<input type='image' src='images/lists/edit.png'      name='editscript_%s'    title='"._("edit")."' alt='"._("edit")."'>";
+        $act .= image('images/lists/edit.png','editscript_%s', msgPool::editButton());
         if(preg_match("/d/",$acl)){
-          $act .="<input type='image' src='images/lists/trash.png' name='deletescript_%s'  title='"._("delete")."' alt='"._("delete")."'>";
+          $act .= image('images/lists/trash.png','deletescript_%s', msgPool::delButton());
         }
       }
 
@@ -296,9 +299,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='?plug=".$_GET['plug']."&getFAItemplate=".$key."'>
-          <img src='images/save.png' alt='"._("Download")."' title='"._("Download")."' border=0>
-          </a>";
+        $down = image('images/save.png','download_'.postEncode($key), _("Download"));
       }
 
       /* Check if we are allowed to view this object */
@@ -308,7 +309,7 @@ class faiTemplate extends plugin
         $edit_link = "<a href='?plug=".$_GET['plug']."&amp;act=edit&amp;id=".$key."'>".$tmp[$key]."</a>";
         $divlist->AddEntry(array( array("string"=> $edit_link), 
               array("string"=>$down , "attach" => "style='width:20px;'"),
-              array("string"=>str_replace("%s",base64_encode($key),$act),
+              array("string"=>str_replace("%s",postEncode($key),$act),
                 "attach"=>"style='border-right: 0px;width:50px;text-align:right;'")));
       }
     }