generateMetaDescriptionCode() has now no longer parameters
[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  * For more information visit: http://www.mxchange.org                  *
22  *                                                                      *
23  * This program is free software; you can redistribute it and/or modify *
24  * it under the terms of the GNU General Public License as published by *
25  * the Free Software Foundation; either version 2 of the License, or    *
26  * (at your option) any later version.                                  *
27  *                                                                      *
28  * This program is distributed in the hope that it will be useful,      *
29  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
30  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
31  * GNU General Public License for more details.                         *
32  *                                                                      *
33  * You should have received a copy of the GNU General Public License    *
34  * along with this program; if not, write to the Free Software          *
35  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
36  * MA  02110-1301  USA                                                  *
37  ************************************************************************/
38
39 // XDEBUG call
40 //* DEBUG: */ xdebug_start_trace();
41
42 // Load security stuff here
43 require('inc/libs/security_functions.php');
44
45 // Init start time
46 $GLOBALS['startTime'] = microtime(true);
47
48 // Init output mode and module
49 $GLOBALS['output_mode'] = '0';
50 $GLOBALS['module'] = 'unknown';
51
52 // Needed include files
53 require('inc/config-global.php');
54
55 // Set content type
56 setContentType('text/html');
57
58 // Fix missing module to 'index'
59 if (!isGetRequestParameterSet('module')) {
60         // Set element
61         setGetRequestParameter('module', 'index');
62
63         // ... and module
64         setModule('index');
65 } // END - if
66
67 // The header file
68 loadIncludeOnce('inc/header.php');
69
70 // Modules are by default not valid!
71 $isModuleValid = false;
72 $URL = '';
73 $check = 'failed';
74
75 // Is the maintenance mode active or goes all well?
76 if ((isExtensionActive('maintenance')) && (getConfig('maintenance') == 'Y') && (!isAdmin()) && (getModule() != 'admin')) {
77         // Maintain mode is active and you are no admin
78         addFatalMessage(__FILE__, __LINE__, getMessage('LANG_DOWN_MAINTAINCE'));
79 } elseif ((SQL_IS_LINK_UP()) && (getTotalFatalErrors() == '0')) {
80         // Construct module name
81         $GLOBALS['module_inc'] =  sprintf("inc/modules/%s.php", getModule());
82
83         // Check module permission (again)
84         $check = checkModulePermissions();
85         switch ($check) {
86                 case 'cache_miss': // The cache is gone
87                 case 'admin_only': // Admin-only access
88                 case 'mem_only': // Member-only access
89                 case 'done': // All fine!
90                         // Does the module exists on local file system?
91                         if ((isIncludeReadable($GLOBALS['module_inc'])) && (getTotalFatalErrors() == '0')) {
92                                 // Module is valid, active and located on the local disc...
93                                 $isModuleValid = true;
94                         } elseif (getTotalFatalErrors() == '0') {
95                                 // Module not found!
96                                 addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_404', getModule()));
97                         }
98                         break;
99
100                 case '404':
101                         addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_404', getModule()));
102                         break;
103
104                 case 'locked':
105                         if (!isIncludeReadable($GLOBALS['module_inc'])) {
106                                 // Module does addionally not exists
107                                 addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_404', getModule()));
108                         } // END - if
109
110                         // Add fatal message
111                         addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_LOCKED', getModule()));
112                         break;
113
114                 default:
115                         logDebugMessage(__FILE__, __LINE__, sprintf("Unknown status %s return from module check. Module=%s", $check, getModule()));
116                         addFatalMessage(__FILE__, __LINE__, getMaskedMessage('LANG_MOD_REG_UNKNOWN', $check));
117                         break;
118         } // END - switch
119 } elseif (getTotalFatalErrors() == '0') {
120         // MySQL problems!
121         addFatalMessage(__FILE__, __LINE__, getMessage('MYSQL_ERRORS'));
122 }
123
124 if (($isModuleValid === true) && (isset($GLOBALS['module_inc']))) {
125         // Everything is okay so we can load the module
126         loadIncludeOnce($GLOBALS['module_inc']);
127 } // END - if
128
129 // Add the footer (this will call shutdown())
130 loadIncludeOnce('inc/footer.php');
131
132 // [EOF]
133 ?>