50eebd774255d3736a3b39342311559c3f5f3f4b
[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 (!defined('__SECURITY')) {
38         $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
39         require($INC);
40 }
41
42 // Is the header already sent?
43 if (($GLOBALS['header_sent'] != "1") && ($GLOBALS['header_sent'] != "2")) {
44         // If not in CSS mode generate the header
45         if (($GLOBALS['output_mode'] != "1")) {
46                 // Generate header
47                 $TITLE = "";
48
49                 // Add title decorations? (left)
50                 if (!defined('__PAGE_TITLE')) {
51                         // Config and database connection valid?
52                         if ((isset($_CONFIG)) && (is_array($_CONFIG)) && (count($_CONFIG) > 1) && (SQL_IS_LINK_UP())) {
53                                 // Title decoration enabled?
54                                 if ((getConfig('enable_title_deco') == "Y") && (getConfig('title_left') != "")) $TITLE .= trim(getConfig('title_left'))." ";
55
56                                 // Do we have some extra title?
57                                 if (!empty($EXTRA_TITLE)) {
58                                         // Then prepent it
59                                         $TITLE .= $EXTRA_TITLE." by ";
60                                 } // END - if
61
62                                 // Add main title
63                                 $TITLE .= constant('MAIN_TITLE');
64
65                                 // Add title of module? (middle decoration will also be added!)
66                                 if ((getConfig('enable_mod_title') == "Y") || ((empty($GLOBALS['what'])) && (empty($GLOBALS['action']))) || ($GLOBALS['module'] == "admin")) $TITLE .= " ".trim(getConfig('title_middle'))." ".ADD_MODULE_TITLE($GLOBALS['module']);
67
68                                 // Add title from what file
69                                 $MODE = "";
70                                 if ($GLOBALS['module'] == "login") $MODE = "member";
71                                  elseif ($GLOBALS['module'] == "index") $MODE = "guest";
72                                 if ((!empty($MODE)) && (getConfig('enable_what_title') == "Y")) $TITLE .= " ".trim(getConfig('title_middle'))." ".GET_MOD_DESCR($MODE, $GLOBALS['what']);
73
74                                 // Add title decorations? (right)
75                                 if ((getConfig('enable_title_deco') == "Y") && (getConfig('title_right') != "")) $TITLE .= " ".trim(getConfig('title_right'));
76
77                                 // Remember title in constant for the template
78                                 define('__PAGE_TITLE', $TITLE);
79                         } elseif ((!isBooleanConstantAndTrue('mxchange_installed')) || (!isBooleanConstantAndTrue('admin_registered'))) {
80                                 // Load language file because it was missing in installation finalizer step... *sigh*
81                                 $INC = sprintf("inc/language/install_%s.php",
82                                         GET_LANGUAGE()
83                                 );
84                                 LOAD_INC_ONCE($INC);
85
86                                 // Installation mode
87                                 define('__PAGE_TITLE', getMessage('INSTALLATION_OF_MXCHANGE'));
88                         } else {
89                                 // Configuration not found!
90                                 define('__PAGE_TITLE', getMessage('NO_CONFIG_FOUND_TITLE'));
91
92                                 // Do not add the fatal message in installation mode
93                                 if (basename($_SERVER['PHP_SELF']) != "install.php") addFatalMessage(getMessage('NO_CONFIG_FOUND'));
94                         }
95                 } // END - if
96
97                 // Save some little memory
98                 unset($TITLE);
99
100                 // Output page header code
101                 LOAD_TEMPLATE("page_header");
102
103                 // Include meta data in "guest" module
104                 if ($GLOBALS['module'] == "index") {
105                         // Load meta data template
106                         LOAD_TEMPLATE("metadata");
107
108                         // Add meta description to header
109                         if ((isBooleanConstantAndTrue('mxchange_installed')) && (isBooleanConstantAndTrue('admin_registered')) && (SQL_IS_LINK_UP())) {
110                                 // Add meta description not in admin and login module and when the script is installed
111                                 META_DESCRIPTION($GLOBALS['module'], $GLOBALS['what']);
112                         } // END - if
113                 } // END - if
114
115                 // Include more header data here
116                 LOAD_TEMPLATE("header");
117
118                 // Include stylesheet
119                 LOAD_INC_ONCE("inc/stylesheet.php");
120         } // END - if
121
122         // Closing HEAD tag
123         if ($GLOBALS['output_mode'] != "1") OUTPUT_HTML("</head>");
124         $GLOBALS['header_sent'] = 1;
125 } // END - if
126
127 // Load body or not
128 if (($GLOBALS['module'] != "frametester") || (($GLOBALS['module'] == "frametester") && (REQUEST_ISSET_GET(('frame')))) || (($GLOBALS['header_sent'] == "1") && (REQUEST_ISSET_GET(('frame')))) && ($GLOBALS['output_mode'] != "1")) {
129         // Is the header sent and the script is not the mail confirmation script and not a CSS?
130         if (($GLOBALS['header_sent'] == "1") && (basename($_SERVER['PHP_SELF']) != "mailid.php") && ($GLOBALS['output_mode'] != "1")) {
131                 // Add BODY tag
132                 LOAD_TEMPLATE("page_body");
133                 $GLOBALS['header_sent'] = 2;
134         } // END - if
135 } // END - if
136
137 //
138 ?>