Code

Updated in_array checks in GOsa.
[gosa.git] / gosa-core / setup / class_setupStep_Migrate.inc
index 4b888535f708a2540b164e50f80fe295a2d2b9ba..cceda31c8dcf578e4008dd14a2697c04e7eefe46 100644 (file)
@@ -39,6 +39,7 @@ class Step_Migrate extends setup_step
     /* Root object classes */
     var $rootOC_migrate_dialog = FALSE;
     var $rootOC_details = array();
+    var $b_displayCheckbutton = TRUE;
 
     function Step_Migrate()
     {
@@ -130,7 +131,7 @@ class Step_Migrate extends setup_step
             $this->checks['permissions']['STATUS']    = FALSE;
             $this->checks['permissions']['STATUS_MSG']= _("Failed");
             $this->checks['permissions']['ERROR_MSG'] = 
-                sprintf(_("The specified user '%s' does not have full access to your ldap database."),$cv['admin']);
+                sprintf(_("The specified user '%s' does not have full access to your LDAP database."),$cv['admin']);
             return(false);
         }
 
@@ -143,13 +144,13 @@ class Step_Migrate extends setup_step
             $this->checks['permissions']['STATUS']    = FALSE;
             $this->checks['permissions']['STATUS_MSG']= _("Failed");
             $this->checks['permissions']['ERROR_MSG'] = 
-                sprintf(_("The specified user '%s' does not have full access to your ldap database."),$cv['admin']);
+                sprintf(_("The specified user '%s' does not have full access to your LDAP database."),$cv['admin']);
             return(false);
         }
 
         /* Create & remove of dummy object was successful */
         $this->checks['permissions']['STATUS']    = TRUE;
-        $this->checks['permissions']['STATUS_MSG']= _("Ok");
+        $this->checks['permissions']['STATUS_MSG']= _("OK");
         $this->checks['permissions']['ERROR_MSG'] = "";
         return(true);
     } 
@@ -186,7 +187,6 @@ class Step_Migrate extends setup_step
             $this->checks['acls']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
         }else{
             $GOsa_26_found = false; // GOsa 2.6 Account found
-            $GOsa_25_found = false; // GOsa 2.5 Account found, allow migration
 
             $username = "";
             $attrs = $ldap->fetch();
@@ -291,43 +291,7 @@ class Step_Migrate extends setup_step
                 }
             }
 
-            /* Try to find an old GOsa 2.5 administrative account that may be migrated 
-             */
-            if(!$GOsa_26_found){
-                $valid_users = "";
-                $valid_groups = "";
-                $ldap->cd($cv['base']);
-                $ldap->search("(&(objectClass=posixGroup)(gosaSubtreeACL=:all)(memberUid=*))",array("memberUid","cn"));
-                while($p_group = $ldap->fetch()){
-                    $val_users = "";
-                    for($e = 0 ; $e < $p_group['memberUid']['count'] ; $e ++ ){
-                        $user = $p_group['memberUid'][$e];
-                        if(isset($rusers[$user])){
-                            $val_users .= $user.", ";
-                        }  
-                    }
-                    if(!empty($val_users)){
-                        $valid_groups .= $groups[$p_group['dn']]."(<i>".trim($val_users,", ")."</i>), ";
-                        $GOsa_25_found  = TRUE;
-                    }
-                }
-            }
-
-
-            /* Print out results 
-             */
-            if($GOsa_25_found){
-                $str = "";
-                if(!empty($valid_groups)){
-                    $str.= "<i>".sprintf(_("GOsa 2.5 administrative accounts found: %s"),trim($valid_groups,", "))."</i><br>";
-                }
-                $this->checks['acls']['STATUS']    = FALSE;
-                $this->checks['acls']['STATUS_MSG']= _("Failed");
-                $this->checks['acls']['ERROR_MSG'] = $str;
-                $this->checks['acls']['ERROR_MSG'].= _("There is no valid GOsa 2.6 administrator account inside your LDAP.")."&nbsp;";
-                $this->checks['acls']['ERROR_MSG'].= "<input type='submit' name='migrate_acls' value='"._("Migrate")."'>";
-                $this->checks['acls']['ERROR_MSG'].= "<input type='submit' name='create_acls' value='"._("Create")."'>";
-            }elseif($GOsa_26_found){
+            if($GOsa_26_found){
                 $str = "";
                 if(!empty($valid_users)){
                     $str.= "<b>"._("Users")."</b>:&nbsp;".trim($valid_users,", ")."<br>";
@@ -336,13 +300,13 @@ class Step_Migrate extends setup_step
                     $str.= "<b>"._("Groups")."</b>:&nbsp;".trim($valid_groups,", ")."<br>";
                 }
                 $this->checks['acls']['STATUS']    = TRUE;
-                $this->checks['acls']['STATUS_MSG']= _("Ok");
+                $this->checks['acls']['STATUS_MSG']= _("OK");
                 $this->checks['acls']['ERROR_MSG'] = $str;
             }else{
                 $this->checks['acls']['STATUS']    = FALSE;
                 $this->checks['acls']['STATUS_MSG']= _("Failed");
                 $this->checks['acls']['ERROR_MSG']= _("There is no GOsa administrator account inside your LDAP.")."&nbsp;";
-                $this->checks['acls']['ERROR_MSG'].= "<input type='submit' name='create_acls' value='"._("Create")."'>";
+                $this->checks['acls']['ERROR_MSG'].= "<button type='submit' name='create_acls'>"._("Create")."</button>";
             }
         }
 
