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