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