Code

Moved new_ldap_conf
[gosa.git] / gosa-core / setup / class_setupStep_Migrate.inc
index 5dcd8e649d9ccba0c9fdf273b1e8a08f0dc6d26c..20d563b5f9a1b90b81cc8f53df2a9058f8f9676d 100644 (file)
@@ -122,7 +122,7 @@ class Step_Migrate extends setup_step
     $this->checks['permissions']['ERROR_MSG'] = "";
     $this->check_ldap_permissions();
 
-    $this->checks['deps_visible']['TITLE']     = _("Checking for invisible deparmtments");
+    $this->checks['deps_visible']['TITLE']     = _("Checking for invisible departments");
     $this->checks['deps_visible']['STATUS']    = FALSE;
     $this->checks['deps_visible']['STATUS_MSG']= "";
     $this->checks['deps_visible']['ERROR_MSG'] = "";
@@ -644,7 +644,7 @@ class Step_Migrate extends setup_step
         }else{
           $ldap->cd($attrs['dn']);
           if(!$ldap->modify($new_attrs)){
-            print_red(sprintf(_("Failed to migrate the department '%s' into GOsa, error message is as follows '%s'."),$attrs['dn'],$ldap->get_error()));
+            msg_dialog::display(_("Migration error"), sprintf(_("Cannot migrate department '%s':")."<br><br><i>%s</i>",LDAP::fix($attrs['dn']),$ldap->get_error()), ERROR_DIALOG);
             return(false);
           }
         }
@@ -776,7 +776,7 @@ class Step_Migrate extends setup_step
         }else{
           $ldap->cd($attrs['dn']);
           if(!$ldap->modify($new_attrs)){
-            print_red(sprintf(_("Failed to migrate the department '%s' into GOsa, error message is as follows '%s'."),$attrs['dn'],$ldap->get_error()));
+            msg_dialog::display(_("Migration error"), sprintf(_("Cannot migrate department '%s':")."<br><br><i>%s</i>",LDAP::fix($attrs['dn']), $ldap->get_error()), ERROR_DIALOG);
             return(false);
           }
         }
@@ -942,7 +942,7 @@ class Step_Migrate extends setup_step
    
       $ldap->cd($cv['base']);
       if(!$ldap->modify($attrs_new)){
-        print_red(sprintf(_("Adding acls for user '%s' failed, ldap says '%s'."),$dn,$ldap->get_error()));
+        msg_dialog::display(_("Migration error"), sprintf(_("Cannot add ACL for user '%s':")."<br><br><i>%s</i>", LDAP::fix($dn), $ldap->get_error()), ERROR_DIALOG);
         return(FALSE);
       }else{
         return(TRUE);
@@ -967,12 +967,12 @@ class Step_Migrate extends setup_step
     }
   
     if(empty($pw1) || empty($pw2) | ($pw1 != $pw2)){
-      print_red(_("Specified passwords are empty or not equal."));
+      msg_dialog::display(_("Password error"), _("Provided passwords do not match!"), ERROR_DIALOG);
       return false;
     }
  
