Code rewritings, load base config improved and many minor fixes...
[mailer.git] / 0.2.1 / inc / header.php
1 <?php\r
2 /************************************************************************\r
3  * MXChange v0.2.1                                    Start: 08/25/2003 *\r
4  * ===============                              Last change: 11/24/2004 *\r
5  *                                                                      *\r
6  * -------------------------------------------------------------------- *\r
7  * File              : header.php                                       *\r
8  * -------------------------------------------------------------------- *\r
9  * Short description : Outputs header HTML code, will not when frameset *\r
10  *           is active                                                  *\r
11  * -------------------------------------------------------------------- *\r
12  * Kurzbeschreibung  : Gibt nur dann HTML-Code fuer den Kopf-Bereich    *\r
13  *           aus, wenn Frameset nicht aktiv ist                         *\r
14  * -------------------------------------------------------------------- *\r
15  *                                                                      *\r
16  * -------------------------------------------------------------------- *\r
17  * Copyright (c) 2003 - 2008 by Roland Haeder                           *\r
18  * For more information visit: http://www.mxchange.org                  *\r
19  *                                                                      *\r
20  * This program is free software; you can redistribute it and/or modify *\r
21  * it under the terms of the GNU General Public License as published by *\r
22  * the Free Software Foundation; either version 2 of the License, or    *\r
23  * (at your option) any later version.                                  *\r
24  *                                                                      *\r
25  * This program is distributed in the hope that it will be useful,      *\r
26  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *\r
27  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *\r
28  * GNU General Public License for more details.                         *\r
29  *                                                                      *\r
30  * You should have received a copy of the GNU General Public License    *\r
31  * along with this program; if not, write to the Free Software          *\r
32  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *\r
33  * MA  02110-1301  USA                                                  *\r
34  ************************************************************************/\r
35 \r
36 // Some security stuff...\r
37 if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {\r
38         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";\r
39         require($INC);\r
40 }\r
41 \r
42 if (defined('frameset_active')) {\r
43         // Initialize variables\r
44         $header = ""; $FOOTER = "";\r
45         if (empty($GLOBALS['what'])) $GLOBALS['what'] = "";\r
46         if (($header != "1") && ($header != "2")) {\r
47                 // If not in CSS mode generate the header\r
48                 if (($CSS != "1")) {\r
49                         // Generate header\r
50                         $TITLE = "";\r
51 \r
52                         // Add title decorations? (left)\r
53                         if ((!empty($CONFIG)) && (isset($link)) && (isset($db))) {\r
54                                 if (($CONFIG['title_decoration'] == "Y") && (trim(!empty($CONFIG['title_left'])))) $TITLE .= trim($CONFIG['title_left'])." ";\r
55                                 $TITLE .= MAIN_TITLE;\r
56 \r
57                                 // Add title of module? (middle decoration will also be added!)\r
58                                 if (($CONFIG['title_mod_show'] == "Y") || ((empty($GLOBALS['what'])) && (empty($GLOBALS['action']))) || ($GLOBALS['module'] == "admin")) $TITLE .= " ".trim($CONFIG['title_middle'])." ".ADD_MODULE_TITLE($GLOBALS['module']);\r
59 \r
60                                 // Add title from what file\r
61                                 $MODE = "";\r
62                                 if ($GLOBALS['module'] == "login") $MODE = "member";\r
63                                  elseif ($GLOBALS['module'] == "index") $MODE = "guest";\r
64                                 if ((!empty($MODE)) && ($CONFIG['title_what_show'] == "Y")) $TITLE .= " ".trim($CONFIG['title_middle'])." ".GET_MOD_DESCR($MODE, $GLOBALS['what']);\r
65 \r
66                                 // Add title decorations? (right)\r
67                                 if (($CONFIG['title_decoration'] == "Y") && (!empty($CONFIG['title_right']))) $TITLE .= " ".trim($CONFIG['title_right']);\r
68 \r
69                                 // Remember title in constant for the template\r
70                                 define('__PAGE_TITLE', html_entity_decode($TITLE));\r
71                         } elseif ((!mxchange_installed) || (!admin_registered)) {\r
72                                 // Load language file because it was missing in installation finalizer step... *sigh*\r
73                                 require_once(sprintf("%sinc/language/install_%s.php",\r
74                                         PATH,\r
75                                         GET_LANGUAGE()\r
76                                 ));\r
77 \r
78                                 // Installation mode\r
79                                 define('__PAGE_TITLE', INSTALLATION_OF_MXCHANGE);\r
80                         } else {\r
81                                 // Configuration not found!\r
82                                 define('__PAGE_TITLE', NO_CONFIG_FOUND_TITLE);\r
83                                 ADD_FATAL(NO_CONFIG_FOUND);\r
84                         }\r
85 \r
86                         // Save some little memory\r
87                         unset($TITLE);\r
88 \r
89                         // Output page header code\r
90                         LOAD_TEMPLATE("page_header");\r
91 \r
92                         // Include meta data here\r
93                         LOAD_TEMPLATE("metadata");\r
94 \r
95                         // Add meta description to header\r
96                         if ((mxchange_installed) && (admin_registered) && ($GLOBALS['module'] != "admin") && ($GLOBALS['module'] != "login") && (isset($db)) && (isset($link))) {\r
97                                 // Add meta description not in admin and login module and when the script is installed\r
98                                 META_DESCRIPTION($GLOBALS['module'], $GLOBALS['what']);\r
99                         }\r
100 \r
101                         // Include more header data here\r
102                         LOAD_TEMPLATE("header");\r
103 \r
104                         // Include stylesheet\r
105                         include (PATH."inc/stylesheet.php");\r
106                 }\r
107 \r
108                 // Closing HEAD tag\r
109                 if ($CSS != "1") OUTPUT_HTML ("</HEAD>\n");\r
110                 $header = 1;\r
111         }\r
112 \r
113         // Set unsetted variables\r
114         if (empty($_GET['frame'])) $_GET['frame'] = "";\r
115 \r
116         // Load body or not\r
117         if (((!frameset_active) && ($GLOBALS['module'] != "frametester")) || (($header == "1") && ($GLOBALS['module'] == "frametester") && (!empty($_GET['frame']))) && ($CSS != "1")) {\r
118                 // Is the header sent and the script is not the mail confirmation script and not a CSS?\r
119                 if (($header == "1") && (basename($_SERVER['PHP_SELF']) != "mailid.php") && ($CSS != "1")) {\r
120                         // Add BODY tag\r
121                         LOAD_TEMPLATE("page_body");\r
122                         $header = 2;\r
123                 }\r
124         }\r
125 } else {\r
126         // Something is missing\r
127         die ("<STRONG>Fatal error:</STRONG> You have to define <STRONG>frameset_active</STRONG>!");\r
128 }\r
129 //\r
130 ?>\r