Extension 'yoomedia' now alpha status, some rewrites
[mailer.git] / 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 (!defined('__SECURITY')) {
36         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
37         require($INC);
38 } elseif (!EXT_IS_ACTIVE("sql_patches", true)) {
39         // The extension "sql_patches" *MUST* be activated or you have lot's of problems!
40         LOAD_URL("modules.php?module=admin");
41 }
42
43 // Load adverstising template
44 define('__GUEST_ADVERT', LOAD_TEMPLATE("guest_advert", true));
45
46 // Generate a tableset for the menu title and content
47 LOAD_TEMPLATE("guest_header");
48
49 // Add message here
50 if (!empty($_GET['msg'])) {
51         switch ($_GET['msg']) {
52                 case CODE_LOGOUT_DONE      : $msg = LOGOUT_DONE; break;
53                 case CODE_LOGOUT_FAILED    : $msg = "<SPAN class=\"guest_failed\">".LOGOUT_FAILED."</SPAN>"; break;
54                 case CODE_DATA_INVALID     : $msg = MAIL_DATA_INVALID; break;
55                 case CODE_POSSIBLE_INVALID : $msg = MAIL_POSSIBLE_INVALID; break;
56                 case CODE_ACCOUNT_LOCKED   : $msg = MEMBER_ACCOUNT_LOCKED_UNC; break;
57                 case CODE_USER_404         : $msg = USER_NOT_FOUND; break;
58                 case CODE_STATS_404        : $msg = MAIL_STATS_404; break;
59                 case CODE_ALREADY_CONFIRMED: $msg = MAIL_ALREADY_CONFIRMED; break;
60
61                 case CODE_ERROR_MAILID:
62                         if (EXT_IS_ACTIVE($ext, true)) { $msg = ERROR_CONFIRMING_MAIL; } else { $msg = sprintf(EXTENSION_PROBLEM_NOT_INSTALLED, "mailid"); }
63                         break;
64
65                 case CODE_EXTENSION_PROBLEM:
66                         // Default extension is "unknown"
67                         $ext = "unknown";
68
69                         // Is extension given?
70                         if (!empty($_GET['ext'])) $ext = SQL_ESCAPE($_GET['ext']);
71                         $msg = sprintf(EXTENSION_PROBLEM_EXT_INACTIVE, $ext);
72                         break;
73
74                 case CODE_COOKIES_DISABLED : $msg = LOGIN_NO_COOKIES; break;
75                 case CODE_BEG_SAME_AS_OWN  : $msg = BEG_SAME_UID_AS_OWN; break;
76                 case CODE_LOGIN_FAILED     : $msg = LOGIN_FAILED_GENERAL; break;
77                 default                    : $msg = UNKNOWN_MAILID_CODE_1.$_GET['msg'].UNKNOWN_MAILID_CODE_2; break;
78         }
79
80         // Load message template
81         LOAD_TEMPLATE("message", false, $msg);
82 } // END - if
83
84 // Some of you needs this to be extracted into a template... ???
85 LOAD_TEMPLATE("guest_menu_td");
86
87 // When no what value is provided take the "home" value
88 if (empty($GLOBALS['what'])) $GLOBALS['what'] = $_CONFIG['index_home'];
89
90 // Adding the main content module here
91 if (empty($GLOBALS['action'])) {
92         // Get action value from what value
93         $act = GET_ACTION("guest", $GLOBALS['what']);
94 } else {
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         // Show only when guest menu is active
102         ADD_MENU("guest", $act, $GLOBALS['what']);
103 } // END - if
104
105 // TDs between menu and content
106 LOAD_TEMPLATE("guest_menu_content");
107
108 $INC_ACTION = sprintf("%sinc/modules/guest/action-%s.php", PATH, $act);
109 if ((FILE_READABLE($INC_ACTION)) && (VALIDATE_MENU_ACTION("guest", $act, $GLOBALS['what']))) {
110         // Requested module is available so we load it
111         require_once($INC_ACTION);
112 } else {
113         // Invalid module specified or not found...
114         LOAD_URL("modules.php?module=index");
115 }
116
117 if (($_CONFIG['guest_menu'] == "Y") || (!EXT_IS_ACTIVE("sql_patches", true))) {
118         // TDs between content and </table>
119         LOAD_TEMPLATE("guest_content_footer");
120
121         // Some advertising stuff?
122         LOAD_TEMPLATE("guest_advert2");
123
124         OUTPUT_HTML("  </TD>
125 </TR>");
126
127         // Goto TOP template
128         LOAD_TEMPLATE("guest_goto_top");
129 } // END - if
130
131 // Footer template (Thanx to Mr. Glaus!)
132 LOAD_TEMPLATE("guest_footer");
133
134 //
135 ?>