Code

Closes #310 Moved copy_FAI_resource_recursive to faiManagement. It is only used there.
[gosa.git] / gosa-core / include / class_plugin.inc
index ceb49f2bf1b56ab94df65b0e4b74b94b21d2739d..9e5d706d37f14aa2622d94672bf50fc09d62adf6 100644 (file)
@@ -239,10 +239,11 @@ class plugin
   function execute()
   {
     /* This one is empty currently. Fabian - please fill in the docu code */
-    $_SESSION['current_class_for_help'] = get_class($this);
+    session::set('current_class_for_help',get_class($this));
 
     /* Reset Lock message POST/GET check array, to prevent perg_match errors*/
-    $_SESSION['LOCK_VARS_TO_USE'] = $_SESSION['LOCK_VARS_USED'] =array();
+    session::set('LOCK_VARS_TO_USE',array());
+    session::set('LOCK_VARS_USED',array());
   }
 
   /*! \brief execute plugin
@@ -622,7 +623,7 @@ class plugin
         exec($command);
       } else {
         $message= sprintf(_("Command '%s', specified as POSTCREATE for plugin '%s' doesn't seem to exist."), $command, get_class($this));
-        print_red ($message);
+        msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
       }
     }
   }
@@ -654,7 +655,7 @@ class plugin
         exec($command);
       } else {
         $message= sprintf(_("Command '%s', specified as POSTMODIFY for plugin '%s' doesn't seem to exist."), $command, get_class($this));
-        print_red ($message);
+        msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
       }
     }
   }
@@ -690,7 +691,7 @@ class plugin
         exec($command);
       } else {
         $message= sprintf(_("Command '%s', specified as POSTREMOVE for plugin '%s' doesn't seem to exist."), $command, get_class($this));
-        print_red ($message);
+        msg_dialog::display(_("Error"), $message, ERROR_DIALOG);
       }
     }
   }
@@ -1211,7 +1212,7 @@ class plugin
 
         /* Check if the snapshot_base is defined */
         if(!isset($tmp['SNAPSHOT_BASE'])){
-          print_red(sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not configured in your gosa.conf."),"SNAPSHOT_BASE"));
+          msg_dialog::display(_("Configuration error"), sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not set."),"SNAPSHOT_BASE"), ERROR_DIALOG);
           return(FALSE);
         }
 
@@ -1223,7 +1224,7 @@ class plugin
           foreach(array("SNAPSHOT_SERVER","SNAPSHOT_USER","SNAPSHOT_PASSWORD","SNAPSHOT_BASE") as $var){
             if(!isset($tmp[$var])){
               $missing .= $var." ";
-              print_red(sprintf(_("The snapshot functionality is enabled, but the required variable(s) '%s' is not configured in your gosa.conf."),$missing));
+              msg_dialog::display(_("Configuration error"), sprintf(_("The snapshot functionality is enabled, but the required variable '%s' is not set."), $missing), ERROR_DIALOG);
               return(FALSE);
             }
           }
@@ -1448,7 +1449,7 @@ class plugin
       $msgs = $this->snapDialog->check();
       if(count($msgs)){
         foreach($msgs as $msg){
-          print_red($msg);
+          msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
         }
       }else{
         $this->dn =  $this->snapDialog->dn;
@@ -1593,8 +1594,10 @@ class plugin
     }
 
     /* Update userinfo if necessary */
-    if($_SESSION['ui']->dn == $old_dn){
-      $_SESSION['ui']->dn = $new_dn;
+    $ui = session::get('ui');
+    if($ui->dn == $old_dn){
+      $ui->dn = $new_dn;
+      session::set('ui',$ui);
       new log("view","acl/".get_class($this),$this->dn,array(),"Updated current user dn from '".$old_dn."' to '".$new_dn."'");
     }
 
@@ -1755,10 +1758,11 @@ class plugin
   function multiple_execute()
   {
     /* This one is empty currently. Fabian - please fill in the docu code */
-    $_SESSION['current_class_for_help'] = get_class($this);
+    session::set('current_class_for_help',get_class($this));
 
     /* Reset Lock message POST/GET check array, to prevent perg_match errors*/
-    $_SESSION['LOCK_VARS_TO_USE'] = $_SESSION['LOCK_VARS_USED'] =array();
+    session::set('LOCK_VARS_TO_USE',array());
+    session::set('LOCK_VARS_USED',array());
     
     return("Multiple edit is currently not implemented for this plugin.");
   }
@@ -1775,11 +1779,13 @@ class plugin
     /* Save values to object */
     $this->multi_boxes = array();
     foreach ($this->attributes as $val){
-      if ($this->acl_is_writeable($val) && isset ($_POST["$val"])){
+  
+      /* Get selected checkboxes from multiple edit */
+      if(isset($_POST["use_".$val])){
+        $this->multi_boxes[] = $val;
+      }
 
-        if(isset($_POST["use_".$val])){
-          $this->multi_boxes[] = $val;
-        }
+      if ($this->acl_is_writeable($val) && isset ($_POST["$val"])){
 
         /* Check for modifications */
         if (get_magic_quotes_gpc()) {