@@ -448,7 +412,7 @@ class Step_Migrate extends setup_step
         $ldap->cd($cv['base']);
         $ldap->search("(uid=".$uid.")");
         if($ldap->count()){
-            msg_dialog::display(_("Input error"),msgPool::duplicated(_("Uid")), ERROR_DIALOG);
+            msg_dialog::display(_("Input error"),msgPool::duplicated(_("UID")), ERROR_DIALOG);
             return false;
         }
 
@@ -507,7 +471,7 @@ class Step_Migrate extends setup_step
     function execute()
     {
         /* Initialise checks if this is the first call */
-        if(!$this->checks_initialised || isset($_POST['reload'])){
+        if(!$this->checks_initialised || isset($_POST['test'])){
             $this->initialize_checks();
             $this->checks_initialised = TRUE;
         }
@@ -696,7 +660,7 @@ class Step_Migrate extends setup_step
                 $this->checks['root']['STATUS']    = FALSE;
                 $this->checks['root']['STATUS_MSG']= _("Failed");
                 $this->checks['root']['ERROR_MSG'] =  _("The LDAP root object is missing. It is required to use your LDAP service.").'&nbsp;';
-                $this->checks['root']['ERROR_MSG'].=  "<input type='submit' name='retry_root_create' value='"._("Try to create root object")."'>";
+                $this->checks['root']['ERROR_MSG'].=  "<button type='submit' name='retry_root_create'>"._("Try to create root object")."</button>";
                 return(FALSE);
             }else{
 
@@ -709,7 +673,7 @@ class Step_Migrate extends setup_step
                     $this->checks['root']['STATUS']    = FALSE;
                     $this->checks['root']['STATUS_MSG']= _("Failed");
                     $this->checks['root']['ERROR_MSG'] = _("Root object couldn't be created, you should try it on your own.");
-                    $this->checks['root']['ERROR_MSG'].= "&nbsp;<input type='submit' name='retry_root_create' value='"._("Try to create root object")."'>";
+                    $this->checks['root']['ERROR_MSG'].= "&nbsp;<button type='submit' name='retry_root_create'>"._("Try to create root object")."</button>";
                     return($res);;
                 }
             }
@@ -717,7 +681,7 @@ class Step_Migrate extends setup_step
 
         /* Create & remove of dummy object was successful */
         $this->checks['root']['STATUS']    = TRUE;
-        $this->checks['root']['STATUS_MSG']= _("Ok");
+        $this->checks['root']['STATUS_MSG']= _("OK");
     }
 
 
@@ -751,7 +715,7 @@ class Step_Migrate extends setup_step
 
         /* Root object doesn't exists 
          */
-        if(!in_array("gosaDepartment",$attrs['objectClass'])){
+        if(!in_array_strict("gosaDepartment",$attrs['objectClass'])){
             if($just_check){
 
                 $this->rootOC_details = array();       
@@ -773,7 +737,7 @@ class Step_Migrate extends setup_step
                 $dep_types = departmentManagement::get_support_departments();
                 $dep_type ="";
                 foreach($dep_types as $dep_name => $dep_class){
-                    if(in_array($dep_class['CLASS'], $attrs['objectClass'])){
+                    if(in_array_strict($dep_class['CLASS'], $attrs['objectClass'])){
                         $dep_type = $dep_name;
                         break;
                     }
@@ -836,8 +800,8 @@ class Step_Migrate extends setup_step
                  */
                 $this->checks['rootOC']['STATUS']    = FALSE;
                 $this->checks['rootOC']['STATUS_MSG']= _("Failed");
-                $this->checks['rootOC']['ERROR_MSG'] = "&nbsp;<input type='submit' 
-                    name='root_add_objectclasses' value='"._("Migrate")."'>";
+                $this->checks['rootOC']['ERROR_MSG'] = "&nbsp;<button type='submit' 
+                    name='root_add_objectclasses'>"._("Migrate")."</button>";
 
                 return(FALSE);
             }else{
@@ -861,7 +825,7 @@ class Step_Migrate extends setup_step
 
         /* Create & remove of dummy object was successful */
         $this->checks['rootOC']['STATUS']    = TRUE;
-        $this->checks['rootOC']['STATUS_MSG']= _("Ok");
+        $this->checks['rootOC']['STATUS_MSG']= _("OK");
         $this->checks['rootOC']['ERROR_MSG'] = "";
     }