Renamed more:
[mailer.git] / inc / mysql-connect.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 11/16/2003 *
4  * ===================                          Last change: 12/13/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : mysql-connect.php                                *
8  * -------------------------------------------------------------------- *
9  * Short description : Connects to your database                        *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Verbindet zu Ihrer Datenbank                     *
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 - 2013 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 // Init array
44 $__functions = array();
45
46 // Init include file array as it follows same naming scheme
47 foreach ( array(
48                 'stats',
49                 'xml',
50                 'callback',
51                 'referral',
52                 'email',
53                 'request',
54                 'session',
55                 'code',
56                 'pool',
57                 'language',
58                 'sql',
59                 'expression',
60                 'filter',
61                 'revision',
62                 'extensions') as $lib) {
63
64         // Add it
65         array_push($__functions, $lib . '-functions');
66 } // END - foreach
67
68 // Load more function libraries or includes
69 foreach (array_merge($__functions, array('filters', 'mysql-manager', 'handler')) as $lib) {
70         // Load special functions
71         loadIncludeOnce('inc/' . $lib . '.php');
72 } // END - foreach
73
74 // Remove array
75 unset($__functions);
76
77 // Set error handler
78 set_error_handler('__errorHandler');
79
80 // Disable block-mode by default
81 enableBlockMode(FALSE);
82
83 // Init error handler
84 initErrorHandler();
85
86 // Init request
87 initRequest();
88
89 // Init userid
90 initMemberId();
91
92 // Set important header_sent
93 if (!isset($GLOBALS['__header_sent'])) {
94         $GLOBALS['__header_sent'] = '0';
95 } // END - if
96
97 // Init fatal messages
98 initFatalMessages();
99
100 // Init repository data sub-system
101 initRepositoryData();
102
103 // Enable HTML templates by default
104 enableTemplateHtml();
105
106 // Are we in installation phase?
107 if ((!isInstalling()) && (!isInstallationPhase())) {
108         // Load configuration file(s) here
109         loadIncludeOnce('inc/load_config.php');
110
111         // Load database layer here
112         loadIncludeOnce('inc/db/lib.php');
113
114         // Init message system
115         initMessages();
116
117         // CSS array
118         initExtensionCssFiles();
119
120         // Initialize SQL link
121         initSqlLink();
122 } else {
123         // Default output is 'direct' for HTML output
124         setConfigEntry('OUTPUT_MODE', 'direct');
125
126         // This hack prevents a backtrace in CSS output
127         if (isCssOutputMode()) {
128                 // Problem with config so set output mode
129                 setConfigEntry('OUTPUT_MODE', 'render');
130         } // END - if
131
132         // CFG: DATABASE-TYPE
133         setConfigEntry('_DB_TYPE', 'mysql3');
134
135         // Set link as down
136         unsetSqlLinkUp(__FILE__, __LINE__);
137
138         // Load database layer here
139         loadIncludeOnce('inc/db/lib.php');
140
141         // Init message system
142         initMessages();
143
144         // Include more
145         foreach (array('databases', 'session', 'versions', 'install-functions', 'load_config', 'load_cache') as $inc) {
146                 // Load the include
147                 loadIncludeOnce('inc/' . $inc . '.php');
148         } // END - foreach
149
150         // Init installer
151         initInstaller();
152
153         // Check whether we are in installation routine
154         if ((!isInstalling()) && (!isCssOutputMode()) && (!isRawOutputMode())) {
155                 // Redirect to the URL
156                 redirectToUrl('install.php');
157         } // END - if
158 }
159
160 // Handle fatal errors
161 runFilterChain('handle_fatal_errors');
162
163 // [EOF]
164 ?>