Code

Added new setup routine.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 9 May 2007 10:28:30 +0000 (10:28 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 9 May 2007 10:28:30 +0000 (10:28 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.5@6317 594d385d-05f5-0310-b6e9-bd551577e9d8

40 files changed:
html/index.php
html/setup.php
html/themes/default/style.css
ihtml/themes/default/setup_headers.tpl [new file with mode: 0644]
include/class_config.inc
include/class_ldap.inc
include/class_password-methods.inc
include/class_pluglist.inc
include/functions.inc
include/functions_setup.inc [deleted file]
setup/class_setup.inc [new file with mode: 0644]
setup/class_setupStep.inc [new file with mode: 0644]
setup/class_setupStep_Checks.inc [new file with mode: 0644]
setup/class_setupStep_Config1.inc [new file with mode: 0644]
setup/class_setupStep_Config2.inc [new file with mode: 0644]
setup/class_setupStep_Config3.inc [new file with mode: 0644]
setup/class_setupStep_Feedback.inc [new file with mode: 0644]
setup/class_setupStep_Finish.inc [new file with mode: 0644]
setup/class_setupStep_Language.inc [new file with mode: 0644]
setup/class_setupStep_Ldap.inc [new file with mode: 0644]
setup/class_setupStep_License.inc [new file with mode: 0644]
setup/class_setupStep_Migrate.inc [new file with mode: 0644]
setup/class_setupStep_Schema.inc [new file with mode: 0644]
setup/class_setupStep_Welcome.inc [new file with mode: 0644]
setup/license.txt [new file with mode: 0644]
setup/main.inc [new file with mode: 0644]
setup/setup.tpl [new file with mode: 0644]
setup/setup_checks.tpl [new file with mode: 0644]
setup/setup_config1.tpl [new file with mode: 0644]
setup/setup_config2.tpl [new file with mode: 0644]
setup/setup_config3.tpl [new file with mode: 0644]
setup/setup_feedback.tpl [new file with mode: 0644]
setup/setup_finish.tpl [new file with mode: 0644]
setup/setup_frame.tpl [new file with mode: 0644]
setup/setup_language.tpl [new file with mode: 0644]
setup/setup_ldap.tpl [new file with mode: 0644]
setup/setup_license.tpl [new file with mode: 0644]
setup/setup_migrate.tpl [new file with mode: 0644]
setup/setup_schema.tpl [new file with mode: 0644]
setup/setup_welcome.tpl [new file with mode: 0644]

index f7c0fb0793a25287eef528ee2b2cd2a5366b4e0d..80446f1f2476d54df350e0290f766aabf0bc0b47 100644 (file)
@@ -97,7 +97,7 @@ $_SESSION['errorsAlreadyPosted']= array();
 $_SESSION['LastError']          = "";
 
 /* Check if we need to run setup */
-if (!file_exists(CONFIG_DIR."/gosa.conf")){
+if (!file_exists(CONFIG_DIR."/".CONFIG_FILE)){
   header("location:setup.php");
   exit();
 }
@@ -112,14 +112,14 @@ if(isset($_POST['javascript']) && $_POST['javascript'] == "true") {
   $_SESSION['js']= FALSE;
 }
 
-/* Check if gosa.conf is accessible */
-if (!is_readable(CONFIG_DIR."/gosa.conf")){
-  echo sprintf(_("GOsa configuration %s/gosa.conf is not readable. Aborted."), CONFIG_DIR);
+/* Check if CONFIG_FILE is accessible */
+if (!is_readable(CONFIG_DIR."/".CONFIG_FILE)){
+  echo sprintf(_("GOsa configuration %s/%s is not readable. Aborted."), CONFIG_DIR,CONFIG_FILE);
   exit();
 }
 
 /* Parse configuration file */
-$config= new config(CONFIG_DIR."/gosa.conf", $BASE_DIR);
+$config= new config(CONFIG_DIR."/".CONFIG_FILE, $BASE_DIR);
 $_SESSION['DEBUGLEVEL']= $config->data['MAIN']['DEBUGLEVEL'];
 if ($_SERVER["REQUEST_METHOD"] != "POST"){
   @DEBUG (DEBUG_CONFIG, __LINE__, __FUNCTION__, __FILE__, $config->data, "config");
@@ -214,7 +214,6 @@ if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['login'])){
     $config->data['MAIN']['SCHEMA_CHECK'] = "true";
   }
   if(isset($config->data['MAIN']['SCHEMA_CHECK'])&&preg_match("/true/i",$config->data['MAIN']['SCHEMA_CHECK'])){
-    require_once("functions_setup.inc");
     $recursive = (isset($config->current['RECURSIVE']) && $config->current['RECURSIVE'] == "true");
     $tls =       (isset($config->current['TLS'])       && $config->current['TLS'] == "true");
 
index 3320ffd20fb4117e9a71921bedaddcf136c94bd6..5adc78a6d1c500e551b33a84c7405af8f0ebf49a 100644 (file)
@@ -1,27 +1,59 @@
 <?php
-/*
-   This code is part of GOsa (https://gosa.gonicus.de)
-   Copyright (C) 2003  Cajus Pollmeier
-
-   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
- */
-
-// Starting the Session to save Form Information 
-session_start();
+
+/* 
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2007 Fabian Hickert
+
+ 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
+*/
+
+
+
+/* Get standard functions */
+require_once ("../include/php_setup.inc");
+require_once ("functions.inc");
+
+require_once("../setup/class_setup.inc");
+require_once("../setup/class_setupStep.inc");
+require_once("../setup/class_setupStep_Welcome.inc");
+require_once("../setup/class_setupStep_Language.inc");
+require_once("../setup/class_setupStep_Checks.inc");
+require_once("../setup/class_setupStep_License.inc");
+require_once("../setup/class_setupStep_Ldap.inc");
+require_once("../setup/class_setupStep_Config1.inc");
+require_once("../setup/class_setupStep_Config2.inc");
+require_once("../setup/class_setupStep_Config3.inc");
+require_once("../setup/class_setupStep_Schema.inc");
+require_once("../setup/class_setupStep_Migrate.inc");
+require_once("../setup/class_setupStep_Feedback.inc");
+require_once("../setup/class_setupStep_Finish.inc");
+
+
+/* Set header */
+header("Content-type: text/html; charset=UTF-8");
+
+/* Set cookie lifetime to one day (The parameter is in seconds ) */
+session_set_cookie_params(24*60*60);
+session_cache_expire(60*24);  // default is 180
+ini_set("session.gc_maxlifetime",24*60*60);
+
+/* Start session */
+session_start ();
 $_SESSION['DEBUGLEVEL']= 1;
 
+/* Check for js */
 if (!isset($_GET['js']) && !isset($_SESSION['js'])){
   echo '<script language="JavaScript" type="text/javascript">';
   echo '  location = "setup.php?js=true";';
@@ -32,68 +64,33 @@ if (!isset($_GET['js']) && !isset($_SESSION['js'])){
   $_SESSION['js']= TRUE;
 }
 
-/* Load required includes */
-require_once ("../include/php_setup.inc");
-require_once ("functions.inc");
-require_once ("functions_setup.inc");
-
-// Save the Post Data (back and forward button)
-foreach ($_POST as $key => $val){
-  $_SESSION['ldapconf'][$key] = $val;
-}
-
-/* Don't call setup if gosa.conf exists */
-if (file_exists(CONFIG_DIR."/gosa.conf")){     
-  header("location:index.php");        
-  exit();
-}
-
-// Check if theres the example
-if (!file_exists(CONFIG_TEMPLATE_DIR."/gosa.conf")){
-       echo "error example of gosa.conf not present!";
-}
-
-// No Errors occured yet
-$_SESSION['errors']= "";
+/* Attribute initialization, reset errors */
 $_SESSION['errors']             = "";
 $_SESSION['errorsAlreadyPosted']= array();
 $_SESSION['LastError']          = "";
 
-
-// Print out gosa.conf 
-//if(isset($_SESSION['classes'])) print "\$_SESSION['classes']=ok";
-//if(isset($_SESSION['ldapconf'])) print "\$_SESSION['ldapconf']=ok";
-//if(isset($_POST['getconf']))  print "\$_POST['getconf']=ok";
-
-if ((
-    isset($_SESSION['classes']) &&  
-    isset($_SESSION['ldapconf']) && 
-      (
-      isset($_POST['getconf']) || isset($_GET['getconfig']) ))){
-  echo parse_contrib_conf();
-  exit;
-}
-
-/* Set detected samba version */
-if (isset($classes['samba2'])) {
-  $samba= "3";
+/* Set template compile directory */
+if (isset ($config->data['MAIN']['COMPILE'])){
+  $smarty->compile_dir= $config->data['MAIN']['COMPILE'];
 } else {
-  $samba= "2";
+  $smarty->compile_dir= '/var/spool/gosa/';
 }
 
-/* Set template compile directory */
-$smarty->compile_dir= '/var/spool/gosa';
 
-/* Check for compile directory */
-if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){
-  print_red(_("Directory '%s' specified as smarty compile directory is not accessible, please check existence and rights of this directory!"), $smarty->compile_dir);
-  echo $_SESSION['errors'];
-  exit();
+
+/* Get posted language */
+if(!isset($_SESSION['lang'])){
+  $_SESSION['lang'] = get_browser_language();
+}
+if(isset($_POST['lang_selected'])){
+  if($_POST['lang_selected'] != ""){
+    $_SESSION['lang'] = $_POST['lang_selected'];
+  }else{
+    $_SESSION['lang'] = get_browser_language();
+  }
 }
 
-/* Language setup */
-$lang= get_browser_language();
-header("Content-type: text/html; charset=UTF-8");
+$lang = $_SESSION['lang'];
 $lang.=".UTF-8";
 putenv("LANGUAGE=");
 putenv("LANG=$lang");
@@ -106,53 +103,35 @@ $domain = 'messages';
 bindtextdomain($domain, "$BASE_DIR/locale");
 textdomain($domain);
 
-if ($_SERVER["REQUEST_METHOD"] != "POST"){
-       // @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to");
-}
-
-/* Fill template with required values */
-$smarty->assign ('date', gmdate("D, d M Y H:i:s"));
 
-if(isset ($_POST['next'])){
-  $next = $_POST['next'];
-} else {
-  $next = 1;
-}
+/* Call setup */
+$display = "";
+require_once("../setup/main.inc");
 
-if(isset($_POST['back'])) {
-  $next = $next -2 ;     
-}
+/* Print_out last ErrorMessage repeated string. */
+print_red(NULL);
 
-if($next < 1){
-  $next = 1;
-}
+$smarty->assign("date", date("l, dS F Y H:i:s O"));
+$header= "<!-- headers.tpl-->".$smarty->fetch(get_template_path('setup_headers.tpl'));
+/* show web frontend */
+$smarty->assign("contents"  , $display);
+$smarty->assign("navigation", $_SESSION['setup']->get_navigation_html());
+$smarty->assign("header", $_SESSION['setup']->get_header_html());
+$smarty->assign("bottom", $_SESSION['setup']->get_bottom_html());
 
-// How this works
-
-// Every functioon called below, has two modes
-// If the parameter is false, we only test if this function 
-//  is called witout an error
-// Is the return value = false, then there was an error
-//  and we call this func again, to output the error
-
-// I hope this will work fine ^^
-if((show_setup_page1(false))||($next == 1)) {
-  show_setup_page1();  
-} elseif((show_setup_page2(false))||($next==2)) {
-  show_setup_page2();
-} elseif((show_setup_page3(false))||($next==3)) {
-  show_setup_page3();
-} elseif((show_setup_page4(false))||($next==4)) {
-  show_setup_page4();
-}
-// This is called to test if we have an administrative Group with a User in it
-elseif((!create_user_for_setup(false))) {
-  create_user_for_setup();
+if ($error_collector != ""){
+  $smarty->assign("php_errors", $error_collector."</div>");
+} else {
+  $smarty->assign("php_errors", "");
 }
-// this is the last Page which shows the downloadable conf file
-else {
-  show_setup_page5();
+if (isset($_SESSION['errors'])){
+  $smarty->assign("errors", $_SESSION['errors']);
+}else{
+  $smarty->assign("errors"    , "");
 }
 
+$smarty->assign("version",get_gosa_version());
+
+echo $header.$smarty->fetch("../setup/setup_frame.tpl");
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index b63fbcc4363610ff4f059a80eb9fac712d1ea91c..e0f264b80b990bd2e441c154175ae9e7cc6c42d8 100644 (file)
@@ -1135,4 +1135,269 @@ td.container_:hover,div.container_:hover {
 }
 
 
+/*********
+ * Setup
+ *********/
+
+/* The body style */
+body.setup_body {
+    margin-left:0px;
+    margin-right:0px;
+    margin-top:0px;
+    margin-bottom:0px;
+    color:#00008F;
+    font-family:arial,helvetica,sans-serif;
+    font-size:12px;
+    background-color: white;
+    background-image: none;
+}
+
+/* The setup complete setup dialog */
+div.setup_dialog {
+    background-color:#FFF;
+    text-align: left;
+}
+
+/* Header col */
+div.setup_header {
+    background-color: #A9FBA6;
+    height:30px;
+    padding:4px 5px 2px 5px;
+    border-bottom: 1px solid #999;
+}
+
+div.setup_menu {
+    background-color: #F8F8F8;
+    padding:4px 5px 4px 5px;
+    border-bottom: 1px solid #B0B0B0;
+}
+
+/* Setup content header container */
+div.setup_plug_header_container {
+}
+
+/* Setup content container */
+div.setup_contents_container {
+}
+/* Setup footer */
+div.setup_bottom {
+    clear: left;
+    background-color:#DDDDDD;
+    border-top: solid 1px red;
+}
+
+/*******
+<div.setup_header_and_content_container_1>
+ <div.setup_header_and_content_container_2>
+  <div.setup_plug_header>
+  </div>
+  <div.setup_content>
+  </div>
+ </div>
+</div>
+********/
+
+/* Header col */
+div.setup_plug_header {
+    padding: 10px;
+    border-bottom: solid 1px #D0D0D0;
+    background-color: #E0E0F0;
+    border: 10px solid #FFFFFF;
+
+}
+
+/* Content col */
+div.setup_contents {
+    margin-right:2px;
+    background-color:white;
+    width:80%;
+    margin-left:20%;
+    border:1px solid #AAAAAA;
+    padding:2px;
+}
+
+/* default.*/
+div.default {
+    padding: 2px;
+    vertical-align: middle;
+}
+
+/* Navigation col */
+div.setup_navigation {
+    width:19%;
+    background-color:white;
+    padding-left: 2px;
+    padding-right: 2px;
+    border:1px solid #AAAAAA;
+    float:left;
+}
+
+
+/* Navigation title */
+div.setup_navigation_title {
+    font-size: 1.2em;
+    font-weight: bold;
+    text-decoration:none;
+    width:100%;
+    padding-top:8px;
+    padding-bottom:8px;
+    border-top:1px dashed #AAAAAA;
+}
+
+/* The box used for each setup step */
+a.navigation_element, div.navigation_element {
+    text-decoration:none;
+    padding-top:8px;
+    padding-bottom:8px;
+    border-top:1px dashed #AAAAAA;
+    width:100%;
+}
+
+/* The box used for each setup step */
+a.navigation_element_active, div.navigation_element_active {
+    text-decoration:none;
+    width:100%;
+    padding-top:8px;
+    padding-bottom:8px;
+    border-top:1px dashed #AAAAAA;
+    background-color:#F0F0F0;
+}
+
+/* An enabled setup step will use this style in navigation*/
+div.navigation_title_active {
+    font-size: 1.2em;
+    background-color:#F0F0F0;
+    font-weight: bold;
+    cursor: default;
+    padding: 3px;
+}
+
+/* Disabled setup steps */
+div.navigation_title_disabled {
+    font-size: 1.2em;
+    font-weight: bold;
+    padding: 3px;
+    cursor: default;
+    text-decoration:none;
+    color: #AAAAAA;
+}
+
+/* Disabled setup steps */
+div.navigation_title_inactive {
+    font-size: 1.2em;
+    font-weight: bold;
+    text-decoration:none;
+    cursor: pointer;
+    padding: 3px;
+}
+
+/* The style for the info of an active setup */
+div.navigation_info {
+    font-size: 1em;
+    color: black;
+    padding: 4px 4px 3px 23px;
+    margin: 0px;
+    cursor: default;
+}
+
+/*
+    Setup step 2 styles
+*/
+
+/* used to hide display info div */
+div.solution_visible {
+    display: block;
+    width: 100%;
+    text-align:left;
+}
+
+/* Container headline */
+h2.step2_container_title {
+    background-color:#F0F0F0;
+    border: solid 1px #CCCCCC;
+    width:100%;
+    padding:3px;
+}
+
+/* Container for name and status */
+div.step2_entry_container {
+    padding:3px;
+    width:99%;
+    cursor:default;
+}
+
+/* Container for name and status, when status is failed */
+div.step2_entry_container_info {
+    padding:3px;
+    border: 1px dashed #AAAAAA;
+    width:99%;
+    cursor:default;
+}
+
+/* Text shown for each entry */
+div.step2_entry_name {
+    float:left;
+    padding-bottom:4px;
+    vertical-align: middle;
+}
+
+/* Status container */
+div.step2_entry_status {
+    float:none;
+    text-align:right;
+    padding-bottom:4px;
+    vertical-align: middle;
+}
+
+/* Status failed */
+div.step2_failed {
+    color:red;
+    padding-bottom:4px;
+}
+
+/* Status failed but not necessary for setup */
+div.step2_warning {
+    color:orange;
+    padding-bottom:4px;
+}
+
+/* Status successful */
+div.step2_successful {
+    color:green;
+}
+
+/* Text used in info div. */
+div.step2_failed_text {
+    background-repeat: no-repeat;
+    padding-left: 25px;
+}
+
+/* Text used in info div. On warnings */
+div.step2_warning_text{
+    background-repeat: no-repeat;
+    padding-left: 25px;
+}
+/*
+    Setup step 4 styles
+*/
+
+li.step4_name, div.step4_name {
+    float:left;
+    width:20%;
+    height:2.0em;
+}
+
+li.step4_value, div.step4_value {
+    float:left;
+    width:50%;
+    height:2.0em;
+}
+
+ul.step4_container, div.step4_container {
+    height:2.0em;
+    margin-top:2px;
+    margin-left:2px;
+    margin-right:2px;
+}
+
 
diff --git a/ihtml/themes/default/setup_headers.tpl b/ihtml/themes/default/setup_headers.tpl
new file mode 100644 (file)
index 0000000..95605b4
--- /dev/null
@@ -0,0 +1,25 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+
+<head>
+  <title>{if isset($title)}{$title}{else}GOsa{/if}</title>
+
+  <meta name="generator" content="my hands">
+  <meta name="description" content="GOsa - Login">
+  <meta name="author" lang="de" content="Cajus Pollmeier">
+
+  <meta http-equiv="Expires" content="Mon, 26 Jul 1997 05:00:00 GMT">
+  <meta http-equiv="Last-Modified" content="{$date} GMT">
+  <meta http-equiv="Cache-Control" content="no-cache">
+  <meta http-equiv="Pragma" content="no-cache">
+  <meta http-equiv="Cache-Control" content="post-check=0, pre-check=0">
+  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+  <style type="text/css">@import url('themes/default/style.css');</style>
+  <link rel="shortcut icon" href="favicon.ico">
+
+  <script language="javascript"src="include/png.js" type="text/javascript"></script>
+  <script language="javascript"src="include/calendar.js" type="text/javascript"></script>
+  <script language="javascript"src="include/focus.js" type="text/javascript"></script>
+  <script language="javascript"src="include/warning.js" type="text/javascript"></script>
+</head>
index c8526823400c309a8eaa8e0b21ad3c8f3f6467df..6a8e23b64e2d01d839b954354ed694e3ecf836ab 100644 (file)
@@ -68,7 +68,8 @@ class config  {
     $xmldata= fread($fh, 100000);
     fclose($fh); 
     if(!xml_parse($this->parser, chop($xmldata))){
-      print_red(sprintf(_("XML error in gosa.conf: %s at line %d"),
+      print_red(sprintf(_("XML error in %s: %s at line %d"),
+            CONFIG_FILE,
             xml_error_string(xml_get_error_code($this->parser)),
             xml_get_current_line_number($this->parser)));
       echo $_SESSION['errors'];
index ea5d4f756ded8625aed59d8b2b9b7ec6bc91641d..4ee33cbab9431186c3dacabfa42a90061ae46c13 100644 (file)
@@ -660,7 +660,150 @@ class LDAP{
     }
   }
 
+
   function create_missing_trees($target)
+  {
+    global $config;
+
+    $real_path= substr($target, 0, strlen($target) - strlen($this->basedn) -1 );
+
+    if ($target == $this->basedn){
+      $l= array("dummy");
+    } else {
+      $l= array_reverse(gosa_ldap_explode_dn($real_path));
+    }
+    unset($l['count']);
+    $cdn= $this->basedn;
+    $tag= "";
+
+    /* Load schema if available... */
+    $classes= $this->get_objectclasses();
+
+    foreach ($l as $part){
+      if ($part != "dummy"){
+        $cdn= "$part,$cdn";
+      }
+
+      /* Ignore referrals */
+      $found= false;
+      foreach($this->referrals as $ref){
+        $base= preg_replace('!^[^:]+://[^/]+/([^?]+).*$!', '\\1', $ref['URL']);
+        if ($base == $cdn){
+          $found= true;
+          break;
+        }
+      }
+      if ($found){
+        continue;
+      }
+
+      $this->cat ($cdn);
+      $attrs= $this->fetch();
+
+      /* Create missing entry? */
+      if (count ($attrs)){
+        /* Catch the tag - if present */
+        if (isset($attrs['gosaUnitTag'][0])){
+          $tag= $attrs['gosaUnitTag'][0];
+        }
+
+      } else {
+        $type= preg_replace('/^([^=]+)=.*$/', '\\1', $cdn);
+        $param= preg_replace('/^[^=]+=([^,]+),.*$/', '\\1', $cdn);
+
+        $na= array();
+
+        /* Automatic or traditional? */
+        if(count($classes)){
+
+          /* Get name of first matching objectClass */
+          $ocname= "";
+          foreach($classes as $class){
+            if (isset($class['MUST']) && $class['MUST'] == "$type"){
+
+              /* Look for first classes that is structural... */
+              if (isset($class['STRUCTURAL'])){
+                $ocname= $class['NAME'];
+                break;
+              }
+
+              /* Look for classes that are auxiliary... */
+              if (isset($class['AUXILIARY'])){
+                $ocname= $class['NAME'];
+              }
+            }
+          }
+
+          /* Bail out, if we've nothing to do... */
+          if ($ocname == ""){
+            print_red(sprintf(_("Autocreation of subtree failed. No objectClass found for attribute '%s'."), $type));
+            echo $_SESSION['errors'];
+            exit;
+          }
+
+          /* Assemble_entry */
+          if ($tag != ""){
+            $na['objectClass']= array($ocname, "gosaAdministrativeUnitTag");
+          } else {
+            $na['objectClass']= array($ocname);
+          }
+          if (isset($classes[$ocname]['AUXILIARY'])){
+            $na['objectClass'][]= $classes[$ocname]['SUP'];
+          }
+          if ($type == "dc"){
+            /* This is bad actually, but - tell me a better way? */
+            $na['objectClass'][]= 'locality';
+          }
+          $na[$type]= $param;
+          if (is_array($classes[$ocname]['MUST'])){
+            foreach($classes[$ocname]['MUST'] as $attr){
+              $na[$attr]= "filled";
+            }
+          }
+
+        } else {
+
+          /* Use alternative add... */
+          switch ($type){
+            case 'ou':
+              if ($tag != ""){
+                $na["objectClass"]= array("organizationalUnit", "gosaAdministrativeUnitTag");
+                $na["gosaUnitTag"]= $tag;
+              } else {
+                $na["objectClass"]= "organizationalUnit";
+              }
+              $na["ou"]= $param;
+              break;
+            case 'dc':
+              if ($tag != ""){
+                $na["objectClass"]= array("dcObject", "top", "locality", "gosaAdministrativeUnitTag");
+                $na["gosaUnitTag"]= $tag;
+              } else {
+                $na["objectClass"]= array("dcObject", "top", "locality");
+              }
+              $na["dc"]= $param;
+              break;
+            default:
+              print_red(sprintf(_("Autocreation of type '%s' is currently not supported. Please report to the GOsa team."), $type));
+              echo $_SESSION['errors'];
+              exit;
+          }
+
+        }
+        $this->cd($cdn);
+        $this->add($na);
+        show_ldap_error($this->get_error(), sprintf(_("Creating subtree '%s' failed."),$cdn));
+        if (!preg_match('/success/i', $this->error)){
+          return FALSE;
+        }
+      }
+    }
+
+    return TRUE;
+  }
+
+
+  function create_missing_trees_old($target)
   {
     /* Ignore create_missing trees if the base equals target */
     if ($target == $this->basedn){
@@ -1133,7 +1276,7 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec
 
   }
   
-  function get_objectclasses()
+  function get_objectclasses_old()
   {
          $objectclasses = array();
        
@@ -1166,6 +1309,97 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec
   }
 
 
+  function get_objectclasses()
+  {
+    $objectclasses = array();
+
+# Get base to look for schema
+    $sr = @ldap_read ($this->cid, NULL, "objectClass=*", array("subschemaSubentry"));
+    if(!$sr){
+      $sr = @ldap_read ($this->cid, "", "objectClass=*", array("subschemaSubentry"));
+    }
+
+    $attr = @ldap_get_entries($this->cid,$sr);
+    if (!isset($attr[0]['subschemasubentry'][0])){
+      return array();
+    }
+
+    /* Get list of objectclasses and fill array */
+    $nb= $attr[0]['subschemasubentry'][0];
+    $objectclasses= array();
+    $sr= ldap_read ($this->cid, $nb, "objectClass=*", array("objectclasses"));
+    $attrs= ldap_get_entries($this->cid,$sr);
+    if (!isset($attrs[0])){
+      return array();
+    }
+    foreach ($attrs[0]['objectclasses'] as $val){
+      if (preg_match('/^[0-9]+$/', $val)){
+        continue;
+      }
+      $name= "OID";
+      $pattern= split(' ', $val);
+      $ocname= preg_replace("/^.* NAME\s+\(*\s*'([^']+)'\s*\)*.*$/", '\\1', $val);
+      $objectclasses[$ocname]= array();
+
+      foreach($pattern as $chunk){
+        switch($chunk){
+
+          case '(':
+            $value= "";
+            break;
+
+          case ')': if ($name != ""){
+                      $objectclasses[$ocname][$name]= $this->value2container($value);
+                    }
+                    $name= "";
+                    $value= "";
+                    break;
+
+          case 'NAME':
+          case 'DESC':
+          case 'SUP':
+          case 'STRUCTURAL':
+          case 'ABSTRACT':
+          case 'AUXILIARY':
+          case 'MUST':
+          case 'MAY':
+                    if ($name != ""){
+                      $objectclasses[$ocname][$name]= $this->value2container($value);
+                    }
+                    $name= $chunk;
+                    $value= "";
+                    break;
+
+          default:  $value.= $chunk." ";
+        }
+      }
+
+    }
+
+    return $objectclasses;
+  }
+
+  function value2container($value)
+  {
+    /* Set emtpy values to "true" only */
+    if (preg_match('/^\s*$/', $value)){
+      return true;
+    }
+
+    /* Remove ' and " if needed */
+    $value= preg_replace('/^[\'"]/', '', $value);
+    $value= preg_replace('/[\'"] *$/', '', $value);
+
+    /* Convert to array if $ is inside... */
+    if (preg_match('/\$/', $value)){
+      $container= preg_split('/\s*\$\s*/', $value);
+    } else {
+      $container= chop($value);
+    }
+
+    return ($container);
+  }
+
   function log($string)
   {
     if (isset($_SESSION['config'])){
@@ -1190,6 +1424,22 @@ function gen_xls ($dn, $filter= "(objectClass=*)", $attributes= array('*'), $rec
 
   }
 
+  function get_naming_contexts($server, $admin= "", $password= "")
+  {
+    /* Build LDAP connection */
+    $ds= ldap_connect ($server);
+    if (!$ds) {
+      die ("Can't bind to LDAP. No check possible!");
+    }
+    ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
+    $r= ldap_bind ($ds, $admin, $password);
+
+    /* Get base to look for naming contexts */
+    $sr  = @ldap_read ($ds, "", "objectClass=*", array("+"));
+    $attr= @ldap_get_entries($ds,$sr);
+
+    return ($attr[0]['namingcontexts']);
+  }
 
 }
 
index 2755134f11c15115fe7420b9ffada04b9da1afc6..6d8dc0e3abd9b94c47b336c1e243de1f60064bab 100644 (file)
@@ -201,7 +201,7 @@ function generate_smb_nt_hash($password)
   $hash= current($ar);
   if ($hash == "")
   {
-    print_red (_("Setting for SMBHASH in gosa.conf is incorrect! Can't change Samba password."));
+    print_red (sprintf(_("Setting for SMBHASH in %s is incorrect! Can't change Samba password."),CONFIG_FILE));
   }
   else 
   {
index 89d55749e6da60b86c57542735e25a00d87ef658..93cd00afd9fe068a6603557df6a317328c24eb14 100644 (file)
@@ -113,7 +113,7 @@ class pluglist {
 
                                        /* Read information from class variable */
                                        if (!isset($info['CLASS'])){
-                                               print_red(_("Your gosa.conf information has changed partly. Please convert it using the contributed script fix_config.sh!"));
+                                               print_red(sprintf(_("Your %s information has changed partly. Please convert it using the contributed script fix_config.sh!"),CONFIG_FILE));
                                                echo $_SESSION['errors'];
                                                exit;
                                        }
index 04a9d91d17c62e1d00e9bda858609ab91db87b57..eb5c3304d058a4922bf390e66f00936993b85359 100644 (file)
@@ -20,6 +20,7 @@
 
 /* Configuration file location */
 define ("CONFIG_DIR", "/etc/gosa");
+define ("CONFIG_FILE", "gosa.conf");
 define ("CONFIG_TEMPLATE_DIR", "../contrib/");
 define ("HELP_BASEDIR", "/var/www/doc/");
 
@@ -476,7 +477,7 @@ function add_lock ($object, $user)
   $ldap->search("(&(objectClass=gosaLockEntry)(gosaUser=$user)(gosaObject=".base64_encode($object)."))",
       array("gosaUser"));
   if (!preg_match("/Success/i", $ldap->error)){
-    print_red (sprintf(_("Can't set locking information in LDAP database. Please check the 'config' entry in gosa.conf! LDAP server says '%s'."), $ldap->get_error()));
+    print_red (sprintf(_("Can't set locking information in LDAP database. Please check the 'config' entry in %s! LDAP server says '%s'."),CONFIG_FILE, $ldap->get_error()));
     return;
   }
 
@@ -557,7 +558,7 @@ function get_lock ($object)
   $ldap->cd ($config->current['CONFIG']);
   $ldap->search("(&(objectClass=gosaLockEntry)(gosaObject=".base64_encode($object)."))", array("gosaUser"));
   if (!preg_match("/Success/i", $ldap->error)){
-    print_red (_("Can't get locking information in LDAP database. Please check the 'config' entry in gosa.conf!"));
+    print_red (sprintf(_("Can't get locking information in LDAP database. Please check the 'config' entry in %s!"),CONFIG_FILE));
     return("");
   }
 
diff --git a/include/functions_setup.inc b/include/functions_setup.inc
deleted file mode 100644 (file)
index 3cd14af..0000000
+++ /dev/null
@@ -1,1208 +0,0 @@
-<?php
-
-function check_schema_version($description, $version)
-{
-  $desc= preg_replace("/^.* DESC\s+\(*\s*'([^']+)'\s*\)*.*$/", '\\1', $description);
-
-  return preg_match("/\(v$version\)/", $desc);
-}
-
-
-function view_schema_check($table)
-{
-  $message="<table summary=\"\" class=\"check\">";
-
-  foreach ($table as $key => $values){
-    $msg = $values['msg'];
-    $message.= "<tr><td class=\"check\">$msg";
-
-    if($values['status']) {
-      $message.="</td><td style='text-align:center' >
-        <img src=images/true.png alt='true' /></td></tr>";
-    } else {
-      $message.="</td><td style='text-align:center' >
-        <img src=images/button_cancel.png alt='false' /></td></tr>";
-    }
-  }
-  $message.="</table>";
-
-  return $message;
-}
-
-
-function is_schema_readable($server, $admin, $password, $follow_referrals=FALSE, $tls=FALSE)
-{
-  $ldap = new LDAP($admin, $password, $server, $follow_referrals, $tls);
-  $tmp = $ldap->get_objectclasses();
-
-  if(count($tmp)){
-    return(true);
-  }
-  return(false);
-} 
-
-function schema_check($server, $admin, $password, $follow_referrals=FALSE, $tls=FALSE, $aff=0, $CalledByIndexPhP=false)
-{
-  global $config;
-
-  $messages= array();
-  $required_classes= array(
-      "gosaObject"            => array("version" => "2.4"),
-      "gosaAccount"           => array("version" => "2.4"),
-      "gosaLockEntry"         => array("version" => "2.4"),
-      "gosaCacheEntry"        => array("version" => "2.4"),
-      "gosaDepartment"        => array("version" => "2.4"),
-
-      "goFaxAccount"          => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"),
-      "goFaxSBlock"           => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"),
-      "goFaxRBlock"           => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"),
-
-      "gosaUserTemplate"      => array("version" => "2.4", "class" => "posixAccount","file" => "nis.schema"),
-      "gosaMailAccount"       => array("version" => "2.4", "class" => "mailAccount","file" => "gosa+samba3.schema"),
-      "gosaProxyAccount"      => array("version" => "2.4", "class" => "proxyAccount","file" => "gosa+samba3.schema"),
-      "gosaApplication"       => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"),
-      "gosaApplicationGroup"  => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"),
-
-      "GOhard"                => array("version" => "2.5", "class" => "terminals","file" => "goto.schema"),
-      "gotoTerminal"          => array("version" => "2.5", "class" => "terminals","file" => "goto.schema"),
-      "goServer"              => array("version" => "2.4","class" => "server","file" => "goserver.schema"),
-      "goTerminalServer"      => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
-      "goShareServer"           => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
-      "goNtpServer"           => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
-      "goSyslogServer"        => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
-      "goLdapServer"          => array("version" => "2.4"),
-      "goCupsServer"          => array("version" => "2.4", "class" => array("posixAccount", "terminals"),),
-      "goImapServer"          => array("version" => "2.4", "class" => array("mailAccount", "mailgroup"),"file" => "gosa+samba3.schema"),
-      "goKrbServer"           => array("version" => "2.4"),
-      "goFaxServer"           => array("version" => "2.4", "class" => "gofaxAccount","file" => "gofax.schema"),
-      );
-
-  /* Get objectclasses */
-  $ldap = new LDAP($admin,$password, $server, $follow_referrals, $tls);
-  $objectclasses = $ldap->get_objectclasses(); 
-  if(count($objectclasses) == 0){
-    return (array(array("msg" => _("Can't get schema information from server. No schema check possible!"), "status" => FALSE)));
-  }
-
-  /* Walk through objectclasses and check if they are needed or not */
-  foreach ($required_classes as $key => $value){
-    if (isset($value['class'])){
-      if (!is_array($value['class'])){
-        $classes= array($value['class']);
-      } else {
-        $classes= $value['class'];
-      }
-
-      /* Check if we are using the class that requires */
-      foreach($classes as $class){
-        if (!isset($objectclasses[$key])){
-          $messages[$key]['msg']= sprintf(_("Optional objectclass '%s' required by plugin '%s' is not present in LDAP setup"), $key, $class);
-          $messages[$key]['status'] = FALSE;
-        } else {
-          if (!check_schema_version($objectclasses[$key], $value['version'])){
-            $messages[$key]['msg']= sprintf(_("Optional objectclass '%s' required by plugin '%s' does not have version %s"), $key, $class, $value['version']);
-            $messages[$key]['needonstartup'] = TRUE;
-            $messages[$key]['status'] =FALSE;
-          }else {
-            if(!isset($affich2[$class])){
-              $affich2[$class]['msg']   = sprintf(_("Support for '%s' enabled"), $class)."<td class=\"check\"> ".$value['file']."</td>";
-              $affich2[$class]['status']= TRUE; 
-            }
-          }
-        }
-
-      }
-    } else {
-      /* Required class */
-      if (!isset($objectclasses[$key])){
-        $messages[$key]['msg']= sprintf(_("Required objectclass '%s' is not present in LDAP setup"), $key);
-        $messages[$key]['status'] = FALSE;  
-      } else {
-        if (!check_schema_version($objectclasses[$key], $value['version'])){
-          $messages[$key]['msg']= sprintf(_("Required objectclass '%s' does not have version %s"), $key, $value['version']);
-          $messages[$key]['status'] = FALSE;  
-          $messages[$key]['needonstartup'] = TRUE;
-        }
-    
-      }
-    }
-  }
-
-  /* Check for correct samba parameters */
-  if (!isset($objectclasses['sambaSamAccount'])){
-    $messages['samba3']['msg']= _("SAMBA 3 support disabled, no schema seems to be installed");
-    $affich['samba3']['msg']= $messages['samba3']['msg']."<td class=\"check\">gosa+samba3.schema</td>";
-    $messages['samba3']['status']= FALSE;
-    $affich['samba3']['status']= FALSE;
-  }else{
-    $affich['samba3']['msg']= _("SAMBA 3 support enabled")."<td class=\"check\">gosa+samba3.schema</td>";
-    $affich['samba3']['status']= TRUE;
-  }
-
-  if (!isset($objectclasses['sambaAccount'])){
-    $messages['samba2']['msg']= _("SAMBA 2 support disabled, no schema seems to be installed");
-    $affich['samba2']['msg']= $messages['samba2']['msg']."<td class=\"check\">samba.schema</td>";
-    $messages['samba2']['status']= FALSE;
-    $affich['samba2']['status']= FALSE;
-  }else{
-    $affich['samba2']['msg']= _("SAMBA 2 support enabled")."<td class=\"check\">samba.schema</td>";
-    $affich['samba2']['status']= TRUE;
-  }
-
-  /* Check pureftp/dns/ */
-  if (!isset($objectclasses['PureFTPdUser'])){
-    $messages['pureftp']['msg']= _("Support for pureftp disabled, no schema seems to be installed");
-    $affich['pureftp']['msg']= $messages['pureftp']['msg']."<td class=\"check\">pureftpd.schema</td>";
-    $messages['pureftp']['status']= FALSE;
-    $affich['pureftp']['status']= FALSE;
-  }else{
-    $affich['pureftp']['msg']= _("Support for pureftp enabled")."<td class=\"check\">pureftpd.schema</td>";
-    $affich['pureftp']['status']= TRUE;
-  }
-
-  if (!isset($objectclasses['gosaWebdavAccount'])){
-    $messages['webdav']['msg']= _("Support for WebDAV disabled, no schema seems to be installed");
-    $affich['webdav']['msg']= $messages['webdav']['msg']."<td class=\"check\"></td>";
-    $messages['webdav']['status']= FALSE;
-    $affich['webdav']['status']= FALSE;
-  }else{
-    $affich['webdav']['msg']=_("Support for WebDAV enabled")."<td class=\"check\">gosa+samba3.schema</td>";
-    $affich['webdav']['status']= TRUE;
-  }
-
-  if (!isset($objectclasses['phpgwAccount'])){
-    $messages['phpgroupware']['msg']= _("Support for phpgroupware disabled, no schema seems to be installed");
-    $affich['phpgroupware']['msg']= $messages['phpgroupware']['msg']."<td class=\"check\">phpgwaccount.schema</td>";
-    $messages['phpgroupware']['status']= FALSE;
-    $affich['phpgroupware']['status']= FALSE;
-  }else{
-    $affich['phpgroupware']['msg']= _("Support for phpgroupware enabled")."<td class=\"check\">phpgwaccount.schema</td>";
-    $affich['phpgroupware']['status']= TRUE;
-  }
-  
-  if (!isset($objectclasses['trustAccount'])){
-    $messages['trustAccount']['msg']= _("Support for trustAccount disabled, no schema seems to be installed");
-    $affich['trustAccount']['msg']= $messages['trustAccount']['msg']."<td class=\"check\">trust.schema</td>";
-    $messages['trustAccount']['status']= FALSE;
-    $affich['trustAccount']['status']= FALSE;
-  }else{
-    $affich['trustAccount']['msg']= _("Support for trustAccount enabled")."<td class=\"check\">trust.schema</td>";
-    $affich['trustAccount']['status']= TRUE;
-  }
-
-  if (!isset($objectclasses['goFonAccount'])){
-    $messages['phoneaccount']['msg']= _("Support for gofon disabled, no schema seems to be installed");
-    $affich['phoneaccount']['msg']= $messages['phoneaccount']['msg']."<td class=\"check\">gofon.schema</td>";
-    $messages['phoneaccount']['status']= FALSE;
-    $affich['phoneaccount']['status']= FALSE;
-  }else{
-    $affich['phoneaccount']['msg']= _("Support for gofon enabled")."<td class=\"check\">gofon.schema</td>";
-    $affich['phoneaccount']['status']= true;
-  }
-
-  if (!isset($objectclasses['nagiosContact'])){
-    $messages['nagioscontact']['msg']= _("Support for nagios disabled, no schema seems to be installed");
-    $affich['nagioscontact']['msg']= $messages['nagioscontact']['msg']."<td class=\"check\">nagios.schema</td>";
-    $messages['nagioscontact']['status']= FALSE;
-    $affich['nagioscontact']['status']= FALSE;
-  }else{
-    $affich['nagioscontact']['msg']= _("Support for nagios enabled")."<td class=\"check\">nagios.schema</td>";
-    $affich['nagioscontact']['status']= true;
-  }
-  
-  if ((!isset($objectclasses['apple-user'])) || (!isset($objectclasses['mount'])) ){
-    $messages['netatalk']['msg']= _("Support for netatalk disabled, no schema seems to be installed");
-    $affich['netatalk']['msg']= $messages['netatalk']['msg']."<td class=\"check\">apple.schema</td>";
-    $messages['netatalk']['status']= FALSE;
-    $affich['netatalk']['status']= FALSE;
-  }else{
-    $affich['netatalk']['msg']= _("Support for netatalk enabled")."<td class=\"check\">apple.schema</td>";
-    $affich['netatalk']['status']= true;
-  }
-  
-  /* Fix for PHP Fehler "Undefined index: ldapconf"
-   * Ablaufverfolgung[1]: Funktion schema_check        Datei: /home/hickert/gosa/include/functions_setup.inc (Zeile 230)
-   */
-  if((isset($_SESSION['ldapconf']['mail_methods']))&&(isset($_SESSION['ldapconf']))){
-       if(($_SESSION['ldapconf']['mail_methods'][$_SESSION['ldapconf']['mail']] == "kolab")&&(!$CalledByIndexPhP)){
-         if(!isset($objectclasses['kolabInetOrgPerson']))  {
-           $messages['kolab']['msg']= _("Support for Kolab disabled, no schema seems to be installed, setting mail-method to cyrus");
-           $affich['kolab']['msg']=$messages['kolab']['msg']."<td class=\"check\">kolab2.schema</td>";
-           $tmp= array_flip($_SESSION['ldapconf']['mail_methods']);
-           $_SESSION['ldapconf']['mail']=$tmp['cyrus'];
-           $messages['kolab']['status']= FALSE;
-           $affich['kolab']['status']= FALSE;
-         }else{
-           $affich['kolab']['msg']=_("Support for Kolab enabled")."<td class=\"check\">gofon.schema</td>";
-           $affich['kolab']['status']= TRUE;
-         }
-       }
-  }
-  if($aff==0){
-    return ($messages);
-  } else {
-    return(array_merge($affich,$affich2));
-  }
-}
-
-
-function check(&$faults, $message, $description, $test, $required= TRUE)
-{
-  $msg= "<table summary=\"\" class='check'><tr><td class='check' style='font-size:14px;'>$message</td>
-    <td rowspan=2 style='vertical-align:middle; text-align:center;width:45px;'>";
-  if ($test){
-    $msg.= _("OK")."<br>";
-  } else {
-    if (!$required){
-      $msg.="<font color=red>"._("Ignored")."</font><br>";
-    } else {
-      $msg.="<font color=red>"._("Failed")."</font><br>";
-      $faults++;
-    }
-  }
-  $msg.= "</td></tr><tr><td class='check' style='padding-left:20px;".
-    "background-color:#F0F0F0;'>$description</td></tr></table><br>";
-
-  return $msg;
-}
-
-function perform_php_checks(&$faults)
-{
-  global $check_globals;
-
-  $faults= 0;
-  $msg= "";
-
-  $msg.= "<h1>"._("PHP setup inspection")."</h1>";
-
-  $msg.= check (       $faults, _("Checking for PHP version (>=4.1.0)"),
-      _("PHP must be of version 4.1.0 or above for some functions and known bugs in PHP language."),
-      version_compare(phpversion(), "4.1.0")>=0);
-
-  $msg.= check (       $faults, _("Checking if register_globals is set to 'off'"),
-      _("register_globals is a PHP mechanism to register all global varibales to be accessible from scripts without changing the scope. This may be a security risk. GOsa will run in both modes."),
-      $check_globals == 0, FALSE);
-  
-  $msg.= check (  $faults, _("PHP session.gc_maxlifetime (>= 86400 seconds)."),
-      _("PHP uses this value for the garbage collector to delete old sessions, setting this value to one day will prevent loosing session and cookie  before they really timeout."),
-      ini_get("session.gc_maxlifetime") >= 86400,FALSE);
-
-  $msg.= check (       $faults, _("Checking for ldap module"),
-      _("This is the main module used by GOsa and therefore really required."),
-      is_callable('ldap_bind'));
-
-  $msg.= check (  $faults, _("Checking for XML functions"),
-      _("XML functions are required to parse the configuration file."),
-      is_callable('xml_parser_create'));
-
-  $msg.= check (       $faults, _("Checking for gettext support"),
-      _("Gettext support is required for internationalized GOsa."),
-      is_callable('bindtextdomain'));
-
-  $msg.= check (       $faults, _("Checking for iconv support"),
-      _("This module is used by GOsa to convert samba munged dial informations and is therefore required."),
-      is_callable('iconv'));
-
-  $msg.= check (       $faults, _("Checking for mhash module"),
-      _("To use SSHA encryption, you'll need this module. If you are just using crypt or md5 encryption, ignore this message. GOsa will run without it."),
-      is_callable('mhash'), FALSE);
-
-  $msg.= check (       $faults, _("Checking for imap module"),
-      _("The IMAP module is needed to communicate with the IMAP server. It gets status informations, creates and deletes mail users."),
-      is_callable('imap_open'));
-
-  $msg.= check (       $faults, _("Checking for getacl in imap"),
-      _("The getacl support is needed for shared folder permissions. The standard IMAP module is not capable of reading acl's. You need a recend PHP version for this feature."),
-      is_callable('imap_getacl'), FALSE);
-
-  $msg.= check (       $faults, _("Checking for mysql module"),
-      _("MySQL support is needed for reading GOfax reports from databases."),
-      is_callable('mysql_query'), FALSE);
-
-  $msg.= check (       $faults, _("Checking for cups module"),
-      _("In order to read available printers from IPP protocol instead of printcap files, you've to install the CUPS module."),
-      is_callable('cups_get_dest_list'), FALSE);
-
-  $msg.= check (       $faults, _("Checking for kadm5 module"),
-      _("Managing users in kerberos requires the kadm5 module which is downloadable via PEAR network."),
-      is_callable('kadm5_init_with_password'), FALSE);
-
-  $msg.= check (  $faults, _("Checking for snmp Module"),
-      _("Simple Network Management Protocol (SNMP) is required for client monitoring."),
-      is_callable('snmpget'), FALSE);
-
-  return ($msg);
-}
-
-function get_link($function_name) {
-  $result= "<a href='http://de.php.net/manual/en/function.";
-
-  /* Replace all underscores with hyphens (phpdoc convention) */
-  /* hjb: added alternative check for GraphicsMagick >= 1.1.2 */
-  $function_name= str_replace("_", "-", $function_name);
-
-  /* Append to base URL */
-  $result.= $function_name.".php'>$function_name</a>";
-
-  return $result;
-}
-
-function perform_additional_function_checks(&$faults) {
-  global $check_globals;
-
-  $faults= 0;
-  $msg= "";
-  $functions= array();
-  
-  $functions_list= '../include/functions_list.inc';
-
-  /* Make sure that we can read the file */
-  if(is_readable($functions_list)) {
-    /* Open filehandle */
-    $fh= fopen($functions_list,'rb');
-    if($fh!=null) {
-      $functions= eval(fread($fh,filesize($functions_list)));
-    }
-  }
-
-  $msg.= "<h1>"._("PHP detailed function inspection")."</h1>";
-  /* Only print message, if function is not callable */
-  foreach($functions as $key => $fn_name) {
-    if(!is_callable($fn_name)) {
-      $msg.= check ($faults, sprintf(_("Checking for function %s"), "<b>".get_link($fn_name)."</b>"),
-        sprintf(_("The function %s is used by GOsa. There is no information if it's optional or required yet."), "<b>".get_link($fn_name)."</b>"),
-        is_callable($fn_name), false);
-    }
-  }
-  return $msg;
-}
-
-function perform_additional_checks(&$faults)
-{
-  $ret = NULL;
-  /* Programm check */
-  $msg= "<h1>"._("Checking for some additional programms")."</h1>";
-
-  /* Image Magick */
-  $query= "LC_ALL=C LANG=C convert -help";
-  $output= shell_exec ($query);
-  if ($output != ""){
-    $lines= split ("\n", $output);
-    $version= preg_replace ("/^Version: (.+Magick) ([^\s]+).*/", "\\1 \\2", $lines[0]);
-    list($prog, $version) = split(" ", $version);
-    list($major, $minor,$minor2)= split("\.", $version);
-    if (preg_match('/GraphicsMagick/', $prog)) {
-      $msg.= check (   $faults, _("Checking for GraphicsMagick (>=1.1.2)"),
-          _("GraphicsMagick is used to convert user supplied images to fit the suggested size and the unified JPEG format."),
-          ($major > 1 || ($major == 1 && $minor >= 1) || ($major == 1 && $minor == 1 && $minor2 >= 2) ) );
-    } else {
-      $msg.= check (   $faults, _("Checking for ImageMagick (>=5.4.0)"),
-          _("ImageMagick is used to convert user supplied images to fit the suggested size and the unified JPEG format."),
-          ($major > 5 || ($major == 5 && $minor >= 4)));
-        }
-  } else {
-    $msg.= check (     $faults, _("Checking imagick module for PHP"),
-        _("Imagick is used to convert user supplied images to fit the suggested size and the unified JPEG format from PHP script."), function_exists('imagick_blob2image'), TRUE);
-  }
-
-  /* Check for fping */
-  $query= "LC_ALL=C LANG=C fping -v 2>&1";
-  $output= shell_exec ($query);
-  $have_fping= preg_match("/^fping:/", $output);
-  $msg.= check (       $faults, _("Checking for fping utility"),
-      _("The fping utility is only used if you've got a thin client based terminal environment running."),
-      $have_fping, FALSE);
-
-  /* Check for smb hash generation tool */
-  $query= "mkntpwd 2>&1";
-  $output= shell_exec ($query);
-  $have_mkntpwd= preg_match("/^Usage: mkntpwd /", $output);
-  $alt = 0;
-
-  if (!$have_mkntpwd){
-    $query= 'LC_ALL=C LANG=C perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;" &>/dev/null';
-    system ($query, $ret);
-    $alt= ($ret == 0);
-  }
-
-  $msg.= check (       $faults, _("Checking for a way to generate LM/NT password hashes"),
-      _("In order to use SAMBA 2/3, you've to install some additional packages to generate password hashes."),
-      ($have_mkntpwd || $alt));
-
-  /* seesio.auto_start should be off, in order to without trouble*/
-  $session_auto_start = ini_get('session.auto_start');
-  $implicit_flush     = ini_get('implicit_flush');
-  $max_execution_time = ini_get('max_execution_time');
-  $memory_limit       = ini_get('memory_limit');
-  $expose_php         = ini_get('expose_php');
-  $magic_quotes_gpc   = ini_get('magic_quotes_gpc');
-  $register_globals   = ini_get('register_globals');
-
-  /* auto_register */
-  $msg.= check (  $faults, _("php.ini check -> session.auto_register"),
-      _("In Order to use GOsa without any trouble, the session.auto_register option in your php.ini must be set to 'Off'."), (!$session_auto_start['local_value']));
-
-  /* implicit_flush */
-  $msg.= check (  $faults, _("php.ini check -> implicit_flush"),
-      _("This option influences the Output handling. Turn this Option off, to increase performance."),
-      !$implicit_flush['local_value'],0,false);
-
-  /* max_execution_time */
-  if($max_execution_time['local_value'] < 30 ){
-    $max_execution_time['local_value']=false;
-  }
-  $msg.= check (  $faults, _("php.ini check -> max_execution_time"),
-      _("The Execution time should be at least 30 seconds, because some actions may consume more time."),
-      $max_execution_time['local_value'],0,false);
-
-  /* memory_limit */
-  if($memory_limit['local_value'] < 16 ){
-    $memory_limit['local_value']=false;
-  }
-  $msg.= check (  $faults, _("php.ini check -> memory_limit"),
-      _("GOsa needs at least 16MB of memory, less will cause unpredictable errors! Increase it for larger setups."),
-      !$implicit_flush['local_value'],0,false);
-
-  /* expose_php */
-  $msg.= check (  $faults, _("php.ini check -> expose_php"),
-      _("Increase the server security by setting expose_php to 'off'. PHP won't send any Information about the server you are running in this case."),
-      !$implicit_flush['local_value'],0,false);
-
-  /* magic_quotes_gpc */
-  $msg.= check (  $faults, _("php.ini check -> magic_quotes_gpc"),
-      _("Increase your server security by setting magic_quotes_gpc to 'on'. PHP will escape all quotes in strings in this case."),
-      $magic_quotes_gpc['local_value'],0,false);
-
-  return $msg;
-}
-
-
-function parse_contrib_conf()
-{
-
-  $str                = "";
-  $used_samba_version = 0;
-  $query              = ""; 
-  $fp                 = false;
-  $output             = "";
-  $needridbase_sid    = false;
-  $pwdhash            = "";
-  $replacements       = array();
-  $ldapconf           = $_SESSION['ldapconf']; // The Installation information
-  $classes            = $_SESSION['classes'];  // Class information needed to define which features are enabled
-  $possible_plugins   = array();
-
-  /* Which samba version do we use? */
-  if(isset($classes['samba3'])){
-    $used_samba_version = 2;
-  } else {
-    $used_samba_version = 3;
-  }
-
-  /* Look for samba password generation method */
-  if(file_exists("/usr/bin/mkntpasswd")){
-    $pwdhash  = "/usr/bin/mkntpasswd";
-  } elseif (preg_match("/^Usage: mkntpwd /", shell_exec ("mkntpwd 2>&1"))){
-    $pwdhash= "mkntpwd";
-  } else {
-    $pwdhash= 'perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;"';
-  }
-
-
-  /* Define which variables will be replaced */
-  $replacements['{LOCATIONNAME}']  = $ldapconf['location'];
-  $replacements['{SAMBAVERSION}']  = $used_samba_version;
-  $replacements['{LDAPBASE}']      = $ldapconf['base'];
-  $replacements['{LDAPADMIN}']     = $ldapconf['admin'];
-  $replacements['{UIDBASE}']       = $ldapconf['uidbase'];
-  $replacements['{DNMODE}']        = $ldapconf['peopledn'];
-  $replacements['{LDAPHOST}']      = $ldapconf['uri'];
-  $replacements['{PASSWORD}']      = $ldapconf['password'];
-  $replacements['{CRYPT}']         = $ldapconf['arr_cryptkeys'][$ldapconf['arr_crypts']];
-  $replacements['{SID}']         = "";
-  $replacements['{RIDBASE}']     = "";
-  if($ldapconf['mail'] != "disabled"){
-    $replacements['{MAILMETHOD}']    = $ldapconf['mail_methods'][$ldapconf['mail']];
-  }   
-  $replacements['{SMBHASH}']       = $pwdhash;
-  $replacements['{GOVERNMENTMODE}']= "false"; 
-  $replacements['{kolabAccount}']  = "";
-  $replacements['{servKolab}']     = "";
-  $replacements['{errorlvl}']     = $ldapconf['errorlvl'];
-
-  /* This array contains all preg_replace syntax to delete all unused plugins
-     THE kEY MUST BE THE CLASSNAME so we can check it with $ldapconf['classes'] */
-
-  $possible_plugins['fonreport'][]   = "'\n.*<plugin.*fonreport+.*\n.*>.*\n'i";
-  $possible_plugins['phoneaccount'][]= "'\n.*<tab.*phoneAccount.*>.*\n'i";
-  $possible_plugins['logview'][]     = "'\n.*<plugin.*logview+.*\n.*>.*\n'i";
-  $possible_plugins['pureftp'][]     = "'\n.*<tab.*pureftp.*>.*\n'i";
-  $possible_plugins['webdav'][]      = "'\n.*<tab.*webdav.*>.*\n'i";
-  $possible_plugins['phpgroupware'][]= "'\n.*<tab.*phpgroupware.*>.*\n'i";
-  $possible_plugins['netatalk'][0]    = "'\n.*<plugin.*netatalk+.*\n.*>.*\n'i";
-  $possible_plugins['netatalk'][1]    = "'\n.*<tab.*netatalk.*>.*\n'i";
-
-  /*Header information
-     Needed to send the generated gosa.conf to the browser */
-  header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
-  header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
-  header("Cache-Control: no-cache");
-  header("Pragma: no-cache");
-  header("Cache-Control: post-check=0, pre-check=0");
-  header("Content-type: text/plain");
-
-  if (preg_match('/MSIE 5.5/', $_SERVER['HTTP_USER_AGENT']) ||
-      preg_match('/MSIE 6.0/', $_SERVER['HTTP_USER_AGENT'])){
-    header('Content-Disposition: filename="gosa.conf"');
-  } else {
-    header('Content-Disposition: attachment; filename="gosa.conf"');
-  }
-
-  if(!$fp=fopen(CONFIG_TEMPLATE_DIR."/gosa.conf","r")) {
-    echo "Can't open file ".CONFIG_TEMPLATE_DIR."/gosa.conf";
-  } else {
-    while(!feof($fp)) {
-      $str.= fread($fp,512);
-    }
-
-    if($ldapconf['mail_methods'][$ldapconf['mail']]=="kolab") {
-      $replacements['{kolabAccount}']  ="<tab class=\"kolabAccount\" />\n     ";
-      $replacements['{servKolab}']     ="<tab class=\"servkolab\" name=\"Kolab\" />";
-    }
-
-    if($used_samba_version == 2) {
-      /* Do nothing for samba 2... */
-    } else {
-      /* Create LDAP connection, to check if there's a domain
-         object defined in the LDAP schema */
-      $ldap= new LDAP($ldapconf['admin'], $ldapconf['password'], $ldapconf['uri']);
-
-      /* Try to find a Samba Domain Objekt */
-      $ldap->search("(objectClass=sambaDomain)");
-    
-      /* Something found ??? so we need to define ridbase an SID by ourselfs */
-      if($ldap->count()< 1) {
-        $replacements['{SID}']= "sid=\"123412-11\"";
-        $replacements['{RIDBASE}']= "ridbase=\"1000\"";  
-      } 
-    }
-
-    /* Data readed, types replaced, samba version detected and checked if
-       we need to add SID and RIDBASE. Check if there is an ivbbentry in
-       the LDAP tree, in this case we will set the governmentmode to true.
-       Create LDAP connection, to check if theres a domain Objekt definen
-       in the LDAP schema. */
-    if(!isset($ldap)){
-      $ldap= new LDAP($ldapconf['admin'], $ldapconf['password'], $ldapconf['uri']);
-    }
-
-    /* Try to find a Samba Domain Objekt */
-    $ldap->search("(objectClass=ivbbentry)");
-
-    /* Something found ??? so we need to define ridbase an SID by ourselfs */
-    if($ldap->count()> 0) {
-      $replacements['{GOVERNMENTMODE}']= "true";
-    }
-
-    /* Replace all colleted information with placeholder */
-    foreach($replacements as $key => $val) {
-      $str = preg_replace("/".$key."/",$val,$str);
-    }    
-
-    if($ldapconf['mail'] == "disabled"){
-      $str = str_replace("mailMethod=\"{MAILMETHOD}\"","",$str);
-    }
-
-    /* Remove all unused plugins */
-    foreach(array_keys($possible_plugins) as $akey) {
-      if(array_key_exists($akey,$classes)) {
-        foreach($possible_plugins[$akey] as $key=>$val) {
-          $str = preg_replace($val,"\n",$str);
-        }
-      }
-    }
-  }
-
-  return ((($str)));
-}
-
-
-/* Show setup_page 1 */
-function show_setup_page1($withoutput = true)
-{
-  $faults   = false;
-  $faults2  = false;
-  $smarty = get_smarty();  
-  $smarty->assign ("content", get_template_path('setup_introduction.tpl'));
-  $smarty->assign ("tests", perform_php_checks($faults));
-  $smarty->assign ("detailed_tests", perform_additional_function_checks($faults2));
-
-  $faults = $faults || $faults2;
-
-  /* This var is true if anything went wrong */
-  if ($faults){
-    $smarty->assign("mode", "disabled");
-  }
-
-  /* This line displays the template only if (withoutput is set) */
-  if($withoutput){
-    $smarty->display (get_template_path('headers.tpl'));
-  }
-
-  if (isset($_SESSION['errors'])){
-    $smarty->assign("errors", $_SESSION['errors']);
-  }
-
-  if($withoutput){
-    $smarty->display (get_template_path('setup.tpl'));
-  }
-
-  return ($faults);
-}
-
-
-/* Show setup_page 2 */
-function show_setup_page2($withoutput = true)
-{
-  $faults = false;
-  $smarty = get_smarty();
-  $smarty->assign ("content", get_template_path('setup_step2.tpl'));
-  $smarty->assign ("tests", perform_additional_checks($faults));
-
-  if ($faults) {
-    $smarty->assign("mode", "disabled");
-  }
-  if($withoutput){
-    $smarty->display (get_template_path('headers.tpl'));
-  }
-  if (isset($_SESSION['errors']))  {
-    $smarty->assign("errors", $_SESSION['errors']);
-  }
-  if($withoutput){
-    $smarty->display (get_template_path('setup.tpl'));
-  }
-
-  return ($faults);                               
-}
-
-
-function show_setup_page3($withoutput = true)
-{
-  $ds = NULL;
-  $smarty = get_smarty();
-
-  /* Take the Post oder the Sessioin saved data */
-  if(isset($_POST['uri'])){
-    $uri = $_POST['uri'];
-  } elseif(isset($_SESSION['ldapconf']['uri'])){
-    $uri = $_SESSION['ldapconf']['uri'];
-  }
-
-  /* If Page called first time, field is empty */
-  if((!isset($uri))||(empty($uri))){
-    $uri = "ldap://localhost:389";
-  }
-
-  /* if isset $uri save it to session */
-  if(isset($uri)) {
-    $_SESSION['ldapconf']['uri'] = $uri;
-    $smarty->assign ("uri", validate($uri));
-  }
-
-  /* No error till now */
-  $fault = false;
-
-  if (!$ds = @ldap_connect (validate($uri))) {
-    $fault =true;
-
-    /* Output the Error */
-    if($withoutput) {
-      print_red (_("Can't connect to the specified LDAP server! Please make sure that is reachable for GOsa."));
-      $smarty->assign ("uri", validate($uri));
-      $smarty->assign ("content", get_template_path('setup_step3.tpl'));
-    }
-  } else {
-    /* Try to bind the connection */    
-    ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
-
-    /* if we can't bind , print error */
-    if (!$r  =  @ldap_bind ($ds)) {
-      $fault = true;
-
-      /* Output the Error */
-      if($withoutput) {
-        print_red (_("Can't bind to the specified LDAP server! Please make sure that it is reachable for GOsa."));
-        $smarty->assign ("content", get_template_path('setup_step3.tpl'));
-        $smarty->assign ("uri", validate($uri));
-      }
-    } else {
-      $fault = false;
-    }
-  }
-
-  $smarty->assign ("content", get_template_path('setup_step3.tpl'));
-
-  /* Load Header */
-  if($withoutput){
-    $smarty->display (get_template_path('headers.tpl'));
-  }
-
-  /* Set Errors to Smarty */
-  if (isset($_SESSION['errors'])) {
-    $smarty->assign("errors", $_SESSION['errors']);
-  }
-
-  /* Print out Template */ 
-  if($withoutput){
-    $smarty->display (get_template_path('setup.tpl'));
-  }
-
-  return ($fault);                             
-}
-
-
-function show_setup_page4($withoutput = true)
-{
-  $smarty= get_smarty();      
-  $checkvars = array("location", "admin", "password", "peopleou", "base",
-      "peopledn", "arr_crypts", "uidbase","errorlvl");
-
-  $fault     = false;              
-  $uri       = $_SESSION['ldapconf']['uri'];
-  $ldapconf  = $_SESSION['ldapconf'];
-  $arr_crypts= array();
-  $temp      = "";
-
-  /* check POST data */
-  if(isset($_POST['check'])) {
-
-    /* Check if all needed vars are submitted */
-    foreach($checkvars as $key) {
-      if($key == "peopleou"){
-        continue;
-      }
-      if($key == "groupou"){
-        continue;
-      }
-
-      if((isset($_POST[$key]))&&(!empty($_POST[$key]))) {
-        $_SESSION['ldapconf'][$key] = $_POST[$key];
-      } else {
-        if($withoutput) {
-          print_red(sprintf(_("You're missing the required attribute '%s' from this formular. Please complete!"), $key));
-        }
-        $fault = true;
-      }
-    }
-  }
-
-  /* Transfer base */
-  if(isset($_POST['base'])){
-    $_SESSION['ldapconf']['base']= $_POST['base'];
-  }
-
-       // ?
-  if(!isset($_SESSION['ldapconf']['base'])){
-    $_SESSION['ldapconf']['base']= $base;
-  }
-
-  if(!isset($_SESSION['ldapconf']['base'])){
-    $_SESSION['ldapconf']['base']= $base;
-  }
-  require_once("class_password-methods.inc");
-
-  if(!isset($_SESSION['ldapconf']['arr_cryptkeys'])) {
-    require_once("class_password-methods.inc");
-    $tmp= passwordMethod::get_available_methods_if_not_loaded();
-    $_SESSION['ldapconf']['arr_cryptkeys']= $tmp['name'];
-  }
-
-  if(!isset($_SESSION['ldapconf']['mail_methods'])) {
-    $_SESSION['ldapconf']['mail_methods']=array();
-    $temp = get_available_mail_classes();
-    $_SESSION['ldapconf']['mail_methods']= $temp['name'];
-  }
-
-  /* If there are some empty vars in ldapconnect -
-     these values also represent out default values */
-  if(!$ds =  @ldap_connect (validate($uri))){
-    $fault = true;
-    if($withoutput){
-      print_red (_("Can't connect to the specified LDAP server! Please make sure that is reachable for GOsa."));
-    }
-  } elseif(!@ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3)){
-    $fault = true;
-    if($withoutput){
-      print_red (_("Can't set ldap protocol version 3."));
-    }
-  } elseif(!$r= @ldap_bind ($ds)){
-    $fault = true;
-    if($withoutput){
-      print_red (_("Could not bind to the specified LDAP server! Please make sure that it is reachable for GOsa."));
-    }
-  } else {
-    $sr=   @ldap_search ($r, NULL, "objectClass=*", array("namingContexts"));
-    $attr= @ldap_get_entries($ds,$sr);
-
-    if((empty($attr))) {
-
-      if($withoutput){
-#        print_red(_("Bind to server successful, but the server seems to be completly empty, please check all information twice"));
-      }
-
-    } else {
-      $base= $attr[0]['dn'];
-    }
-  }
-
-  if(!isset($_SESSION['ldapconf']['base'])){
-    $_SESSION['ldapconf']['base']= $base;
-  }
-  if(!isset($_SESSION['ldapconf']['admin'])){
-    $_SESSION['ldapconf']['admin']= "cn=ldapadmin,".$base;
-  }
-  if(!isset($_SESSION['ldapconf']['peopleou'])){
-    $_SESSION['ldapconf']['peopleou']= "ou=people";
-  }
-  if(!isset($_SESSION['ldapconf']['groupou'])){
-    $_SESSION['ldapconf']['groupou']= "ou=groups";
-  }
-  if(!isset($_SESSION['ldapconf']['peopledn'])){
-    $_SESSION['ldapconf']['peopledn']= "cn";
-  }
-  if(!isset($_SESSION['ldapconf']['password'])){
-    $_SESSION['ldapconf']['password']= "";
-  }
-  if(!isset($_SESSION['ldapconf']['location'])){
-    $_SESSION['ldapconf']['location']= "Example";
-  }
-  if(!isset($_SESSION['ldapconf']['uidbase'])){
-    $_SESSION['ldapconf']['uidbase']= "1000";
-  }
-  if(!isset($_SESSION['ldapconf']['mail'])){
-    $_SESSION['ldapconf']['mail']= 0;
-  }
-  if(!isset($_SESSION['ldapconf']['follow_referrals'])){
-    $_SESSION['ldapconf']['follow_referrals']= FALSE;
-  }
-  if(!isset($_SESSION['ldapconf']['tls'])){
-    $_SESSION['ldapconf']['tls']= FALSE;
-  }
-
-  $tmp= array_flip($_SESSION['ldapconf']['arr_cryptkeys']);
-  if(!isset($_SESSION['ldapconf']['arr_crypts'])){
-    $_SESSION['ldapconf']['arr_crypts']   = $tmp['md5'];
-  }
-
-  $smarty->assign("arr_cryptkeys",$_SESSION['ldapconf']['arr_cryptkeys']);
-  $smarty->assign("mail_methods", $_SESSION['ldapconf']['mail_methods']);
-
-  foreach($_SESSION['ldapconf'] as $key => $val) {
-    $smarty->assign($key,$val);
-  }
-
-  if(isset($_POST['check']) || (isset($_POST['admin'])) && isset($_POST['password'])) {
-    $ldap= new LDAP($_SESSION['ldapconf']['admin'],
-        $_SESSION['ldapconf']['password'],
-        $_SESSION['ldapconf']['uri'],
-        $_SESSION['ldapconf']['follow_referrals'],
-        $_SESSION['ldapconf']['tls']);
-
-    $m= schema_check($_SESSION['ldapconf']['uri'],
-        $_SESSION['ldapconf']['admin'],
-        $_SESSION['ldapconf']['password'],
-        $_SESSION['ldapconf']['follow_referrals'],
-        $_SESSION['ldapconf']['tls']);
-
-    $_SESSION['classes']= $m;
-
-    //TODO: Ask user for referrals and TLS config options during setup. They are initialized to false at the moment:
-    $ldapconf['follow_referrals'] = false;
-    $ldapconf['tls'] = false;
-    if(!is_schema_readable($ldapconf['uri'], $ldapconf['admin'], $ldapconf['password'], $ldapconf['follow_referrals'], $ldapconf['tls'])){
-      if($withoutput){
-        print_red(_("Can't read schema informations, GOsa needs to know your schema setup. Please verify that it is readable for GOsa"));
-      }
-      $fault=true;
-    }
-
-
-
-    if ($ldap->error != "Success") {
-      if($withoutput) {
-        print_red(sprintf(_("Can't log into LDAP server. Reason was: %s."), $ldap->get_error()));
-      }
-      $fault = true;
-    }
-  }
-
-  /* Set smarty output */
-  $smarty->assign ("content", get_template_path('setup_step4.tpl'));
-  $smarty->assign ("peopledns", array("cn", "uid"));
-  if($withoutput){
-    $smarty->display (get_template_path('headers.tpl'));
-  }
-  if(isset($_SESSION['errors'])) {
-    $smarty->assign("errors", $_SESSION['errors']);
-  }
-  if($withoutput){
-    $smarty->display (get_template_path('setup.tpl'));
-  }
-
-  return ($fault);
-}
-
-
-function show_setup_page5($withoutput=true)
-{
-  /* Get ldapconf */
-  $ldapconf= $_SESSION['ldapconf'];
-
-  /* get smarty */
-  $smarty = get_smarty();
-
-  if(isset($_SESSION['classes'])){
-    $classes = $_SESSION['classes'];
-  }
-
-  $info= posix_getgrgid(posix_getgid());
-  $smarty->assign("webgroup", $info['name']);
-  $smarty->assign("path", CONFIG_DIR);
-  $message= "<table summary=\"\" class=\"check\">";
-
-  //TODO:Ask user for referral and TLS config options during setup. They are initialized to false at the moment:
-  $ldapconf['follow_referrals'] = false;
-  $ldapconf['tls'] = false;
-
-  $m= schema_check($ldapconf['uri'], $ldapconf['admin'], $ldapconf['password'], $ldapconf['follow_referrals'], $ldapconf['tls'], 1);
-
-  if($withoutput) {
-    $smarty->assign ("schemas", view_schema_check($m));
-    $smarty->assign ("content", get_template_path('setup_finish.tpl'));
-  }
-
-  /* Output templates... */
-  if($withoutput){
-    $smarty->display (get_template_path('headers.tpl'));
-  }
-  if (isset($_SESSION['errors'])) {
-    $smarty->assign("errors", $_SESSION['errors']);
-  }
-  if($withoutput){
-    $smarty->display (get_template_path('setup.tpl'));
-  }
-
-  return(true);
-}
-
-
-function create_user_for_setup($withoutput=true)
-{
-  global $samba;
-
-  $ldapconf = $_SESSION['ldapconf'];
-  $smarty = get_smarty();
-  
-  $need_to_create_group = false;
-  $need_to_create_user  = false;
-
-  $str_there="";
-
-  if(isset($_SESSION['classes'])){
-    $classes= $_SESSION['classes'];
-  }
-
-  /* Everything runns perfect ...
-     So we do a last test on this page
-     is there a user with ACLs :all which will be able to adminsitrate GOsa
-     We check that, if this user or group is missing we ask for creating them */
-  $ldap= new LDAP($_SESSION['ldapconf']['admin'],    $_SESSION['ldapconf']['password'],   $_SESSION['ldapconf']['uri']);
-
-  /* Now we are testing for a group, with the rights :all  */
-  $ldap->cd($ldapconf['base']);
-  $ldap->search("(&(objectClass=gosaObject)(gosaSubtreeACL=:all))");
-
-  $group_cnt  = $ldap->count();
-  $data       = $ldap->fetch();
-
-  /* We need to create administrative user and group  because there was no group found */
-  if($group_cnt < 1) {
-    
-    $need_to_create_group = true;
-    $need_to_create_user  = true;
-
-    /* Output error */
-#    if(($withoutput)&&(!isset($_POST['new_admin']))){
-#      print_red(_("You're missing an administrative account for GOsa, you'll not be able to administrate anything!"));
-#    }
-  } else {
-    
-    $need_to_create_group = false;
-    $ldap->clearResult();
-   
-    /* We found an Administrative Group, is there a user too ? */
-    if(isset($data['memberUid'][0])) {
-      $str      = "uid=".$data['memberUid']['0'];
-      $ldap->search("(&(objectClass=gosaAccount)(objectClass=person)(".$str."))");
-      $data2    = $ldap->fetch();
-  
-      /* We must create a user */
-      if (($ldap->count() < 1)||(!isset($data2))) {
-        $need_to_create_user = true;
-#        if(($withoutput)&&(!isset($_POST['new_admin']))){
-#          print_red(_("You're missing an administrative account for GOsa, you'll not be able to administrate anything!"));
-#        }
-      }else {
-        $need_to_create_user = false;
-      }
-    } else {
-      $need_to_create_user=true;
-#      if(($withoutput)&&(!isset($_POST['new_admin']))){
-#          print_red(_("You're missing an administrative account for GOsa, you'll not be able to administrate anything!"));
-#        }   
-    }
-  }
-
-  if(!($need_to_create_user&&$need_to_create_group))
-    return(true);
-
-  /* We need to create a new user with group */
-  if(isset($_POST['new_admin']))
-  {
-  
-    /* Adjust password attributes according to the samba version */
-    if (isset($classes['samba3'])) {
-      $samba= "2";
-      $lmPassword = "lmPassword";
-      $ntPassword = "ntPassword";
-    } else {
-      $samba= "3";
-      $lmPassword = "sambaLMPassword";
-      $ntPassword = "sambaNtPassword";
-    }
-
-    /* Nothing submitted */
-    if(((empty($_POST['admin_name']))||(empty($_POST['admin_pass'])))) {
-      return(true);
-    }
-
-    if($need_to_create_user) {
-      /* We have the order to create an Admin */
-      /* Define the user we are going to create */
-      $dn= "cn=".$_POST['admin_name'].",".$ldapconf['peopleou'].",".$ldapconf['base'];
-      $arr['objectClass'][0] ="person";
-      $arr['objectClass'][1] ="organizationalPerson";
-      $arr['objectClass'][2] ="inetOrgPerson";
-      $arr['objectClass'][3] ="gosaAccount";
-      $arr['uid']            = $_POST['admin_name'];
-      $arr['cn']             = $_POST['admin_name'];
-      $arr['sn']             = $_POST['admin_name'];
-      $arr['givenName']      = "GOsa main administrator";
-      $arr[$lmPassword]      = "10974C6EFC0AEE1917306D272A9441BB";
-      $arr[$ntPassword]      = "38F3951141D0F71A039CFA9D1EC06378";
-      $arr['userPassword']   = crypt_single($_POST['admin_pass'],"md5");
-    
-
-      if(!$ldap->dn_exists($dn)){ 
-        $ldap->cd($dn); 
-        $ldap->create_missing_trees($dn);
-        $ldap->cd($dn);
-        $ldap->add($arr);
-        if($ldap->error!="Success"){
-          show_ldap_error($ldap->get_error(),_("User and/or group could not be created, please check your configuration twice !"));
-        }
-      }    
-    }
-
-    /* There's already a group for administrator, so we only need to add the user */
-    if(!$need_to_create_group) {
-      if(!isset($data['memberUid'])) {
-        $arrr['memberUid']= $_POST['admin_name'];
-      } else {
-        $data['memberUid'][$data['memberUid']['count']]=$_POST['admin_name'];
-        $arrr['memberUid'] = $data['memberUid'];
-        unset($arrr['memberUid']['count']);
-  
-        $tmp = array_reverse($arrr['memberUid']);    
-        foreach($tmp as $tt){
-          $tmp2[]=$tt;
-        }
-        $arrr['memberUid']= $tmp2;
-//        $str_there="Group found<br>".$data['dn'];
-      }
-
-      $ldap->cd($data['dn']);
-      $ldap->modify($arrr);
-
-    } else {
-      $dn                    = "cn=administrators,".$ldapconf['groupou'].",".$ldapconf['base'];
-      $arrr['objectClass'][0]= "gosaObject";
-      $arrr['objectClass'][1]= "posixGroup";
-      $arrr['gosaSubtreeACL']= ":all";
-      $arrr['cn']            = "administrators";
-      $arrr['gidNumber']     = "999";
-      $arrr['memberUid']     = $_POST['admin_name'];
-
-      $ldap->cd($dn);
-      $ldap->create_missing_trees($dn);
-      $ldap->cd($dn);
-
-      $ldap->add($arrr);
-    }
-    return(true);
-  } else {
-
-    if((!isset($need_to_create_user))||(!($need_to_create_user))) {
-      $smarty->assign ("content", get_template_path('setup_useradmin.tpl'));
-      $smarty->assign("exists",true);
-    } else {
-      $smarty->assign ("content", get_template_path('setup_useradmin.tpl'));
-      $smarty->assign("exists",false);
-    }
-
-  }
-
-  /* Smarty output */ 
-  if($withoutput){
-    $smarty->display (get_template_path('headers.tpl'));
-  }
-  if (isset($_SESSION['errors'])) {
-    $smarty->assign("errors", $_SESSION['errors']);
-  }
-  $smarty->assign("str_there",$str_there);
-  if($withoutput){
-    $smarty->display (get_template_path('setup.tpl'));
-  }
-  return(false);
-}
-
-
-/* Returns the classnames auf the mail classes */
-function get_available_mail_classes()
-{
-  $dir = opendir( "../include");
-  $methods = array();
-  $suffix = "class_mail-methods-";
-  $lensuf = strlen($suffix);
-  $prefix = ".inc";
-  $lenpre = strlen($prefix);
-
-  $i = 0;
-  while (($file = readdir($dir)) !== false){
-
-    if(stristr($file,$suffix)) {
-      $lenfile = strlen($file);
-      $methods['name'][$i] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
-      $methods['file'][$i] = $file;
-      $methods[$i]['file'] = $file;
-      $methods[$i]['name'] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
-      $i++;
-    }
-
-  }
-
-  return($methods);
-}
-
-// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
-?>
diff --git a/setup/class_setup.inc b/setup/class_setup.inc
new file mode 100644 (file)
index 0000000..d93dada
--- /dev/null
@@ -0,0 +1,320 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+/* Returns contents of the given POST variable and check magic quotes settings */
+function get_post($name)
+{
+  if(!isset($_POST[$name])){
+    trigger_error("Requested POST value (".$name.") does not exists, you should add a check to prevent this message.");
+    return(FALSE);
+  }
+  if(get_magic_quotes_gpc()){
+    return(stripcslashes($_POST[$name]));
+  }else{
+    return($_POST[$name]);
+  }
+}
+
+require_once("class_setupStep.inc");
+
+
+class setup 
+{
+  var $i_steps  = 9;  // Number of setup steps 
+  var $i_current= 1;  // Current step
+  var $i_last   = 1;  // Last setup step;
+  var $o_steps  = array(); 
+  var $captured_values = array();
+
+  function setup()
+  {
+    $i = 1; 
+    $this->o_steps[$i++] = new Step_Welcome();
+    $this->o_steps[$i++] = new Step_Language();
+    $this->o_steps[$i++] = new Step_Checks();
+    $this->o_steps[$i++] = new Step_License();
+    $this->o_steps[$i++] = new Step_Ldap();
+    $this->o_steps[$i++] = new Step_Schema();
+    $this->o_steps[$i++] = new Step_Config1();
+    $this->o_steps[$i++] = new Step_Config2();
+    $this->o_steps[$i++] = new Step_Config3();
+    $this->o_steps[$i++] = new Step_Migrate();
+    $this->o_steps[$i++] = new Step_Feedback();
+    $this->o_steps[$i++] = new Step_Finish();
+    $this->i_steps = $i-1;
+
+    /* Ensure that setup is not reachable if gosa.conf (CONFIG_FILE) */
+    if(file_exists(CONFIG_DIR."/".CONFIG_FILE)){
+      session_destroy();
+      header("Location: index.php")    ;
+      exit();
+    }
+    
+    foreach($this->o_steps as $key => $step){
+      $this->o_steps[$key]->parent = $this;
+    }
+  }
+
+  function execute()
+  {
+    /* Display phpinfo() dialog when $_GET['info'] is set,
+     *  but only do this, if user is allowed to use the setup.
+     * If setupStep_Welcome is_completed, we are allowed to view those infos-
+     */
+    if(isset($_GET['info']) && get_class($this->o_steps[1]) == "Step_Welcome" && $this->o_steps[1]->is_completed()){
+      phpinfo();
+      exit();
+    }
+
+    /* display step error msgs */
+    $msgs = $this->o_steps[$this->i_current]->check();
+    foreach($msgs as $msg){
+      print_red($msg);
+    }
+
+    $this->o_steps[$this->i_last]->set_active(FALSE);
+    $this->o_steps[$this->i_current]->set_active();
+    $content = $this->o_steps[$this->i_current]->execute();
+    return($content);
+  }
+
+
+  /* Save posted attributes  */
+  function save_object()
+  {
+    /* Call save_object for current setup step */
+    $this->o_steps[$this->i_current] -> save_object();
+
+    /* Get attributes from setup step */
+    $tmp = $this->o_steps[$this->i_current]->get_attributes();
+    foreach($tmp as $name => $value){
+      $this->captured_values[$name] = $value;
+    }
+
+    /* Set parent */
+    foreach($this->o_steps as $key => $value){
+      $this->o_steps[$key]->parent = $this;
+    }
+
+    /* Check if image button requests next page */
+    foreach($_POST as $name => $value){
+      if(preg_match("/^next_(x|y)/",$name)){
+        $_POST['next'] = TRUE;
+      }
+      if(preg_match("/^last_(x|y)/",$name)){
+        $_POST['last'] = TRUE;
+      }
+    }
+
+    /* Check if step was selected */
+    if(isset($_GET['step']) || isset($_POST['next']) || isset($_POST['last'])){
+
+      /* check if current setup step is completed now 
+          and activate the next step if possible */
+      for($i = 1 ; $i <= $this->i_steps ; $i ++ ){
+        if($this->o_steps[$i]->is_completed()){
+          if(isset($this->o_steps[($i+1)])){
+            $this->o_steps[($i+1)]->set_enabled();
+          }
+        }else{
+          $this->disable_steps_from($i+1);
+        }
+      }
+    }
+    /* Disable all following steps, if one step isn't compelted right now .*/
+    for($i = 1 ; $i <= $this->i_steps ; $i ++ ){
+      if($this->o_steps[$i]->is_completed()){
+      }else{
+        $this->disable_steps_from($i+1);
+      }
+    }
+    $step = -1;
+
+    if(isset($_POST['setup_goto_step'])){
+      $step= $_POST['setup_goto_step'];
+    }
+
+    if(isset($_GET['step'])){
+      $step = $_GET['step'];
+    }elseif(isset($_POST['next'])){
+      $step = $this->i_current + 1;
+    }elseif(isset($_POST['last'])){
+      $step = $this->i_current - 1;
+    }
+  
+    $once = true;
+    foreach($_POST as $name => $value){
+      if(preg_match("/^step_[0-9]*$/",$name) && $once ){
+        $step = preg_replace("/^step_/","",$name);
+      }
+    }
+
+    if($this->selectable_step($step)){
+      $this->i_last    = $this->i_current;
+      $this->i_current = $step;
+    }
+  }
+
+
+  function disable_steps_from($start)
+  {
+    $found = false;
+    foreach($this->o_steps as $key => $step){
+      if($key == $start){
+        $found = true;
+      }
+
+      if($found){ 
+        $this->o_steps[$key]->set_enabled(false);
+        $this->o_steps[$key]->set_completed(false);
+      }
+    }
+  }
+
+
+  /* Create navigation menu */
+  function get_navigation_html()
+  {
+    $str = "";
+    foreach($this->o_steps as $key => $step){
+
+      $step -> update_strings();
+
+      $s_title    = $step -> get_title();
+      $s_info     = $step -> get_small_info();
+      $b_active   = $step -> is_active();
+      $b_enabled  = $step -> is_enabled();
+      $b_completed= $step -> is_completed();
+
+      if($b_completed){
+        $s = "<img src='images/true.png' alt='"._("Completed")."' class='center'>&nbsp;"; 
+      }else{
+        $s = "<img src='images/empty.png' alt=' ' class='center'>&nbsp;";
+      }
+
+      if($_SESSION['js']){
+
+        $str .="<div >";
+    
+        if($b_enabled){
+          if($b_active){
+            $str .= "<div class='navigation_element_active'>";
+            $str .= "<div class='navigation_title_active'>".$s.$s_title."</div>";
+            $str .= "<div class='navigation_info'>".$s_info."</div>";
+            $str .= "</div>";
+          }else{
+            $str .= "<div class='navigation_element'>";
+            $str .= "<div onClick='document.mainform.setup_goto_step.value=\"$key\";document.mainform.submit();'
+              class='navigation_title_inactive'>".$s.$s_title."</div>";
+            $str .= "</div>";
+          }
+        }else{
+          $str .= "<div class='navigation_element'>";
+          $str .= "<div class='navigation_title_disabled'>".$s.$s_title."</div>";
+          $str .= "</div>";
+        }
+        $str .= "</div>" ;
+      }else{
+        $str .="<div >";
+        if($b_enabled){
+          if($b_active){
+            $str .= "<div class='navigation_element_active'>";
+            $str .= "<input style='text-align: left; color: #00008F; font-weight: bold; width:100%;' 
+                        type='button' value='".$s_title."' name='step_".$key."'>";
+            $str .= "</div>";
+          }else{
+            $str .= "<div class='navigation_element'>";
+            $str .= "<input style='text-align: left; color: #00008F; font-weight: bold; width:100%;' 
+                        type='submit' value='".$s_title."' name='step_".$key."'>";
+            $str .= "</div>";
+          }
+        }else{
+          $str .= "<div class='navigation_element'>";
+          $str .= "<div class='navigation_title_disabled'>".$s_title."</div>";
+          $str .= "</div>";
+        }
+        $str .= "</div>" ;
+      }
+    }
+    return($str);
+  }
+
+  
+
+  function get_bottom_html()
+  {
+    /* Skip adding forward/backward button,   
+     *  if the currently opened step is a sub dialog 
+     */
+    if($this->o_steps[$this->i_current]->dialog){
+      $str ="";
+    }else{
+      $str ="<p class='seperator' style='margin-bottom:10px;'>&nbsp;</p>";
+      $str.="   <div style='text-align:right;float:top;'>";
+      if(isset($this->o_steps[$this->i_current -1]) && $this->o_steps[$this->i_current -1]->is_enabled()){
+        $str .= "<input type='submit' name='last' value='"._("Back")."'>";
+      }else{
+        $str .= "<input type='button' name='last' value='"._("Back")."' disabled>";
+      }
+      $str.= "&nbsp;";
+        $str .= "<input type='submit' name='next' value='"._("Continue")."'>";
+      $str .="</div>";
+    }
+    return($str);
+  }
+
+  
+  /* Create header entry */
+  function get_header_html()
+  {
+    $str=   $this->o_steps[$this->i_current]->print_header();
+    return ($str);
+  }
+
+
+  /* Check if the given step id is valid and selectable */
+  function selectable_step($id)
+  {
+    if(isset($this->o_steps[$id]) && $this->o_steps[$id]->is_enabled()){
+      return(true);
+    }
+    return(false);
+  }
+
+  function step_name_to_id($name)
+  {
+    foreach($this->o_steps as $id => $class){
+      if(get_class($class) == $name){
+        return($id);
+      }
+    }
+    return(0);
+  }
+  
+}
+
+
+
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep.inc b/setup/class_setupStep.inc
new file mode 100644 (file)
index 0000000..5364187
--- /dev/null
@@ -0,0 +1,130 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+class setup_step extends plugin
+{
+  var $s_title      = "Still undefined";
+  var $s_title_long = "This is a still undefined long title";
+  var $s_info       = "This info is still undefined. This setup step detect the type of your ldap. This is a basic requirement for gosa.";
+  var $is_active    = false;
+  var $is_enabled   = false;
+  var $is_completed = false;
+
+  var $header_image = "images/personal.png";
+
+  var $attributes   = array();
+  var $parent       = NULL;
+  var $dialog       = FALSE;
+  
+  function setup_step()
+  {
+  }
+
+  function execute()
+  { 
+  }
+
+  function save_object()
+  {
+    /* Do not call plugin::save_object. This causes acl trouble  */
+  }
+
+  function get_title()
+  { 
+    return($this->s_title);
+  }
+
+  function get_long_title()
+  { 
+    return($this->s_title_long);
+  }
+
+  function get_small_info()
+  { 
+    return($this->s_info);
+  }
+  
+  function is_active()
+  {
+    return($this->is_active);
+  }
+
+  function is_enabled()
+  {
+    return($this->is_enabled);
+  }
+
+  function is_completed()
+  {
+    return($this->is_completed);
+  }
+
+  function set_active($value = TRUE)
+  {
+    if($value){ 
+      $this->is_active = TRUE;  
+    }else{
+      $this->is_active = FALSE;  
+    }
+  }
+
+  function set_enabled($value = TRUE)
+  {
+    if($value){ 
+      $this->is_enabled = TRUE;  
+    }else{
+      $this->is_enabled = FALSE;  
+    }
+  }
+
+  function set_completed($value = TRUE)
+  {
+    if($value){ 
+      $this->is_completed = TRUE;  
+    }else{
+      $this->is_completed = FALSE;  
+    }
+  }
+
+  /* Return attributes handled by this setup step */
+  function get_attributes()
+  {
+    $tmp = array();
+    foreach($this->attributes as $attr){
+      $tmp[$attr] = $this->$attr;
+    }
+    return($tmp);
+  }
+
+  function print_header()
+  {
+    $image= get_template_path($this->header_image);
+    $display= "<div style='padding:3px;'>";
+    $display.= "  <p class=\"center\" style=\"margin:0px 0px 0px 5px;padding:0px;font-size:24px;font-weight:bold;\"><img class=\"center\" src=\"$image\" align=\"middle\" alt=\"*\">&nbsp;".$this->s_title_long."</p>\n";
+    $display.= "</div>\n";
+
+    return($display);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_Checks.inc b/setup/class_setupStep_Checks.inc
new file mode 100644 (file)
index 0000000..366ab1b
--- /dev/null
@@ -0,0 +1,318 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+class Step_Checks extends setup_step
+{
+  var $basic_checks = array();
+  var $config_checks= array();
+  var $is_writeable = array();
+  var $header_image = "images/system.png";
+
+  function Step_Checks()
+  {
+    $this->update_strings();
+  }
+
+  function update_strings()
+  {
+    $this->s_title      = _("Installation check");
+    $this->s_title_long = _("Installation check");
+    $this->s_info       = _("Basic checks for PHP version and required extensions.");
+  }
+  
+  
+  /* Execute and display template */ 
+  function execute()
+  {
+    $this->run_checks();
+    $smarty = get_smarty();
+    $smarty->assign("basic"       ,$this->basic_checks);
+    $smarty->assign("config"      ,$this->config_checks);
+    $smarty->assign("is_writeable",$this->is_writeable);
+    return($smarty->fetch(get_template_path("setup_checks.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  /* Execute all checks */ 
+  function run_checks()
+  {
+    $this->basic_checks = array();
+    $this->config_checks = array();
+    $this->is_writeable = array();
+    /* PHP version check */
+    $N = _("Checking PHP version"); 
+    $D = sprintf(_("PHP must be of version %s / %s or above."),"4.3.10","5.2.0");
+    $S = _("GOsa requires functionality that is not available (or buggy) in older PHP versions. Please update to a supported version.");
+    $R = $this->check_php_version();
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checking imap extension */
+    $N = _("Checking for LDAP support");
+    $D = _("This is the main extension used by GOsa and therefore really required.");
+    $S = _("The ldap extension (php4-ldap/php5-ldap) is required to communicate with your LDAP server.");
+    $R = is_callable("ldap_bind");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Check for gettext support */
+    $N = _("Checking for gettext support");
+    $D = _("Gettext support is required for internationalization.");
+    $S = _("Please make sure that the extension is activated.");
+    $R = is_callable("bindtextdomain");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checing for iconv */
+    $N = _("Checking for iconv support");
+    $D = _("This module is used by GOsa to convert samba munged dial informations and is therefore required. ");
+    $S = _("Please make sure that the extension is activated.");
+    $R = is_callable("iconv");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Check for installed mhash module */
+    $N = _("Checking for mhash support");
+    $D = _("You'll need this module to make use of SSHA encryption");
+    $S = _("The mhash module for PHP 4/5 is not available.Please install php4-mhash/php5-mhash.");
+    $R = is_callable("mhash");
+    $M = FALSE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Is imap module available */
+    $N = _("Checking for IMAP support");
+    $D = _("The IMAP module is needed to communicate with the IMAP server. GOsa retrieves status information, creates and deletes mail users, etc.");
+    $S = _("This module is used to communicate with your mail server. Please install php4-imap/php5-imap.");
+    $R = is_callable("imap_open");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Check getacl in imap module */
+    $N = _("Checking for getacl in IMAP implementation");
+    $D = _("The getacl support is needed to handle shared folder permissions. Old IMAP extensions are not capable of reading acl's. You need a recent PHP version to use this feature.");
+    $S = $D;
+    $R = is_callable("imap_getacl");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Mysql module loaded ? */
+    $N = _("Checking for MySQL support");
+    $D = _("MySQL support is needed to communicate with several supported databases.");
+    $S = _("This module is required to communicate with database servers (GOfax, asterisk, GLPI, etc.). Please install php4-mysql/php5-mysql");
+    $R = is_callable("mysql_query");
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checking for kadm5 module */
+    $N = _("Checking for kadm5 support");
+    $D = _("Managing users in kerberos requires the kadm5 module which is downloadable via PEAR network.");
+    $S = _("This module is required to manage user in kerberos, it is downloadable via PEAR network");
+    $R = is_callable("kadm5_init_with_password");
+    $M = FALSE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Snmp module available ? */
+    $N = _("Checking for SNMP support");
+    $D = _("The simple network management protocol is needed to get status information from clients.");
+    $S = _("This module is required for client monitoring. Please install php4-snmp/php5-snmp.");
+    $R = is_callable("snmpget");
+    $M = FALSE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checking for Cups module */
+    $N = _("Checking for CUPS support");
+    $D = _("In order to read available printers via the IPP protocol instead of printcap files, you've to install the CUPS module.");
+    $S = $D; 
+    $R = is_callable("cups_get_dest_list");
+    $M = FALSE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checking for F ping utility */
+    $query= "LC_ALL=C LANG=C fping -v 2>&1";
+    $output= shell_exec ($query);
+    $N = _("Checking for fping utility");
+    $D = _("The fping utility is used if you've got a thin client based terminal environment.");
+    $S = _("The fping utility is only used in thin client based terminal environment.");
+    $R = preg_match("/^fping:/", $output);
+    $M = FALSE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Checking generate LM/NT password hashes */
+    $query= "mkntpwd 2>&1";
+    $output= shell_exec ($query);
+    $have_mkntpwd= preg_match("/^Usage: mkntpwd /", $output);
+    if (!$have_mkntpwd){
+      $query= 'LC_ALL=C LANG=C perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen $ARGV[0]), $/;" &>/dev/null';
+      system ($query, $ret);
+      $have_mkntpwd |= ($ret == 0);
+    }
+
+    $N = _("SAMBA password hash generation");
+    $D = _("In order to use SAMBA 2/3 passwords, you've to install additional packages to generate password hashes.");
+    $S = _("In order to use SAMBA 2/3 you've to install additional perl libraries. Take a look at mkntpasswd.");
+    $R = $have_mkntpwd;
+    $M = TRUE;
+    $this->basic_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+
+    /* PHP Configuration checks 
+     */
+
+    /* Register_globals off */
+    $N = "register_globals = <b>"._("Off")."</b>";
+    $D = _("register_globals is a PHP mechanism to register all global variables to be accessible from scripts without changing the scope. This may be a security risk.");
+    $S = _("Search for 'register_globals' in your php.ini and switch it to 'Off'.");
+    $R = ini_get("register_globals") == 0;
+    $M = FALSE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+
+    /* session lifetime set to >=86400 seconds ? */
+    $N = "session.gc_maxlifetime &gt;= <b>86400</b>";
+    $D = _("PHP uses this value for the garbage collector to delete old sessions.")." ".
+         _("Setting this value to one day will prevent loosing session and cookies before they really timeout.");
+    $S = _("Search for 'session.gc_maxlifetime' in your php.ini and set it to 86400 or higher.");
+    $R = ini_get("session.gc_maxlifetime") >= 86400;
+    $M = FALSE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Session auto start must be turned off */
+    $session_auto_start = ini_get('session.auto_start');
+    $N = "session.auto_start = <b>"._("Off")."</b>";
+    $D = _("In Order to use GOsa without any trouble, the session.auto_register option in your php.ini should be set to 'Off'.");
+    $S = _("Search for 'session.auto_start' in your php.ini and set it to 'Off'.");
+    $R = !$session_auto_start['local_value'];
+    $M = TRUE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Check if memory limit is set to 32 or > */
+    $N = "memory_limit &gt;= <b>32</b>";
+    $D = _("GOsa needs at least 32MB of memory. Setting it below this limit may cause errors that are not reproducable! Increase it for larger setups.");
+    $S = _("Search for 'memory_limit' in your php.ini and set it to '32M' or higher.");
+    $R = ini_get('memory_limit') >= 32 ;
+    $M = TRUE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Implicit Flush disabled can increase performance */
+    $N = "implicit_flush = <b>"._("Off")."</b>";
+    $D = _("This option influences the PHP output handling. Turn this Option off, to increase performance.");
+    $S = _("Search for 'implicit_flush' in your php.ini and set it to 'Off'."); 
+    $R = ini_get('implicit_flush');
+    $M = FALSE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Check if execution time is set to 30 */
+    $N = "max_execution_time &gt;= <b>30</b>";
+    $D = _("The Execution time should be at least 30 seconds.");
+    $S = _("Search for 'max_execution_time' in your php.ini and set it to '30' or higher.");
+    $R = ini_get("max_execution_time") >= 30 ;
+    $M = TRUE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Expose php should be set to off */
+    $N = "expose_php = <b>"._("Off")."</b>";
+    $D = _("Increase the server security by setting expose_php to 'off'. PHP won't send any information about the server you are running in this case.");
+    $S = _("Search for 'expose_php' in your php.ini and set if to 'Off'.");
+    $R = !ini_get("expose_php");
+    $M = FALSE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Automatic quoting must be turned on */
+    $N = "magic_quotes_gpc = <b>"._("On")."</b>";
+    $D = _("Increase your server security by setting magic_quotes_gpc to 'on'. PHP will escape all quotes in strings in this case."); 
+    $S = _("Search for 'magic_quotes_gpc' in your php.ini and set it to 'On'."); 
+    $R = ini_get('magic_quotes_gpc'); 
+    $M = TRUE;
+    $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* Emulating old stuff? */
+    if (!preg_match('/^4/', phpversion())){
+      $N = "zend.ze1_compatibility_mode = <b>"._("Off")."</b>";
+      $D = _("Increase your server performance by setting magic_quotes_gpc to 'off'."); 
+      $S = _("Search for 'zend.ze1_compatibility_mode' in your php.ini and set it to 'Off'."); 
+      $R = !ini_get('zend.ze1_compatibility_mode'); 
+      $M = FALSE;
+      $this->config_checks[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+    }
+
+
+    /* Configuration file  
+     */
+
+    /* Check if we can create a config file.*/
+    $N = _("Configuration writeable");
+    $D = _("The configuration file can't be written");
+    $S = sprintf(_("GOsa reads its configuration from a file located in (%s/%s). The setup can write the configuration directly if it is writeable."),CONFIG_DIR,CONFIG_FILE); 
+    $R =    ( file_exists(CONFIG_DIR."/".CONFIG_FILE) && is_writeable(CONFIG_DIR."/".CONFIG_FILE)) // is there a config file ? 
+        ||  (!file_exists(CONFIG_DIR."/".CONFIG_FILE) && is_writeable(CONFIG_DIR));  // There is non, but can we create a file there ?
+    $M = FALSE;
+    $this->is_writeable[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+
+    /* If we have writeaccess to the config dir, check if there is already a config file */
+#    if($R){
+#
+#      /* check if there is already a config file. */
+#      $N = _("No old configuration file.");
+#      $D = "";//_("");
+#      $S = _("If there is already a configuration file, this file will be overwritten when GOsa setup finishes. Please move your old config file away.");
+#      $R =  !file_exists(CONFIG_DIR."/".CONFIG_FILE);
+#      $M = FALSE;
+#      $this->is_writeable[] = array("NAME" => $N , "DESC" => $D , "RESULT" => $R , "SOLUTION" => $S , "MUST" => $M );
+#    }
+  }
+
+  function save_object()
+  {
+     /* If everything is fine, set this step to completed
+     *  and allow switching to next setup step
+     */
+    $failed = false;
+    foreach(array("basic_checks","config_checks","is_writeable") as $type){
+      foreach($this->$type as $obj){
+
+        if($obj['MUST'] && !$obj['RESULT']){
+          $failed = true;
+          break;
+        }
+      }
+    }
+    $this->is_completed = !$failed;
+  }
+
+  /* Check if current PHP version is compatible 
+      with the current version of GOsa */
+  function check_php_version()
+  {
+    if(preg_match("/^5/",phpversion())){
+      return(version_compare(phpversion(),"5.2.0",">=")); 
+    }else{
+      return(version_compare(phpversion(),"4.3.10",">="));
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_Config1.inc b/setup/class_setupStep_Config1.inc
new file mode 100644 (file)
index 0000000..a1e9c0b
--- /dev/null
@@ -0,0 +1,244 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+class Step_Config1 extends setup_step
+{
+
+  var $peopleou   = "ou=people";
+  var $groupou    =  "ou=groups";
+  var $peopledn   = "cn";
+  var $uidbase    = 1000;
+  var $krbsasl    = FALSE;
+  var $strict     = TRUE;
+
+  var $header_image = "images/ldapserver.png";
+  var $account_expiration  =FALSE;
+  var $base_hook         = ""; 
+  var $base_hook_active  = FALSE; 
+
+  var $encryption = "crypt";
+  var $theme      = "default"; 
+
+  var $include_personal_title = FALSE;
+
+  var $pwd_rules  = array("pwminlen" => 6, 
+                          "pwminlen_active" => FALSE,
+                          "pwdiffer" => 5,
+                          "pwdiffer_active" => FALSE,
+                          "externalpwdhook" => "",
+                          "externalpwdhook_active" => FALSE);
+
+  var $id_settings = array(       "idgen"         => "{%sn}-{%givenName[2-4]}",
+                                  "idgen_active"  => FALSE,
+                                  "minid"         => "100",
+                                  "minid_active"  => FALSE);
+
+  var $crypt_methods  = array();
+
+  var $attributes = array("peopleou","groupou","peopledn","uidbase","encryption","theme","krbsasl",
+                          "base_hook","base_hook_active","account_expiration","strict","include_personal_title");
+
+  function Step_Config1()
+  {
+    $this->update_strings();
+
+    $tmp = @passwordMethod::get_available_methods_if_not_loaded();
+    foreach($tmp['name'] as $name){
+      $this->crypt_methods[$name] = $name;
+    }
+  }
+
+
+  function update_strings()
+  {
+    $this->s_title      = _("GOsa settings 1/3");
+    $this->s_title_long = _("GOsa settings 1/3");
+    $this->s_info       = _("GOsa generic settings");
+  }
+
+  
+  function execute()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("peopledns",array("uid","cn"));
+    $smarty->assign("id_settings",$this->id_settings);
+    $smarty->assign("crypt_methods",$this->crypt_methods);
+    $smarty->assign("themes",$this->get_themes());
+    $smarty->assign("pwd_rules",$this->pwd_rules);
+    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    /* !!! Attention strict is inverse. If you change this, 
+     *  don't forget to change save_object too 
+     */
+    $smarty->assign("strict",!$this->strict);
+    return($smarty -> fetch (get_template_path("../setup/setup_config1.tpl")));
+  }
+
+
+  function get_themes()
+  {
+    $dir = opendir( "../ihtml/themes/");
+    $themes = array();
+    while (($file = readdir($dir)) !== false){
+      if(is_dir("../ihtml/themes/".$file) && !preg_match("/^\./",$file)){
+        $themes[$file] = $file;
+      }      
+    }
+    return($themes);
+  }
+
+  function check()
+  {
+    $message = array();
+
+    if(isset($this->id_settings['minid_active']) && !is_numeric($this->id_settings['minid'])){
+      $message[] = sprintf(_("The specified value for '%s' must be a numeric value"),_("GID / UID min id"));
+    }
+
+    if(preg_match("/,$/",$this->peopleou)){
+      $message[] =sprintf(_("Don't add a trailing comma to '%s'."),_("People storage ou"));
+    }
+
+    if(preg_match("/,$/",$this->groupou)){
+      $message[] =sprintf(_("Don't add a trailing comma to '%s'."),_("Group storage ou"));
+    }
+
+    if(!is_numeric($this->uidbase)){
+      $message[] = _("Uid base must be numeric");
+    }
+
+    if(($this->pwd_rules['pwminlen_active']) && !is_numeric($this->pwd_rules['pwminlen'])){
+      $message[] = _("The given password minimum length is not numeric.");
+    }
+    if(($this->pwd_rules['pwdiffer_active']) && !is_numeric($this->pwd_rules['pwdiffer'])){
+      $message[] = _("The given password differ value is not numeric.");
+    }
+    return($message);
+  }
+
+  function save_object()
+  {
+    if(isset($_POST['step5_posted'])){
+
+      /* Get attributes */
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = validate(get_post($attr));
+        }
+      }
+
+      /* !!! Attention strict is inverse. If you change this, 
+       *  don't forget to change the smarty assignment too 
+       */
+      if(isset($_POST['strict'])){
+        if($_POST['strict']){
+          $this->strict = FALSE;
+        }else{
+          $this->strict = TRUE;
+        }
+      }
+
+      if(isset($_POST['minid_active'])){
+        $this->id_settings['minid_active'] = TRUE;
+        if(isset($_POST['minid'])){
+          $this->id_settings['minid'] = get_post('minid');
+        }
+      }else{
+        $this->id_settings['minid_active'] = FALSE;
+      }
+
+      /* Generic settings */
+      if(isset($_POST['idgen_active'])){
+        $this->id_settings['idgen_active'] = TRUE;
+        if(isset($_POST['idgen'])){
+          $this->id_settings['idgen'] = get_post('idgen');
+        }
+      }else{
+        $this->id_settings['idgen_active'] = FALSE;
+      }
+
+      /* Get password settings */ 
+      if(isset($_POST['pwdiffer_active'])){
+        $this->pwd_rules['pwdiffer_active'] = TRUE;
+        if(isset($_POST['pwdiffer'])){
+          $this->pwd_rules['pwdiffer'] = get_post('pwdiffer');
+        }
+      }else{
+        $this->pwd_rules['pwdiffer_active'] = FALSE;
+      }
+
+      /* Get password minimum length posts */
+      if(isset($_POST['pwminlen_active'])){
+        $this->pwd_rules['pwminlen_active'] = TRUE;
+        if(isset($_POST['pwminlen'])){
+          $this->pwd_rules['pwminlen'] = get_post('pwminlen');
+        }
+      }else{
+        $this->pwd_rules['pwminlen_active'] = FALSE;
+      }
+
+      /* External pwd settings */
+      if(isset($_POST['externalpwdhook_active'])){
+        $this->pwd_rules['externalpwdhook_active'] = TRUE;
+        if(isset($_POST['externalpwdhook'])){
+          $this->pwd_rules['externalpwdhook'] = get_post('externalpwdhook');
+        }
+      }else{
+        $this->pwd_rules['externalpwdhook_active'] = FALSE;
+      }
+
+      /* base hook settings */
+      if(isset($_POST['base_hook_active'])){
+        $this->pwd_rules['base_hook_active'] = TRUE;
+        if(isset($_POST['base_hook'])){
+          $this->pwd_rules['base_hook'] = get_post('base_hook');
+        }
+      }else{
+        $this->pwd_rules['base_hook_active'] = FALSE;
+      }
+    }
+
+    $tmp = $this->check(); 
+    if(count($tmp) == 0){
+      $this->is_completed = TRUE;
+    }else{
+      $this->is_completed = FALSE;
+    }
+  }// if tempalte posted 
+
+
+  /* Attributes that are interesting for configuration generation */
+  function get_attributes()
+  {
+    $tmp = setup_step::get_attributes();
+    foreach(array("pwd_rules","id_settings") as $attr){
+      $tmp[$attr]= $this->$attr;
+    }
+    return($tmp);
+  }
+}// CLass
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_Config2.inc b/setup/class_setupStep_Config2.inc
new file mode 100644 (file)
index 0000000..d238af0
--- /dev/null
@@ -0,0 +1,268 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+class Step_Config2 extends setup_step
+{
+  var $governmentmode = FALSE;
+  var $sambaidmapping = FALSE;
+  var $header_image = "images/ldapserver.png";
+
+  var $cyrusunixstyle = FALSE;
+  var $mail       = "none";
+  var $mail_methods   = array();
+  var $mail_settings = array("vacationdir"        => "/etc/gosa/vacation",
+                             "vacationdir_active" => FALSE);
+
+  var $generic_settings  = array( "enableCopyPaste" => false,
+                                  "wws_ou"        => "ou=winstations",
+                                  "wws_ou_active" => FALSE,
+                                  "snapshot_active"     => FALSE,
+                                  "snapshot_base"       => "ou=snapshots,%base%",
+                                  "snapshot_user"       => "%admin%",
+                                  "snapshot_password"   => "",
+                                  "snapshot_server"     => "%connection%");
+
+  var $samba_settings    = array( "samba_sid"        => "0-815-4711",
+                                  "samba_sid_active" => FALSE,
+                                  "samba_rid"        => 1000,
+                                  "smbhash"          => 'SMBHASH',
+                                  "samba_rid_active" => FALSE); 
+
+  var $sambaDomain_found = FALSE;
+
+  var $attributes = array("governmentmode","sambaidmapping","cyrusunixstyle","mail");
+  var $called = FALSE;
+
+
+  function Step_Config2()
+  {
+    $this->update_strings();
+    $tmp = $this->get_available_mail_classes();
+    foreach($tmp['name'] as $name){
+      $this->mail_methods[$name] = $name;
+    }
+
+    /* Look for samba password generation method */
+    if(file_exists("/usr/bin/mkntpasswd")){
+      $pwdhash  = "/usr/bin/mkntpasswd";
+    } elseif (preg_match("/^Usage: mkntpwd /", shell_exec ("mkntpwd 2>&1"))){
+      $pwdhash= "mkntpwd";
+    } else {
+      $pwdhash= 'perl -MCrypt::SmbHash -e "print join(q[:], ntlmgen \$ARGV[0]), $/;"';
+    }
+
+    $this->samba_settings['smbhash'] = $pwdhash;
+  }
+
+  function update_strings()
+  {
+    $this->s_title      = _("GOsa settings 2/3");
+    $this->s_title_long = _("GOsa settings 2/3");
+    $this->s_info       = _("Customize special parameters");
+  }
+
+  function execute()
+  {
+    /* On first call check for rid/sid base */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+    $ldap->search("(objectClass=sambaDomain)",array("dn"));
+    if($ldap->count()){
+      $this->sambaDomain_found =TRUE;
+    }else{
+      $this->sambaDomain_found =FALSE;
+    }
+
+    if(!$this->called){
+      if(!$this->sambaDomain_found){
+        $this->samba_settings['samba_sid_active'] = TRUE;
+        $this->samba_settings['samba_rid_active'] = TRUE;
+      }
+   
+      $this->called = TRUE;
+    }
+
+    /* Update snapshot values, with already collected values */
+    foreach($this->generic_settings as $key => $value){
+      foreach(array("snapshot_base","snapshot_user","snapshot_server") as $attr){
+        foreach($this->parent->captured_values as $replace_name => $replace_value){
+          if(is_string($replace_value))  {
+            $this->generic_settings[$attr] = preg_replace("/%".$replace_name."%/",$replace_value,$this->generic_settings[$attr]);
+          }
+        }
+      }
+    }
+
+    $smarty = get_smarty();
+    $smarty->assign("sambaDomain_found",$this->sambaDomain_found);
+    $smarty->assign("generic_settings",$this->generic_settings);
+    $smarty->assign("mail_settings",$this->mail_settings);
+    $smarty->assign("mail_methods",$this->mail_methods);
+    $smarty->assign("samba_settings",$this->samba_settings);
+    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
+        foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    return($smarty -> fetch (get_template_path("../setup/setup_config2.tpl")));
+  }
+
+  function save_object()
+  {
+    if(isset($_POST['step6_posted'])){
+
+      /* Get attributes */
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = validate(get_post($attr));
+        }
+      }
+
+      /* Mail settings */
+      if(isset($_POST['vacationdir_active'])){
+        $this->mail_settings['vacationdir_active'] = TRUE;
+        if(isset($_POST['vacationdir'])){
+          $this->mail_settings['vacationdir'] = get_post('vacationdir');
+        }
+      }else{
+        $this->mail_settings['vacationdir_active'] = FALSE;
+      }
+
+      if(isset($_POST['enableCopyPaste'])){
+        $this->generic_settings['enableCopyPaste'] = get_post('enableCopyPaste');
+      }
+
+      if(isset($_POST['wws_ou_active'])){
+        $this->generic_settings['wws_ou_active'] = TRUE;
+        if(isset($_POST['wws_ou'])){
+          $this->generic_settings['wws_ou'] = get_post('wws_ou');
+        }
+      }else{
+        $this->generic_settings['wws_ou_active'] = FALSE;
+      }
+
+      if(isset($_POST['snapshot_active'])){
+        $this->generic_settings['snapshot_active'] = TRUE;
+        if(isset($_POST['snapshot_base'])){
+          $this->generic_settings['snapshot_base'] = get_post('snapshot_base');
+        }
+        if(isset($_POST['snapshot_user'])){
+          $this->generic_settings['snapshot_user'] = get_post('snapshot_user');
+        }
+        if(isset($_POST['snapshot_password'])){
+          $this->generic_settings['snapshot_password'] = get_post('snapshot_password');
+        }
+        if(isset($_POST['snapshot_server'])){
+          $this->generic_settings['snapshot_server'] = get_post('snapshot_server');
+        }
+      }else{
+        $this->generic_settings['snapshot_active'] = FALSE;
+      }
+
+      /* Samba settings */
+      if(isset($_POST['samba_sid_active'])){
+        $this->samba_settings['samba_sid_active'] = TRUE;
+        if(isset($_POST['samba_sid'])){
+          $this->samba_settings['samba_sid'] = get_post('samba_sid');
+        }
+      }else{
+        $this->samba_settings['samba_sid_active'] = FALSE;
+      }
+      if(isset($_POST['samba_rid_active'])){
+        $this->samba_settings['samba_rid_active'] = TRUE;
+        if(isset($_POST['samba_rid'])){
+          $this->samba_settings['samba_rid'] = get_post('samba_rid');
+        }
+      }else{
+        $this->samba_settings['samba_rid_active'] = FALSE;
+      }
+      if(isset($_POST['smbhash'])){
+        $this->samba_settings['smbhash'] = get_post('smbhash');
+      }
+
+      if(!$this->sambaDomain_found){
+        $this->samba_settings['samba_sid_active'] = TRUE;
+        $this->samba_settings['samba_rid_active'] = TRUE;
+      }
+    }
+
+    $tmp = $this->check();
+    if(count($tmp) == 0){
+      $this->is_completed = TRUE;
+    }else{
+      $this->is_completed = FALSE;
+    }
+  }
+
+
+  function check()
+  {
+    $message = array();
+    return($message);
+  }
+  
+
+  /* Attributes that are interesting for configuration generation */
+  function get_attributes()
+  {
+    $tmp = setup_step::get_attributes();
+    foreach(array("samba_settings","generic_settings","mail_settings") as $attr){
+      $tmp[$attr]= $this->$attr;
+    }
+    return($tmp);
+  }
+
+/* Returns the classnames auf the mail classes */
+  function get_available_mail_classes()
+  {
+    $dir = opendir( "../include");
+    $methods = array();
+    $suffix = "class_mail-methods-";
+    $lensuf = strlen($suffix);
+    $prefix = ".inc";
+    $lenpre = strlen($prefix);
+    $i = 0;
+    while (($file = readdir($dir)) !== false){
+
+      if(stristr($file,$suffix)) {
+        $lenfile = strlen($file);
+        $methods['name'][$i] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
+        $methods['file'][$i] = $file;
+        $methods[$i]['file'] = $file;
+        $methods[$i]['name'] = substr($file,$lensuf,($lenfile-$lensuf)-$lenpre);
+        $i++;
+      }
+    }
+    return($methods);
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_Config3.inc b/setup/class_setupStep_Config3.inc
new file mode 100644 (file)
index 0000000..6140cd2
--- /dev/null
@@ -0,0 +1,195 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+class Step_Config3 extends setup_step
+{
+  var $header_image= "images/ldapserver.png";
+
+  var $errorlvl   = FALSE;
+
+  var $optional = array(
+              "strict_units" => false,
+              "forceglobals" => true,
+              "forcessl" => false,
+              "ldapstats" => false,
+              "warnssl" => true,
+              "ppd_path" => "/var/spool/ppd/",
+              "ppd_path_active" => FALSE,
+              "compile" =>  "/var/spool/gosa",
+              "debuglevel" => 0,
+              "session_lifetime" => 7200,
+              "max_ldap_query_time" => "5.0",
+              "max_ldap_query_time_active" => FALSE,
+
+              "mailQueueScriptPath" => "/usr/bin/sudo /usr/local/sbin/mailqueue %action %id %server",
+              "mailQueueScriptPath_active" => FALSE,
+
+              "auto_network_hook" => "/etc/gosa/net-resolv.sh",
+              "auto_network_hook_active" => FALSE,
+
+              "notifydir" => "",
+              "notifydir_active" => FALSE,
+
+              "kioskpath" => "/var/spool/kiosk",
+              "kioskpath_active" => FALSE,
+
+              "noprimarygroup"  => FALSE);
+
+  var $attributes = array("errorlvl");
+
+  function Step_Config3()
+  {
+    $this->update_strings();
+  }
+
+
+  function update_strings()
+  {
+    $this->s_title      = _("GOsa settings 3/3");
+    $this->s_title_long = _("GOsa settings 3/3");
+    $this->s_info       = _("Tweak some GOsa core behaviour");
+  }
+  
+
+  function execute()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
+    $smarty->assign("optional", $this->optional);
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+    return($smarty -> fetch (get_template_path("../setup/setup_config3.tpl")));
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['step6a_posted'])){
+
+      /* Get attributes */
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = validate(get_post($attr));
+        }
+      }
+      
+      foreach(array("strict_units","noprimarygroup","forceglobals","forcessl","ldapstats","warnssl","compile","debuglevel","session_lifetime") as $name){
+        if(isset($_POST[$name])){
+          $this->optional[$name] = get_post($name);
+        }
+      } 
+
+      if(isset($_POST['ppd_path_active'])){
+        $this->optional['ppd_path_active'] = TRUE;
+        if(isset($_POST['ppd_path'])){
+          $this->optional['ppd_path'] = get_post('ppd_path');
+        }
+      }else{
+        $this->optional['ppd_path_active'] = FALSE;
+      }
+
+      if(isset($_POST['max_ldap_query_time_active'])){
+        $this->optional['max_ldap_query_time_active'] = TRUE;
+        if(isset($_POST['max_ldap_query_time'])){
+          $this->optional['max_ldap_query_time'] = get_post('max_ldap_query_time');
+        }
+      }else{
+        $this->optional['max_ldap_query_time_active'] = FALSE;
+      }
+
+      if(isset($_POST['mailQueueScriptPath_active'])){
+        $this->optional['mailQueueScriptPath_active'] = TRUE;
+        if(isset($_POST['mailQueueScriptPath'])){
+          $this->optional['mailQueueScriptPath'] = get_post('mailQueueScriptPath');
+        }
+      }else{
+        $this->optional['mailQueueScriptPath_active'] = FALSE;
+      }
+
+      if(isset($_POST['kioskpath_active'])){
+        $this->optional['kioskpath_active'] = TRUE;
+        if(isset($_POST['kioskpath'])){
+          $this->optional['kioskpath'] = get_post('kioskpath');
+        }
+      }else{
+        $this->optional['kioskpath_active'] = FALSE;
+      }
+
+      if(isset($_POST['auto_network_hook_active'])){
+        $this->optional['auto_network_hook_active'] = TRUE;
+        if(isset($_POST['auto_network_hook'])){
+          $this->optional['auto_network_hook'] = get_post('auto_network_hook');
+        }
+      }else{
+        $this->optional['auto_network_hook_active'] = FALSE;
+      }
+
+      if(isset($_POST['notifydir_active'])){
+        $this->optional['notifydir_active'] = TRUE;
+        if(isset($_POST['notifydir'])){
+          $this->optional['notifydir'] = get_post('notifydir');
+        }
+      }else{
+        $this->optional['notifydir_active'] = FALSE;
+      }
+    }
+
+    $tmp = $this->check();
+    if(count($tmp) == 0){
+      $this->is_completed = TRUE;
+    }else{
+      $this->is_completed = FALSE;
+    }
+  }
+
+
+  function check()
+  {
+    $message = array();
+
+    if(!is_numeric( $this->optional['session_lifetime'])){
+      $message[] = _("Session lifetime must be a numeric value.");
+    }
+
+    if(!is_numeric( $this->optional['max_ldap_query_time'])){
+      $message[] = _("Maximal ldap query time must be a numeric value. ");
+    }
+  
+    return($message);
+  }
+  
+
+  /* Attributes that are interesting for configuration generation */
+  function get_attributes()
+  {
+    $tmp = setup_step::get_attributes();
+    foreach(array("optional") as $attr){
+      $tmp[$attr]= $this->$attr;
+    }
+    return($tmp);
+  }
+
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_Feedback.inc b/setup/class_setupStep_Feedback.inc
new file mode 100644 (file)
index 0000000..fd6e394
--- /dev/null
@@ -0,0 +1,274 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+class Step_Feedback  extends setup_step
+{
+  var $languages      = array();
+  var $header_image   = "images/welcome.png";
+
+  var $organization       = "";
+  var $eMail              = "";
+  var $name               = "";
+  var $subscribe          = FALSE;
+  var $use_gosa_announce  = FALSE;
+
+  var $feedback_url         = "http://oss.gonicus.de/gosa-feedback/";
+  var $get_started          = TRUE;
+  var $problems_encountered = "";
+  
+  var $first_use            = TRUE;
+  var $use_since            = "";
+
+  var $distribution         = "";
+  var $web_server           = "";
+  var $php_version          = "";
+
+  var $ldap_server          = "";
+  var $object_count         = "";
+    
+  var $want_to_see_next     = "";
+
+  var $features_used        = array();  
+  var $initialized          = FALSE; 
+
+  var $attributes = array("organization","eMail","name","subscribe","use_gosa_announce","get_started","problems_encountered","features_used",
+                          "first_use","use_since","distribution","web_server","php_version","ldap_server","object_count","want_to_see_next");
+  
+
+  function Step_Feedback()
+  {
+    $this->is_enabled     = TRUE;
+    $this->is_active      = TRUE;
+    $this->update_strings(); 
+  }
+
+
+  function init()
+  {
+    $cv = $this->parent->captured_values;
+
+    /* Initialize values */
+    $this->use_since      = date("Y");
+    $this->organization   = preg_replace("/^[^=]*+=(.*),.*$/","\\1",$cv['base']);
+    $this->distribution   = "";
+    $this->web_server     = $_SERVER['SERVER_SOFTWARE'];
+    $this->php_version    = PHP_VERSION;
+
+    /* On first call check for rid/sid base */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+    $ldap->cd($cv['base']);
+    $ldap->search("(objectClass=*)",array("dn"));
+    $this->object_count=$ldap->count();
+
+    /* Preselect used features */
+    $oc = $ldap->get_objectclasses();
+    $this->features_used                = array();
+    $this->features_used['posix']       = array("USED" => isset($oc['posixAccount']) , 
+                                                "NAME" => _("UNIX accounts/groups"));
+    $this->features_used['samba']       = array("USED" => isset($oc['sambaSamAccount']) || isset($oc['sambaAccount']) , 
+                                                "NAME" => _("Samba management"));
+    $this->features_used['mail']        = array("USED" => $cv['mail']  != "none", 
+                                                "NAME" => _("Mailsystem management"));
+    $this->features_used['fax']         = array("USED" => isset($oc['goFaxAccount']) , 
+                                                "NAME" => _("FAX system administration"));
+    $this->features_used['asterisk']    = array("USED" => isset($oc['goFonAccount']), 
+                                                "NAME" => _("Asterisk administration"));
+    $this->features_used['inventory']   = array("USED" => isset($oc['glpiAccount']) , 
+                                                "NAME" => _("System inventory"));
+    $this->features_used['system']      = array("USED" => FALSE , 
+                                                "NAME" => _("System-/Configmanagement"));
+    $this->features_used['addressbook'] = array("USED" => FALSE , 
+                                                "NAME" => _("Addressbook"));
+  }
+
+
+  function update_strings()
+  {
+    $this->s_title      = _("Notification and feedback");
+    $this->s_info       = _("Get notifications or send feedback");
+    $this->s_title_long = _("Notification and feedback");
+  }
+
+  
+  function execute()
+  {
+    if(!$this->initialized){
+      $this->initialized = TRUE;
+      $this->init();
+    }
+
+    $additional_info ="";
+
+    if(isset($_POST['send_feedback'])){
+
+      $msgs = $this->check_feedback();
+      if(count($msgs)){
+        foreach($msgs as $msg){
+          print_red($msg);
+        }
+      }else{
+        $str = $this->create_serialise_data_string(); 
+        $feedback_url = $this->feedback_url."?data=".base64_encode($str);
+
+        $ret = @fopen($feedback_url,"r");
+
+        if(!$ret){
+          print_red(sprintf(_("Could not connect to feedback server (%s). There is possibly no connection to the internet."),$this->feedback_url));
+        }else{
+          $ret_value="";
+          while($ret && !feof($ret)){
+            $ret_value.= fgets($ret,256);
+          }
+          if(!preg_match("/successful/i",$ret_value)){
+            print_red(_("Error while sending your feedback. The service is possible temporary unavailable"));
+          }else{
+            $additional_info = "<font color='green'>"._("Feedback sucessfully send")."</font>";
+          }
+        }
+        @fclose($ret);
+      }
+    }
+
+    $years = array();
+    for($i = date("Y") ; $i >= 2001; $i--){
+      $years[$i] = $i;
+    }
+
+    $this->is_completed=TRUE;
+    $smarty = get_smarty();
+
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr, $this->$attr);
+    }
+    $smarty->assign("years",$years);
+    $smarty->assign("features_used",$this->features_used);
+    $smarty->assign("additional_info",$additional_info);
+    $smarty->assign ("must", "<font class=\"must\">*</font>");
+    return($smarty->fetch(get_template_path("setup_feedback.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function check_feedback()
+  {
+    $msgs = array();
+    if(!is_email($this->eMail) || empty($this->eMail)){
+      $msgs[] = _("Please specify a valid email address.");
+    }
+
+    if(!$this->subscribe && !$this->use_gosa_announce){
+      $msgs[] = _("You should have enabled at least one option, to subscribe or send your feedback.");
+    }
+
+    return($msgs);
+  }
+  
+
+  function save_object()
+  {
+    if(isset($_POST['step_feedback'])){
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = get_post($attr);
+        }
+      }
+
+      if(isset($_POST['subscribe'])){
+        $this->subscribe = TRUE;
+      }else{
+        $this->subscribe = FALSE;
+      }
+
+      if(isset($_POST['use_gosa_announce'])){
+        $this->use_gosa_announce = TRUE;
+      }else{
+        $this->use_gosa_announce = FALSE;
+      }
+    
+      foreach($this->features_used as $key => $data){
+        if(isset($_POST['feature_'.$key])){
+          $this->features_used[$key]['USED'] = TRUE;
+        }else{
+          $this->features_used[$key]['USED'] = FALSE;
+        }
+      }
+    }
+  }
+
+
+  function create_serialise_data_string()
+  {
+    $str = "#FEEDBACK ".date("H:i:s d:m:Y");
+    if($this->subscribe){
+
+      $str.= "\n\nSubscribe";
+      $str .= "\nOrganization: ".$this->organization; 
+      $str .= "\nName: ".$this->name;
+      $str .= "\neMail: ".$this->eMail;
+    }
+  
+    if($this->use_gosa_announce){
+
+      $str.= "\n\nFeedback";    
+  
+      if($this->get_started) {
+        $str .= "\nGet started: TRUE";
+      }else{
+        $str .= "\nGet started: FALSE";
+      }
+      $str .= "\nProblems : ".base64_encode($this->problems_encountered);
+
+      if($this->first_use){
+        $str .= "\nFirst use: TRUE";
+      }else{
+        $str .= "\nFirst use: FALSE";
+      }
+      $str .= "\nUsing GOsa since: ".$this->use_since;
+
+      $str .="\nDistribution: ".$this->distribution;
+      $str .="\nWeb Server: ".$this->web_server;
+      $str .="\nPHP_Version: ".$this->php_version;
+      $str .="\nLDAP Server: ".$this->ldap_server;
+      $str .="\nObject count: ".$this->object_count;
+      $str .="\nMissing features: ".base64_encode($this->want_to_see_next);
+    }
+
+    $str .= "\n\nFeatures used";
+    foreach($this->features_used as $name => $data){
+      $str.="\n".$name.": ";
+      if($data['USED']){
+        $str .= "TRUE";
+      }else{
+        $str .= "FALSE";
+      }
+    }
+
+    return($str);  
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_Finish.inc b/setup/class_setupStep_Finish.inc
new file mode 100644 (file)
index 0000000..3898c55
--- /dev/null
@@ -0,0 +1,143 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+ */
+
+
+class Step_Finish extends setup_step
+{
+  var $gosa_conf_contrib   = "/gosa.conf";
+  var $cfg_file_written = FALSE;
+  var $header_image= 'images/ldapserver.png';
+
+  function Step_Finish()
+  {
+    $this->update_strings();
+  }
+
+  
+  function update_strings()
+  {
+    $this->s_title      = _("Finish");
+    $this->s_info       = _("Write configuration file");
+    $this->s_title_long = _("Finish - write the configuration file");
+  }
+
+
+  function get_conf_data()
+  {
+    $smarty = get_smarty();
+    $smarty->assign("cv",$this->parent->captured_values);
+    $str =  $smarty->fetch(CONFIG_TEMPLATE_DIR.$this->gosa_conf_contrib);
+    return($str);
+  }  
+
+
+  function execute()
+  {
+
+    $info= posix_getgrgid(posix_getgid());
+    $webgroup = $info['name'];
+      
+    
+    /* Check if there is currently an active gosa.conf 
+     */
+    $exists = file_exists(CONFIG_DIR."/".CONFIG_FILE); 
+
+    /* Redirect to GOsa login, if : 
+     *   - gosa.conf exists
+     *   - Permisssion are set correctly 
+     */ 
+    if(isset($_POST['next']) && $exists && !$this->is_world_readable(CONFIG_DIR."/".CONFIG_FILE)){
+      session_destroy();
+      header("Location: index.php");
+      exit();
+    }
+
+    /* Downlaod config */
+    if(isset($_POST['getconf'])){
+
+      header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+      header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+      header("Cache-Control: no-cache");
+      header("Pragma: no-cache");
+      header("Cache-Control: post-check=0, pre-check=0");
+      header("Content-type: text/plain");
+     
+      if (preg_match('/MSIE 5.5/', $_SERVER['HTTP_USER_AGENT']) ||
+          preg_match('/MSIE 6.0/', $_SERVER['HTTP_USER_AGENT'])){
+        header('Content-Disposition: filename="'.CONFIG_FILE.'"');
+      } else {
+        header('Content-Disposition: attachment; filename="'.CONFIG_FILE.'"');
+      }
+
+      $str = $this->get_conf_data();
+      $str = preg_replace("/\n[ ]*\n/","",$str);
+
+      echo $this->get_conf_data();
+      exit();
+    }
+   
+    $err_msg= "";
+    
+    if($exists && $this->is_world_readable(CONFIG_DIR."/".CONFIG_FILE)){
+      $err_msg = _("Your configuration file is currently world readable. Please updated the file permissions!");
+    }elseif(!$exists){
+      $err_msg = _("The configuration is currently not readable or it does not exists.");
+    }
+
+    $smarty = get_smarty();
+    $smarty->assign("err_msg",$err_msg);
+    $smarty->assign("webgroup", $webgroup);
+    $smarty->assign("CONFIG_DIR",CONFIG_DIR);
+    $smarty->assign("CONFIG_FILE" , CONFIG_FILE);
+
+    $smarty->assign("msg2", sprintf(_("After downloading and placing the file under %s, please make sure that the user the webserver is running with is able to read %s, while other users shouldn't. You may want to execute these commands to achieve this requirement:"),CONFIG_DIR,CONFIG_FILE));
+
+    $smarty->assign("cv",$this->parent->captured_values);
+    return($smarty -> fetch (get_template_path("../setup/setup_finish.tpl")));
+  }
+
+
+  /* check if given file is world readable */
+  function is_world_readable($file)
+  {
+    clearstatcache();
+    $p = fileperms($file);
+    $w_r = (decbin($p & 4) == TRUE);
+    return($w_r);
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['step8_posted'])){
+
+      /* Get attributes */
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = validate($_POST[$attr]);
+        }
+      }
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_Language.inc b/setup/class_setupStep_Language.inc
new file mode 100644 (file)
index 0000000..76106eb
--- /dev/null
@@ -0,0 +1,76 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+class Step_Language extends setup_step
+{
+  var $lang_selected  = "";       /* Language selected from select box  */
+  var $lang           = "en_EN";  /* Detected language */
+  var $languages      = array();
+  var $attributes     = array("lang","lang_selected");
+  var $header_image   = "images/locale.png";
+
+  function Step_Language()
+  {
+    $this->lang           = get_browser_language();
+    $this->lang_selected  = "";
+    $this->update_strings(); 
+  }
+
+  function update_strings()
+  {
+    $this->s_title      = _("Language setup");
+    $this->s_title_long = _("Language setup");
+    $this->s_info       = _("This step allows you to select your preferred language.");
+  }
+  
+  function execute()
+  {
+    $this->languages = array(""      => _("Automatic"),
+                             "de_DE" => _("German"),
+                             "fr_FR" => _("French"),
+                             "en_EN" => _("English"),
+                             "ru_RU" => _("Russian"));
+    asort($this->languages);
+    $smarty = get_smarty();
+    $smarty->assign("languages",    $this->languages);
+    $smarty->assign("lang",         $this->lang);
+    $smarty->assign("lang_selected",$this->lang_selected);
+    return($smarty->fetch(get_template_path("setup_language.tpl",TRUE,dirname(__FILE__))));
+  }
+
+  function save_object()
+  {
+    if((isset($_POST['lang_selected'])) && isset($this->languages[$_POST['lang_selected']])) {
+      $this->lang_selected = $_POST['lang_selected'];
+      $this->is_completed = TRUE;
+
+      if($this->lang_selected != ""){
+        $_SESSION['lang'] = $this->lang_selected;
+      }else{
+        $_SESSION['lang'] = $this->lang;
+      }
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_Ldap.inc b/setup/class_setupStep_Ldap.inc
new file mode 100644 (file)
index 0000000..c982eec
--- /dev/null
@@ -0,0 +1,192 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+class Step_Ldap extends setup_step
+{
+  var $connection = "ldap://localhost:389";
+  var $location   = "default";
+  var $admin      = "";
+  var $password   = "";
+  var $base       = "";
+  var $append_base_to_admin_dn = FALSE;
+  var $admin_given = "";
+
+  var $connect_id = FALSE;
+  var $bind_id    = FALSE;
+
+  var $resolve_filter = "*";
+  var $resolve_user   = FALSE;
+  var $tls            = FALSE;
+
+  var $rfc2307bis             = FALSE;
+  var $attributes = array("connection","location","admin","password","base","admin_given","append_base_to_admin_dn","tls","rfc2307bis");
+
+  var $header_image= "images/proxy.png";
+
+  function Step_Ldap()
+  {
+    $this->update_strings();
+  }
+
+  
+  function update_strings()
+  {
+    $this->s_title      = _("LDAP setup");
+    $this->s_title_long = _("LDAP connection setup");
+    $this->s_info       = _("This dialog performs the basic configuration of the LDAP connectivity for GOsa.");
+  }
+  
+  
+  function execute()
+  {
+    $smarty = get_smarty();
+    foreach($this->attributes as $attr){
+      $smarty->assign($attr,$this->$attr);
+    }
+
+    /* Assign connection status */
+    $smarty->assign("connection_status",$this->get_connection_status());
+
+    /* Handle namingContext detection */
+    $attr = @LDAP::get_naming_contexts($this->connection);
+    unset($attr['count']);
+    $smarty->assign("namingContexts",$attr);
+    $smarty->assign("namingContextsCount",count($attr));
+    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
+
+    /* Addign resolved users */
+    $smarty->assign("resolve_user",$this->resolve_user);
+    if($this->resolve_user){
+      $tmp = $this->resolve_user();
+      $smarty->assign("resolved_users",$tmp);
+      $smarty->assign("resolved_users_count",count($tmp));
+      $smarty->assign("resolve_filter",$this->resolve_filter);
+    }
+    return($smarty -> fetch (get_template_path("../setup/setup_ldap.tpl")));
+  }
+
+  function get_connection_status()
+  {
+    $this->connect_id = FALSE;
+    $this->bind_id    = FALSE;
+
+    @ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, 7);
+    $this->connect_id = @ldap_connect($this->connection);
+      
+    @ldap_set_option($this->connect_id, LDAP_OPT_PROTOCOL_VERSION, 3);
+    $this->bind_id = @ldap_bind($this->connect_id, $this->admin, $this->password);
+    
+    if(!$this->bind_id){
+      $str = sprintf(_("Anonymous bind failed on server '%s'."),$this->connection); 
+      if(!empty($this->admin)){
+        $str = sprintf(_("Bind as user '%s' failed on server '%s'."),$this->admin,$this->connection);
+      }      
+      return("<font color='red'>".$str."</font>");
+    }else{
+      if(empty($this->admin)){
+        $str = sprintf(_("Anonymous bind on server '%s' succeeded."), $this->connection);
+        return("<font color='blue'>".$str."</font> <font color='red'>"._("Please specify user and password.")."</font>");
+      }else{
+        $str = sprintf(_("Bind as user '%s' on server '%s' succeeded."),$this->admin,$this->connection);
+        return("<font color='green'>".$str."</font>");
+      }      
+    }
+  }
+
+  
+  function resolve_user()
+  {
+    $filter  = $this->resolve_filter;
+    $ldap = new LDAP("","",$this->connection);
+    $ldap->cd($this->base);
+    $ldap->search("(&(objectClass=person)(|(uid=".$filter.")(cn=".$filter.")))");
+    $tmp = array();
+    while($attrs = $ldap->fetch()){
+      $tmp[base64_encode($attrs['dn'])]= @LDAP::fix($attrs['dn']);
+      natcasesort($tmp);
+    }
+    return($tmp);
+  }   
+
+
+  function save_object()
+  {
+    foreach($this->attributes as $attr){
+      if(isset($_POST[$attr])){
+
+        if(in_array($attr,array("base","connection")) && $this->$attr != get_post($attr)){
+          $this->parent->disable_steps_from($this->parent->step_name_to_id(get_class($this)));
+        }
+        $this->$attr = get_post($attr);
+      }
+    }
+
+    if(isset($_POST['resolve_user_x'])){
+      $this->resolve_user = !$this->resolve_user;
+    }
+    if(isset($_POST['resolve_user'])){
+      $this->resolve_user = !$this->resolve_user;
+    }
+  
+    /* Hide backward forward button*/
+    $this->dialog = $this->resolve_user;
+    if(isset($_POST['resolve_filter'])){
+      $this->resolve_filter = get_post('resolve_filter');
+    }
+
+    if(isset($_POST['use_selected_user'])){
+
+      if(isset($_POST['admin_to_use'])){
+        $this->admin = base64_decode(get_post('admin_to_use'));
+        $this->resolve_user = false;
+      }
+    }
+
+    if(isset($_POST['append_base_to_admin_dn'])){
+      $this->append_base_to_admin_dn = TRUE;
+    }else{
+      $this->append_base_to_admin_dn = FALSE;
+    }
+    if($this->append_base_to_admin_dn){
+      $base = $this->base;      
+      if(!preg_match("/,$/",$this->admin_given)){
+        $base = ",".$base;
+      }
+      $this->admin = $this->admin_given.$base;
+    }else{
+      $this->admin = $this->admin_given;
+    }
+
+    $this->get_connection_status();
+    if($this->bind_id && !empty($this->admin) && !empty($this->base)){
+      $this->is_completed =TRUE;
+    }else{
+      $this->is_completed =FALSE;
+    }
+
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_License.inc b/setup/class_setupStep_License.inc
new file mode 100644 (file)
index 0000000..0ed29d9
--- /dev/null
@@ -0,0 +1,82 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+class Step_License extends setup_step
+{
+  var $license_found  = false;
+  var $License        = "";
+  var $header_image   = "images/ldif.png";
+
+  function Step_License()
+  {
+    $this->update_strings();
+  }
+
+  
+  function load_license()
+  {
+    if(!file_exists("../setup/license.txt")){
+      $this->License = "<font color='red'>License not found. Setup stops here.</font>";
+      $this->license_found = false;
+    }else{
+      $fp = fopen("../setup/license.txt","r");
+      $this->License = "";
+      while (!feof($fp)){
+        $this->License .= fread($fp, 255);
+      }
+      $this->license_found = true;
+    }
+  }
+
+
+  function update_strings()
+  {
+    $this->s_title      = _("License");
+    $this->s_title_long = _("License");
+    $this->s_info       = _("Terms and conditions for usage");
+  }
+
+  function execute()
+  {
+    $this->load_license();
+
+    $smarty = get_smarty();
+    $smarty -> assign("License",nl2br($this->License));
+    $smarty -> assign("license_found",$this->license_found);
+
+    return($smarty -> fetch (get_template_path("../setup/setup_license.tpl")));
+  }
+
+  
+  function save_object()
+  {
+    if($this->license_found){
+      $this->is_completed = true;
+    }else{
+      $this->is_completed = false;
+    }
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_Migrate.inc b/setup/class_setupStep_Migrate.inc
new file mode 100644 (file)
index 0000000..8354a76
--- /dev/null
@@ -0,0 +1,1805 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+ */
+
+
+
+/****************
+ * FUNCTIONS 
+
+Step_Migrate                - Constructor.
+update_strings              - Used to update the displayed step informations.
+initialize_checks           - Initialize migration steps.
+check_ldap_permissions      - Check if the used admin account has full access to the ldap database.
+check_gosaAccounts          - Check if there are users without the required objectClasses.
+migrate_gosaAccounts        - Migrate selected users to GOsa user accounts.
+check_organizationalUnits   - Check if there are departments, that are not visible for GOsa
+migrate_organizationalUnits - Migrate selected departments 
+check_administrativeAccount - Check if there is at least one acl entry available                  
+checkBase                   - Check if there is a root object available 
+
+get_user_list               - Get list of available users
+get_group_list              - Get list of groups
+  
+create_admin                
+create_admin_user           
+
+execute                     - Generate html output of this plugin
+save_object                 - Save posts 
+array_to_ldif               - Create ldif output of an ldap result array 
+ ****************/
+
+
+
+class Step_Migrate extends setup_step
+{
+  var $languages      = array();
+  var $attributes     = array();
+  var $header_image   = "images/monitoring.png";
+  var $checks         = array();
+
+  /* Department migration attributes */
+  var $dep_migration_dialog = FALSE;
+  var $deps_to_migrate      = array();
+  var $show_details         = FALSE;
+
+  /* Department migration attributes */
+  var $users_migration_dialog= FALSE;
+  var $users_to_migrate      = array();
+
+  /* Create Acl attributes */
+  var $acl_create_dialog  = FALSE;
+  var $acl_create_type    = "group";
+  var $acl_create_selected= ""; // Currently selected element, that should receive admin rights 
+  var $acl_create_changes = ""; // Contains ldif information about changes 
+  var $acl_create_confirmed= FALSE;
+
+  /* Checks initialised ? */
+  var $checks_initialised = FALSE;
+
+  /* Users outside to people ou */
+  var $outside_users        = array();
+  var $outside_users_dialog = FALSE;
+
+  /* Users outside to groups ou */
+  var $outside_groups        = array();
+  var $outside_groups_dialog = FALSE;
+
+  /* Win-Workstations outside to reserved ou */
+  var $outside_winstations        = array();
+  var $outside_winstations_dialog = FALSE;
+
+  /* check for multiple use of same uidNumber */
+  var $check_uidNumbers        = array();
+  var $check_uidNumbers_dialog = FALSE;
+
+  /* check for multiple use of same gidNumber */
+  var $check_gidNumbers        = array();
+  var $check_gidNumbers_dialog = FALSE;
+
+
+  function Step_Migrate()
+  {
+    $this->update_strings(); 
+  }
+
+  function update_strings()
+  {
+    $this->s_title      = _("LDAP inspection");
+    $this->s_title_long = _("LDAP inspection");
+    $this->s_info       = _("Analyze your current LDAP for GOsa compatibility");
+  }
+
+  function initialize_checks()
+  {
+    $this->checks = array();
+    $this->checks['root']['TITLE']     = _("Checking for root object");
+    $this->checks['root']['STATUS']    = FALSE;
+    $this->checks['root']['STATUS_MSG']= "";
+    $this->checks['root']['ERROR_MSG'] = "";
+    $this->checkBase();
+
+    $this->checks['permissions']['TITLE']     = _("Checking permissions on LDAP database");
+    $this->checks['permissions']['STATUS']    = FALSE;
+    $this->checks['permissions']['STATUS_MSG']= "";
+    $this->checks['permissions']['ERROR_MSG'] = "";
+    $this->check_ldap_permissions();
+
+    $this->checks['deps_visible']['TITLE']     = _("Checking for invisible deparmtments");
+    $this->checks['deps_visible']['STATUS']    = FALSE;
+    $this->checks['deps_visible']['STATUS_MSG']= "";
+    $this->checks['deps_visible']['ERROR_MSG'] = "";
+    $this->check_organizationalUnits();
+
+    $this->checks['users_visible']['TITLE']     = _("Checking for invisible users");
+    $this->checks['users_visible']['STATUS']    = FALSE;
+    $this->checks['users_visible']['STATUS_MSG']= "";
+    $this->checks['users_visible']['ERROR_MSG'] = "";
+    $this->check_gosaAccounts();
+
+    $this->checks['acls']['TITLE']     = _("Checking for super administrator");
+    $this->checks['acls']['STATUS']    = FALSE;
+    $this->checks['acls']['STATUS_MSG']= "";
+    $this->checks['acls']['ERROR_MSG'] = "";
+    $this->check_administrativeAccount();
+
+    $this->checks['outside_users']['TITLE']     = _("Checking for users outside the people tree");
+    $this->checks['outside_users']['STATUS']    = FALSE;
+    $this->checks['outside_users']['STATUS_MSG']= "";
+    $this->checks['outside_users']['ERROR_MSG'] = "";
+    $this->search_outside_users();
+    
+    $this->checks['outside_groups']['TITLE']     = _("Checking for groups outside the groups tree");
+    $this->checks['outside_groups']['STATUS']    = FALSE;
+    $this->checks['outside_groups']['STATUS_MSG']= "";
+    $this->checks['outside_groups']['ERROR_MSG'] = "";
+    $this->search_outside_groups();
+
+    $this->checks['outside_winstations']['TITLE']     = _("Checking for windows workstations outside the winstation tree");
+    $this->checks['outside_winstations']['STATUS']    = FALSE;
+    $this->checks['outside_winstations']['STATUS_MSG']= "";
+    $this->checks['outside_winstations']['ERROR_MSG'] = "";
+    $this->search_outside_winstations();
+
+    $this->checks['uidNumber_usage']['TITLE']     = _("Checking for duplicate uid numbers");
+    $this->checks['uidNumber_usage']['STATUS']    = FALSE;
+    $this->checks['uidNumber_usage']['STATUS_MSG']= "";
+    $this->checks['uidNumber_usage']['ERROR_MSG'] = "";
+    $this->check_uidNumber();
+    
+    $this->checks['gidNumber_usage']['TITLE']     = _("Checking for duplicate gid numbers");
+    $this->checks['gidNumber_usage']['STATUS']    = FALSE;
+    $this->checks['gidNumber_usage']['STATUS_MSG']= "";
+    $this->checks['gidNumber_usage']['ERROR_MSG'] = "";
+    $this->check_gidNumber();
+  }
+
+
+  /* Check if there are uidNumbers which are used more than once. 
+   */
+  function check_uidNumber()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+    $res = $ldap->search("uidNumber=*",array("dn","uidNumber"));
+    if(!$res){
+      $this->checks['uidNumber_usage']['STATUS']    = FALSE;
+      $this->checks['uidNumber_usage']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['uidNumber_usage']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+
+    $this->check_uidNumbers= array(); 
+    $tmp = array();
+    while($attrs = $ldap->fetch()){
+      $tmp[$attrs['uidNumber'][0]][] = $attrs;
+    }
+
+    foreach($tmp as $id => $entries){
+      if(count($entries) > 1){
+        foreach($entries as $entry){
+          $this->check_uidNumbers[base64_encode($entry['dn'])] = $entry;
+        }
+      }
+    }
+
+    if($this->check_uidNumbers){
+      $this->checks['uidNumber_usage']['STATUS']    = FALSE;
+      $this->checks['uidNumber_usage']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+      $this->checks['uidNumber_usage']['ERROR_MSG'] =
+        sprintf(_("Found %s duplicate values for attribute 'uidNumber'."),count($this->check_uidNumbers));
+      return(false);
+    }else{
+      $this->checks['uidNumber_usage']['STATUS']    = TRUE;
+      $this->checks['uidNumber_usage']['STATUS_MSG']= _("Ok");
+      $this->checks['uidNumber_usage']['ERROR_MSG'] = "";
+      return(TRUE);
+    }
+  }
+
+  
+  /* Check if there are duplicated gidNumbers present in ldap
+   */
+  function check_gidNumber()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+    $res = $ldap->search("(&(objectClass=posixGroup)(gidNumber=*))",array("dn","gidNumber"));
+    if(!$res){
+      $this->checks['gidNumber_usage']['STATUS']    = FALSE;
+      $this->checks['gidNumber_usage']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['gidNumber_usage']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+
+    $this->check_gidNumbers= array(); 
+    $tmp = array();
+    while($attrs = $ldap->fetch()){
+      $tmp[$attrs['gidNumber'][0]][] = $attrs;
+    }
+
+    foreach($tmp as $id => $entries){
+      if(count($entries) > 1){
+        foreach($entries as $entry){
+          $this->check_gidNumbers[base64_encode($entry['dn'])] = $entry;
+        }
+      }
+    }
+
+    if($this->check_gidNumbers){
+      $this->checks['gidNumber_usage']['STATUS']    = FALSE;
+      $this->checks['gidNumber_usage']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+      $this->checks['gidNumber_usage']['ERROR_MSG'] =
+        sprintf(_("Found %s duplicate values for attribute 'gidNumber'."),count($this->check_gidNumbers));
+      return(false);
+    }else{
+      $this->checks['gidNumber_usage']['STATUS']    = TRUE;
+      $this->checks['gidNumber_usage']['STATUS_MSG']= _("Ok");
+      $this->checks['gidNumber_usage']['ERROR_MSG'] = "";
+      return(TRUE);
+    }
+  }
+
+
+  /* Search for winstations outside the winstation ou 
+   */
+  function search_outside_winstations()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Get winstation ou */
+    if($cv['generic_settings']['wws_ou_active']) {
+      $winstation_ou = $cv['generic_settings']['ws_ou'];
+    }else{
+      $winstation_ou = "ou=winstations";
+    }
+
+    if($cv['samba_version'] == 3){
+      $oc = "sambaSamAccount";
+    }else{
+      $oc = "sambaAccount";
+    }
+    $ldap->cd($cv['base']);
+    $res = $ldap->search("(&(objectClass=".$oc.")(uid=*$))",array("dn","sambaSID"));
+    if(!$res){
+      $this->checks['outside_winstations']['STATUS']    = FALSE;
+      $this->checks['outside_winstations']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['outside_winstations']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+
+    $this->outside_winstations = array();
+    while($attrs = $ldap->fetch()){
+      if((!preg_match("/^[^,]+,".normalizePreg($winstation_ou)."/",$attrs['dn'])) && !preg_match("/,dc=addressbook,/",$attrs['dn'])){
+        $attrs['selected'] = FALSE;
+        $attrs['ldif']     = "";
+        $this->outside_winstations[base64_encode($attrs['dn'])] = $attrs;
+      }
+    }
+
+    if(count($this->outside_winstations)){
+      $this->checks['outside_winstations']['STATUS']    = FALSE;
+      $this->checks['outside_winstations']['STATUS_MSG']= _("Failed");
+      $this->checks['outside_winstations']['ERROR_MSG'] = 
+        sprintf(_("Found %s winstations outside the predefined winstation department ou '%s'."),count($this->outside_winstations),$winstation_ou);
+      $this->checks['outside_winstations']['ERROR_MSG'].= "<input type='submit' name='outside_winstations_dialog' value='"._("Migrate")."...'>";
+      return(false);
+    }else{
+      $this->checks['outside_winstations']['STATUS']    = TRUE;
+      $this->checks['outside_winstations']['STATUS_MSG']= _("Ok");
+      $this->checks['outside_winstations']['ERROR_MSG'] = "";
+      return(TRUE);
+    }
+  }
+
+
+  /* Search for groups outside the group ou 
+   */
+  function search_outside_groups()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $group_ou = $cv['groupou'];
+    $ldap->cd($cv['base']);
+    $res = $ldap->search("(objectClass=posixGroup)",array("dn"));
+    if(!$res){
+      $this->checks['outside_groups']['STATUS']    = FALSE;
+      $this->checks['outside_groups']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['outside_groups']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+
+
+    $this->outside_groups = array();
+    while($attrs = $ldap->fetch()){
+      if((!preg_match("/^[^,]+,".normalizePreg($group_ou)."/",$attrs['dn'])) && !preg_match("/,dc=addressbook,/",$attrs['dn'])){
+        $attrs['selected'] = FALSE;
+        $attrs['ldif']     = "";
+        $this->outside_groups[base64_encode($attrs['dn'])] = $attrs;
+      }
+    }
+
+    if(count($this->outside_groups)){
+      $this->checks['outside_groups']['STATUS']    = FALSE;
+      $this->checks['outside_groups']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+      $this->checks['outside_groups']['ERROR_MSG'] = 
+        sprintf(_("Found %s groups outside the configured tree '%s'."),count($this->outside_groups),$group_ou);
+      $this->checks['outside_groups']['ERROR_MSG'].= "&nbsp;<input type='submit' name='outside_groups_dialog' value='"._("Move")."...'>";
+      return(false);
+    }else{
+      $this->checks['outside_groups']['STATUS']    = TRUE;
+      $this->checks['outside_groups']['STATUS_MSG']= _("Ok");
+      $this->checks['outside_groups']['ERROR_MSG'] = "";
+      return(TRUE);
+    }
+  }
+
+
+  /* Search for users outside the people ou 
+   */
+  function search_outside_users()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+    $people_ou = $cv['peopleou'];
+    $ldap->cd($cv['base']);
+    $res = $ldap->search("(&(objectClass=gosaAccount)(!(uid=*$)))",array("dn"));
+    if(!$res){
+      $this->checks['outside_users']['STATUS']    = FALSE;
+      $this->checks['outside_users']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['outside_users']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+
+
+    $this->outside_users = array();
+    while($attrs = $ldap->fetch()){
+      if((!preg_match("/^[^,]+,".normalizePreg($people_ou)."/",$attrs['dn'])  && !preg_match("/,dc=addressbook,/",$attrs['dn']))){
+        $attrs['selected'] = FALSE;
+        $attrs['ldif']     = "";
+        $this->outside_users[base64_encode($attrs['dn'])] = $attrs;
+      }
+    }
+
+    if(count($this->outside_users)){
+      $this->checks['outside_users']['STATUS']    = FALSE;
+      $this->checks['outside_users']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+      $this->checks['outside_users']['ERROR_MSG'] = 
+        sprintf(_("Found %s user(s) outside the configured tree '%s'."),count($this->outside_users),$people_ou);
+      $this->checks['outside_users']['ERROR_MSG'].= "<input type='submit' name='outside_users_dialog' value='"._("Move")."...'>";
+      return(false);
+    }else{
+      $this->checks['outside_users']['STATUS']    = TRUE;
+      $this->checks['outside_users']['STATUS_MSG']= _("Ok");
+      $this->checks['outside_users']['ERROR_MSG'] = "";
+      return(TRUE);
+    }
+  }
+
+
+  /* Check ldap accessibility 
+   * Create and remove a dummy object, 
+   *  to ensure that we have the necessary permissions
+   */
+  function check_ldap_permissions()
+  {
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Create dummy entry 
+     */
+    $name     = "GOsa_setup_text_entry_".session_id().rand(0,999999);
+    $dn       = "ou=".$name.",".$cv['base'];
+    $testEntry= array();
+    $testEntry['objectClass'][]= "top";
+    $testEntry['objectClass'][]= "organizationalUnit";
+    $testEntry['objectClass'][]= "gosaDepartment";
+    $testEntry['description']= "Created by GOsa setup, this object can be removed.";
+    $testEntry['ou']  = $name;
+
+    /* check if simple ldap cat will be successful 
+     */
+    $res = $ldap->cat($cv['base']);  
+    if(!$res){
+      $this->checks['permissions']['STATUS']    = FALSE;
+      $this->checks['permissions']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['permissions']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+      return(false);
+    }
+  
+    /* Try to create dummy object 
+     */ 
+    $ldap->cd ($dn);
+    $ldap->create_missing_trees($dn);
+    $res = $ldap->add($testEntry);
+    $ldap->cat($dn);
+    if(!$ldap->count()){
+      gosa_log($ldap->get_error());
+      $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']);
+      return(false);
+    }
+
+    /* Try to remove created entry 
+     */
+    $res = $ldap->rmDir($dn);
+    $ldap->cat($dn);
+    if($ldap->count()){
+      gosa_log($ldap->get_error());
+      $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']);
+      return(false);
+    }
+
+    /* Create & remove of dummy object was successful */
+    $this->checks['permissions']['STATUS']    = TRUE;
+    $this->checks['permissions']['STATUS_MSG']= _("Ok");
+    $this->checks['permissions']['ERROR_MSG'] = "";
+    return(true);
+  } 
+
+
+  /* Check if there are users which will 
+   *  be invisible for GOsa 
+   */
+  function check_gosaAccounts()
+  {
+    /* Remember old list of ivisible users, to be able to set 
+     *  the 'html checked' status for the checkboxes again 
+     */
+    $cnt_ok = 0;
+    $old    = $this->users_to_migrate;
+    $this->users_to_migrate = array();
+
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Get all invisible users 
+     */
+    $ldap->cd($cv['base']); 
+    $res =$ldap->search("(&(|(objectClass=posixAccount)(&(objectClass=inetOrgPerson)(objectClass=organizationalPerson)))(!(objectClass=gosaAccount))(uid=*))",array("sn","givenName","cn","uid"));
+    while($attrs = $ldap->fetch()){
+      if(!preg_match("/,dc=addressbook,/",$attrs['dn'])){
+        $attrs['checked'] = FALSE;
+        $attrs['before']  = "";
+        $attrs['after']   = "";
+
+        /* Set objects to selected, that were selected before reload */
+        if(isset($old[base64_encode($attrs['dn'])])){
+          $attrs['checked'] = $old[base64_encode($attrs['dn'])]['checked'];
+        }
+        $this->users_to_migrate[base64_encode($attrs['dn'])] = $attrs;
+      }
+    }
+
+    /* No invisible */
+    if(!$res){
+      $this->checks['users_visible']['STATUS']    = FALSE;
+      $this->checks['users_visible']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['users_visible']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+    }elseif(count($this->users_to_migrate) == 0){
+      $this->checks['users_visible']['STATUS']    = TRUE;
+      $this->checks['users_visible']['STATUS_MSG']= _("Ok");
+      $this->checks['users_visible']['ERROR_MSG'] = "";
+    }else{
+      $this->checks['users_visible']['STATUS']    = FALSE;
+      $this->checks['users_visible']['STATUS_MSG']= "<font style='color:#F0A500'>"._("Warning")."</font>";
+      $this->checks['users_visible']['ERROR_MSG'] = sprintf(_("Found %s user(s) that will not be visible in GOsa."), 
+          count($this->users_to_migrate));
+      $this->checks['users_visible']['ERROR_MSG'] .= "<input type='submit' name='users_visible_migrate' value='"._("Migrate")."...'>";
+    }
+  }
+
+
+  /* Start user account migration 
+   */  
+  function migrate_gosaAccounts($only_ldif = FALSE)
+  {
+    $this->show_details= $only_ldif;
+
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Add gosaAccount objectClass to the selected users  
+     */
+    foreach($this->users_to_migrate as $key => $dep){
+      if($dep['checked']){
+
+        /* Get old objectClasses */
+        $ldap->cat($dep['dn'],array("objectClass"));
+        $attrs      = $ldap->fetch();
+
+        /* Create new objectClass array */
+        $new_attrs  = array();
+        $new_attrs['objectClass']= array("gosaAccount","inetOrgPerson","organizationalPerson");
+        for($i = 0 ; $i < $attrs['objectClass']['count']; $i ++ ){
+          if(!in_array_ics($attrs['objectClass'][$i], $new_attrs['objectClass'])){
+            $new_attrs['objectClass'][]   = $attrs['objectClass'][$i];
+          }
+        }
+
+        /* Set info attributes for current object, 
+         *  or write changes to the ldap database 
+         */
+        if($only_ldif){
+          $this->users_to_migrate[$key]['before'] = $this->array_to_ldif($attrs);
+          $this->users_to_migrate[$key]['after']  = $this->array_to_ldif($new_attrs);
+        }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()));
+            return(false);
+          }
+        }
+      }
+    }
+    return(TRUE);
+  }
+
+
+  /* Check if there are invisible organizational Units 
+   */
+  function check_organizationalUnits()
+  {
+    $cnt_ok = 0;
+    $old = $this->deps_to_migrate;
+    $this->deps_to_migrate = array();
+
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Skip GOsa internal departments */
+    $skip_dns = array("/^ou=people,/","/^ou=groups,/","/(,|)ou=configs,/","/(,|)ou=systems,/",
+        "/^ou=apps,/","/^ou=mime,/","/^ou=aclroles,/","/^ou=incoming,/",
+        "/ou=snapshots,/","/(,|)dc=addressbook,/","/^(,|)ou=machineaccounts,/",
+        "/(,|)ou=winstations,/");
+
+
+    /* Get all invisible departments */
+    $ldap->cd($cv['base']); 
+    $res = $ldap->search("(&(objectClass=organizationalUnit)(!(objectClass=gosaDepartment)))",array("ou","description","dn"));
+    while($attrs = $ldap->fetch()){
+      $attrs['checked'] = FALSE;
+      $attrs['before']  = "";
+      $attrs['after']   = "";
+
+      /* Set objects to selected, that were selected before reload */
+      if(isset($old[base64_encode($attrs['dn'])])){
+        $attrs['checked'] = $old[base64_encode($attrs['dn'])]['checked'];
+      }
+      $this->deps_to_migrate[base64_encode($attrs['dn'])] = $attrs;
+    }
+
+    /* Filter returned list of departments and ensure that 
+     *  GOsa internal departments will not be listed 
+     */
+    foreach($this->deps_to_migrate as $key => $attrs){
+      $dn = $attrs['dn'];
+      $skip = false;
+      foreach($skip_dns as $skip_dn){
+        if(preg_match($skip_dn,$dn)){
+          $skip = true;
+        }
+      }
+      if($skip){
+        unset($this->deps_to_migrate[$key]);
+      }
+    }
+
+    /* If we have no invisible departments found  
+     *  tell the user that everything is ok 
+     */
+    if(!$res){
+      $this->checks['deps_visible']['STATUS']    = FALSE;
+      $this->checks['deps_visible']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['deps_visible']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+    }elseif(count($this->deps_to_migrate) == 0 ){
+      $this->checks['deps_visible']['STATUS']    = TRUE;
+      $this->checks['deps_visible']['STATUS_MSG']= _("Ok");
+      $this->checks['deps_visible']['ERROR_MSG'] = "";
+    }else{
+      $this->checks['deps_visible']['STATUS']    = TRUE;
+      $this->checks['deps_visible']['STATUS_MSG']= '<font style="color:#FFA500">'._("Warning").'</font>';
+      $this->checks['deps_visible']['ERROR_MSG'] = sprintf(_("Found %s department(s) that will not be visible in GOsa."),count($this->deps_to_migrate));
+      $this->checks['deps_visible']['ERROR_MSG'] .= "&nbsp;<input type='submit' name='deps_visible_migrate' value='"._("Migrate")."...'>";
+    }
+  }
+
+
+
+  /* Start deparmtment migration */  
+  function migrate_organizationalUnits($only_ldif = FALSE)
+  {
+    $this->show_details= $only_ldif;
+
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Add gosaDepartment objectClass to each selected entry 
+     */
+    foreach($this->deps_to_migrate as $key => $dep){
+      if($dep['checked']){
+
+        /* Get current objectClasses */
+        $ldap->cat($dep['dn'],array("objectClass","description"));
+        $attrs      = $ldap->fetch();
+
+        /* Create new objectClass attribute including gosaDepartment*/
+        $new_attrs  = array();
+        for($i = 0 ; $i < $attrs['objectClass']['count']; $i ++ ){
+          $new_attrs['objectClass'][]   = $attrs['objectClass'][$i];
+        }
+        $new_attrs['objectClass'][] = "gosaDepartment";
+
+        /* Append description it is missing */
+        if(!isset($attrs['description'])){
+          $new_attrs['description'][] = "GOsa department";
+        }
+
+        /* Depending on the parameter >only_diff< we save the changes as ldif
+         *  or we write our changes directly to the ldap database
+         */
+        if($only_ldif){
+          $this->deps_to_migrate[$key]['before'] = $this->array_to_ldif($attrs);
+          $this->deps_to_migrate[$key]['after']  = $this->array_to_ldif($new_attrs);
+        }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()));
+            return(false);
+          }
+        }
+      }
+    }
+    return(TRUE);
+  }
+
+
+  /* Check Acls if there is at least one object with acls defined 
+   */
+  function check_administrativeAccount()
+  {
+    /* Establish ldap connection */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Search for gosaAcls */ 
+    $ldap->cd($cv['base']);
+    $res = $ldap->cat($cv['base']);
+    
+    if(!$res){
+      $this->checks['acls']['STATUS']    = FALSE;
+      $this->checks['acls']['STATUS_MSG']= _("LDAP query failed");
+      $this->checks['acls']['ERROR_MSG'] = _("Possibly the 'root object' is missing.");
+    }else{
+      $found = false;
+      $username = "";
+      $attrs = $ldap->fetch();
+      if(isset($attrs['gosaAclEntry'])){
+        $acls = $attrs['gosaAclEntry'];
+        for($i = 0 ; $i < $acls['count'] ; $i++){
+          $acl = $acls[$i];
+          $tmp = split(":",$acl);
+          if($tmp[1] == "psub"){
+            $members = split(",",$tmp[2]);
+            foreach($members as $member){
+              $member = base64_decode($member);
+
+              /* Check if acl owner is a valid GOsa user account */
+              $ldap->cat($member,array("objectClass","uid","cn"));
+              $ret = $ldap->fetch();
+
+              if(isset($ret['objectClass']) && in_array("posixGroup",$ret['objectClass'])){
+                $found = TRUE;
+                $username .= "ACL-Group:&nbsp;".$ret['cn'][0]."<br>";
+              }elseif(isset($ret['objectClass']) && in_array("gosaAccount",$ret['objectClass']) &&
+                  in_array("organizationalPerson",$ret['objectClass']) &&
+                  in_array("inetOrgPerson",$ret['objectClass'])){
+                $found = TRUE;
+                $username .= "ACL:&nbsp;".$ret['uid'][0]."<br>";
+              }
+            }
+          }elseif($tmp[1] == "role"){
+
+            /* Check if acl owner is a valid GOsa user account */
+            $ldap->cat(base64_decode($tmp[2]),array("gosaAclTemplate"));
+            $ret = $ldap->fetch();
+
+            if(isset($ret['gosaAclTemplate'])){
+              $cnt = $ret['gosaAclTemplate']['count'];
+              for($e = 0 ; $e < $cnt ; $e++){
+
+                $a_str = $ret['gosaAclTemplate'][$e];
+                if(preg_match("/^[0-9]*:psub:/",$a_str) && preg_match("/:all;cmdrw$/",$a_str)){
+
+                  $members = split(",",$tmp[3]);
+                  foreach($members as $member){
+                    $member = base64_decode($member);
+
+                    /* Check if acl owner is a valid GOsa user account */
+                    $ldap->cat($member,array("objectClass","uid"));
+                    $ret = $ldap->fetch();
+  
+                    if(isset($ret['objectClass']) && in_array("gosaAccount",$ret['objectClass']) &&
+                        in_array("organizationalPerson",$ret['objectClass']) &&
+                        in_array("inetOrgPerson",$ret['objectClass'])){
+                      $found = TRUE;
+                      $username .= "ACL Role:&nbsp;".$ret['uid'][0]."<br>";
+                    }
+                  }
+                }
+              }
+            }
+          }
+        }
+      }
+
+      # For debugging
+      #echo $username;
+
+      if($found){
+        $this->checks['acls']['STATUS']    = TRUE;
+        $this->checks['acls']['STATUS_MSG']= _("Ok")."&nbsp;";
+        $this->checks['acls']['ERROR_MSG'] = "";
+      }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")."'>";
+      }
+    }
+    return($ldap->count()>=1);
+  }
+
+
+
+  function create_admin($only_ldif = FALSE)
+  {
+    /* Reset '' */
+    $this->acl_create_changes="";
+
+    /* Object that should receive admin acls */
+    $dn = $this->acl_create_selected;
+
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Get current base attributes */
+    $ldap->cd($cv['base']);
+    $ldap->cat($cv['base'],array("dn","objectClass","gosaAclEntry"));
+    $attrs = $ldap->fetch();
+
+    /* Add acls for the selcted user to the base */
+    $attrs_new['objectClass'] = array("gosaACL");
+
+    for($i = 0; $i < $attrs['objectClass']['count']; $i ++){
+      if(!in_array_ics($attrs['objectClass'][$i],$attrs_new['objectClass'])){
+        $attrs_new['objectClass'][] = $attrs['objectClass'][$i];
+      }
+    }
+
+    $acl = "0:psub:".base64_encode($dn).":all;cmdrw";    
+    $attrs_new['gosaAclEntry'][] = $acl;
+    if(isset($attrs['gosaAclEntry'])){
+      for($i = 0 ; $i < $attrs['gosaAclEntry']['count']; $i ++){
+          
+        $prio = preg_replace("/[:].*$/","",$attrs['gosaAclEntry'][$i]);
+        $rest = preg_replace("/^[^:]/","",$attrs['gosaAclEntry'][$i]);
+        $data = ($prio+1).$rest;
+        $attrs_new['gosaAclEntry'][] = $data;
+      }
+    }
+
+    if($only_ldif){
+      $this->acl_create_changes ="\n".$cv['base']."\n";
+      $this->acl_create_changes.=$this->array_to_ldif($attrs)."\n";
+      $this->acl_create_changes.="\n".$cv['base']."\n";
+      $this->acl_create_changes.=$this->array_to_ldif($attrs_new);
+    }else{
+   
+      $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()));
+        return(FALSE);
+      }else{
+        return(TRUE);
+      }
+    }
+  }
+  
+  function create_admin_user()
+  {
+    $pw1 = $pw2 = "";
+
+    if(isset($_POST['new_user_password'])){
+      $pw1 = $_POST['new_user_password'];
+    }
+    if(isset($_POST['new_user_password2'])){
+      $pw2 = $_POST['new_user_password2'];
+    }
+  
+    if(empty($pw1) || empty($pw2) | ($pw1 != $pw2)){
+      print_red(_("Specified passwords are empty or not equal."));
+      return false;
+    }
+    /* Establish ldap connection */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Get current base attributes */
+    $ldap->cd($cv['base']);
+  
+    if($cv['peopledn'] == "cn"){
+      $dn = "cn=System Administrator,".$cv['peopleou'].",".$cv['base'];
+    }else{
+      $dn = "uid=admin,".$cv['peopleou'].",".$cv['base'];
+    }
+
+    $methods = @passwordMethod::get_available_methods_if_not_loaded();
+    $p_m = $methods[$cv['encryption']];
+    $p_c = new $p_m(array());
+    $hash = $p_c->generate_hash($pw2);
+
+    $new_user=array();
+    $new_user['objectClass']= array("top","person","gosaAccount","organizationalPerson","inetOrgPerson");
+    $new_user['givenName']  = "System";
+    $new_user['sn']  = "Administrator";
+    $new_user['cn']  = "System Administrator";
+    $new_user['uid'] = "admin";
+    $new_user['userPassword'] = $hash;
+    
+    $ldap->cd($cv['base']);
+    $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$dn));
+    $ldap->cd($dn);  
+    $res = $ldap->add($new_user);
+    $this->acl_create_selected = $dn;
+    $this->create_admin();
+    
+    if(!$res){
+      print_red($ldap->get_error());
+      return(FALSE);
+    }
+  
+    $this->acl_create_dialog=FALSE;        
+    $this->check_administrativeAccount();
+    return(TRUE);
+  }
+
+  function migrate_outside_winstations($perform = FALSE)
+  {
+    /* Establish ldap connection */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+
+    /* Check if there was a destination department posted */
+    if(isset($_POST['move_winstation_to'])){
+      $destination_dep = $_POST['move_winstation_to'];
+    }else{
+      print_red(_("Couldn't move users to specified department."));
+      return(false);
+    }
+    foreach($this->outside_winstations as $b_dn => $data){
+      $this->outside_winstations[$b_dn]['ldif'] ="";
+      if($data['selected']){
+        $dn = base64_decode($b_dn);
+        $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn);
+        if(!$perform){
+          $this->outside_winstations[$b_dn]['ldif'] = _("Winstation will be moved from").":<br>\t".$dn."<br>"._("to").":<br>\t".$d_dn;
+
+
+          /* Check if there are references to this object */
+          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $refs = "";
+          while($attrs = $ldap->fetch()){
+            $ref_dn = $attrs['dn'];
+            $refs .= "<br />\t".$ref_dn;
+          } 
+          if(!empty($refs)){ 
+            $this->outside_winstations[$b_dn]['ldif'] .= "<br /><br /><i>"._("Updating following references too").":</i>".$refs;
+          }
+
+        }else{
+          $this->move($dn,$d_dn);
+        }
+      }
+    }
+  }
+  
+
+  function migrate_outside_groups($perform = FALSE)
+  {
+    /* Establish ldap connection */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+
+    /* Check if there was a destination department posted */
+    if(isset($_POST['move_group_to'])){
+      $destination_dep = $_POST['move_group_to'];
+    }else{
+      print_red(_("Couldn't move users to specified department."));
+      return(false);
+    }
+    foreach($this->outside_groups as $b_dn => $data){
+      $this->outside_groups[$b_dn]['ldif'] ="";
+      if($data['selected']){
+        $dn = base64_decode($b_dn);
+        $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn);
+        if(!$perform){
+          $this->outside_groups[$b_dn]['ldif'] = _("Group will be moved from").":<br>\t".$dn."<br>"._("to").":<br>\t".$d_dn;
+
+
+          /* Check if there are references to this object */
+          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $refs = "";
+          while($attrs = $ldap->fetch()){
+            $ref_dn = $attrs['dn'];
+            $refs .= "<br />\t".$ref_dn;
+          } 
+          if(!empty($refs)){ 
+            $this->outside_groups[$b_dn]['ldif'] .= "<br /><br /><i>"._("Updating following references too").":</i>".$refs;
+          }
+
+        }else{
+          $this->move($dn,$d_dn);
+        }
+      }
+    }
+  }
+  
+
+  function migrate_outside_users($perform = FALSE)
+  {
+    /* Establish ldap connection */
+    $cv = $this->parent->captured_values;
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+
+    /* Check if there was a destination department posted */
+    if(isset($_POST['move_user_to'])){
+      $destination_dep = $_POST['move_user_to'];
+    }else{
+      print_red(_("Couldn't move users to specified department."));
+      return(false);
+    }
+    foreach($this->outside_users as $b_dn => $data){
+      $this->outside_users[$b_dn]['ldif'] ="";
+      if($data['selected']){
+        $dn = base64_decode($b_dn);
+        $d_dn = preg_replace("/,.*$/",",".base64_decode($destination_dep),$dn);
+        if(!$perform){
+          $this->outside_users[$b_dn]['ldif'] = _("User will be moved from").":<br>\t".$dn."<br>"._("to").":<br>\t".$d_dn;
+
+          /* Check if there are references to this object */
+          $ldap->search("(&(member=".$dn.")(|(objectClass=gosaGroupOfNames)(objectClass=groupOfNames)))",array('dn'));
+          $refs = "";
+          while($attrs = $ldap->fetch()){
+            $ref_dn = $attrs['dn'];
+            $refs .= "<br />\t".$ref_dn;
+          } 
+          if(!empty($refs)){ 
+            $this->outside_users[$b_dn]['ldif'] .= "<br /><br /><i>"._("The following references will be updated").":</i>".$refs;
+          }
+
+        }else{
+          $this->move($dn,$d_dn);
+        }
+      }
+    }
+  }
+  
+
+  function execute()
+  {
+    /* Initialise checks if this is the first call */
+    if(!$this->checks_initialised || isset($_POST['reload'])){
+      $this->initialize_checks();
+      $this->checks_initialised = TRUE;
+    }
+
+    /*************
+     * Winstations outside the group ou 
+     *************/
+    
+    if(isset($_POST['outside_winstations_dialog_cancel'])){
+      $this->outside_winstations_dialog = FALSE;
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+    }
+   
+    if(isset($_POST['outside_winstations_dialog_whats_done'])){
+      $this->migrate_outside_winstations(FALSE);
+    }
+    if(isset($_POST['outside_winstations_dialog_perform'])){
+      $this->migrate_outside_winstations(TRUE);
+      $this->search_outside_winstations();
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+      $this->outside_winstations_dialog = FALSE;
+    }
+
+    if(isset($_POST['outside_winstations_dialog'])){
+      $this->outside_winstations_dialog = TRUE;
+      $this->dialog = TRUE;
+    }
+    
+    if($this->outside_winstations_dialog){
+      $smarty = get_smarty();
+      $smarty->assign("ous",$this->get_all_winstation_ous());
+      $smarty->assign("method","outside_winstations");
+      $smarty->assign("outside_winstations",$this->outside_winstations);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+    /*************
+     * Groups outside the group ou 
+     *************/
+    
+    if(isset($_POST['outside_groups_dialog_cancel'])){
+      $this->outside_groups_dialog = FALSE;
+      $this->show_details = FALSE;
+      $this->dialog = FALSE;
+    }
+   
+    if(isset($_POST['outside_groups_dialog_whats_done'])){
+      $this->show_details= TRUE;
+      $this->migrate_outside_groups(FALSE);
+    }
+    if(isset($_POST['outside_groups_dialog_refresh'])){
+      $this->show_details= FALSE;
+    }
+
+    if(isset($_POST['outside_groups_dialog_perform'])){
+      $this->migrate_outside_groups(TRUE);
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+      $this->outside_groups_dialog = FALSE;
+      $this->initialize_checks();
+    }
+
+    if(isset($_POST['outside_groups_dialog'])){
+      $this->outside_groups_dialog = TRUE;
+      $this->dialog = TRUE;
+    }
+    
+    if($this->outside_groups_dialog){
+      $smarty = get_smarty();
+      $smarty->assign("ous",$this->get_all_group_ous());
+      $smarty->assign("method","outside_groups");
+      $smarty->assign("outside_groups",$this->outside_groups);
+      $smarty->assign("group_details", $this->show_details);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+    /*************
+     * User outside the people ou 
+     *************/
+    
+    if(isset($_POST['outside_users_dialog_cancel'])){
+      $this->outside_users_dialog = FALSE;
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+    }
+   
+    if(isset($_POST['outside_users_dialog_whats_done'])){
+      $this->show_details= TRUE;
+      $this->migrate_outside_users(FALSE);
+    }
+    if(isset($_POST['outside_users_dialog_perform'])){
+      $this->migrate_outside_users(TRUE);
+      $this->initialize_checks();
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+      $this->outside_users_dialog = FALSE;
+    }
+
+    if (isset($_POST['outside_users_dialog_refresh'])){
+      $this->show_details= FALSE;
+    }
+
+    if(isset($_POST['outside_users_dialog'])){
+      $this->outside_users_dialog = TRUE;
+      $this->dialog = TRUE;
+    }
+    
+    if($this->outside_users_dialog){
+      $smarty = get_smarty();
+      $smarty->assign("ous",$this->get_all_people_ous());
+      $smarty->assign("method","outside_users");
+      $smarty->assign("outside_users",$this->outside_users);
+      $smarty->assign("user_details", $this->show_details);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+    /*************
+     * Root object check  
+     *************/
+  
+    if(isset($_POST['retry_root_create'])){
+
+      $state = $this->checks['root']['STATUS'];
+      $this->checkBase(FALSE);
+      if($state != $this->checks['root']['STATUS']){
+        $this->initialize_checks();
+      }
+    }
+    /*************
+     * User Migration handling 
+     *************/
+
+    if(isset($_POST['retry_acls'])){
+      $this->check_administrativeAccount();
+    }
+
+    if(isset($_POST['create_acls'])){
+      $this->acl_create_dialog = TRUE;
+      $this->dialog = TRUE;
+    }
+  
+    if(isset($_POST['create_acls_cancel'])){
+      $this->acl_create_dialog = FALSE;
+      $this->dialog = FALSE;
+      $this->show_details = FALSE;
+    }
+
+    if(isset($_POST['create_acls_create_confirmed'])){
+      if($this->create_admin()){
+        $this->acl_create_dialog = FALSE;
+        $this->dialog = FALSE;
+      $this->show_details = FALSE;
+        $this->initialize_checks();
+      }
+    }
+
+    if(isset($_POST['create_acls_create'])){
+      $this->create_admin(TRUE);
+    }
+
+    if(isset($_POST['create_admin_user'])){
+      if($this->create_admin_user()){
+        $this->dialog = FALSE;
+      $this->show_details = FALSE;
+      }
+    }
+
+    if($this->acl_create_dialog){
+      $smarty = get_smarty();
+      $smarty->assign("new_user_password",@$_POST['new_user_password']);
+      $smarty->assign("new_user_password2",@$_POST['new_user_password2']);
+      $smarty->assign("users" ,$this->get_user_list());
+      $smarty->assign("users_cnt" ,count($this->get_user_list()));
+      $smarty->assign("groups",$this->get_group_list());
+      $smarty->assign("groups_cnt",count($this->get_group_list()));
+      $smarty->assign("type"  ,$this->acl_create_type);
+      $smarty->assign("method","create_acls");
+      $smarty->assign("acl_create_selected",$this->acl_create_selected);
+      $smarty->assign("what_will_be_done_now",$this->acl_create_changes);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+
+    /*************
+     * User Migration handling 
+     *************/
+
+    /* Refresh list of deparments */
+    if(isset($_POST['users_visible_migrate_refresh'])){
+      $this->check_gosaAccounts();
+    }
+
+    /* Open migration dialog */
+    if(isset($_POST['users_visible_migrate'])){
+      $this->show_details= FALSE;
+      $this->users_migration_dialog = TRUE;
+      $this->dialog =TRUE;
+    }
+
+    /* Close migration dialog */
+    if(isset($_POST['users_visible_migrate_close'])){
+      $this->users_migration_dialog = FALSE;
+      $this->dialog =FALSE;
+      $this->show_details = FALSE;
+    }
+
+    /* Start migration */
+    if(isset($_POST['users_visible_migrate_migrate'])){
+      if($this->migrate_gosaAccounts()){
+        $this->initialize_checks();
+        $this->dialog = FALSE;
+        $this->show_details = FALSE;
+        $this->users_migration_dialog = FALSE;
+      }
+    }
+
+    /* Start migration */
+    if(isset($_POST['users_visible_migrate_whatsdone'])){
+      $this->migrate_gosaAccounts(TRUE);
+    }
+
+    /* Display migration dialog */
+    if($this->users_migration_dialog){
+      $smarty = get_smarty();
+      $smarty->assign("users_to_migrate",$this->users_to_migrate);
+      $smarty->assign("method","migrate_users");
+      $smarty->assign("user_details", $this->show_details);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+
+
+    /*************
+     * Department Migration handling 
+     *************/
+
+    /* Refresh list of deparments */
+    if(isset($_POST['deps_visible_migrate_refresh'])){
+      $this->check_organizationalUnits();
+      $this->show_details= FALSE;
+    }
+
+    /* Open migration dialog */
+    if(isset($_POST['deps_visible_migrate'])){
+      $this->dep_migration_dialog = TRUE;
+      $this->dialog =TRUE;
+    }
+
+    /* Close migration dialog */
+    if(isset($_POST['deps_visible_migrate_close'])){
+      $this->dep_migration_dialog = FALSE;
+      $this->dialog =FALSE;
+      $this->show_details = FALSE;
+    }
+
+    /* Start migration */
+    if(isset($_POST['deps_visible_migrate_migrate'])){
+      if($this->migrate_organizationalUnits()){
+        $this->show_details= FALSE;
+        $this->check_organizationalUnits();
+        $this->dialog = FALSE;
+        $this->dep_migration_dialog = FALSE;
+      }
+    }
+
+    /* Start migration */
+    if(isset($_POST['deps_visible_migrate_whatsdone'])){
+      $this->migrate_organizationalUnits(TRUE);
+    }
+
+    /* Display migration dialog */
+    if($this->dep_migration_dialog){
+      $smarty = get_smarty();
+      $smarty->assign("deps_to_migrate",$this->deps_to_migrate);
+      $smarty->assign("method","migrate_deps");
+      $smarty->assign("deps_details", $this->show_details);
+      return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+    }
+
+    $smarty = get_smarty();
+    $smarty->assign("checks",$this->checks);
+    $smarty->assign("method","default");
+    return($smarty->fetch(get_template_path("setup_migrate.tpl",TRUE,dirname(__FILE__))));
+  }
+
+
+  function save_object()
+  {
+    $this->is_completed= TRUE;
+
+    /* Capture all selected winstations from outside_winstations_dialog */
+    if($this->outside_winstations_dialog){
+      foreach($this->outside_winstations as $dn => $data){
+        if(isset($_POST['select_winstation_'.$dn])){
+          $this->outside_winstations[$dn]['selected'] = TRUE;
+        }else{
+          $this->outside_winstations[$dn]['selected'] = FALSE;
+        }
+      }
+    }
+
+    /* Capture all selected groups from outside_groups_dialog */
+    if($this->outside_groups_dialog){
+      foreach($this->outside_groups as $dn => $data){
+        if(isset($_POST['select_group_'.$dn])){
+          $this->outside_groups[$dn]['selected'] = TRUE;
+        }else{
+          $this->outside_groups[$dn]['selected'] = FALSE;
+        }
+      }
+    }
+
+    /* Capture all selected users from outside_users_dialog */
+    if($this->outside_users_dialog){
+      foreach($this->outside_users as $dn => $data){
+        if(isset($_POST['select_user_'.$dn])){
+          $this->outside_users[$dn]['selected'] = TRUE;
+        }else{
+          $this->outside_users[$dn]['selected'] = FALSE;
+        }
+      }
+    }
+
+    /* Get "create acl" dialog posts */
+    if($this->acl_create_dialog){
+      if(isset($_POST['create_acls_create'])){
+        if(isset($_POST['create_acls_selected'])){
+          $this->acl_create_selected = base64_decode($_POST['create_acls_selected']);
+        }else{
+          $this->acl_create_selected = ""; 
+        }
+      }
+
+      if(isset($_POST['create_acls_create_abort'])){
+        $this->acl_create_selected = "";
+      }
+
+      if(isset($_POST['acl_create_type'])){
+        $this->acl_create_type = $_POST['acl_create_type'];
+      }
+    }
+
+    /* Get selected departments */
+    if($this->dep_migration_dialog){
+      foreach($this->deps_to_migrate as $id => $data){
+        if(isset($_POST['migrate_'.$id])){
+          $this->deps_to_migrate[$id]['checked'] = TRUE;
+        }else{
+          $this->deps_to_migrate[$id]['checked'] = FALSE;
+        }
+      }
+    }
+
+    /* Get selected users */
+    if($this->users_migration_dialog){
+      foreach($this->users_to_migrate as $id => $data){
+        if(isset($_POST['migrate_'.$id])){
+          $this->users_to_migrate[$id]['checked'] = TRUE;
+        }else{
+          $this->users_to_migrate[$id]['checked'] = FALSE;
+        }
+      }
+    }
+  }
+
+
+  /* Check if the root object exists.
+   * If the parameter just_check is true, then just check if the 
+   *  root object is missing and update the info messages.
+   * If the Parameter is false, try to create a new root object.
+   */
+  function checkBase($just_check = TRUE)
+  {
+    /* Get collected setup informations */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Check if root object exists */
+    $ldap->cd($cv['base']);
+    $res = $ldap->search("(objectClass=*)");
+    $err = ldap_errno($ldap->cid); 
+
+    if( !$res || 
+        $err == 0x20 ||  # LDAP_NO_SUCH_OBJECT
+        $err == 0x40) {  # LDAP_NAMING_VIOLATION
+
+      /* Root object doesn't exists 
+       */
+      if($just_check){
+        $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")."'>";
+        return(FALSE);
+      }else{
+
+        /* Add root object */ 
+        $ldap->cd($cv['base']);
+        $res = $ldap->create_missing_trees($cv['base']);
+
+        /* If adding failed, tell the user */
+        if(!$res){
+          $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")."'>";
+          return($res);;
+        }
+      }
+    }
+
+    /* Create & remove of dummy object was successful */
+    $this->checks['root']['STATUS']    = TRUE;
+    $this->checks['root']['STATUS_MSG']= _("Ok");
+  }
+
+
+  /* Return ldif information for a 
+   * given attribute array 
+   */
+  function array_to_ldif($atts)
+  {
+    $ret = "";
+    unset($atts['count']);
+    unset($atts['dn']);
+    foreach($atts as $name => $value){
+      if(is_numeric($name)) {
+        continue;
+      }
+      if(is_array($value)){
+        unset($value['count']);
+        foreach($value as $a_val){
+          $ret .= $name.": ". $a_val."\n";
+        }
+      }else{
+        $ret .= $name.": ". $value."\n";
+      }
+    }
+    return(preg_replace("/\n$/","",$ret));
+  }
+
+
+  function get_user_list()
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+    
+    $ldap->cd($cv['base']);
+    $ldap->search("(objectClass=gosaAccount)",array("dn"));
+  
+    $tmp = array();
+    while($attrs = $ldap->fetch()){
+      $tmp[base64_encode($attrs['dn'])] = @LDAP::fix($attrs['dn']);
+    }
+    return($tmp);
+  }
+
+
+  function get_all_people_ous()
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+    $ldap->search("(".$cv['peopleou'].")",array("dn"));
+  
+    if($ldap->count() == 0 ){
+      $add_dn = $cv['peopleou'].",".$cv['base'];
+      $naming_attr = preg_replace("/=.*$/","",$add_dn);
+      $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
+      $add = array();
+      $add['objectClass'] = array("organizationalUnit");
+      $add[$naming_attr] = $naming_value;
+
+      $ldap->cd($cv['base']);
+      $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
+      $ldap->cd($add_dn);
+      $ldap->add($add);
+    }
+
+    $ldap->search("(".$cv['peopleou'].")",array("dn"));
+    $tmp = array();
+    while($attrs= $ldap->fetch()){
+      if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
+        $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
+      }
+    }
+    return($tmp); 
+  }
+
+  function get_all_winstation_ous()
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    /* Get winstation ou */
+    if($cv['generic_settings']['wws_ou_active']) {
+      $winstation_ou = $cv['generic_settings']['ws_ou'];
+    }else{
+      $winstation_ou = "ou=winstations";
+    }
+
+    $ldap->cd($cv['base']);
+    $ldap->search("(".$winstation_ou.")",array("dn"));
+  
+    if($ldap->count() == 0 ){
+      $add_dn = $winstation_ou.",ou=systems,".$cv['base'];
+      $naming_attr = preg_replace("/=.*$/","",$add_dn);
+      $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
+      $add = array();
+      $add['objectClass'] = array("organizationalUnit");
+      $add[$naming_attr] = $naming_value;
+
+      $ldap->cd($cv['base']);
+      $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
+      $ldap->cd($add_dn);
+      $ldap->add($add);
+    }
+
+    $ldap->search("(".$winstation_ou.")",array("dn"));
+    $tmp = array();
+    while($attrs= $ldap->fetch()){
+      if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
+        $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
+      }
+    }
+    return($tmp); 
+  }
+
+
+  function get_all_group_ous()
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+    $ldap->cd($cv['base']);
+    $ldap->search("(".$cv['groupou'].")",array("dn"));
+  
+    if($ldap->count() == 0 ){
+      $add_dn = $cv['groupou'].",".$cv['base'];
+      $naming_attr = preg_replace("/=.*$/","",$add_dn);
+      $naming_value = preg_replace("/^[^=]*+=([^,]*).*$/","\\1",$add_dn);
+      $add = array();
+      $add['objectClass'] = array("organizationalUnit");
+      $add[$naming_attr] = $naming_value;
+
+      $ldap->cd($cv['base']);
+      $ldap->create_missing_trees(preg_replace("/^[^,]+,/","",$add_dn));
+      $ldap->cd($add_dn);
+      $ldap->add($add);
+    }
+
+    $ldap->search("(".$cv['groupou'].")",array("dn"));
+    $tmp = array();
+    while($attrs= $ldap->fetch()){
+      if(!preg_match("/ou=snapshots,/",$attrs['dn'])){
+        $tmp[base64_encode($attrs['dn'])] = $ldap->fix($attrs['dn']);
+      }
+    }
+    return($tmp); 
+  }
+
+
+  function get_group_list()
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+    
+    $ldap->cd($cv['base']);
+    $ldap->search("(objectClass=posixGroup)",array("dn"));
+  
+    $tmp = array();
+    while($attrs = $ldap->fetch()){
+      $tmp[base64_encode($attrs['dn'])] = @LDAP::fix($attrs['dn']);
+    }
+    return($tmp);
+  }
+
+
+  function move($source,$destination)
+  {
+    /* Get collected configuration settings */
+    $cv = $this->parent->captured_values;
+
+    /* Establish ldap connection */
+    $ldap = new LDAP($cv['admin'],
+        $cv['password'],
+        $cv['connection'],
+        FALSE,
+        $cv['tls']);
+
+     /* Update object references in gosaGroupOfNames */
+    $ogs_to_fix = array();
+    $ldap->cd($cv['base']);
+    $ldap->search('(&(objectClass=gosaGroupOfNames)(member='.@LDAP::fix($source).'))', array('cn','member'));
+    while ($attrs= $ldap->fetch()){
+      $dn = $attrs['dn'];
+      $attrs = $this->cleanup_array($attrs);
+      $member_new = array($destination);
+      foreach($attrs['member'] as $member){
+        if($member != $source){
+          $member_new[] = $member;
+        }
+      }
+      $attrs['member'] = $member_new;
+      $ogs_to_fix[$dn] = $attrs;
+    }
+
+    /* Copy source to destination dn */
+    $ldap->cat($source);
+    $new_data = $this->cleanup_array($ldap->fetch());
+    $ldap->cd($destination);
+    $res = $ldap->add($new_data);
+
+    /* Display warning if copy failed */
+    if(!$res){
+      print_red(_("Failed to copy '%s' to '%s'. LDAP says '%s'."),$source,$destination,$ldap->get_error());
+    }else{
+      $res = $ldap->rmDir($source);
+      show_ldap_error($ldap->get_error(),_("Something went wrong while copying dns."));
+
+      /* Object is copied, so update its references */
+      foreach($ogs_to_fix as $dn => $data){
+        $ldap->cd($dn);
+        $ldap->modify($data);
+      }
+    }
+  }
+
+  
+  /* Cleanup ldap result to be able to write it be to ldap */
+  function cleanup_array($attrs)
+  {
+    foreach($attrs as $key => $value) {
+      if(is_numeric($key) || in_array($key,array("count","dn"))){
+        unset($attrs[$key]);
+      }
+      if(is_array($value) && isset($value['count'])){
+        unset($attrs[$key]['count']);
+      }
+    }
+    return($attrs);
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_Schema.inc b/setup/class_setupStep_Schema.inc
new file mode 100644 (file)
index 0000000..8d22f6e
--- /dev/null
@@ -0,0 +1,243 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+class Step_Schema extends setup_step
+{
+  var $checked = array();
+  var $not_checked = array();
+  var $schema_readable  = FALSE;
+  var $attributes       = array("enable_schema_check","samba_version");
+  var $enable_schema_check = TRUE;
+  var $samba_version       = 3;
+
+  function Step_Schema()
+  {
+    $this->update_strings();
+  }
+
+  
+  function update_strings()
+  {
+    $this->s_title      = _("LDAP schema check");
+    $this->s_title_long = _("LDAP schema check");
+    $this->s_info       = _("Perform test on your current LDAP schema");
+  }
+
+  
+  function execute()
+  {
+    $this->check_schema();
+    $failed_checks = 0 ; 
+    foreach($this->checked as $val) {
+      if(!$val['STATUS']){
+        $failed_checks ++;
+      }
+    }
+
+    if($failed_checks == 0){
+      $this->is_completed = TRUE;
+    }else{
+      $this->is_completed = TRUE;
+    }
+
+    $smarty = get_smarty();
+    $smarty->assign("bool",array(FALSE => _("No"), TRUE => _("Yes")));
+    $smarty->assign("schema_readable",$this->schema_readable);
+    $smarty->assign("enable_schema_check",$this->enable_schema_check);
+    $smarty->assign("checks",$this->checked);
+    $smarty->assign("not_checked",$this->not_checked);
+    $smarty->assign("failed_checks",$failed_checks);
+    return($smarty -> fetch (get_template_path("../setup/setup_schema.tpl")));
+  }
+
+  function check_schema_version($class, $version)
+  {
+    return preg_match("/\(v$version\)/", $class['DESC']);
+  }
+
+
+  function save_object()
+  {
+    if(isset($_POST['step7_posted'])){
+
+      /* Get attributes */
+      foreach($this->attributes as $attr){
+        if(isset($_POST[$attr])){
+          $this->$attr = validate($_POST[$attr]);
+        }
+      }
+    }
+  }
+
+
+  function check_schema()
+  {
+    $cfg = $this->parent->captured_values;
+    $messages= array();
+
+    /* Get objectclasses */
+    $ldap = new LDAP($cfg['admin'],$cfg['password'],$cfg['connection'] ,FALSE,$cfg['tls']);
+    $objectclasses = $ldap->get_objectclasses();
+    if(count($objectclasses) == 0){
+      print_red(_("Can't get schema information from server. No schema check possible!"));
+    }
+
+  
+    /* Which samba version do we use? */
+    if(isset($objectclasses['sambaSamAccount'])){
+      $this->samba_version = 3;
+    } elseif(isset($objectclasses['sambaAccount'])) {
+      $this->samba_version = 2;
+    }else{
+      $this->samba_version = 0;
+    }
+
+    /* This is the default block used for each entry. 
+     *  to avoid unset indexes. 
+     */
+    $def_check = array("REQUIRED_VERSION" => "0",
+                       "SCHEMA_FILES"     => array(),
+                       "CLASSES_REQUIRED" => array(),
+                       "STATUS"           => FALSE,
+                       "IS_MUST_HAVE"     => FALSE,
+                       "MSG"              => "",
+                       "INFO"             => "");#_("There is currently no information specified for this schema extension."));
+
+
+    /* The gosa base schema */
+    $checks['gosaObject'] = $def_check;
+    $checks['gosaObject']['REQUIRED_VERSION'] = "2.4";
+    $checks['gosaObject']['SCHEMA_FILES']     = array("gosa+samba3.schema","gosa.schema");
+    $checks['gosaObject']['CLASSES_REQUIRED'] = array("gosaObject");
+    $checks['gosaObject']['IS_MUST_HAVE']     = TRUE;
+
+    /* GOsa Account class */
+    $checks["gosaAccount"]["REQUIRED_VERSION"]= "2.4";
+    $checks["gosaAccount"]["SCHEMA_FILES"]    = array("gosa+samba3.schema","gosa.schema");
+    $checks["gosaAccount"]["CLASSES_REQUIRED"]= array("gosaAccount");
+    $checks["gosaAccount"]["IS_MUST_HAVE"]    = TRUE;
+    $checks["gosaAccount"]["INFO"]            = _("Used to store account specific informations.");
+
+    /* GOsa lock entry, used to mark currently edited objects as 'in use' */
+    $checks["gosaLockEntry"]["REQUIRED_VERSION"] = "2.4";
+    $checks["gosaLockEntry"]["SCHEMA_FILES"]     = array("gosa+samba3.schema","gosa.schema");
+    $checks["gosaLockEntry"]["CLASSES_REQUIRED"] = array("gosaLockEntry");
+    $checks["gosaLockEntry"]["IS_MUST_HAVE"]     = TRUE;
+    $checks["gosaLockEntry"]["INFO"]             = _("Used to lock currently edited entries to avoid multiple changes at the same time.");
+
+    /* Some other checks */
+    foreach(array(
+          "gosaCacheEntry"        => array("version" => "2.4"),
+          "gosaDepartment"        => array("version" => "2.4"),
+          "goFaxAccount"          => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"),
+          "goFaxSBlock"           => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"),
+          "goFaxRBlock"           => array("version" => "1.0.4", "class" => "gofaxAccount","file" => "gofax.schema"),
+          "gosaUserTemplate"      => array("version" => "2.4", "class" => "posixAccount","file" => "nis.schema"),
+          "gosaMailAccount"       => array("version" => "2.4", "class" => "mailAccount","file" => "gosa+samba3.schema"),
+          "gosaProxyAccount"      => array("version" => "2.4", "class" => "proxyAccount","file" => "gosa+samba3.schema"),
+          "gosaApplication"       => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"),
+          "gosaApplicationGroup"  => array("version" => "2.4", "class" => "appgroup","file" => "gosa.schema"),
+          "GOhard"                => array("version" => "2.5", "class" => "terminals","file" => "goto.schema"),
+          "gotoTerminal"          => array("version" => "2.5", "class" => "terminals","file" => "goto.schema"),
+          "goServer"              => array("version" => "2.4","class" => "server","file" => "goserver.schema"),
+          "goTerminalServer"      => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
+          "goShareServer"         => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
+          "goNtpServer"           => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
+          "goSyslogServer"        => array("version" => "2.4", "class" => "terminals","file" => "goto.schema"),
+          "goLdapServer"          => array("version" => "2.4"),
+          "goCupsServer"          => array("version" => "2.4", "class" => array("posixAccount", "terminals"),),
+          "goImapServer"          => array("version" => "2.4", "class" => array("mailAccount", "mailgroup"),"file" => "gosa+samba3.schema"),
+          "goKrbServer"           => array("version" => "2.4"),
+          "goFaxServer"           => array("version" => "2.4", "class" => "gofaxAccount","file" => "gofax.schema"),
+          ) as $name => $values){
+
+      $checks[$name] = $def_check;
+      if(isset($values['version'])){
+        $checks[$name]["REQUIRED_VERSION"] = $values['version'];
+      }
+      if(isset($values['file'])){
+        $checks[$name]["SCHEMA_FILES"] = array($values['file']);
+      }
+      $checks[$name]["CLASSES_REQUIRED"] = array($name);
+    }
+
+    foreach($checks as $name => $value){
+      foreach($value['CLASSES_REQUIRED'] as $class){
+
+        if(!isset($objectclasses[$name])){
+          $checks[$name]['STATUS'] = FALSE;
+          if($value['IS_MUST_HAVE']){
+            $checks[$name]['MSG']    = sprintf(_("The required objectClass '%s' is not present in your schema setup"),$class);
+          }else{
+            $checks[$name]['MSG']    = sprintf(_("The optional objectClass '%s' is not present in your schema setup"),$class);
+          }
+        }elseif(!$this->check_schema_version($objectclasses[$name],$value['REQUIRED_VERSION'])){
+          $checks[$name]['STATUS'] = FALSE;
+
+          if($value['IS_MUST_HAVE']){
+            $checks[$name]['MSG'] = sprintf(_("The required objectclass '%s' does not have version %s"), $class, $value['REQUIRED_VERSION']);
+          }else{
+            $checks[$name]['MSG'] = sprintf(_("The optional objectclass '%s' does not have version %s"), $class, $value['REQUIRED_VERSION']);
+          }
+        }else{
+          $checks[$name]['STATUS'] = TRUE;
+          $checks[$name]['MSG'] = sprintf(_("Class(es) available"));
+        }
+      }
+    }
+  
+    $tmp = $objectclasses;
+
+    /* Depending on selected rfc2307bis mode, we need different schema configurations */
+    $rfc2307bis = $this->parent->captured_values['rfc2307bis'];
+
+
+    /* The gosa base schema */
+    $checks['posixGroup'] = $def_check;
+    $checks['posixGroup']['REQUIRED_VERSION'] = "2.4";
+    $checks['posixGroup']['SCHEMA_FILES']     = array("gosa+samba3.schema","gosa.schema");
+    $checks['posixGroup']['CLASSES_REQUIRED'] = array("posixGroup");
+    $checks['posixGroup']['STATUS']           = TRUE;
+    $checks['posixGroup']['IS_MUST_HAVE']     = TRUE;
+    $checks['posixGroup']['MSG']              = "";
+    $checks['posixGroup']['INFO']             = "";
+
+    if(isset($tmp['posixGroup'])){
+
+      if($rfc2307bis && isset($tmp['posixGroup']['STRUCTURAL'])){
+        $checks['posixGroup']['STATUS']           = FALSE;
+        $checks['posixGroup']['MSG']              = _("You have enabled the rfc2307bis option on the 'ldap setup' step, but your schema configuration do not support this option.");
+        $checks['posixGroup']['INFO']             = _("In order to use rfc2307bis conform groups the objectClass 'posixGroup' must be AUXILIARY");
+      }
+      if(!$rfc2307bis && !isset($tmp['posixGroup']['STRUCTURAL'])){
+        $checks['posixGroup']['STATUS']           = FALSE;
+        $checks['posixGroup']['MSG']              = _("You have disabled the rfc2307bis option on the 'ldap setup' step, but your schema configuration do not support this option.");
+        $checks['posixGroup']['INFO']             = _("The objectClass 'posixGroup' must be STRUCTURAL");
+      }
+    }
+
+    $this->checked = $checks;
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/class_setupStep_Welcome.inc b/setup/class_setupStep_Welcome.inc
new file mode 100644 (file)
index 0000000..f030f31
--- /dev/null
@@ -0,0 +1,71 @@
+<?php
+
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+*/
+
+
+class Step_Welcome  extends setup_step
+{
+  var $languages      = array();
+  var $attributes     = array();
+  var $header_image   = "images/welcome.png";
+
+  function Step_Welcome()
+  {
+    $this->is_enabled     = TRUE;
+    $this->is_active      = TRUE;
+    $this->update_strings(); 
+  }
+
+  function update_strings()
+  {
+    $this->s_title      = _("Welcome");
+    $this->s_info       = _("The welcome message");
+    $this->s_title_long = _("Welcome to GOsa setup wizard");
+  }
+  
+  function execute()
+  {
+    $smarty = get_smarty();
+    $smarty->assign('auth_id', session_id());
+    return($smarty->fetch(get_template_path("setup_welcome.tpl",TRUE,dirname(__FILE__))));
+  }
+
+  function save_object()
+  {
+    $id = "";
+    
+    /* Get auth ID from file */
+    if (file_exists('/tmp/gosa.auth') && is_readable('/tmp/gosa.auth')){
+      $contents= file('/tmp/gosa.auth');
+      $id= chop($contents[0]);
+    }
+
+    /* Continue if we've the correct ID */
+    if ($id == session_id()){
+      $this->is_completed = true;
+    } else {
+      $this->is_completed = false;
+    }
+
+  }
+}
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/license.txt b/setup/license.txt
new file mode 100644 (file)
index 0000000..9140f02
--- /dev/null
@@ -0,0 +1,147 @@
+Table of Contents
+
+    * GNU GENERAL PUBLIC LICENSE
+          o Preamble
+          o TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+          o How to Apply These Terms to Your New Programs
+
+GNU GENERAL PUBLIC LICENSE
+
+Version 2, June 1991
+
+Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+59 Temple Place - Suite 330, Boston, MA  02111-1307, USA
+
+Everyone is permitted to copy and distribute verbatim copies
+of this license document, but changing it is not allowed.
+
+Preamble
+
+The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too.
+
+When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
+
+To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
+
+For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights.
+
+We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
+
+Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
+
+Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
+
+The precise terms and conditions for copying, distribution and modification follow.
+TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
+
+1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
+
+2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
+
+    * a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
+    * b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
+    * c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
+
+3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
+
+    * a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+    * b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
+    * c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
+
+If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
+
+4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
+
+5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
+
+6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License.
+
+7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License.
+
+9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
+
+10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
+
+NO WARRANTY
+
+11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+END OF TERMS AND CONDITIONS
+How to Apply These Terms to Your New Programs
+
+If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
+
+To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
+
+one line to give the program's name and an idea of what it does.
+Copyright (C) yyyy  name of author
+
+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.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author
+Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
+type `show w'.  This is free software, and you are welcome
+to redistribute it under certain conditions; type `show c'
+for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names:
+
+Yoyodyne, Inc., hereby disclaims all copyright
+interest in the program `Gnomovision'
+(which makes passes at compilers) written
+by James Hacker.
+
+signature of Ty Coon, 1 April 1989
+Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License.
+
+Linking Joomla! statically or dynamically with other modules is making a combined work based on Joomla!. Thus, the terms and conditions of the GNU General Public License cover the whole combination.
+
+In addition, as a special exception, the copyright holders of Joomla! give you permission to combine Joomla! with free software programs or libraries that are released under the GNU LGPL and with independent modules that communicate with Joomla! solely through the Joomla! extension interface. You may copy and distribute such a system following the terms of the GNU GPL for Joomla! and the licenses of the other code concerned, provided that you include the source code of that other code when and as the GNU GPL requires distribution of source code.
+
+Note that people who make modified versions of Joomla! are not obligated to grant this special exception for their modified versions; it is their choice whether to do so. The GNU General Public License gives permission to release a modified version without this exception; this exception also makes it possible to release a modified version which carries forward this exception.
diff --git a/setup/main.inc b/setup/main.inc
new file mode 100644 (file)
index 0000000..bce41ef
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/*
+   This code is part of GOsa (https://gosa.gonicus.de)
+   Copyright (C) 2007 Fabian Hickert
+
+   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
+ */
+
+/* Create a new setup class if necessary  */
+if (!isset($_SESSION['setup']) || (isset($_GET['reset']) && $_GET['reset'] == 1)){
+  $_SESSION['setup']= new setup ();
+}
+$setup= $_SESSION['setup'];
+
+/* Execute formular */
+$setup->save_object();
+$display= $setup->execute();
+
+/* Store changes  in session */
+$_SESSION['setup']= $setup;
+
+// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
+?>
diff --git a/setup/setup.tpl b/setup/setup.tpl
new file mode 100644 (file)
index 0000000..3bb21f7
--- /dev/null
@@ -0,0 +1,4 @@
+<div style='background-color: #009900;'>
+{$php_errors}
+sadffasdsdfa
+</div>
diff --git a/setup/setup_checks.tpl b/setup/setup_checks.tpl
new file mode 100644 (file)
index 0000000..90275fc
--- /dev/null
@@ -0,0 +1,122 @@
+<!-- 
+       Div container with PHP module checks 
+-->
+<div style='float:left;width:50%;'> 
+
+       <!-- Set content styles -->     
+       <div class='default' style='margin:10px;'>
+               <!-- Beginning PHP module check output -->
+               <h2 class='step2_container_title'>{t}PHP module and extension checks{/t}</h2>
+               <!-- {cycle reset=true values="#F0F0F0, #FFF"} -->
+               {foreach from=$basic item=val key=key}
+                       <!-- Entry {$key} -->           
+                       {if $basic[$key].SOLUTION != "" && !$basic[$key].RESULT}
+               
+                               <!-- Add ability to display info popup -->      
+                               <div class='step2_entry_container_info' style='background-color:{cycle values="#F0F0F0, #FFF"}'>
+                       {else}
+
+                               <!-- Normal entry everything is fine -->
+                               <div class='step2_entry_container' style='background-color:{cycle values="#F0F0F0, #FFF"}'>     
+                       {/if}
+                       
+                       <div class='step2_entry_name'>{$basic[$key].NAME}</div>
+                       <div class='step2_entry_status'>
+
+                       {if $basic[$key].RESULT}
+                               <div class='step2_successful'>{t}Ok{/t}</div>
+                       {else}
+                               {if $basic[$key].MUST}
+                                       <div class='step2_failed'>{t}Error{/t}</div>
+                               {else}
+                                       <div class='step2_warning'>{t}Warning{/t}</div>
+                               {/if}
+                               {if $basic[$key].SOLUTION != ""}
+       
+                               <!-- Inforamtion popup -->
+                               <div class='solution_visible' id='sol_{$key}'>
+                                       {if $basic[$key].MUST}
+                                               <div class='step2_failed_text' style="background-image: url('images/small_error.png')">
+                                               {$basic[$key].SOLUTION}
+                                               <b>{t}GOsa will NOT run without fixing this.{/t}</b>
+                                       {else}
+                                               <div class="step2_warning_text" style="background-image: url('images/small_warning.png')">
+                                               {$basic[$key].SOLUTION}
+                                               <b>{t}GOsa will run without fixing this.{/t}</b>
+                                       {/if}
+                                       </div>
+                               </div>
+                               {/if}
+                       {/if}
+                               </div>
+                       </div>
+               {/foreach}
+       </div>
+</div>
+
+
+<!-- 
+       Div container with PHP config checks 
+-->
+<div style='width:50%; float:left;'>
+
+       <!-- Set content styles -->     
+       <div class='default' style='margin:10px;'>
+
+               <!-- Beginning PHP config check output -->
+               <h2 class='step2_container_title'>{t}PHP setup configuration{/t} (<a style='text-decoration:underline' href='?info' target='_blank'>{t}show information{/t})</a></h2>
+
+               <!-- {cycle reset=true values="#F0F0F0, #FFF"} -->
+               {foreach from=$config item=val key=key}
+
+                       <!-- Entry {$key} -->
+            {if $config[$key].SOLUTION != "" && !$config[$key].RESULT}
+
+                <!-- Add ability to display info popup -->
+                <div class='step2_entry_container_info' style='background-color:{cycle values="#FFF, #F0F0F0"}'>
+            {else}
+
+                <!-- Normal entry everything is fine -->
+                <div class='step2_entry_container' style='background-color:{cycle values="#FFF, #F0F0F0"}'>
+            {/if}
+
+
+                       <div class='step2_entry_name'>{$config[$key].NAME}</div>
+                       <div class='step2_entry_status'>
+                       {if $config[$key].RESULT}
+                               <div class='step2_successful'>{t}Ok{/t}</div>
+                       {else}
+
+                               {if $config[$key].MUST}
+                                       <div class='step2_failed'>{t}Error{/t}</div>
+                               {else}
+                                       <div class='step2_warning'>{t}Warning{/t}</div>
+                               {/if}
+
+                               {if $config[$key].SOLUTION != ""}
+       
+                               <!-- Inforamtion popup -->
+                               <div class='solution_visible' id='sol_config_{$key}'>
+                                       {if $config[$key].MUST}
+                                               <div class='step2_failed_text' style="background-image: url('images/small_error.png')">
+                                               {$config[$key].SOLUTION}
+                                               <b>{t}GOsa will NOT run without fixing this.{/t}</b>
+                                       {else}
+                                               <div class='step2_warning_text' style="background-image: url('images/small_warning.png')">
+                                               {$config[$key].SOLUTION}
+                                               <b>{t}GOsa will run without fixing this.{/t}</b>
+                                       {/if}
+                                       </div>
+                               </div>
+                               {/if}
+                       {/if}
+                       </div>
+                       </div>
+               {/foreach}
+
+
+       </div>
+</div>
+
+<div style="clear:both"></div>
+
diff --git a/setup/setup_config1.tpl b/setup/setup_config1.tpl
new file mode 100644 (file)
index 0000000..c6072cc
--- /dev/null
@@ -0,0 +1,213 @@
+<div class='default'>
+    <p><b>{t}Look and feel{/t}</b></p>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Theme{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="theme">
+                {html_options options=$themes selected=$theme}
+            </select>
+        </div>
+    </div>
+
+    <p><b>{t}People and group storage{/t}</b></p>
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}People DN attribute{/t}
+        </div>
+        <div class='step4_value'>
+            <select size="1" name="peopledn">
+                {html_options values=$peopledns output=$peopledns selected=$peopledn}
+            </select>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}People storage subtree{/t}
+        </div>
+        <div class='step4_value'>
+            <input type='text' name='peopleou' maxlength='40' size='40' value='{$peopleou}'>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Group storage subtree{/t}
+        </div>
+        <div class='step4_value'>
+            <input type='text' name='groupou' maxlength='40' size='40' value='{$groupou}'>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Include personal title in user DN{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="include_personal_title" size="1" title="">
+            {html_options options=$bool selected=$include_personal_title}
+            </select>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Relaxed naming policies{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="strict" size="1" title="">
+            {html_options options=$bool selected=$strict}
+            </select>
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Automatic uids{/t}
+        </div>
+        <div class='step4_value'>
+            {if $id_settings.idgen_active == FALSE}
+                <input type='checkbox' value='1' name='idgen_active'
+                    onClick='changeState("idgen");'>
+                <input size='20' id='idgen' name='idgen' type='text' value='{$id_settings.idgen}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='idgen_active' checked>
+                <input size='20' id='idgen' name='idgen' type='text' value='{$id_settings.idgen}'  >
+            {/if}
+        </div>
+    </div>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}GID / UID min id{/t}
+        </div>
+        <div class='step4_value'>
+            {if $id_settings.minid_active == FALSE}
+                <input type='checkbox' value='1' name='minid_active'
+                    onClick='changeState("minid");'>
+                <input size='10' id='minid' name='minid' type='text' value='{$id_settings.minid}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='minid_active' checked>
+                <input size='10' id='minid' name='minid' type='text' value='{$id_settings.minid}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container' style="margin-bottom:5px;">
+        <div class='step4_name'>
+            {t}Number base for people/groups{/t}
+        </div>
+        <div class='step4_value'>
+            <input type='text' name='uidbase' maxlength='20' size='10' value='{$uidbase}'>
+        </div>
+     </div>
+    <div class='step4_container' style="margin-bottom:5px;">
+        <div class='step4_name'>
+                {t}Hook for number base{/t}
+       </div>
+        <div class='step4_value'>
+            {if $base_hook_active == FALSE}
+                <input type='checkbox' value='1' name='base_hook_active'
+                    onClick='changeState("base_hook");'>
+                <input id='base_hook' name='base_hook' size=40 type='text' value='{$base_hook}'      disabled>
+            {else}
+                <input type='checkbox' value='1' name='base_hook_active' checked>
+                <input id='base_hook' name='base_hook' size=40 type='text' value='{$base_hook}'  >
+            {/if}
+     </div>
+        </div>
+    </div>
+
+    <p><b>{t}Password settings{/t}</b></p>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Password encryption algorithm{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="encryption" size="1" title="">
+                {html_options options=$crypt_methods selected=$encryption}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container' style='height:4em;'>
+        <div class='step4_name' style='height:4em;'>
+            {t}Password restrictions{/t}
+        </div>
+        <div class='step4_value' style='height:4em;'>
+
+                       {if $pwd_rules.pwminlen_active == FALSE}
+                               <input type='checkbox' value='1' name='pwminlen_active'
+                                       onClick='changeState("pwminlen");'>
+                                       {t}Password minimum length{/t}
+                               <input id='pwminlen' name='pwminlen' type='text' value='{$pwd_rules.pwminlen}' size=3 disabled>
+                       {else}
+                               <input type='checkbox' value='1' name='pwminlen_active' checked>
+                               {t}Password minimum length{/t}
+                               <input id='pwminlen' name='pwminlen' type='text' value='{$pwd_rules.pwminlen}' size=3 >
+                       {/if}
+                       <br>
+                       {if $pwd_rules.pwdiffer_active == FALSE}
+                               <input type='checkbox' value='1' name='pwdiffer_active' 
+                                       onClick='changeState("pwdiffer");'>
+                               {t}Different characters from old password{/t}
+                               <input id='pwdiffer' name='pwdiffer' type='text' value='{$pwd_rules.pwdiffer}' size=3 disabled>
+                       {else}
+                               <input type='checkbox' value='1' name='pwdiffer_active' checked>
+                               {t}Different characters from old password{/t}
+                               <input id='pwdiffer' name='pwdiffer' type='text' value='{$pwd_rules.pwdiffer}' size=3 >
+                       {/if}
+       
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+                {t}Password change hook{/t}
+        </div>
+        <div class='step4_value'>
+            {if $pwd_rules.externalpwdhook_active == FALSE}
+                <input type='checkbox' value='1' name='externalpwdhook_active'
+                    onClick='changeState("externalpwdhook");'>
+                <input size=40 id='externalpwdhook' name='externalpwdhook' type='text' value='{$pwd_rules.externalpwdhook}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='externalpwdhook_active' checked>
+                <input size=40 id='externalpwdhook' name='externalpwdhook' type='text' value='{$pwd_rules.externalpwdhook}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Use SASL for kerberos{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="krbsasl" size="1" title="">
+            {html_options options=$bool selected=$krbsasl}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Use account expiration{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="account_expiration" size="1" title="">
+            {html_options options=$bool selected=$account_expiration}
+            </select>
+        </div>
+    </div>
+
+
+<input type='hidden' value='1' name='step5_posted'>
+<!--
+         {t}GOsa supports several encryption types for your passwords. Normally this is adjustable via user templates, but you can specify a default method to be used here, too.{/t}
+         {t}GOsa always acts as admin and manages access rights internally. This is a workaround till OpenLDAP's in directory ACI's are    fully implemented. For this to work, we need the admin DN and the corresponding password.{/t}
+         {t}Some basic LDAP parameters are tunable and affect the locations where GOsa saves people and groups, including the way accounts get created. Check the values below if the fit your needs.{/t}
+         {t}GOsa has modular support for several mail methods. These methods provide interfaces to users mailboxes and general handling    for quotas. You can choose the dummy plugin to leave all your mail settings untouched.{/t}-->
+
diff --git a/setup/setup_config2.tpl b/setup/setup_config2.tpl
new file mode 100644 (file)
index 0000000..5b35c4e
--- /dev/null
@@ -0,0 +1,238 @@
+<div class='default' style='margin:12px; '>  
+    <p><b>{t}Samba settings{/t}</b></p>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Samba hash generator{/t}
+        </div>
+        <div class='step4_value'>
+                <input size=40 id='smbhash' name='smbhash' type='text' value='{$samba_settings.smbhash}'  >
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Samba SID{/t}
+        </div>
+        <div class='step4_value'>
+            {if $samba_settings.samba_sid_active == FALSE}
+                <input type='checkbox' value='1' name='samba_sid_active'
+                    onClick='changeState("samba_sid");'>
+                <input size=20 id='samba_sid' name='samba_sid' type='text' value='{$samba_settings.samba_sid}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='samba_sid_active' checked {if !$sambaDomain_found} disabled {/if}>
+                <input size=20 id='samba_sid' name='samba_sid' type='text' value='{$samba_settings.samba_sid}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}RID base{/t}
+        </div>
+        <div class='step4_value'>
+            {if $samba_settings.samba_rid_active == FALSE}
+                <input type='checkbox' value='1' name='samba_rid_active'
+                    onClick='changeState("samba_rid");'>
+                <input size=20 id='samba_rid' name='samba_rid' type='text' value='{$samba_settings.samba_rid}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='samba_rid_active' checked {if !$sambaDomain_found} disabled {/if}>
+                <input size=20 id='samba_rid' name='samba_rid' type='text' value='{$samba_settings.samba_rid}'  >
+            {/if}
+        </div>
+    </div>
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Workstation container{/t}
+        </div>
+        <div class='step4_value'>
+            {if $generic_settings.wws_ou_active == FALSE}
+                <input type='checkbox' value='1' name='wws_ou_active'
+                    onClick='changeState("wws_ou");'>
+                <input size=40 id='wws_ou' name='wws_ou' type='text' value='{$generic_settings.wws_ou}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='wws_ou_active' checked>
+                <input size=40 id='wws_ou' name='wws_ou' type='text' value='{$generic_settings.wws_ou}'  >
+            {/if}
+        </div>
+    </div>
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Samba SID mapping{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="sambaidmapping" size="1" title="">
+                       {html_options options=$bool selected=$sambaidmapping}
+            </select>
+        </div>
+    </div>
+
+    <p><b>{t}Additional GOsa settings{/t}</b></p>
+
+       <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enable Copy & Paste{/t}
+        </div>
+        <div class='step4_value'>
+
+            <select name="enableCopyPaste" size="1" title="">
+                {html_options options=$bool selected=$generic_settings.enableCopyPaste}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Government mode{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="governmentmode" size="1" title="">
+                       {html_options options=$bool selected=$governmentmode}
+                       </select>
+        </div>
+    </div>
+
+    <p><b>{t}Mail settings{/t}</b></p>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Mail method{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="mail" size="1" title="">
+                <option  value="disabled">{t}disabled{/t}</option>
+                {html_options options=$mail_methods selected=$mail}
+            </select>
+        </div>
+        <div class='step4_status'>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Vacation templates{/t}
+        </div>
+        <div class='step4_value'>
+            {if $mail_settings.vacationdir_active == FALSE}
+                <input type='checkbox' value='1' name='vacationdir_active'
+                    onClick='changeState("vacationdir");'>
+                <input size=40 id='vacationdir' name='vacationdir' type='text' value='{$mail_settings.vacationdir}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='vacationdir_active' checked>
+                <input size=40 id='vacationdir' name='vacationdir' type='text' value='{$mail_settings.vacationdir}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Use Cyrus UNIX style{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="cyrusunixstyle" size="1" title="">
+            {html_options options=$bool selected=$cyrusunixstyle}
+            </select>
+        </div>
+    </div>
+
+
+        <p><b>{t}Snapshots / Undo{/t}</b></p>
+            {if $generic_settings.snapshot_active == FALSE}
+        <div class='step4_container'>
+         <div class='step4_name'>
+                <input type='checkbox' value='1' name='snapshot_active'
+                    onClick='
+                                                                changeState("snapshot_base");
+                                                                changeState("snapshot_server");
+                                                                changeState("snapshot_user");
+                                                                changeState("snapshot_password");'>{t}Enable snapshots{/t}
+         </div>
+        </div>
+        <div style='margin-left:10px;'>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                {t}Snapshot base{/t}
+         </div>
+         <div class='step4_value'>
+                <input style='width:220' id='snapshot_base' name='snapshot_base'
+                                        type='text' value='{$generic_settings.snapshot_base}' disabled>
+         </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                    {t}Server{/t}
+         </div>
+         <div class='step4_value'>
+                                <input style='width:220' id='snapshot_server' name='snapshot_server'
+                                        type='text' value='{$generic_settings.snapshot_server}' disabled>
+        </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                        {t}User{/t}
+         </div>
+         <div class='step4_value'>
+                                <input style='width:220' id='snapshot_user' name='snapshot_user'
+                                        type='text' value='{$generic_settings.snapshot_user}' disabled>
+        </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                        {t}Password{/t}
+         </div>
+         <div class='step4_value'>
+                                <input style='width:220' id='snapshot_password' name='snapshot_password'
+                                        type='password' value='{$generic_settings.snapshot_password}' disabled>
+        </div>
+        </div>
+        </div>
+
+            {else}
+        <div class='step4_container'>
+         <div class='step4_name'>
+                <input type='checkbox' value='1' name='snapshot_active' checked>{t}Enable snapshots{/t}
+        </div>
+        </div>
+        <div style='margin-left:10px;'>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                    {t}Snapshot base{/t}
+        </div>
+         <div class='step4_value'>
+           <input style='width:220' id='snapshot_base' name='snapshot_base'
+                                        type='text' value='{$generic_settings.snapshot_base}'>
+        </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                        {t}Server{/t}
+        </div>
+         <div class='step4_value'>
+                                <input style='width:220' id='snapshot_server' name='snapshot_server'
+                                        type='text' value='{$generic_settings.snapshot_server}'>
+        </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                    {t}User{/t}
+        </div>
+         <div class='step4_value'>
+                                <input style='width:220' id='snapshot_user' name='snapshot_user'
+                                        type='text' value='{$generic_settings.snapshot_user}'>
+        </div>
+        </div>
+        <div class='step4_container'>
+         <div class='step4_name'>
+                        {t}Password{/t}
+        </div>
+         <div class='step4_value'>
+                                <input style='width:220;' id='snapshot_password' name='snapshot_password'
+                                        type='password' value='{$generic_settings.snapshot_password}'>
+        </div>
+        </div>
+        </div>
+            {/if}
+</div>
+
+<input type='hidden' value='1' name='step6_posted'>
+<div style="clear:both"></div>
diff --git a/setup/setup_config3.tpl b/setup/setup_config3.tpl
new file mode 100644 (file)
index 0000000..5a878fe
--- /dev/null
@@ -0,0 +1,235 @@
+<div class='default' style='margin:12px; '>
+     <p><b>{t}GOsa core settings{/t}</b></p>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Disable primary group filter{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="noprimarygroup" size="1" title="">
+               {html_options options=$bool selected=$optional.noprimarygroup}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Honour administrative units{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="strict_units" size="1" title="">
+               {html_options options=$bool selected=$optional.strict_units}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Smarty compile directory{/t}
+        </div>
+        <div class='step4_value'>
+                       <input size=40 id='compile' name='compile' 
+                               type='text' value='{$optional.compile}'>
+        </div>
+    </div>
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Path for PPD storage{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.ppd_path_active == FALSE}
+                <input type='checkbox' value='1' name='ppd_path_active'
+                    onClick='changeState("ppd_path");'>
+                <input size=40 id='ppd_path' name='ppd_path' type='text' value='{$optional.ppd_path}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='ppd_path_active' checked>
+                <input size=40 id='ppd_path' name='ppd_path' type='text' value='{$optional.ppd_path}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Path for kiosk profile storage{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.kioskpath_active == FALSE}
+                <input type='checkbox' value='1' name='kioskpath_active'
+                    onClick='changeState("kioskpath");'>
+                <input size=40 id='kioskpath' name='kioskpath' 
+                                       type='text' value='{$optional.kioskpath}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='kioskpath_active' checked>
+                <input size=40 id='kioskpath' name='kioskpath' 
+                                       type='text' value='{$optional.kioskpath}'  >
+            {/if}
+        </div>
+    </div>
+
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Network resolv hook{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.auto_network_hook_active == FALSE}
+                <input type='checkbox' value='1' name='auto_network_hook_active'
+                    onClick='changeState("auto_network_hook");'>
+                <input size=40 id='auto_network_hook' name='auto_network_hook' 
+                                       type='text' value='{$optional.auto_network_hook}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='auto_network_hook_active' checked>
+                <input size=40 id='auto_network_hook' name='auto_network_hook' type='text' 
+                                       value='{$optional.auto_network_hook}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Mail queue script{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.mailQueueScriptPath_active == FALSE}
+                <input type='checkbox' value='1' name='mailQueueScriptPath_active'
+                    onClick='changeState("mailQueueScriptPath");'>
+                <input size=40 id='mailQueueScriptPath' name='mailQueueScriptPath' 
+                                       type='text' value='{$optional.mailQueueScriptPath}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='mailQueueScriptPath_active' checked>
+                <input size=40 id='mailQueueScriptPath' name='mailQueueScriptPath' type='text' 
+                                       value='{$optional.mailQueueScriptPath}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Notification script{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.notifydir_active == FALSE}
+                <input type='checkbox' value='1' name='notifydir_active'
+                    onClick='changeState("notifydir");'>
+                <input size=40 id='notifydir' name='notifydir' 
+                                       type='text' value='{$optional.notifydir}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='notifydir_active' checked>
+                <input size=40 id='notifydir' name='notifydir' 
+                                       type='text' value='{$optional.notifydir}'  >
+            {/if}
+        </div>
+    </div>
+
+    <p><b>{t}Login and session{/t}</b></p>
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enforce register_globals to be activated{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="forceglobals" size="1" title="">
+               {html_options options=$bool selected=$optional.forceglobals}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Enforce encrypted connections{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="forcessl" size="1" title="">
+               {html_options options=$bool selected=$optional.forcessl}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Warn if session is not encrypted{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="warnssl" size="1" title="">
+               {html_options options=$bool selected=$optional.warnssl}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Session lifetime{/t}
+        </div>
+        <div class='step4_value'>
+                       <input size=10 id='session_lifetime' name='session_lifetime' 
+                               type='text' value='{$optional.session_lifetime}'>
+        </div>
+    </div>
+
+    <p><b>{t}Debugging{/t}</b></p>
+       
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Show PHP errors{/t}
+        </div>
+        <div class='step4_value'>
+            <select name="errorlvl" size="1" title="">
+            {html_options options=$bool selected=$errorlvl}
+            </select>
+        </div>
+    </div>
+
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Maximum LDAP query time{/t}
+        </div>
+        <div class='step4_value'>
+            {if $optional.max_ldap_query_time_active == FALSE}
+                <input type='checkbox' value='1' name='max_ldap_query_time_active'
+                    onClick='changeState("max_ldap_query_time");'>
+                <input size=10 id='max_ldap_query_time' name='max_ldap_query_time' 
+                                       type='text' value='{$optional.max_ldap_query_time}' disabled>
+            {else}
+                <input type='checkbox' value='1' name='max_ldap_query_time_active' checked>
+                <input size=10 id='max_ldap_query_time' name='max_ldap_query_time' 
+                                       type='text' value='{$optional.max_ldap_query_time}'  >
+            {/if}
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Log LDAP statistics{/t}
+        </div>
+        <div class='step4_value'>
+       
+            <select name="ldapstats" size="1" title="">
+               {html_options options=$bool selected=$optional.ldapstats}
+            </select>
+        </div>
+    </div>
+
+    <div class='step4_container'>
+        <div class='step4_name'>
+            {t}Debug level{/t}
+        </div>
+        <div class='step4_value'>
+                       <select name='debuglevel'>
+                               {if $optional.debuglevel == 0}
+                                       <option value='0' selected>0 {t}Disabled{/t}</option>
+                                       <option value='1'>1 {t}Enabled{/t}</option>
+                               {else}
+                                       <option value='0'>0 {t}Disabled{/t}</option>
+                                       <option value='1' selected>1 {t}Enabled{/t}</option>
+                               {/if}
+                       </select>               
+        </div>
+    </div>
+</div>
+
+<input type='hidden' value='1' name='step6a_posted'>
diff --git a/setup/setup_feedback.tpl b/setup/setup_feedback.tpl
new file mode 100644 (file)
index 0000000..20fae54
--- /dev/null
@@ -0,0 +1,144 @@
+<div class='default' style='margin:12px; '>  
+
+       <h2>{$additional_info}</h2>
+
+       <h2>
+               <input {if $subscribe} checked {/if} type='checkbox' name='subscribe' value='1' class='center'>&nbsp;{t}Subscribe to the gosa-announce mailinglist{/t}
+       </h2>
+       <p>
+       {t}When checking this option, GOsa will try to connect http://oss.gonicus.de in order to subscribe you to the gosa-announce mailing list. You've to confirm this by mail.{/t}
+       </p>
+       <table> 
+               <tr>
+                       <td>
+                               {t}Organization{/t}
+                       </td>
+                       <td>
+                               <input name='organization' type='text' value='{$organization}' style='width:300px;'>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               {t}Name{/t}
+                       </td>
+                       <td>
+                               <input name='name' type='text' value='{$name}' style='width:300px;'>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               {t}Mail address{/t}{$must}
+                       </td>
+                       <td>
+                               <input name='eMail' type='text' value='{$eMail}' style='width:300px;'>  
+                       </td>
+               </tr>
+       </table>
+
+
+       <p>&nbsp;</p>
+       <h2>
+               <input {if $use_gosa_announce} checked {/if} type='checkbox' name='use_gosa_announce' value='1' class='center'>&nbsp;{t}Send feedback to the GOsa project team{/t}
+       </h2>
+       <p>
+       {t}When checking this option, GOsa will try to connect http://oss.gonicus.de in order to submit your form anonymously.{/t}
+       </p>
+       <b>{t}Generic{/t}</b>
+       <table> 
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}Did the setup procedure help you to get started?{/t}   
+                       </td>
+                       <td>
+                               <input {if $get_started} checked {/if} type='radio' name='get_started' value='1'>{t}Yes{/t}
+                               <br>
+                               <input {if !$get_started} checked {/if} type='radio' name='get_started' value='0'>{t}No{/t}
+                       </td>
+               </tr>
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}If not, what problems did you encounter{/t}:
+                       </td>
+                       <td>
+                               <textarea name='problems_encountered' rows='4' cols='50' style='width:100%'>{$problems_encountered}</textarea>
+                       </td>
+               </tr>
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}Is this the first time you use GOsa?{/t}
+                       </td>
+                       <td>
+                               <input {if $first_use} checked {/if} type='radio' name='first_use' value='1'>{t}Yes{/t}
+                               <br>
+                               <input {if !$first_use} checked {/if} type='radio' name='first_use' value='0'>{t}No{/t},
+                               {t}I use it since{/t}
+                               <select name='use_since' title='{t}Select the year since when you are using GOsa{/t}'> 
+                                       {html_options options=$years}
+                               </select>
+                       </td>   
+               </tr>
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}What operating system / distribution do you use?{/t}
+                       </td>
+                       <td>
+                               <input type='text' name='distribution' size=50 value='{$distribution}'>
+                       </td>
+               </tr>
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}What web server do you use?{/t}
+                       </td>
+                       <td>
+                               <input type='text' size=50 name='web_server' value='{$web_server}'>
+                       </td>
+               </tr>
+               <tr>
+                       <td style='vertical-align:top'>
+                               {t}What PHP version do you use?{/t}
+                       </td>
+                       <td>
+                               <input type='text' size=50 name='php_version' value='{$php_version}'>
+                       </td>
+               </tr>
+       </table>
+
+       <br><b>{t}LDAP{/t}</b>
+       <table>
+               <tr>
+                       <td style='vertical-align:top'>
+                       {t}What kind of LDAP server(s) do you use?{/t}
+                       </td>
+                       <td><input type='text' name='ldap_server' size=50 value='{$ldap_server}'>
+                       </td>
+               </tr>
+               <tr>
+                       <td>{t}How many objects are in your LDAP?{/t}
+                       </td>
+                       <td><input type='text' name='object_count' size=50 value='{$object_count}'>
+                       </td>
+               </tr>
+       </table>
+
+       <br><b>{t}Features{/t}</b>
+       <table>
+               <tr>
+                       <td style='vertical-align:top'>{t}What features of GOsa do you use?{/t}
+                       </td>
+                       <td>
+                               {foreach from=$features_used item=data key=key}
+                                       <input type='checkbox' name='feature_{$key}' {if $data.USED} checked {/if}>
+                                       {$data.NAME}<br>
+                               {/foreach}
+                       </td>
+               </tr>
+               <tr>
+                       <td style="vertical-align:top">{t}What features do you want to see in future versions of GOsa?{/t}
+                       </td>
+                       <td><textarea name='want_to_see_next' cols=50 rows=3>{$want_to_see_next}</textarea>
+                       </td>
+               </tr>
+       </table>
+</div>
+<input type='submit' name='send_feedback' value='{t}Send feedback{/t}'>
+<input type='hidden' name='step_feedback' value='1'>
diff --git a/setup/setup_finish.tpl b/setup/setup_finish.tpl
new file mode 100644 (file)
index 0000000..87b6732
--- /dev/null
@@ -0,0 +1,23 @@
+<div class='default'>
+       <p>
+               <b>{t}Create your configuration file{/t}</b>
+       </p>
+       <p>     
+               {$msg2}
+       </p>
+       <tt>
+       chown root.{$webgroup} {$CONFIG_DIR}/{$CONFIG_FILE}<br>
+       chmod 640 {$CONFIG_DIR}/{$CONFIG_FILE}
+       </tt>
+       <p>     
+               <input type='submit' name='getconf' value='{t}Download configuration{/t}'>
+       </p>
+               {if $err_msg != ""}
+                       <p class="seperator">&nbsp;</p>
+                       <br>
+                       {t}Status: {/t}
+                       <a style='color:red ; font-weight:bold '>{$err_msg}</a>
+               {/if}
+
+</div>
+<input type='hidden' value='1' name='step8_posted'>
diff --git a/setup/setup_frame.tpl b/setup/setup_frame.tpl
new file mode 100644 (file)
index 0000000..2968707
--- /dev/null
@@ -0,0 +1,46 @@
+<body class='setup_body'>
+{$php_errors}
+<form action='setup.php' name='mainform' method='post' enctype='multipart/form-data'>
+<input id='focus' name='focus' type='image' src='images/empty.png' style='width:0px; height:0px;' >
+<div class='setup_dialog'>
+       <div class='setup_header'>
+               <div style="float:left;"><img src='themes/default/images/go_logo.png' class='center' alt='GOsa'></div>
+               <div style="padding-top:8px;text-align:right;height:28px">{$version}</div>
+       </div>
+       <div class='setup_menu'>
+               <b>{t}GOsa setup wizard{/t}</b>
+       </div>
+
+       <div style="padding:10px;background-color:white;">
+
+               <div class='setup_navigation'>
+                       <div style='padding:4px'>
+                               <img src='images/fai.png' class='center' alt='{t}Installation{/t}'>&nbsp;&nbsp;<font style="font-size:24px;">{t}Steps{/t}</font>
+                       </div>
+                       {$navigation}           
+               </div>
+       
+               <div class='setup_contents'>
+                       <div style='border-bottom:1px dashed #AAAAAA'>
+                               {$errors}
+                               {$header}
+                       </div>
+                       <div style='padding-left:12px;'>
+                               {$contents}
+                               {$bottom}
+                               <br>
+                       </div>
+               </div>
+               <div style="clear:both">        </div>
+       </div>
+</div>
+
+
+<input type='hidden' name='setup_goto_step' value=''>
+</form>
+
+<script type='javascript'>
+       document.getElementById('focus').focus();
+</script>
+</body>
+</html>
diff --git a/setup/setup_language.tpl b/setup/setup_language.tpl
new file mode 100644 (file)
index 0000000..6d1b30b
--- /dev/null
@@ -0,0 +1,13 @@
+<div>
+       <div class='default'>
+               <p><b>{t}Please select the preferred language{/t}</b></p>
+               <p>
+               {t}At this point, you can select the site wide default language. Choosing 'automatic' will use the language requested by the browser. This setting can be overriden per user.{/t}
+               </p>
+       </div>
+       <div class='default' style='padding-right:10px; margin-bottom:20px;'>
+               <select name='lang_selected' title='{t}Please your preferred language here{/t}' size=20 style="width:100%">
+               {html_options options=$languages selected=$lang_selected}
+               </select>
+       </div>
+</div>
diff --git a/setup/setup_ldap.tpl b/setup/setup_ldap.tpl
new file mode 100644 (file)
index 0000000..a753c8a
--- /dev/null
@@ -0,0 +1,135 @@
+<div class='default' style="width:100%; margin-right:20px;">
+
+       {if $resolve_user}
+
+       <div style='float:left; width:99%; margin-bottom:20px;'>
+               <p>
+               <b>{t}Please choose the LDAP user to be used by GOsa{/t}</b>
+               </p>
+               <select name='admin_to_use' size=20 style="width:100%; margin-bottom:10px;">                            
+                       {html_options options=$resolved_users selected=$admin}
+               </select>
+               <input type='text' value='{$resolve_filter}' name='resolve_filter'>
+               <input type='submit' value='{t}Search{/t}' name='resolve_search'>
+               <p class='seperator' style='margin-bottom:10px;'>&nbsp;</p>
+               <div style='text-align:right'>
+               <input type='submit' value='{t}Apply{/t}' name='use_selected_user'>
+               <input type='submit' value='{t}Cancel{/t}' name='resolve_user'>
+               </div>
+       </div>          
+       
+       <div style="clear:both;"></div>
+
+       {else}
+       <p>
+       <b>{t}LDAP connection{/t}</b>
+       </p>
+       <div class='step4_container'>
+               <div class='step4_name'>
+                       {t}Location name{/t}
+               </div>
+               <div class='step4_value'>
+                       <input type='text' name='location' maxlength='80' size='40' value='{$location}'>
+               </div>
+       </div>
+       <div class='step4_container'>
+               <div class='step4_name'>
+                       <div style='vertical-align:middle;height:100%;'>{t}Connection URL{/t}</div>
+               </div>
+               <div class='step4_value'>
+                       <input type='text' name='connection' maxlength='80' size='40' value='{$connection}'>
+               </div>
+       </div>
+        <div class='step4_container'>
+          <div class='step4_name'>
+            {t}TLS connection{/t}
+          </div>
+          <div class='step4_value'>
+            <select name="tls" size="1" title="">
+                       {html_options options=$bool selected=$tls}
+            </select>
+          </div>
+        </div>
+       <div class='step4_container'>
+               <div class='step4_name'> 
+                       {t}Base{/t}
+               </div>
+               <div class='step4_value'>
+                       {if $namingContextsCount >= 1}
+                               <select name='base'>            
+                                       {html_options values=$namingContexts output=$namingContexts selected=$base}
+                               </select>
+                       {else}
+                               <input type='text' name='base' maxlength='80' size='40' value='{$base}'>
+                       {/if}
+                       <input type='image' class='center' src='images/list_reload.png' title='{t}Reload{/t}' name='reload' alt='{t}Reload{/t}'>
+               </div>
+       </div>
+       <p style="margin-top:20px">
+       <b>{t}Authentication{/t}</b>
+       </p>
+       <div class='step4_container'>
+               <div class='step4_name'> 
+                       {t}Admin DN{/t}
+               </div>
+               <div class='step4_value'>
+                       <input type='text' name='admin_given' maxlength='160' size='40' value='{$admin_given}'>
+                       <input type='image' class='center' src='images/folder.png' title='{t}Select user{/t}' name='resolve_user' alt='{t}Select user{/t}'>
+               </div>
+       </div>
+
+       <div class='step4_container'>
+               <div class='step4_name'> 
+               </div>
+               <div class='step4_value'>
+                       <input {if $append_base_to_admin_dn} checked {/if} type='checkbox' name='append_base_to_admin_dn' value='1'>&nbsp;{t}Automatically append LDAP base to admin DN{/t}
+               </div>
+       </div>
+
+
+       <div class='step4_container'>
+               <div class='step4_name'>
+                       {t}Admin password{/t}
+               </div>
+               <div class='step4_value'>
+                       <input type='password' name='password' maxlength='20' size='20' value='{$password}'>
+               </div>
+       </div>
+
+       <p style="margin-top:20px">
+       <b>{t}Schema based settings{/t}</b>
+       </p>
+           <div class='step4_container'>
+               <div class='step4_name'>
+                   {t}Use rfc2307bis compliant groups{/t}
+               </div>
+               <div class='step4_value'>
+                   <select name="rfc2307bis" size="1" title="">
+                   {html_options options=$bool selected=$rfc2307bis}
+                   </select>
+               </div>
+           </div>
+       {/if}
+
+       {if ! $resolve_user}
+       <p style="margin-top:20px">
+       <b>{t}Current status{/t}</b>
+       </p>
+    <div class='step4_container' style='height:45px;'>
+        <div class='step4_name' style='height:45px;'>
+            {t}Information{/t}
+        </div>
+        <div class='step4_value' style='height:45px;'>
+                       {$connection_status}
+        </div>
+    </div>
+       {/if}
+
+</div>
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+  document.mainform.location.focus();
+  -->
+</script>
+
diff --git a/setup/setup_license.tpl b/setup/setup_license.tpl
new file mode 100644 (file)
index 0000000..c0c1896
--- /dev/null
@@ -0,0 +1,7 @@
+<div style='float:left'>
+       <div class='default' style='margin:10px; border:1px solid #A0A0A0'>
+               <div style='height:450px;padding:5px;overflow:auto; '>
+                       {$License}
+               </div>
+       </div>
+</div>
diff --git a/setup/setup_migrate.tpl b/setup/setup_migrate.tpl
new file mode 100644 (file)
index 0000000..e2f5dd3
--- /dev/null
@@ -0,0 +1,394 @@
+<div>
+    <div class='default'>
+
+       {if $method == "default"}
+                       <p>{t}During the LDAP inspection, we're going to check for several common pitfalls that may occur when migration to GOsa base LDAP administration. You may want to fix the problems below, in order to provide smooth services.{/t}
+                       </p>
+
+                       {foreach from=$checks item=val key=key}
+                               <div style='width:98%; padding:4px; background-color:{cycle values="#F0F0F0, #FFF"}'>
+
+                       {if $checks.$key.ERROR_MSG}
+                                <!-- Add ability to display info popup -->
+                                <div class='step2_entry_container_info'>
+                        {else}
+                                <!-- Normal entry everything is fine -->
+                                <div class='step2_entry_container'>
+                        {/if}
+                               <div class='step2_entry_name'><b>{$checks.$key.TITLE}</b></div>
+                               <div class='step2_entry_status'>
+                               {if $checks.$key.STATUS}
+                                       <div class='step2_successful'>{$checks.$key.STATUS_MSG}</div>
+                               {else}
+                                       <div class='step2_failed'>{$checks.$key.STATUS_MSG}</div>
+                               {/if}
+                               </div>
+                                       {if $checks.$key.ERROR_MSG}
+                                               {$checks.$key.ERROR_MSG}
+                                       {/if}
+                               </div>
+                               </div>
+                       {/foreach}
+               <br>
+               <input type='submit' name='reload' value='{t}Check again{/t}'>
+
+               {elseif $method == "outside_winstations"}
+
+                       <h2>{t}Move windows workstations into a valid windows workstation department{/t}</h2>
+
+                       {t}This dialog allows you to move the displayed windows workstations into a valid department{/t}
+                       <br>
+                       {t}Be careful with this tool, there may be references pointing to this workstations that can't be migrated.{/t}
+                       <br>
+                       <br>    
+
+                       {foreach from=$outside_winstations item=val key=key}
+                               {if $outside_winstations.$key.selected}
+                                       <input id='select_winstation_{$key}' type='checkbox' name='select_winstation_{$key}' checked>
+                               {else}
+                                       <input id='select_winstation_{$key}' type='checkbox' name='select_winstation_{$key}'>
+                               {/if}
+
+                               &nbsp;{$outside_winstations.$key.dn}
+                               {if $outside_winstations.$key.ldif != ""}
+                    <div class="step2_entry_container_info" id="sol_8">
+                                               <div style='padding-left:20px;'>
+                                                       <pre>
+                                                               {$outside_winstations.$key.ldif}
+                                                       </pre>
+                                               </div>
+                                       </div>
+                               {/if}
+                               <br>
+                       {/foreach}
+                       <input type='button' value='{t}Select all{/t}' onClick="acl_set_all('^select_winstation_',true)">
+                       <input type='button' value='{t}Select none{/t}' onClick="acl_set_all('^select_winstation_',false)">
+                       <p>
+                       <b>{t}Move selected windows workstations into the following GOsa department{/t} : </b>
+                       <select name='move_winstation_to'>
+                               {html_options options=$ous}
+                       </select>
+                       <br>
+                       <input type='submit' name='outside_winstations_dialog_perform' value='{t}Move selected workstations{/t}'>
+                       <input type='submit' name='outside_winstations_dialog_whats_done' value='{t}What will be done here{/t}'>
+                       </p>
+                               
+
+                       <p class='seperator'>&nbsp;</p> 
+                       <div style='width:100%; text-align:right; padding:5px;'>
+                               <input type='submit' name='outside_winstations_dialog_cancel' value='{t}Close{/t}'>
+                       </div>
+               
+
+               {elseif $method == "outside_groups"}
+
+                       <h2>{t}Move groups into configured group tree{/t}</h2>
+
+                        <p>
+                        {t}This dialog allows moving a couple of groups to the configured group tree. Doing this may straighten your LDAP service.{/t}
+                        </p>
+                        <p style='color:red'>
+                        {t}Be careful with this option! There may be references pointing to these groups. The GOsa setup can't migrate references, so you may want to cancel the migration in this case in this case.{/t}
+                        </p>
+                       <p>
+                       {t}Move selected groups into this group tree{/t}: 
+                       <select name='move_group_to'>
+                               {html_options options=$ous}
+                       </select>
+                       </p>
+
+                       {foreach from=$outside_groups item=val key=key}
+                               {if $outside_groups.$key.selected}
+                                       <input id='select_group_{$key}' type='checkbox' name='select_group_{$key}' checked>
+                               {else}
+                                       <input id='select_group_{$key}' type='checkbox' name='select_group_{$key}'>
+                               {/if}
+
+                               &nbsp;{$outside_groups.$key.dn}
+                               {if $outside_groups.$key.ldif != "" && $group_details}
+                      <div class="step2_entry_container_info" id="sol_8">
+<div style='padding-left:20px;'>
+<pre>
+{$outside_groups.$key.ldif}
+</pre>
+</div>
+</div>
+                               {/if}
+                               <br>
+                       {/foreach}
+
+                       <p>
+                               <input type='button' value='{t}Select all{/t}' onClick="acl_set_all('^select_group_',true)">
+                               <input type='button' value='{t}Select none{/t}' onClick="acl_set_all('^select_group_',false)">
+                        {if $group_details}
+                        <input type='submit' name='outside_groups_dialog_refresh' value='{t}Hide changes{/t}'>
+                        {else}
+                        <input type='submit' name='outside_groups_dialog_whats_done' value='{t}Show changes{/t}'>
+                        {/if}
+                       </p>
+
+                       <p class='seperator'>&nbsp;</p> 
+                       <div style='width:99%; text-align:right; padding:5px;'>
+                               <input type='submit' name='outside_groups_dialog_perform' value='{t}Apply{/t}'>
+                               &nbsp;
+                               <input type='submit' name='outside_groups_dialog_cancel' value='{t}Cancel{/t}'>
+                       </div>
+               
+               {elseif $method == "outside_users"}
+
+                       <h2>{t}Move users into configured user tree{/t}</h2>
+                       <p>
+                       {t}This dialog allows moving a couple of users to the configured user tree. Doing this may straighten your LDAP service.{/t}
+                       </p>
+                       <p style='color:red'>
+                       {t}Be careful with this option! There may be references pointing to these users. The GOsa setup can't migrate references, so you may want to cancel the migration in this case.{/t}
+                       </p>    
+                       <p>
+                       {t}Move selected users into this people tree{/t}: 
+                       <select name='move_user_to'>
+                               {html_options options=$ous}
+                       </select>
+                       </p>
+                       {foreach from=$outside_users item=val key=key}
+                               {if $outside_users.$key.selected}
+                                       <input id='select_user_{$key}' type='checkbox' name='select_user_{$key}' checked>
+                               {else}
+                                       <input id='select_user_{$key}' type='checkbox' name='select_user_{$key}'>
+                               {/if}
+
+                               &nbsp;{$outside_users.$key.dn}
+                               {if $outside_users.$key.ldif != "" && $user_details}
+                      <div class="step2_entry_container_info" id="sol_8">
+<div style='padding-left:20px;'>
+<pre>
+{$outside_users.$key.ldif}
+</pre>
+</div>
+</div>
+                               {/if}
+                               <br>
+                       {/foreach}
+                       <br>
+                       <input type='button' value='{t}Select all{/t}' onClick="acl_set_all('^select_user_',true)">
+                       <input type='button' value='{t}Select none{/t}' onClick="acl_set_all('^select_user_',false)">
+
+                       {if $user_details}
+                       <input type='submit' name='outside_users_dialog_refresh' value='{t}Hide changes{/t}'>
+                        {else}
+                       <input type='submit' name='outside_users_dialog_whats_done' value='{t}Show changes{/t}'>
+                       {/if}
+
+                       <p class='seperator'>&nbsp;</p> 
+                       <div style='width:99%; text-align:right; padding:5px;'>
+                               <input type='submit' name='outside_users_dialog_perform' value='{t}Apply{/t}'>
+                               &nbsp;
+                               <input type='submit' name='outside_users_dialog_cancel' value='{t}Cancel{/t}'>
+                       </div>
+               
+
+               {elseif $method == "create_acls"}
+
+               {if $acl_create_selected != "" && $what_will_be_done_now!=""}
+                       <div>
+<pre>
+{$what_will_be_done_now}
+</pre>
+                       </div>          
+                       <input type='submit' name='create_acls_create_confirmed' value='{t}Next{/t}'>
+                       <input type='submit' name='create_acls_create_abort' value='{t}Abort{/t}'>
+               {else}
+                       <h2>{t}Create a new GOsa administrator account{/t}</h2>
+       
+                       <p>
+                       {t}This dialog will automatically add a new super administrator to your LDAP tree.{/t}
+                       </p>
+                       <table>
+                               <tr>
+                                       <td>
+                                               {t}Name{/t}:&nbsp;
+                                       </td>
+                                       <td>
+                                               <i>System administrator</i>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}User ID{/t}:&nbsp;
+                                       </td>
+                                       <td>
+                                               <i>admin</i>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Password{/t}:&nbsp;
+                                       </td>
+                                       <td>
+                                               <input type='password' value='{$new_user_password}' name='new_user_password'><br>
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <td>
+                                               {t}Password (again){/t}:&nbsp;
+                                       </td>
+                                       <td>
+                                               <input type='password' value='{$new_user_password2}' name='new_user_password2'><br>
+                                       </td>
+                               </tr>
+                       </table>
+       
+<!-- Place cursor -->
+<script language="JavaScript" type="text/javascript">
+  <!-- // First input field on page
+  document.mainform.new_user_password.focus();
+  -->
+</script>
+                               <input type='submit' name='create_admin_user' value='{t}Apply{/t}'>     
+                       
+                       {if $users_cnt != 0 || $groups_cnt != 0}
+                       
+                       <h2>{t}Assign super administrator permissions to an existing user or group{/t}</h2>
+                       <p>{t}To grant administrative permissions to a user or a group, select an object and choose 'Assign'.{/t}</p>
+                       <select name='acl_create_type' onChange='document.mainform.submit();' >
+                               {if $type == "user"}
+                               <option value='group'>{t}Group{/t}</option>
+                               <option selected value='user'>{t}User{/t}</option>
+                               {else}
+                               <option selected value='group'>{t}Group{/t}</option>
+                               <option value='user'>{t}User{/t}</option>
+                               {/if}
+                       </select>
+                       <select name='create_acls_selected' size="12" style='width:100%;'>
+                               {if $type == "user"}
+                                       {html_options options=$users selected=$acl_create_selected}
+                               {else}
+                                       {html_options options=$groups selected=$acl_create_selected}
+                               {/if}
+                       </select>
+                       <input type='submit' name='create_acls_create' value='{t}Apply{/t}'>
+                       {/if}
+                       <p class='seperator'>&nbsp;</p> 
+
+                       <div style='width:99%; text-align:right; padding:5px;'>
+                               <input type='submit' name='create_acls_cancel' value='{t}Cancel{/t}'>
+                       </div>
+               
+               {/if}
+
+
+
+               {elseif $method == "migrate_deps"}
+       
+                       <h2>Department migration</h2>
+
+                       <p>{t}The listed departments are currenlty invisble in the GOsa user interface. If you want to change this for a couple of entries, select them and use the migrate button below.{/t}</p>
+                       <p>{t}If you want to know what will be done when migrating the selected entries, use the 'Show changes' button to see the LDIF.{/t}</p>
+                                       
+                       {foreach from=$deps_to_migrate item=val key=key}
+
+                               {if $deps_to_migrate.$key.checked}
+                                       <input id='migrate_{$key}' type='checkbox' name='migrate_{$key}' checked>
+                                       {$deps_to_migrate.$key.dn}
+                                       {if $deps_to_migrate.$key.after != ""}
+                                               <div class="step2_entry_container_info" id="sol_8">
+
+{t}Current{/t}
+<div style='padding-left:20px;'>
+<pre>
+dn: {$deps_to_migrate.$key.dn}
+{$deps_to_migrate.$key.before}
+</pre>
+</div>
+{t}After migration{/t}
+<div style='padding-left:20px;'>
+<pre>
+dn: {$deps_to_migrate.$key.dn}
+{$deps_to_migrate.$key.after}
+</pre>
+</div>
+                                               </div>
+                                       {/if}
+                               {else}
+                                       <input id='migrate_{$key}' type='checkbox' name='migrate_{$key}'>
+                                       {$deps_to_migrate.$key.dn}
+                               {/if}
+                               
+
+                       {/foreach}
+
+                       <br>
+                       <input type='button' value='{t}Select all{/t}' onClick="acl_set_all('^migrate_',true)">
+                       <input type='button' value='{t}Select none{/t}' onClick="acl_set_all('^migrate_',false)">
+
+                       {if $deps_details}
+                       <input type='submit' name='deps_visible_migrate_refresh' value='{t}Hide changes{/t}'>
+                       {else}
+                       <input type='submit' name='deps_visible_migrate_whatsdone' value='{t}Show changes{/t}'>
+                       {/if}
+
+                       <p class='seperator'>&nbsp;</p> 
+
+                       <div style='width:99%; text-align:right; padding:5px;'>
+                               <input type='submit' name='deps_visible_migrate_migrate' value='{t}Apply{/t}'>
+                               &nbsp;
+                               <input type='submit' name='deps_visible_migrate_close' value='{t}Cancel{/t}'>
+                       </div>
+               {elseif $method == "migrate_users"}
+       
+                       <h2>User migration</h2>
+
+                       <p>{t}The listed users are currenlty invisble in the GOsa user interface. If you want to change this for a couple of users, just select them and use the 'Migrate' button below.{/t}</p>
+                       <p>{t}If you want to know what will be done when migrating the selected entries, use the 'Show changes' button to see the LDIF.{/t}</p>
+                       {foreach from=$users_to_migrate item=val key=key}
+
+                               {if $users_to_migrate.$key.checked}
+                                       <input type='checkbox' name='migrate_{$key}' checked id='migrate_{$key}'>
+                                       {$users_to_migrate.$key.dn}
+                                       {if $users_to_migrate.$key.after != ""}
+                                               <div class="step2_entry_container_info" id="sol_8">
+
+{t}Current{/t}
+<div style='padding-left:20px;'>
+<pre>
+dn: {$users_to_migrate.$key.dn}
+{$users_to_migrate.$key.before}
+</pre>
+</div>
+{t}After migration{/t}
+<div style='padding-left:20px;'>
+<pre>
+dn: {$users_to_migrate.$key.dn}
+{$users_to_migrate.$key.after}
+</pre>
+</div>
+                                               </div>
+                                       {/if}
+                               {else}
+                                       <input type='checkbox' name='migrate_{$key}' id='migrate_{$key}'>
+                                       {$users_to_migrate.$key.dn}
+                               {/if}
+
+                               <br>
+                               
+
+                       {/foreach}
+                       <br>
+            <input type='button' value='{t}Select all{/t}' onClick="acl_set_all('^migrate_',true)">
+            <input type='button' value='{t}Select none{/t}' onClick="acl_set_all('^migrate_',false)">
+
+                       {if $user_details}
+                       <input type='submit' name='users_visible_migrate_refresh' value='{t}Hide changes{/t}'>
+                       {else}
+                       <input type='submit' name='users_visible_migrate_whatsdone' value='{t}Show changes{/t}'>
+                       {/if}
+
+                       <p class='seperator'>&nbsp;</p> 
+
+                       <div style='width:99%; text-align:right; padding-top:5px;'>
+                               <input type='submit' name='users_visible_migrate_migrate' value='{t}Apply{/t}'>
+                               &nbsp;
+                               <input type='submit' name='users_visible_migrate_close' value='{t}Cancel{/t}'>
+                       </div>
+       {/if}
+    </div>
+</div>
diff --git a/setup/setup_schema.tpl b/setup/setup_schema.tpl
new file mode 100644 (file)
index 0000000..e56538b
--- /dev/null
@@ -0,0 +1,40 @@
+<div class='default'>
+    <p>
+     <b>{t}Schema specific settings{/t}</b>
+    </p>
+    <div class='step4_container'>
+        <div class='step4_name' style='width:30%'>
+            {t}Enable schema validation when logging in{/t}
+        </div>
+        <div class='step4_value'>
+                       <select name='enable_schema_check'>
+                               {html_options options=$bool selected=$enable_schema_check}
+            </select>
+        </div>
+    </div>
+    <p>
+     <b>{t}Check status{/t}</b>
+    </p>
+       <div>
+               {if $failed_checks == 0}
+                       <font style="color:green">{t}Schema check succeeded{/t}</font>
+               {else}
+                       <img src='images/small_warning.png' class='center'>
+                               <font style="color:red">{t}Schema check failed{/t}</font>
+               {/if}
+       </div>
+       <div style="margin-left:20px;">
+               {foreach from=$checks item=val key=key}
+                               {if !$checks[$key].STATUS}
+                               <br>
+                                       {if $checks[$key].IS_MUST_HAVE}
+                                               <font color='red'>{$checks[$key].MSG}</font>
+                                       {else}
+                                               {$checks[$key].MSG}
+                                       {/if}
+                               <br>
+                               {/if}
+               {/foreach}
+       </div>
+</div>
+<input type='hidden' value='1' name='step7_posted'>
diff --git a/setup/setup_welcome.tpl b/setup/setup_welcome.tpl
new file mode 100644 (file)
index 0000000..e6f76c7
--- /dev/null
@@ -0,0 +1,37 @@
+<div>
+    <div class='default'>
+       <p>
+       {t}This seems to be the first time you start GOsa - we didn't find any configuration right now. This simple wizard intends to help you while setting it up.{/t}
+       </p>
+       
+       <p style='border-top:1px solid #AAAAAA; padding-top:10px;'>
+       <b>{t}What will the wizard do for you?{/t}</b>
+       </p>
+       <ul>
+        <li>{t}Create a basic, single site configuration{/t}</li>
+        <li>{t}Tries to find problems within your PHP and LDAP setup{/t}</li>
+        <li>{t}Let you choose from a set of basic and advanced configuration switches{/t}</li>
+        <li>{t}Guided migration of existing LDAP trees{/t}</li>
+       </ul>
+       <p>
+       <b>{t}What will the wizard NOT do for you?{/t}</b>
+       </p>
+       <ul>
+        <li>{t}Find every possible configuration error{/t}</li>
+        <li>{t}Migrate every possible LDAP setup - create backup dumps!{/t}</li>
+       </ul>
+
+       <p style='border-top:1px solid #AAAAAA; padding-top:10px;'>
+       <b>{t}To continue...{/t}</b>
+       </p>
+       <p>
+       {t}For security reasons you need to authenticate for the installation by creating the file '/tmp/gosa.auth', containing the current session ID on the servers local filesystem. This can be done by executing the following command:{/t}
+       </p>
+       <tt>
+       echo -n <b>{$auth_id}</b> &gt; /tmp/gosa.auth
+       </tt>
+       <p>
+       {t}Click the 'Continue' button when you've finished.{/t}
+       </p>
+     </div>
+</div>