]> git.mxchange.org Git - mailer.git/blob - modules.php
Configuration of advertisement networks prepared, CSS cleaned up, HTML rewritten:
[mailer.git] / modules.php
1 <?php
2 /************************************************************************
3  * Mailer v0.2.1-FINAL                                Start: 08/25/2003 *
4  * ===================                          Last change: 07/01/2005 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : modules.php                                      *
8  * -------------------------------------------------------------------- *
9  * Short description : Main loader file. Loads our needed stuff         *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Hauptladedatei. Laedt alle benoetigten Dateien   *
12  * -------------------------------------------------------------------- *
13  * $Revision::                                                        $ *
14  * $Date::                                                            $ *
15  * $Tag:: 0.2.1-FINAL                                                 $ *
16  * $Author::                                                          $ *
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                  *
23  *                                                                      *
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.                                  *
28  *                                                                      *
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.                         *
33  *                                                                      *
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,               *
37  * MA  02110-1301  USA                                                  *
38  ************************************************************************/
39
40 // XDEBUG call
41 //* DEBUG: */ xdebug_start_trace();
42
43 // Load security stuff here
44 require('inc/libs/security_functions.php');
45
46 // Init start time
47 $GLOBALS['startTime'] = microtime(true);
48
49 // Init output mode and module
50 $GLOBALS['output_mode'] = '0';
51 $GLOBALS['module'] = 'unknown';
52
53 // Needed include files
54 require('inc/config-global.php');
55
56 // Set content type
57 setContentType('text/html');
58
59 // The header file
60 loadIncludeOnce('inc/header.php');
61
62 // Modules are by default not valid!
63 $isModuleValid = false;
64 $URL = '';
65 $check = 'failed';
66
67 // Is the maintenance mode active or goes all well?
68 if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && (!isAdmin()) && (getModule() != 'admin')) {
69         // Maintain mode is active and you are no admin
70         addFatalMessage(__FILE__, __LINE__, '{--MAILER_DOWN_FOR_MAINTENANCE--}');
71 } elseif ((SQL_IS_LINK_UP()) && (!ifFatalErrorsDetected())) {
72         // Construct module name
73         $GLOBALS['module_inc'] =  sprintf("inc/modules/%s.php", getModule());
74
75         // Check module permission (again)
76         $check = checkModulePermissions();
77         switch ($check) {
78                 case 'cache_miss': // The cache is gone
79                 case 'admin_only': // Admin-only access
80                 case 'mem_only': // Member-only access
81                 case 'done': // All fine!
82                         // Does the module exists on local file system?
83                         if ((isIncludeReadable($GLOBALS['module_inc'])) && (!ifFatalErrorsDetected())) {
84                                 // Module is valid, active and located on the local disc...
85                                 $isModuleValid = true;
86                         } elseif (!ifFatalErrorsDetected()) {
87                                 // Set HTTP status
88                                 setHttpStatus('404');
89
90                                 // Module not found!
91                                 addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule()));
92
93                                 // Set module to error module (non-existent!)
94                                 setModule('error');
95                         }
96                         break;
97
98                 case '404':
99                         // Set HTTP status
100                         setHttpStatus('404');
101
102                         // Add fatal message
103                         addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule()));
104                         break;
105
106                 case 'locked':
107                         // Set HTTP status
108                         setHttpStatus('403');
109
110                         if (!isIncludeReadable($GLOBALS['module_inc'])) {
111                                 // Set HTTP status
112                                 setHttpStatus('404');
113
114                                 // Module does addionally not exists
115                                 addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_REGISTRY_404', getModule()));
116                         } // END - if
117
118                         // Add fatal message
119                         addFatalMessage(__FILE__, __LINE__, getMaskedMessage('MODULE_IS_LOCKED', getModule()));
120                         break;
121
122                 default:
123                         // Unknown module status
124                         logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $check, getModule()));
125                         addFatalMessage(__FILE__, __LINE__, getMaskedMessage('UNKNOWN_MODULE_STATUS', $check));
126                         break;
127         } // END - switch
128 } elseif (!ifFatalErrorsDetected()) {
129         // MySQL problems detected
130         addFatalMessage(__FILE__, __LINE__, '{--MYSQL_ERRORS--}');
131 }
132
133 if (($isModuleValid === true) && (isset($GLOBALS['module_inc']))) {
134         // Everything is okay so we can load the module
135         loadIncludeOnce($GLOBALS['module_inc']);
136 } // END - if
137
138 // Add the footer (this will call shutdown())
139 loadIncludeOnce('inc/footer.php');
140
141 // [EOF]
142 ?>