db_Mark_Time('(Header Top)');
//
// *** Code sequence for headers ***
// IMPORTANT: These items are in a carefully constructed order. DO NOT REARRANGE
// without checking with experienced devs! Various subtle things WILL break.
//
// We realize this is a bit (!) of a mess and hope to make further cleanups in a future release.
//
// A: Admin Defines and Links
// B: Send HTTP headers that come before any html
// C: Send start of HTML
// D: Send JS
// E: Send CSS
// F: Send Meta Tags and Icon links
// G: Send final theme headers (theme_head() function)
// H: Generate JS for image preloading (setup for onload)
// I: Calculate onload() JS functions to be called
// J: Send end of html
and start of
// K: (The rest is ignored for popups, which have no menus)
// L: (optional) Body JS to disable right clicks
// M: Send top of body for custom pages and for news
// N: Send other top-of-body HTML
//
// Load order notes for devs
// * Browsers wait until ALL HTML has loaded before executing ANY JS
// * The last CSS tag downloaded supercedes earlier CSS tags
// * Browsers don't care when Meta tags are loaded. We load last due to
// a quirk of e107's log subsystem.
// * Multiple external file references slow down page load. Each one requires
// browser-server interaction even when cached.
//
//
// A: Admin Defines and Links
//
require_once(e_ADMIN.'ad_links.php');
//
// B: Send HTTP headers (these come before ANY html)
//
// send the charset to the browser - overrides spurious server settings with the lan pack settings.
header("Content-type: text/html; charset=".CHARSET, true);
echo (defined("STANDARDS_MODE") ? "" : "\n")."\n";
//
// B.2: Include admin LAN defines
//
if (file_exists(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_header.php')) {
@include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_header.php");
} else {
@include_once(e_LANGUAGEDIR."English/admin/lan_header.php");
}
if (file_exists(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_footer.php')) {
@include_once(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_footer.php');
} else {
@include_once(e_LANGUAGEDIR.'English/admin/lan_footer.php');
}
if (!defined('ADMIN_WIDTH')) {
define('ADMIN_WIDTH', 'width: 95%');
}
if (!defined('ADMIN_TRUE_ICON'))
{
define("ADMIN_TRUE_ICON", "");
define("ADMIN_TRUE_ICON_PATH", e_IMAGE."fileinspector/integrity_pass.png");
}
if (!defined('ADMIN_FALSE_ICON'))
{
define("ADMIN_FALSE_ICON", "");
define("ADMIN_FALSE_ICON_PATH", e_IMAGE."fileinspector/integrity_fail.png");
}
if (!defined('ADMIN_EDIT_ICON'))
{
define("ADMIN_EDIT_ICON", "");
define("ADMIN_EDIT_ICON_PATH", e_IMAGE."admin_images/edit_16.png");
}
if (!defined('ADMIN_DELETE_ICON'))
{
define("ADMIN_DELETE_ICON", "");
define("ADMIN_DELETE_ICON_PATH", e_IMAGE."admin_images/delete_16.png");
}
//
// C: Send start of HTML
//
echo "
".SITENAME." : ".LAN_head_4."\n";
//
// D: Send JS
//
echo "\n";
// Wysiwyg JS support on or off.
// your code should run off e_WYSIWYG
if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html']) && varset($e_wysiwyg) != "") {
require_once(e_HANDLER."tiny_mce/wysiwyg.php");
define("e_WYSIWYG",TRUE);
echo wysiwyg($e_wysiwyg);
}else{
define("e_WYSIWYG",FALSE);
}
if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) {
echo "\n";
}
if (file_exists(THEME.'theme.js')) { echo "\n"; }
if (filesize(e_FILE.'user.js')) { echo "\n"; }
if (isset($eplug_js) && $eplug_js) {
echo "\n\n";
echo "\n";
}
if (isset($htmlarea_js) && $htmlarea_js) {
echo $htmlarea_js;
}
if ((strpos(e_SELF, 'fileinspector.php') === FALSE) && getperms("0"))
{
echo "\n";
}
if (function_exists('headerjs')){echo headerjs(); }
//
// E: Send CSS
//
echo "\n";
if (isset($eplug_css) && $eplug_css) {
echo "\n\n";
echo "\n";
}
echo "\n";
if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE && isset($pref['admincss']) && $pref['admincss'] && file_exists(THEME.$pref['admincss'])) {
$css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? THEME_ABS.'admin_'.$pref['admincss'] : THEME_ABS.$pref['admincss'];
echo "\n";
} else if (isset($pref['themecss']) && $pref['themecss'] && file_exists(THEME.$pref['themecss']))
{
$css_file = file_exists(THEME.'admin_'.$pref['themecss']) ? THEME_ABS.'admin_'.$pref['themecss'] : THEME_ABS.$pref['themecss'];
echo "\n";
}
else
{
$css_file = file_exists(THEME.'admin_style.css') ? THEME_ABS.'admin_style.css' : THEME_ABS.'style.css';
echo "\n";
}
if (!isset($no_core_css) || !$no_core_css) {
echo "\n";
}
//
// F: Send Meta Tags and Icon links
//
echo "\n";
// Multi-Language meta-tags with merge and override option.
echo "
\n";
// --- Load plugin Meta files and eplug_ before others --------
if (is_array($pref['e_meta_list']))
{
foreach($pref['e_meta_list'] as $val)
{
if(is_readable(e_PLUGIN.$val."/e_meta.php"))
{
echo "\n";
require_once(e_PLUGIN.$val."/e_meta.php");
}
}
}
// ---------- Favicon ---------
if (file_exists(THEME."favicon.ico")) {
echo "\n\n";
}elseif (file_exists(e_BASE."favicon.ico")) {
echo "\n\n";
}
//
// G: Send Theme Headers
//
if(function_exists('theme_head')){
echo "\n\n";
echo theme_head();
}
//
// H: Generate JS for image preloads [user mode only]
//
echo "\n\n";
//
// I: Calculate JS onload() functions for the BODY tag [user mode only]
//
$body_onload = "";
//
// J: Send end of and start of
//
echo "
\n";
$sql->db_Mark_Time("End Head, Start Body");
//
// K: (The rest is ignored for popups, which have no menus)
//
// require $e107_popup =1; to use it as header for popup without menus
if(!isset($e107_popup))
{
$e107_popup = 0;
}
if ($e107_popup != 1) {
//
// L: (optional) Body JS to disable right clicks [reserved; user mode]
//
//
// M: Send top of body for custom pages and for news [user mode only]
//
//
// N: Send other top-of-body HTML
//
$ns = new e107table;
$e107_var = array();
if (!function_exists('show_admin_menu')) {
function show_admin_menu($title, $active_page, $e107_vars, $js = FALSE, $sub_link = FALSE, $sortlist = FALSE) {
global $ns, $BUTTON, $BUTTON_OVER, $BUTTONS_START, $BUTTONS_END, $SUB_BUTTON, $SUB_BUTTON_OVER, $SUB_BUTTONS_START, $SUB_BUTTONS_END;
$id_title = "yop_".str_replace(" ", "", $title);
if (!isset($BUTTONS_START)) {
$BUTTONS_START = "