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