2 /************************************************************************
\r
3 * MXChange v0.2.1 Start: 08/25/2003 *
\r
4 * =============== Last change: 07/01/2005 *
\r
6 * -------------------------------------------------------------------- *
\r
7 * File : modules.php *
\r
8 * -------------------------------------------------------------------- *
\r
9 * Short description : Main loader file. Loads our needed stuff *
\r
10 * -------------------------------------------------------------------- *
\r
11 * Kurzbeschreibung : Hauptladedatei. L�dt alle ben�tigten Dateien *
\r
12 * -------------------------------------------------------------------- *
\r
14 * -------------------------------------------------------------------- *
\r
15 * Copyright (c) 2003 - 2008 by Roland Haeder *
\r
16 * For more information visit: http://www.mxchange.org *
\r
18 * This program is free software; you can redistribute it and/or modify *
\r
19 * it under the terms of the GNU General Public License as published by *
\r
20 * the Free Software Foundation; either version 2 of the License, or *
\r
21 * (at your option) any later version. *
\r
23 * This program is distributed in the hope that it will be useful, *
\r
24 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
\r
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
\r
26 * GNU General Public License for more details. *
\r
28 * You should have received a copy of the GNU General Public License *
\r
29 * along with this program; if not, write to the Free Software *
\r
30 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, *
\r
31 * MA 02110-1301 USA *
\r
32 ************************************************************************/
\r
34 // APD call (if you have this apache extension and want to debug this script for us)
\r
35 //apd_set_pprof_trace();
\r
37 // Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
\r
38 require_once ("inc/libs/security_functions.php");
\r
40 // Init "action" and "what"
\r
41 global $what, $action;
\r
43 $GLOBALS['what'] = ""; $GLOBALS['action'] = "";
\r
44 $GLOBALS['userid'] = 0;
\r
45 if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
\r
46 if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
\r
48 // Secure the module name (very important line!)
\r
49 $GLOBALS['module'] = htmlentities(strip_tags($_GET['module']), ENT_QUOTES);
\r
51 // Needed include files
\r
52 require ("inc/config.php");
\r
54 // Check if logged in
\r
57 // Is still logged in so we welcome him with his name
\r
58 $result = SQL_QUERY_ESC("SELECT surname, family FROM "._MYSQL_PREFIX."_user_data WHERE userid=%d LIMIT 1",
\r
59 array($GLOBALS['userid']), __FILE__, __LINE__);
\r
60 if (SQL_NUMROWS($result) == 1)
\r
62 // Load surname and family's name and build the username
\r
63 list($s, $f) = SQL_FETCHROW($result);
\r
64 $username = $s." ".$f;
\r
66 // Update only cookies and no login data!
\r
67 UPDATE_LOGIN_DATA(false);
\r
72 // Hmmm, logged in and no valid cookies???
\r
73 $username = "<I>"._UNKNOWN."</I>";
\r
77 SQL_FREERESULT($result);
\r
85 // He's a guest, hello there... ;-)
\r
90 include (PATH."inc/header.php");
\r
92 // Modules are by default not valid!
\r
93 $MOD_VALID = false; $check = "failed";
\r
94 if ((!empty($CONFIG['maintenance'])) && ($CONFIG['maintenance'] == "Y") && (!IS_ADMIN()) && ($GLOBALS['module'] != "admin"))
\r
96 // Maintain mode is active and you are no admin
\r
97 ADD_FATAL(LANG_DOWN_MAINTAINCE);
\r
99 elseif (($link) && ($db) && (sizeof($FATAL) == 0))
\r
101 // Did we found the module listed in allowed modules and are we successfully connected?
\r
102 $check = CHECK_MODULE($GLOBALS['module']);
\r
108 // Construct module name
\r
109 define('__MODULE', sprintf(PATH."inc/modules/%s.php", $GLOBALS['module']));
\r
111 // Does the module exists on local file system?
\r
112 if (((file_exists(__MODULE)) || (!empty($URL))) && (sizeof($FATAL) == 0))
\r
114 // Module is valid, active and located on the local disc...
\r
117 elseif (!empty($URL))
\r
119 // An URL was specified so we load the de-referrer module
\r
120 include (PATH."inc/loader.php");
\r
122 elseif (sizeof($FATAL) == 0)
\r
124 ADD_FATAL(LANG_MOD_REG_404_1.$GLOBALS['module'].LANG_MOD_REG_404_2);
\r
129 ADD_FATAL(LANG_MOD_REG_404_1.$GLOBALS['module'].LANG_MOD_REG_404_2);
\r
133 if (!file_exists(PATH."inc/modules/".$GLOBALS['module'].".php"))
\r
135 // Module does addionally not exists
\r
136 ADD_FATAL(LANG_MOD_REG_404_1.$GLOBALS['module'].LANG_MOD_REG_404_2);
\r
138 ADD_FATAL(LANG_MOD_LOCKED_1.$GLOBALS['module'].LANG_MOD_LOCKED_2);
\r
142 ADD_FATAL(LANG_MOD_UNKNOWN_1.$check.LANG_MOD_UNKNOWN_2);
\r
146 elseif (sizeof($FATAL) == 0)
\r
149 ADD_FATAL(MYSQL_ERRORS);
\r
154 /////////////////////////////////////////////
\r
155 // Main including line DO NOT REMOVE/EDIT! //
\r
156 /////////////////////////////////////////////
\r
158 // Everything is okay so we can load the module
\r
159 include (__MODULE);
\r
162 // Next-to-end add the footer
\r
163 include (PATH."inc/footer.php");
\r