2 /************************************************************************
3 * Mailer v0.2.1-FINAL Start: 08/25/2003 *
4 * =================== Last change: 07/01/2005 *
6 * -------------------------------------------------------------------- *
8 * -------------------------------------------------------------------- *
9 * Short description : Main loader file. Loads our needed stuff *
10 * -------------------------------------------------------------------- *
11 * Kurzbeschreibung : Hauptladedatei. Laedt alle benoetigten Dateien *
12 * -------------------------------------------------------------------- *
15 * $Tag:: 0.2.1-FINAL $ *
17 * Needs to be in all Files and every File needs "svn propset *
18 * svn:keywords Date Revision" (autoprobset!) at least!!!!!! *
19 * -------------------------------------------------------------------- *
20 * Copyright (c) 2003 - 2009 by Roland Haeder *
21 * Copyright (c) 2009, 2010 by Mailer Developer Team *
22 * For more information visit: http://www.mxchange.org *
24 * This program is free software; you can redistribute it and/or modify *
25 * it under the terms of the GNU General Public License as published by *
26 * the Free Software Foundation; either version 2 of the License, or *
27 * (at your option) any later version. *
29 * This program is distributed in the hope that it will be useful, *
30 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
31 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
32 * GNU General Public License for more details. *
34 * You should have received a copy of the GNU General Public License *
35 * along with this program; if not, write to the Free Software *
36 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
38 ************************************************************************/
41 //* DEBUG: */ xdebug_start_trace();
43 // Load security stuff here
44 require('inc/libs/security_functions.php');
47 $GLOBALS['startTime'] = microtime(true);
49 // Init output mode and module
50 $GLOBALS['output_mode'] = '0';
51 $GLOBALS['module'] = 'unknown';
53 // Needed include files
54 require('inc/config-global.php');
57 setContentType('text/html');
59 // Fix missing module to 'index'
60 if (!isGetRequestParameterSet('module')) {
62 setGetRequestParameter('module', 'index');
69 loadIncludeOnce('inc/header.php');
71 // Modules are by default not valid!
72 $isModuleValid = false;
76 // Is the maintenance mode active or goes all well?
77 if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && (!isAdmin()) && (getModule() != 'admin')) {
78 // Maintain mode is active and you are no admin
79 addFatalMessage(__FILE__, __LINE__, getMessage('LANG_DOWN_MAINTAINCE'));
80 } elseif ((SQL_IS_LINK_UP()) && (getTotalFatalErrors() == '0')) {
81 // Construct module name
82 $GLOBALS['module_inc'] = sprintf("inc/modules/%s.php", getModule());
84 // Check module permission (again)
85 $check = checkModulePermissions();
87 case 'cache_miss': // The cache is gone
88 case 'admin_only': // Admin-only access
89 case 'mem_only': // Member-only access
90 case 'done': // All fine!
91 // Does the module exists on local file system?
92 if ((isIncludeReadable($GLOBALS['module_inc'])) && (getTotalFatalErrors() == '0')) {
93 // Module is valid, active and located on the local disc...
94 $isModuleValid = true;
95 } elseif (getTotalFatalErrors() == '0') {
97 addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_404', getModule()));
102 addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_404', getModule()));
106 if (!isIncludeReadable($GLOBALS['module_inc'])) {
107 // Module does addionally not exists
108 addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_404', getModule()));
112 addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_LOCKED', getModule()));
116 logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $check, getModule()));
117 addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_UNKNOWN', $check));
120 } elseif (getTotalFatalErrors() == '0') {
122 addFatalMessage(__FILE__, __LINE__, getMessage('MYSQL_ERRORS'));
125 if (($isModuleValid === true) && (isset($GLOBALS['module_inc']))) {
126 // Everything is okay so we can load the module
127 loadIncludeOnce($GLOBALS['module_inc']);
130 // Add the footer (this will call shutdown())
131 loadIncludeOnce('inc/footer.php');