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 * -------------------------------------------------------------------- *
13 * Copyright (c) 2003 - 2009 by Roland Haeder *
14 * Copyright (c) 2009 - 2013 by Mailer Developer Team *
15 * For more information visit: http://mxchange.org *
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. *
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. *
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, *
31 ************************************************************************/
33 // Some security stuff...
34 if (!defined('__SECURITY')) {
39 $__functions = array();
41 // Init include file array as it follows same naming scheme
56 'extensions') as $lib) {
59 array_push($__functions, $lib . '-functions');
62 // Load more function libraries or includes
63 foreach (array_merge($__functions, array('filters', 'mysql-manager', 'handler')) as $lib) {
64 // Load special functions
65 loadIncludeOnce('inc/' . $lib . '.php');
72 set_error_handler('__errorHandler');
74 // Disable block-mode by default
75 enableBlockMode(FALSE);
86 // Set important header_sent
87 if (!isset($GLOBALS['__header_sent'])) {
88 $GLOBALS['__header_sent'] = '0';
91 // Init fatal messages
94 // Enable HTML templates by default
97 // Are we in installation phase?
98 if ((!isInstaller()) && (isInstalled())) {
99 // Load configuration file(s) here
100 loadIncludeOnce('inc/load_config.php');
102 // Load database layer here
103 loadIncludeOnce('inc/db/lib.php');
105 // Init message system
109 initExtensionCssFiles();
111 // Initialize SQL link
114 // Default output is 'direct' for HTML output
115 setConfigEntry('OUTPUT_MODE', 'direct');
117 // This hack prevents a backtrace in CSS output
118 if (isCssOutputMode()) {
119 // Problem with config so set output mode
120 setConfigEntry('OUTPUT_MODE', 'render');
123 // CFG: DATABASE-TYPE
124 setConfigEntry('_DB_TYPE', 'mysql');
127 unsetSqlLinkUp(__FILE__, __LINE__);
129 // Load database layer here
130 loadIncludeOnce('inc/db/lib.php');
132 // Init message system
139 foreach (array('databases', 'install-functions', 'load_config', 'load_cache') as $inc) {
141 loadIncludeOnce('inc/' . $inc . '.php');
147 // Check whether we are in installation routine
148 if ((!isInstalling()) && (!isCssOutputMode()) && (!isRawOutputMode())) {
149 // Redirect to the URL
150 redirectToUrl('install.php');
154 // Handle fatal errors
155 runFilterChain('handle_fatal_errors');