Code rewritings, load base config improved and many minor fixes...
[mailer.git] / 0.2.1 / inc / modules / index.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 09/23/2003 *\r
4  * ===============                              Last change: 03/27/2004 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : index.php                                        *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : Entrance page                                    *\r
10  * -------------------------------------------------------------------- *\r
11  * Kurzbeschreibung  : Eingangsseite                                    *\r
12  * -------------------------------------------------------------------- *\r
13  *                                                                      *\r
14  * -------------------------------------------------------------------- *\r
15  * Copyright (c) 2003 - 2008 by Roland Haeder                           *\r
16  * For more information visit: http://www.mxchange.org                  *\r
17  *                                                                      *\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
22  *                                                                      *\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
27  *                                                                      *\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
33 \r
34 // Some security stuff...\r
35 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF']))\r
36 {\r
37         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";\r
38         require($INC);\r
39 }\r
40  elseif (!EXT_IS_ACTIVE("sql_patches", true))\r
41 {\r
42         // The extension "sql_patches" *MUST* be activated or you have lot's of problems!\r
43         LOAD_URL(URL."/modules.php?module=admin");\r
44 }\r
45 \r
46 // When the frameset is active redirect the user :)\r
47 if (frameset_active)\r
48 {\r
49         LOAD_URL(URL."/modules.php?module=frameset");\r
50 }\r
51 \r
52 // Load adverstising template\r
53 define('__GUEST_ADVERT', LOAD_TEMPLATE("guest_advert", true));\r
54 \r
55 // Generate a tableset for the menu title and content\r
56 LOAD_TEMPLATE("guest_header");\r
57 \r
58 // Add message here\r
59 if (!empty($_GET['msg']))\r
60 {\r
61         switch ($_GET['msg'])\r
62         {\r
63                 case CODE_LOGOUT_DONE      : $msg = LOGOUT_DONE; break;\r
64                 case CODE_LOGOUT_FAILED    : $msg = "<SPAN class=\"guest_failed\">".LOGOUT_FAILED."</SPAN>"; break;\r
65                 case CODE_DATA_INVALID     : $msg = MAIL_DATA_INVALID; break;\r
66                 case CODE_POSSIBLE_INVALID : $msg = MAIL_POSSIBLE_INVALID; break;\r
67                 case CODE_ACCOUNT_LOCKED   : $msg = MEMBER_ACCOUNT_LOCKED_UNC; break;\r
68                 case CODE_USER_404         : $msg = USER_NOT_FOUND; break;\r
69                 case CODE_STATS_404        : $msg = MAIL_STATS_404; break;\r
70                 case CODE_ALREADY_CONFIRMED: $msg = MAIL_ALREADY_CONFIRMED; break;\r
71                 case CODE_ERROR_MAILID     : $msg = ERROR_CONFIRMING_MAIL; break;\r
72                 case CODE_EXTENSION_PROBLEM: $msg = sprintf(EXTENSION_PROBLEM_EXT_INACTIVE, "mailid"); break;\r
73                 case CODE_COOKIES_DISABLED : $msg = LOGIN_NO_COOKIES; break;\r
74                 case CODE_BEG_SAME_AS_OWN  : $msg = BEG_SAME_UID_AS_OWN; break;\r
75                 case CODE_LOGIN_FAILED     : $msg = LOGIN_FAILED_GENERAL; break;\r
76                 default                    : $msg = UNKNOWN_MAILID_CODE_1.$_GET['msg'].UNKNOWN_MAILID_CODE_2; break;\r
77         }\r
78         LOAD_TEMPLATE("message", false, $msg);\r
79 }\r
80 \r
81 // Some of you needs this to be extracted into a template... ???\r
82 LOAD_TEMPLATE("guest_menu_td");\r
83 \r
84 // When no what value is provided take the "home" value\r
85 if (empty($GLOBALS['what'])) $GLOBALS['what'] = $CONFIG['index_home'];\r
86 \r
87 // Adding the main content module here\r
88 if (empty($GLOBALS['action']))\r
89 {\r
90         // Get action value from what value\r
91         $act = GET_ACTION("guest", $GLOBALS['what']);\r
92 }\r
93  else\r
94 {\r
95         // Get action value directly from URL\r
96         $act = COMPILE_CODE($GLOBALS['action']);\r
97 }\r
98 \r
99 // Add the guest's menu here...\r
100 if (($CONFIG['guest_menu'] == "Y") || (!EXT_IS_ACTIVE("sql_patches", true)))\r
101 {\r
102         // Show only when guest menu is active\r
103         ADD_MENU("guest", $act, $GLOBALS['what']);\r
104 }\r
105 \r
106 // TDs between menu and content\r
107 LOAD_TEMPLATE("guest_menu_content");\r
108 \r
109 $INC_ACTION = sprintf(PATH."inc/modules/guest/action-%s.php", $act);\r
110 if ((file_exists($INC_ACTION)) && (is_readable($INC_ACTION)) && (VALIDATE_MENU_ACTION("guest", $act, $GLOBALS['what'])))\r
111 {\r
112         // Requested module is available so we load it\r
113         require_once($INC_ACTION);\r
114 }\r
115  else\r
116 {\r
117         // Invalid module specified or not found...\r
118         LOAD_URL(URL."/modules.php?module=index");\r
119 }\r
120 \r
121 if (($CONFIG['guest_menu'] == "Y") || (!EXT_IS_ACTIVE("sql_patches", true)))\r
122 {\r
123         // TDs between content and </table>\r
124         LOAD_TEMPLATE("guest_content_footer");\r
125 \r
126         // Some advertising stuff?\r
127         LOAD_TEMPLATE("guest_advert2");\r
128 \r
129         OUTPUT_HTML ("  </TD>\r
130 </TR>");\r
131 \r
132         // Goto TOP template\r
133         LOAD_TEMPLATE("guest_goto_top");\r
134 }\r
135 \r
136 // Footer template (Thanx to Mr. Glaus!)\r
137 LOAD_TEMPLATE("guest_footer");\r
138 \r
139 //\r
140 ?>\r