]> git.mxchange.org Git - mailer.git/blob - inc/load_config.php
0bb8a7aa3615d0f41c4cfdce9d10e1fcec1c7305
[mailer.git] / inc / load_config.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 04/04/2009 *
4  * ===================                          Last change: 04/04/2009 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : load_config.php                                  *
8  * -------------------------------------------------------------------- *
9  * Short description : Loader for configuration                         *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Lader fuer Konfiguration                         *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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                      *
21  *                                                                      *
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.                                  *
26  *                                                                      *
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.                         *
31  *                                                                      *
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,               *
35  * MA  02110-1301  USA                                                  *
36  ************************************************************************/
37
38 // Some security stuff...
39 if (!defined('__SECURITY')) {
40         die();
41 } // END - if
42
43 // Set some config entries which is required for installation phase
44 setConfigEntry('OUTPUT_MODE' , 'render');
45 setConfigEntry('WRITE_FOOTER', 'Y');
46 setConfigEntry('_DB_TYPE'    , 'mysql3');
47
48 // Mark configuration as NOT loaded which is the default
49 $GLOBALS['config_local_loaded'] = false;
50
51 // Is the local configuration there?
52 if ((isIncludeReadable(getCachePath() . 'config-local.php')) && (isIncludeReadable('inc/config.php'))) {
53         // We are better in installation mode
54         $GLOBALS['__mailer_installing'] = true;
55
56         // Define default main_title here
57         setConfigEntry('MAIN_TITLE', 'Your mail-exchange title');
58
59         // Set output mode here
60         setConfigEntry('OUTPUT_MODE', 'render');
61
62         // Both exist! This is bad and should be avoided by the admin
63         reportBug(__FILE__, __LINE__, 'You have uploaded or kept an out-dated file at <strong>inc/config.php</strong> along with the new file <strong>'.getCachePath().'config-local.php</strong>. Please remove <strong>inc/config.php</strong> to avoid incompatiblity issues. Thank you.');
64 } elseif (isIncludeReadable(getCachePath() . 'config-local.php')) {
65         // Then load it
66         loadIncludeOnce(getCachePath() . 'config-local.php');
67
68         // Mark configuration as loaded
69         $GLOBALS['config_local_loaded'] = true;
70 } elseif (isIncludeReadable('inc/config.php')) {
71         // Out-dated inc/config.php found, falling back to load and "wrap" it
72         updateOldConfigFile();
73 } elseif (isInstalling()) {
74         // Set some essential constants
75         // @TODO Rewrite them to avoid this else block
76         setConfigEntry('MAIN_TITLE', 'Your mail-exchanger title');
77         setConfigEntry('SLOGAN'    , 'Your cool slogan here');
78         setConfigEntry('WEBMASTER' , 'you@some-hoster.example');
79
80         // Set output mode here
81         setConfigEntry('OUTPUT_MODE', 'render');
82 }
83
84 // Check if the user setups his database login stuff...
85 if ((empty($GLOBALS['mysql']['login'])) && (!isInstalling()) && (!isInstallationPhase()) && (!isGetRequestElementSet('installing')) && (isInstalled())) {
86         // No login entered and outside installation mode
87         outputHtml('<strong>{--MAILER_WARNING--}:</strong>');
88         if (isInstalled()) {
89                 // You have changed my configuration file!
90                 reportBug(__FILE__, __LINE__, '{--DIE_CONFIG_CHANGED_YOU--}');
91         } else {
92                 // Please run the installation script (maybe again)
93                 reportBug(__FILE__, __LINE__, '{--DIE_RUN_INSTALLER_MYSQL--}');
94         }
95 } elseif ((!isInstalling()) && (!isInstallationPhase()) && (empty($GLOBALS['mysql']['password'])) && (getConfig('WARN_NO_PASS') == 'Y')) {
96         // No database password entered
97         displayMessage('<div class="warning">{--MAILER_WARNING--}:</div> {--WARN_NULL_PASSWORD--}');
98 }
99
100 // [EOF]
101 ?>