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