Continued a bit:
[mailer.git] / inc / install-inc.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 08/29/2003 *
4  * ===================                          Last change: 11/11/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : install-inc.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Initial stuff for plain (old) installer          *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Initiale Dinge fuer alten Installer              *
12  * -------------------------------------------------------------------- *
13  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
14  * Copyright (c) 2009 - 2016 by Mailer Developer Team                   *
15  * For more information visit: http://mxchange.org                      *
16  *                                                                      *
17  * This program is free software; you can redistribute it and/or modify *
18  * it under the terms of the GNU General Public License as published by *
19  * the Free Software Foundation; either version 2 of the License, or    *
20  * (at your option) any later version.                                  *
21  *                                                                      *
22  * This program is distributed in the hope that it will be useful,      *
23  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
25  * GNU General Public License for more details.                         *
26  *                                                                      *
27  * You should have received a copy of the GNU General Public License    *
28  * along with this program; if not, write to the Free Software          *
29  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
30  * MA  02110-1301  USA                                                  *
31  ************************************************************************/
32
33 // Some security stuff...
34 if ((!defined('__SECURITY')) || (!isInstaller())) {
35         die();
36 } // END - if
37
38 // Load extension timezone
39 loadExtension('timezone', 'test');
40
41 // Set config entry
42 setConfigEntry('timezone', 'Europe/Berlin');
43
44 // Init some things
45 FILTER_INIT_TIMEZONE(array());
46 FILTER_INIT_RANDOMIZER();
47 FILTER_INIT_RANDOM_NUMBER();
48
49 // Init variables
50 $GLOBALS['install_mysql'] = array();
51 if ((isPostRequestElementSet('mysql')) && (ifPostContainsSelections('mysql'))) {
52         // Transfer 'mysql' array
53         $GLOBALS['install_mysql'] = postRequestElement('mysql');
54 } // END - if
55
56 // Check if both passwords from SMTP are matching
57 if ((isGetRequestElementSet('install_page') && (getRequestElement('install_page') == 5))) {
58         // Okay, we have to check it
59         if (isPostRequestElementSet('smtp_user') && (!isPostRequestElementSet('smtp_host'))) {
60                 // Hostname not set
61                 addToInstallContent('<div class="para">{--INSTALLER_SMTP_HOSTNAME_EMPTY--}</div>');
62                 setGetRequestElement('install_page', 3);
63         } // END - if
64
65         if ((!isPostRequestElementSet('smtp_password1')) && (isPostRequestElementSet('smtp_password2'))) {
66                 // Password is empty
67                 addToInstallContent('<div class="para">{--INSTALLER_SMTP_PASSWORD1_EMPTY--}</div>');
68                 setGetRequestElement('install_page', 3);
69         } // END - if
70
71         if ((isPostRequestElementSet('smtp_password1')) && (!isPostRequestElementSet('smtp_password2'))) {
72                 // Password repeat is empty
73                 addToInstallContent('<div class="para">{--INSTALLER_SMTP_PASSWORD2_EMPTY--}</div>');
74                 setGetRequestElement('install_page', 3);
75         } // END - if
76
77         if (postRequestElement('smtp_password1') != postRequestElement('smtp_password1')) {
78                 // Passwords are not matching
79                 addToInstallContent('<div class="para">{--INSTALLER_SMTP_PASS_MISMATCH--}</div>');
80                 setGetRequestElement('install_page', 3);
81         } // END - if
82 } // END - if
83
84 // Is the mailer installed or no admin registered so far?
85 if ((!isInstalled()) || (!isAdminRegistered())) {
86         // Construct include file name
87         $inc = 'inc/install/install_page_' . getRequestElement('install_page') . '.php';
88
89         // Is the include file there?
90         if (isIncludeReadable($inc)) {
91                 // Then load it
92                 loadIncludeOnce($inc);
93         } else {
94                 // Not found, may be invalid page
95                 logDebugMessage(__FILE__, __LINE__, sprintf('Wrong install_page=%s detected', getRequestElement('install_page')));
96                 addTemplateToInstallContent('admin_settings_unsaved', '{%message,INSTALLER_WRONG_PAGE=' . getRequestElement('install_page') . '%}');
97         }
98 } else {
99         // Already installed!
100         addFatalMessage(__FILE__, __LINE__, '{--MAILER_ALREADY_INSTALLED--}');
101 }
102
103 // [EOF]
104 ?>