X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;ds=sidebyside;f=html%2Fsetup.php;h=e98b41cfbf7810569d90ea8d37e42f1a9fcb785c;hb=6e8abbd4123cbceb3edfba6a3d2617227bafd8b1;hp=e7e8803c63c5999753c0ce766d2acac37311cc63;hpb=588229f481da6fb0e0ee2fb20e7d88c566c96a8b;p=gosa.git
diff --git a/html/setup.php b/html/setup.php
index e7e8803c6..e98b41cfb 100644
--- a/html/setup.php
+++ b/html/setup.php
@@ -1,97 +1,101 @@
';
- echo ' location = "index.php?js=true";';
- echo '';
- $_SESSION['js']= FALSE;
-} else {
- $_SESSION['js']= TRUE;
-}
-/* Load required includes */
+/* Get standard functions */
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;
-}
+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");
-/* Don't call setup if gosa.conf exists */
-if (file_exists(CONFIG_DIR."/gosa.conf")){
- header("location:index.php");
- exit();
-}
+/* 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);
-// Check if theres the example
-if (!file_exists(CONFIG_TEMPLATE_DIR."/gosa.conf")){
- echo "error example of gosa.conf not present!";
-}
+/* Start session */
+session_start ();
+$_SESSION['DEBUGLEVEL']= 1;
-// No Errors occured yet
-$_SESSION['errors']= "";
-
-// 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;
-}
+/* Check for js */
+if (!isset($_GET['js']) && !isset($_SESSION['js'])){
+ echo '';
-/* Set detected samba version */
-if (isset($classes['samba2'])) {
- $samba= "3";
-} else {
- $samba= "2";
+ $_SESSION['js']= FALSE;
+} elseif(isset($_GET['js'])) {
+ $_SESSION['js']= TRUE;
}
+/* Attribute initialization, reset errors */
+$_SESSION['errors'] = "";
+$_SESSION['errorsAlreadyPosted']= array();
+$_SESSION['LastError'] = "";
+
/* Set template compile directory */
-$smarty->compile_dir= '/var/spool/gosa';
+$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 accessable, check existence and rigths of this directory!"), $smarty->compile_dir);
- echo $_SESSION['errors'];
+ msg_dialog::display(_("Smarty"),sprintf(_("Directory '%s' specified as compile directory is not accessible!"),
+ $smarty->compile_dir),FATAL_ERROR_DIALOG);
exit();
}
-/* Language setup */
-$lang= get_browser_language();
-header("Content-type: text/html; charset=UTF-8");
-$lang.=".UTF-8";
+/* 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();
+ }
+}
+
+$lang = $_SESSION['lang'];
+/* Append .UTF-8 to language string if necessary */
+if(!preg_match("/utf(-)8$/i",$lang)){
+ $lang .= ".UTF-8";
+}
putenv("LANGUAGE=");
putenv("LANG=$lang");
setlocale(LC_ALL, $lang);
@@ -103,55 +107,46 @@ $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"));
+/* Call setup */
+$display = "";
+require_once("../setup/main.inc");
-if(isset ($_POST['next'])){
- $next = $_POST['next'];
-} else {
- $next = 1;
-}
+/* Print_out last ErrorMessage repeated string. */
+print_red(NULL);
-if(isset($_POST['back'])) {
- $next = $next -2 ;
-}
+$smarty->assign("date", date("l, dS F Y H:i:s O"));
+$header= "".$smarty->fetch(get_template_path('setup_headers.tpl'));
-if($next < 1){
- $next = 1;
-}
-// 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();
+
+/* Set focus to the error button if we've an error message */
+$focus= "";
+if (isset($_SESSION['errors']) && $_SESSION['errors'] != ""){
+ $focus= '';
}
-// this is the last Page which shows the downloadable conf file
-else {
- show_setup_page5();
+
+$focus= '';
+
+/* 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", $focus.$_SESSION['setup']->get_bottom_html());
+$smarty->assign("msg_dialogs", msg_dialog::get_dialogs());
+
+if ($error_collector != ""){
+ $smarty->assign("php_errors", preg_replace("/%BUGBODY%/",$error_collector_mailto,$error_collector)."");
+} else {
+ $smarty->assign("php_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:
?>
-