Use upcoming functions loadPageHeader() and loadPageFooter() instead of include
[mailer.git] / install.php
index 7c7bc4fc4b6047f056687268ac2c100c0c22561c..948cbd9af6e328dc84e59150d7671c93ac154a6a 100644 (file)
  * -------------------------------------------------------------------- *
  * Kurzbeschreibung  : Installationsscript.                             *
  * -------------------------------------------------------------------- *
- * $Revision::                                                        $ *
- * $Date::                                                            $ *
- * $Tag:: 0.2.1-FINAL                                                 $ *
- * $Author::                                                          $ *
- * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * Copyright (c) 2009 - 2013 by Mailer Developer Team                   *
  * For more information visit: http://mxchange.org                      *
  *                                                                      *
  * This program is free software; you can redistribute it and/or modify *
 require('inc/libs/security_functions.php');
 
 // Init start time
-$GLOBALS['startTime'] = microtime(true);
+$GLOBALS['__start_time'] = microtime(TRUE);
 
 // Tell every module / require file we are installing
-$GLOBALS['mailer_installing'] = true;
-
-// Set CSS variable for "normal mode"
-$GLOBALS['output_mode'] = '0';
+$GLOBALS['__mailer_installing'] = TRUE;
 
-// Set module
-$GLOBALS['__module'] = 'install';
+// Set module and output mode
+$GLOBALS['__module']      = 'install';
+$GLOBALS['__output_mode'] = '0';
 
 // Load config file
 require('inc/config-global.php');
@@ -59,34 +52,60 @@ require('inc/config-global.php');
 // Set content type
 setContentType('text/html');
 
-// Reload page to page=welcome when it is not specified
-if (!isGetRequestElementSet('page')) {
-       redirectToUrl('install.php?page=welcome');
+// Is 'install_page' set?
+if (!isGetRequestElementSet('install_page')) {
+       // No, so set it to 'welcome'
+       setGetRequestElement('install_page', 'welcome');
 } // END - if
 
 // Set username
 setUsername('{--USERNAME_INSTALLER--}');
 
 // Already installed?
-if ((isInstalled()) && (getRequestElement('page') != 'finished')) {
+if ((isInstalled()) && (getRequestElement('install_page') != 'finished')) {
        // Add fatal message
-       addFatalMessage(__FILE__, __LINE__, '{--ALREADY_INSTALLED--}');
+       addFatalMessage(__FILE__, __LINE__, '{--MAILER_ALREADY_INSTALLED--}');
 } // END - if
 
 // Load header here
-loadIncludeOnce('inc/header.php');
+loadPageHeader();
 
 // Handle fatal errors
 runFilterChain('handle_fatal_errors');
 
-// Here start's our installtion stuff
-loadIncludeOnce('inc/install-inc.php');
-
-// Load main installation table
-loadTemplate('install_main');
+// Is plain or AJAX-enabled installation used?
+if (isGetRequestElementSet('installer')) {
+       // Set installer type
+       setSession('installer', getRequestElement('installer'));
+
+       // Redirect to install.php again
+       redirectToUrl('install.php');
+} elseif (isAjaxInstaller()) {
+       // AJAX-enabled installer:
+       // Load 'init' page
+       addTemplateToInstallContent('install_page_init');
+
+       // Prepare content
+       $content = array(
+               'install_page' => getRequestElement('install_page')
+       );
+
+       // Load main installation table
+       loadTemplate('install_main_ajax', FALSE, $content);
+} elseif (isPlainInstaller()) {
+       // Plain installer:
+       // Load include file
+       loadIncludeOnce('inc/install-inc.php');
+
+       // Load main template
+       loadTemplate('install_main_plain');
+} else {
+       // What do you want, red or blue pill? AJAX or plain installer? ;-)
+       loadTemplate('install_selector');
+}
 
 // Footer
-loadIncludeOnce('inc/footer.php');
+loadPageFooter();
 
 // [EOF]
 ?>