Code

Updated ACL handling in groups
[gosa.git] / gosa-core / include / class_SnapShotDialog.inc
index 00e1f870d53a952be0c7e13b33dd28575c79aabf..3bde8d02e759e3e03ff58087be829bd3a1daf6f3 100644 (file)
@@ -1,4 +1,24 @@
 <?php
+/*
+ * This code is part of GOsa (http://www.gosa-project.org)
+ * Copyright (C) 2003-2008 GONICUS GmbH
+ *
+ * ID: $$Id$$
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
 
 /* Snap shot dialog class */
 class SnapShotDialog extends plugin 
@@ -41,14 +61,13 @@ class SnapShotDialog extends plugin
                plugin::execute();
                $smarty = get_smarty();
 
+    $ui = get_userinfo();
                $once = true;
                foreach($_POST as $name => $value){
                        if((preg_match("/^RemoveSnapShot_/",$name)) && ($once)){
                                $once = false;
-       
-                               $entry = preg_replace("/^RemoveSnapShot_/","",$name);
-                               $entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
-
+        $entry = preg_replace("/^RemoveSnapShot_/","",$name);
+        $entry = base64_decode(preg_replace("/_[xy]$/","",$entry));
         $found = false;
         foreach($this->last_list as $t_stamp => $obj){
           if($obj['dn'] == $entry){
@@ -60,7 +79,7 @@ class SnapShotDialog extends plugin
         if($found){
           $this->del_dn        = $entry;
           $smarty= get_smarty();
-          $smarty->assign("intro", sprintf(_("You're about to delete the snapshot '%s'."), @LDAP::fix($this->del_dn)));
+          $smarty->assign("intro", sprintf(_("You're about to delete the snapshot '%s'."), LDAP::fix($this->del_dn)));
           return($smarty->fetch (get_template_path('remove.tpl')));
         }
       }
@@ -73,6 +92,7 @@ class SnapShotDialog extends plugin
                }
 
                /* We must restore a snapshot */
+
                if($this->display_restore_dialog){
 
                        /* Should we only display all snapshots of already deleted objects 
@@ -98,8 +118,10 @@ class SnapShotDialog extends plugin
                        
                        /* Walk through all entries and setup the display text */
                        foreach($tmp as $key => $entry){
-                               $TimeStamp = $entry['gosaSnapshotTimestamp'][0];
-                               $list_of_elements[$TimeStamp] = $entry;
+    
+        /* Check permissions */
+        $TimeStamp = $entry['gosaSnapshotTimestamp'][0];
+        $list_of_elements[$TimeStamp] = $entry;
                        }
 
                        /* Sort generated list */
@@ -109,10 +131,10 @@ class SnapShotDialog extends plugin
       $this->last_list = $list_of_elements;
                        foreach($list_of_elements as $entry){
 
-                               $actions= "<input type='image' src='images/restore.png' name='RestoreSnapShot_%KEY' 
-                                                               class='center' title='"._("Restore snapshot")."'>&nbsp;";
-                               $actions.= "<input type='image' src='images/edittrash.png' name='RemoveSnapShot_%KEY' 
-                                                               class='center' title='"._("Remove snapshot")."'>&nbsp;";
+        $actions= "<input type='image' src='images/lists/restore.png' name='RestoreSnapShot_%KEY' 
+          class='center' title='"._("Restore snapshot")."'>&nbsp;";
+        $actions.= "<input type='image' src='images/lists/trash.png' name='RemoveSnapShot_%KEY' 
+          class='center' title='"._("Remove snapshot")."'>&nbsp;";
 
                                $time_stamp     = date(_("Y-m-d, H:i:s"),preg_replace("/\-.*$/","",$entry['gosaSnapshotTimestamp'][0]));
                                $display_data   = $entry['description'][0];
@@ -122,8 +144,8 @@ class SnapShotDialog extends plugin
                                }
 
                                $field0 = array("string"=> $time_stamp , "attach"=> "style='vertical-align:top;width:120px;'");
-                               $field1 = array("string"=> htmlentities (utf8_decode($display_data)), "attach"=> "");
-                               $field2 = array("string"=> preg_replace("/%KEY/",base64_encode($entry['dn']),$actions) , 
+                               $field1 = array("string"=> htmlentities (utf8_decode(LDAP::fix($display_data))), "attach"=> "");
+                               $field2 = array("string"=> str_replace("%KEY",base64_encode($entry['dn']),$actions) , 
                                                                "attach"=> "style='border-right:0px;vertical-align:top;width:40px;text-align:right;'");
                                $DivListSnapShots->AddEntry(array($field0,$field1,$field2));
                        }               
@@ -135,7 +157,7 @@ class SnapShotDialog extends plugin
                $smarty->assign("restore_deleted",$this->display_all_removed_objects);
                $smarty->assign("RestoreMode",$this->display_restore_dialog);
                $smarty->assign("CurrentDate",date(_("Y-m-d, H:i:s")));
-               $smarty->assign("CurrentDN",$this->dn);
+               $smarty->assign("CurrentDN",LDAP::fix($this->dn));
                $smarty->assign("CurrentDescription",$this->CurrentDescription);
                return($smarty->fetch(get_template_path("snapshotdialog.tpl")));
        }
@@ -146,7 +168,7 @@ class SnapShotDialog extends plugin
                $message = plugin::check();
                if(!$this->display_restore_dialog){
                        if(empty($this->CurrentDescription)){
-                               $message[]  = _("Please specify a valid description for this snapshot.");
+        $message[]= msgPool::invalid(_("Description"));
                        }
                }
                return($message);