-    if(!is_uid($uid) || empty($uid)){
-      print_red(_("Please specify a valid uid."));
+    if(!tests::is_uid($uid) || empty($uid)){
+      msg_dialog::display(_("Input error"), _("Specify a valid user ID!"), ERROR_DIALOG);
       return false;
     }
     
@@ -1016,7 +1016,7 @@ class Step_Migrate extends setup_step
   
     $ldap->cat($dn,array("dn"));
     if($ldap->count()){
-      print_red(sprintf(_("Could not add administrative user, there is already an object with the same dn '%s' in your ldap database."),$dn));
+      msg_dialog::display(_("Error"), sprintf(_("Adding an administrative user failed: object '%s' already exists!"), LDAP::fix($dn)), ERROR_DIALOG);
       return(FALSE);  
     }
 
@@ -1027,7 +1027,7 @@ class Step_Migrate extends setup_step
     $this->create_admin();
     
     if(!$res){
-      print_red($ldap->get_error());
+      msg_dialog::display(_("LDAP error"), $ldap->get_error(), ERROR_DIALOG);
       return(FALSE);
     }
   
@@ -1053,7 +1053,7 @@ class Step_Migrate extends setup_step
     if(isset($_POST['move_winstation_to'])){
       $destination_dep = $_POST['move_winstation_to'];
     }else{
-      print_red(_("Couldn't move users to specified department."));
+      msg_dialog::display(_("LDAP error"), _("Cannot move users to the requested department!"), ERROR_DIALOG);
       return(false);
     }
  
@@ -1067,7 +1067,7 @@ class Step_Migrate extends setup_step
 
 
           /* Check if there are references to this object */
-          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $ldap->search("(&(member=".LDAP::prepare4filter($dn).")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
           $refs = "";
           while($attrs = $ldap->fetch()){
             $ref_dn = $attrs['dn'];
@@ -1101,7 +1101,7 @@ class Step_Migrate extends setup_step
     if(isset($_POST['move_group_to'])){
       $destination_dep = $_POST['move_group_to'];
     }else{
-      print_red(_("Couldn't move users to specified department."));
+      msg_dialog::display(_("LDAP error"), _("Cannot move users to the requested department!"), ERROR_DIALOG);
       return(false);
     }
  
@@ -1115,7 +1115,7 @@ class Step_Migrate extends setup_step
           $this->outside_groups[$b_dn]['ldif'] = _("Group will be moved from").":<br>\t".($ldap->fix($dn))."<br>"._("to").":<br>\t".($ldap->fix($d_dn));
 
           /* Check if there are references to this object */
-          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $ldap->search("(&(member=".LDAP::prepare4filter($dn).")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
           $refs = "";
           while($attrs = $ldap->fetch()){
             $ref_dn = $attrs['dn'];
@@ -1149,7 +1149,7 @@ class Step_Migrate extends setup_step
     if(isset($_POST['move_user_to'])){
       $destination_dep = $_POST['move_user_to'];
     }else{
-      print_red(_("Couldn't move users to specified department."));
+      msg_dialog::display(_("LDAP error"), _("Cannot move users to the requested department!"), ERROR_DIALOG);
       return(false);
     }
       
@@ -1162,7 +1162,7 @@ class Step_Migrate extends setup_step
           $this->outside_users[$b_dn]['ldif'] = _("User will be moved from").":<br>\t".($ldap->fix($dn))."<br>"._("to").":<br>\t".($ldap->fix($d_dn));
 
           /* Check if there are references to this object */
-          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $ldap->search("(&(member=".LDAP::prepare4filter($dn).")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
           $refs = "";
           while($attrs = $ldap->fetch()){
             $ref_dn = $attrs['dn'];
@@ -1891,7 +1891,7 @@ class Step_Migrate extends setup_step
      /* Update object references in gosaGroupOfNames */
     $ogs_to_fix = array();
     $ldap->cd($cv['base']);
-    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::fix($source).'))', array('cn','member'));
+    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::prepare4filter($source).'))', array('cn','member'));
     while ($attrs= $ldap->fetch()){
       $dn = $attrs['dn'];
       $attrs = $this->cleanup_array($attrs);
@@ -1913,10 +1913,10 @@ class Step_Migrate extends setup_step
 
     /* Display warning if copy failed */
     if(!$res){
-      print_red(_("Failed to copy '%s' to '%s'. LDAP says '%s'."),$source,$destination,$ldap->get_error());
+      msg_dialog::display(_("LDAP error"), sprintf(_("Copy '%s' to '%s' failed:")."<br><br><i>%s</i>", LDAP::fix($source), LDAP::fix($destination), $ldap->get_error()), ERROR_DIALOG);
     }else{
       $res = $ldap->rmDir($source);
-      show_ldap_error($ldap->get_error(),_("Something went wrong while copying dns."));
+      show_ldap_error($ldap->get_error(),_("Problem copying DNs"));
 
       /* Object is copied, so update its references */
       foreach($ogs_to_fix as $dn => $data){