2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 11/16/2003 *
4 * =================== Last change: 12/13/2004 *
6 * -------------------------------------------------------------------- *
7 * File : mysql-connect.php *
8 * -------------------------------------------------------------------- *
9 * Short description : Connects to your database *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Verbindet zu Ihrer Datenbank *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
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 *
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')) {
44 $__functions = array();
46 // Init include file array as it follows same naming scheme
62 'extensions') as $lib) {
65 array_push($__functions, $lib . '-functions');
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');
78 set_error_handler('__errorHandler');
80 // Disable block-mode by default
81 enableBlockMode(FALSE);
92 // Set important header_sent
93 if (!isset($GLOBALS['__header_sent'])) {
94 $GLOBALS['__header_sent'] = '0';
97 // Init fatal messages
100 // Init repository data sub-system
101 initRepositoryData();
103 // Enable HTML templates by default
104 enableTemplateHtml();
106 // Are we in installation phase?
107 if ((!isInstaller()) && (isInstalled())) {
108 // Load configuration file(s) here
109 loadIncludeOnce('inc/load_config.php');
111 // Load database layer here
112 loadIncludeOnce('inc/db/lib.php');
114 // Init message system
118 initExtensionCssFiles();
120 // Initialize SQL link
123 // Default output is 'direct' for HTML output
124 setConfigEntry('OUTPUT_MODE', 'direct');
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');
132 // CFG: DATABASE-TYPE
133 setConfigEntry('_DB_TYPE', 'mysql3');
136 unsetSqlLinkUp(__FILE__, __LINE__);
138 // Load database layer here
139 loadIncludeOnce('inc/db/lib.php');
141 // Init message system
145 foreach (array('databases', 'session', 'versions', 'install-functions', 'load_config', 'load_cache') as $inc) {
147 loadIncludeOnce('inc/' . $inc . '.php');
153 // Check whether we are in installation routine
154 if ((!isInstalling()) && (!isCssOutputMode()) && (!isRawOutputMode())) {
155 // Redirect to the URL
156 redirectToUrl('install.php');
160 // Handle fatal errors
161 runFilterChain('handle_fatal_errors');