Fixes for POST setter, template and others
[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  * $Revision::                                                        $ *
16  * $Date::                                                            $ *
17  * $Tag:: 0.2.1-FINAL                                                 $ *
18  * $Author::                                                          $ *
19  * Needs to be in all Files and every File needs "svn propset           *
20  * svn:keywords Date Revision" (autoprobset!) at least!!!!!!            *
21  * -------------------------------------------------------------------- *
22  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
23  * For more information visit: http://www.mxchange.org                  *
24  *                                                                      *
25  * This program is free software; you can redistribute it and/or modify *
26  * it under the terms of the GNU General Public License as published by *
27  * the Free Software Foundation; either version 2 of the License, or    *
28  * (at your option) any later version.                                  *
29  *                                                                      *
30  * This program is distributed in the hope that it will be useful,      *
31  * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
32  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
33  * GNU General Public License for more details.                         *
34  *                                                                      *
35  * You should have received a copy of the GNU General Public License    *
36  * along with this program; if not, write to the Free Software          *
37  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
38  * MA  02110-1301  USA                                                  *
39  ************************************************************************/
40
41 // Some security stuff...
42 if (!defined('__SECURITY')) {
43         die();
44 }
45
46 // Is the header already sent?
47 if (($GLOBALS['header_sent'] != '1') && ($GLOBALS['header_sent'] != '2')) {
48         // If not in CSS mode generate the header
49         if (getOutputMode() != '1') {
50                 // Config and database connection valid?
51                 if ((isConfigLocalLoaded()) && (isConfigLoaded()) && (SQL_IS_LINK_UP()) && (isExtensionActive('sql_patches'))) {
52                         // Init title
53                         $TITLE = '';
54
55                         // Title decoration enabled?
56                         if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_left') != '')) $TITLE .= trim(getConfig('title_left'))." ";
57
58                         // Do we have some extra title?
59                         if (isExtraTitleSet()) {
60                                 // Then prepent it
61                                 $TITLE .= getExtraTitle() . ' by ';
62                         } // END - if
63
64                         // Add main title
65                         $TITLE .= getConfig('MAIN_TITLE');
66
67                         // Add title of module? (middle decoration will also be added!)
68                         if ((getConfig('enable_mod_title') == 'Y') || ((!isWhatSet()) && (!isActionSet())) || (getModule() == 'admin')) {
69                                 $TITLE .= ' ' . trim(getConfig('title_middle')) . ' ' . getModuleTitle(getModule());
70                         } // END - if
71
72                         // Add title from what file
73                         $mode = '';
74                         if (getModule() == 'login') $mode = 'member';
75                         elseif (getModule() == 'index') $mode = 'guest';
76                         if ((!empty($mode)) && (getConfig('enable_what_title') == 'Y')) $TITLE .= " ".trim(getConfig('title_middle'))." ".getModuleDescription($mode, getWhat());
77
78                         // Add title decorations? (right)
79                         if ((getConfig('enable_title_deco') == 'Y') && (getConfig('title_right') != '')) $TITLE .= " ".trim(getConfig('title_right'));
80
81                         // Remember title in constant for the template
82                         $content['header_title'] = $TITLE;
83                 } elseif ((isInstalled()) && (isAdminRegistered())) {
84                         // Installed, admin registered but no ext-sql_patches
85                         $content['header_title'] = '[-- ' . getConfig('MAIN_TITLE').' - '.getModuleTitle(getModule()) . ' --]';
86                 } elseif ((isInstalled()) && (!isAdminRegistered())) {
87                         // Installed but no admin registered
88                         $content['header_title'] = sprintf(getMessage('SETUP_OF_MXCHANGE'), getConfig('MAIN_TITLE'));
89                 } elseif ((!isInstalled()) || (!isAdminRegistered())) {
90                         // Installation mode
91                         $content['header_title'] = getMessage('INSTALLATION_OF_MXCHANGE');
92                 } else {
93                         // Configuration not found!
94                         $content['header_title'] = getMessage('NO_CONFIG_FOUND_TITLE');
95
96                         // Do not add the fatal message in installation mode
97                         if ((!isInstalling()) && (!isConfigLoaded())) addFatalMessage(__FILE__, __LINE__, getMessage('NO_CONFIG_FOUND'));
98                 }
99
100                 // Save some little memory
101                 unset($TITLE);
102
103                 // Output page header code
104                 loadTemplate('page_header', false, $content);
105
106                 // Include meta data in 'guest' module
107                 if (getModule() == 'index') {
108                         // Load meta data template
109                         loadTemplate('metadata');
110
111                         // Add meta description to header
112                         if ((isInstalled()) && (isAdminRegistered()) && (SQL_IS_LINK_UP())) {
113                                 // Add meta description not in admin and login module and when the script is installed
114                                 generateMetaDescriptionCode(getModule(), getWhat());
115                         } // END - if
116                 } // END - if
117
118                 // Include more header data here
119                 loadTemplate('header');
120
121                 // Include stylesheet
122                 loadIncludeOnce('inc/stylesheet.php');
123         } // END - if
124
125         // Closing HEAD tag
126         if (getOutputMode() != '1') outputHtml('</head>');
127         if ($GLOBALS['header_sent'] == 0) $GLOBALS['header_sent'] = 1;
128 } // END - if
129
130 // Add BODY tag or not?
131 if ((getOutputMode() != '1') && ($GLOBALS['header_sent'] == 1) && ((getModule() != 'frametester') || (isGetRequestElementSet('frame')))) {
132         loadTemplate('page_body');
133         $GLOBALS['header_sent'] = 2;
134 } // END - if
135
136 // [EOF]
137 ?>