2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 08/29/2003 *
4 * =================== Last change: 11/11/2004 *
6 * -------------------------------------------------------------------- *
7 * File : install-inc.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Functions for installation procedure *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Funktionen fuer die Installationsroutine *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * -------------------------------------------------------------------- *
18 * Copyright (c) 2003 - 2009 by Roland Haeder *
19 * Copyright (c) 2009 - 2012 by Mailer Developer Team *
20 * For more information visit: http://mxchange.org *
22 * This program is free software; you can redistribute it and/or modify *
23 * it under the terms of the GNU General Public License as published by *
24 * the Free Software Foundation; either version 2 of the License, or *
25 * (at your option) any later version. *
27 * This program is distributed in the hope that it will be useful, *
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
30 * GNU General Public License for more details. *
32 * You should have received a copy of the GNU General Public License *
33 * along with this program; if not, write to the Free Software *
34 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
36 ************************************************************************/
38 // Some security stuff...
39 if ((!defined('__SECURITY')) || (!isInstallationPhase())) {
43 // Load extension timezone
44 loadExtension('timezone', 'test');
47 setConfigEntry('timezone', 'Europe/Berlin');
50 FILTER_INIT_TIMEZONE(array());
51 FILTER_INIT_RANDOMIZER();
52 FILTER_INIT_RANDOM_NUMBER();
55 $GLOBALS['install_mysql'] = array();
56 if ((isPostRequestElementSet('mysql')) && (ifPostContainsSelections('mysql'))) {
57 // Transfer 'mysql' array
58 $GLOBALS['install_mysql'] = postRequestElement('mysql');
61 // Check if both passwords from SMTP are matching
62 if ((isGetRequestElementSet('install_page') && (getRequestElement('install_page') == 5))) {
63 // Okay, we have to check it
64 if (isPostRequestElementSet('smtp_user') && (!isPostRequestElementSet('smtp_host'))) {
66 addToInstallContent('<div class="para">{--INSTALLER_SMTP_HOSTNAME_EMPTY--}</div>');
67 setGetRequestElement('install_page', 3);
70 if ((!isPostRequestElementSet('smtp_pass1')) && (isPostRequestElementSet('smtp_pass2'))) {
72 addToInstallContent('<div class="para">{--INSTALLER_SMTP_PASSWORD1_EMPTY--}</div>');
73 setGetRequestElement('install_page', 3);
76 if ((isPostRequestElementSet('smtp_pass1')) && (!isPostRequestElementSet('smtp_pass2'))) {
77 // Password repeat is empty
78 addToInstallContent('<div class="para">{--INSTALLER_SMTP_PASSWORD2_EMPTY--}</div>');
79 setGetRequestElement('install_page', 3);
82 if (postRequestElement('smtp_pass1') != postRequestElement('smtp_pass1')) {
83 // Passwords are not matching
84 addToInstallContent('<div class="para">{--INSTALLER_SMTP_PASS_MISMATCH--}</div>');
85 setGetRequestElement('install_page', 3);
89 // Is the mailer installed or no admin registered so far?
90 if ((!isInstalled()) || (!isAdminRegistered())) {
91 // Construct include file name
92 $inc = 'inc/install/install_page_' . getRequestElement('install_page') . '.php';
94 // Is the include file there?
95 if (isIncludeReadable($inc)) {
97 loadIncludeOnce($inc);
99 // Not found, may be invalid page
100 logDebugMessage(__FILE__, __LINE__, sprintf("Wrong install_page=%s detected", getRequestElement('install_page')));
101 addTemplateToInstallContent('admin_settings_unsaved', '{%message,INSTALLER_WRONG_PAGE=' . getRequestElement('install_page') . '%}');
104 // Already installed!
105 addFatalMessage(__FILE__, __LINE__, '{--MAILER_ALREADY_INSTALLED--}');