Added update_year.sh (still not fully flexible) and updated all years with it.
[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  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
14  * Copyright (c) 2009 - 2015 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')) {
35         die();
36 } // END - if
37
38 // Set some config entries which is required for installation phase
39 setConfigEntry('OUTPUT_MODE' , 'render');
40 setConfigEntry('WRITE_FOOTER', 'Y');
41 setConfigEntry('_DB_TYPE'    , 'mysql');
42
43 // Mark configuration as NOT loaded which is the default
44 $GLOBALS['config_local_loaded'] = FALSE;
45
46 // Is the local configuration there?
47 if ((isIncludeReadable(getCachePath() . 'config-local.php')) && (isIncludeReadable('inc/config.php'))) {
48         // We are better in installation mode
49         $GLOBALS['__mailer_installing'] = TRUE;
50
51         // Define default main_title here
52         setConfigEntry('MAIN_TITLE', 'Your mail-exchange title');
53
54         // Set output mode here
55         setConfigEntry('OUTPUT_MODE', 'render');
56
57         // Both exist! This is bad and should be avoided by the admin
58         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.');
59 } elseif (isIncludeReadable(getCachePath() . 'config-local.php')) {
60         // Then load it
61         loadIncludeOnce(getCachePath() . 'config-local.php');
62
63         // Mark configuration as loaded
64         $GLOBALS['config_local_loaded'] = TRUE;
65 } elseif (isIncludeReadable('inc/config.php')) {
66         // Out-dated inc/config.php found, falling back to load and "wrap" it
67         updateOldConfigFile();
68 } elseif (isInstalling()) {
69         // Set some essential constants
70         // @TODO Rewrite them to avoid this else block
71         setConfigEntry('MAIN_TITLE', 'Your mail-exchanger title');
72         setConfigEntry('SLOGAN'    , 'Your cool slogan here');
73         setConfigEntry('WEBMASTER' , 'you@some-hoster.example');
74
75         // Set output mode here
76         setConfigEntry('OUTPUT_MODE', 'render');
77 }
78
79 // Check if the user setups his database login stuff...
80 if ((empty($GLOBALS['mysql']['login'])) && (!isInstalling()) && (!isInstaller()) && (!isGetRequestElementSet('installing')) && (isInstalled())) {
81         // No login entered and outside installation mode
82         outputHtml('<strong>{--MAILER_WARNING--}</strong>');
83         if (isInstalled()) {
84                 // You have changed my configuration file!
85                 reportBug(__FILE__, __LINE__, '{--DIE_CONFIG_CHANGED_YOU--}');
86         } else {
87                 // Please run the installation script (maybe again)
88                 reportBug(__FILE__, __LINE__, '{--DIE_RUN_INSTALLER_MYSQL--}');
89         }
90 } elseif ((!isInstalling()) && (!isInstaller()) && (empty($GLOBALS['mysql']['password'])) && (getConfig('WARN_NO_PASS') == 'Y')) {
91         // No database password entered
92         displayMessage('<div class="warning">{--MAILER_WARNING--}</div> {--WARN_NULL_PASSWORD--}');
93 }
94
95 // [EOF]
96 ?>