From bdfa0bf9fb1dc2a9483ab8710a392de2f24fb278 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 30 Nov 2006 12:06:01 +0000 Subject: [PATCH] Ensure that only listed entries can be restored. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5273 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_SnapShotDialog.inc | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/include/class_SnapShotDialog.inc b/include/class_SnapShotDialog.inc index 4fc900d01..66211bfd0 100755 --- a/include/class_SnapShotDialog.inc +++ b/include/class_SnapShotDialog.inc @@ -17,6 +17,7 @@ class SnapShotDialog extends plugin var $acl; var $dns = array(); var $snap_shot_bases = array(); + var $last_list = array(); function SnapShotDialog($config,$dn,$parent) @@ -48,15 +49,20 @@ class SnapShotDialog extends plugin $entry = preg_replace("/^RemoveSnapShot_/","",$name); $entry = base64_decode(preg_replace("/_[xy]$/","",$entry)); - $this->del_dn = $entry; - $smarty= get_smarty(); - $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'))); - - /* Obviously the user isn't allowed to delete. Show message and - clean session. - print_red (_("You are not allowed to delete this snapshot!")); - */ + $found = false; + foreach($this->last_list as $t_stamp => $obj){ + if($obj['dn'] == $entry){ + $found = true; + break; + } + } + + 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))); + return($smarty->fetch (get_template_path('remove.tpl'))); + } } } @@ -100,6 +106,7 @@ class SnapShotDialog extends plugin krsort($list_of_elements); /* Add Elements to divlist */ + $this->last_list = $list_of_elements; foreach($list_of_elements as $entry){ $actions= "