branch prepared
[mailer.git] / index.php
1 <?php
2 /************************************************************************
3  * MXChange v0.2.1                                    Start: 08/25/2003 *
4  * ===============                              Last change: 11/23/2004 *
5  *                                                                      *
6  * -------------------------------------------------------------------- *
7  * File              : index.php                                        *
8  * -------------------------------------------------------------------- *
9  * Short description : Index page. A simple redirection to modules.php  *
10  * -------------------------------------------------------------------- *
11  * Kurzbeschreibung  : Index-Seite. Eine simple Weiterleitung auf die   *
12  *           modules.php                                                *
13  * -------------------------------------------------------------------- *
14  *                                                                      *
15  * -------------------------------------------------------------------- *
16  * Copyright (c) 2003 - 2008 by Roland Haeder                           *
17  * For more information visit: http://www.mxchange.org                  *
18  *                                                                      *
19  * This program is free software; you can redistribute it and/or modify *
20  * it under the terms of the GNU General Public License as published by *
21  * the Free Software Foundation; either version 2 of the License, or    *
22  * (at your option) any later version.                                  *
23  *                                                                      *
24  * This program is distributed in the hope that it will be useful,      *
25  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
26  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
27  * GNU General Public License for more details.                         *
28  *                                                                      *
29  * You should have received a copy of the GNU General Public License    *
30  * along with this program; if not, write to the Free Software          *
31  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
32  * MA  02110-1301  USA                                                  *
33  ************************************************************************/
34
35 // Load security stuff here (Oh, I hope this is not unsecure? Am I paranoia??? ;-) )
36 require_once("inc/libs/security_functions.php");
37
38 // Init "action" and "what"
39 global $what, $action;
40 $GLOBALS['what'] = ""; $GLOBALS['action'] = "";
41 if (!empty($_GET['action'])) $GLOBALS['action'] = secureString($_GET['action']);
42 if (!empty($_GET['what'])) $GLOBALS['what'] = secureString($_GET['what']);
43
44 // Set module
45 $GLOBALS['module'] = "index";
46
47 // Load config.php
48 require ("inc/config.php");
49
50 // Is the script installed?
51 if (defined('mxchange_installed') && (mxchange_installed))
52 {
53         // Header
54         require(PATH."inc/header.php");
55
56         // Check for cookies
57         if (empty($_COOKIE['visited']) || ($CONFIG['index_delay'] == 0) || ($CONFIG['index_cookie'] == 0))
58         {
59                 if ($CONFIG['index_cookie'] > 0)
60                 {
61                         // Set cookie and remeber it for specified time
62                         @setcookie("visited", "true", (time() + $CONFIG['index_cookie']), COOKIE_PATH);
63                 }
64                  elseif (!empty($_COOKIE['visited']))
65                 {
66                         // Remove cookie when admin set 0 in setup
67                         @setcookie("visited", "", (time() - 3600), COOKIE_PATH);
68                 }
69
70                 // Template laden
71                 LOAD_TEMPLATE("index", false, ADD_URL_DATA(""));
72
73                 // Shall I insert an automated forward?
74                 if ($CONFIG['index_delay'] > 0)
75                 {
76                         // This will be a JavaScript-redirect!
77                         define('__DELAY_VALUE', ($CONFIG['index_delay'] * 1000 + 500));
78                         define('__MOD_VALUE'  , ADD_URL_DATA("index"));
79                         LOAD_TEMPLATE("index_forward");
80                 }
81         }
82          else
83         {
84                 // Redirect to main page
85                 LOAD_URL(URL."/modules.php?module=index");
86         }
87
88         // Footer
89         require(PATH."inc/footer.php");
90 }
91  else
92 {
93         // You have to configure first!
94         LOAD_URL("install.php");
95 }
96 // All done here...
97 ?>