db_Mark_Time('(Header Top)');
// Admin template
if (defined('THEME') && file_exists(THEME.'admin_template.php'))
{
require_once (THEME.'admin_template.php');
}
else
{
require_once (e_BASE.$e107->getFolder('themes').'templates/admin_template.php');
}
e107::js('core', 'colorbox/jquery.colorbox-min.js', 'jquery', 2);
e107::css('core', 'colorbox/colorbox.css', 'jquery');
e107::js('core', 'jquery.elastic.js', 'jquery', 2);
e107::js('core', 'jquery-ui-timepicker-addon.js', 'jquery', 2);
//e107::js('core', 'plupload/plupload.full.js', 'jquery', 2);
//e107::css('core', 'plupload/jquery.plupload.queue/css/jquery.plupload.queue.css', 'jquery');
//e107::js('core', 'plupload/jquery.plupload.queue/jquery.plupload.queue.js', 'jquery', 2);
e107::css('core', 'chosen/chosen.css', 'jquery');
e107::js('core', 'chosen/chosen.jquery.min.js', 'jquery', 2);
e107::css('core', 'password/style.css', 'jquery');
e107::js('core', 'password/jquery.pwdMeter.js', 'jquery', 2);
// e107::js("core", "core/mediaManager.js","jquery",3);
//e107::js("core", "tooltip/jquery.tipsy.js","jquery",3);
//e107::css('core', 'tooltip/tipsy.css', 'jquery');
e107::js("core", "tags/jquery.tagit.js","jquery",3);
e107::css('core', 'tags/jquery.tagit.css', 'jquery');
e107::css('core', 'core/admin.jquery.css', 'jquery');
e107::css('core', 'core/all.jquery.css', 'jquery');
e107::js("core", "core/admin.jquery.js","jquery",4); // Load all default functions.
e107::js("core", "core/all.jquery.js","jquery",4); // Load all default functions.
e107::js("core", "core/admin.js","prototype",3); // Load all default functions.
//
// *** 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.
// FIXME - outdated list
// A: Admin Defines and Links
// B: Send HTTP headers that come before any html
// C: Send start of HTML
// D: Send CSS
// E: Send JS
// 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'); Moved to boot.php
// FIXME - remove ASAP
if (isset($pref['del_unv']) && $pref['del_unv'] && $pref['user_reg_veri'] != 2)
{
$threshold = (time() - ($pref['del_unv'] * 60));
$sql->db_Delete("user", "user_ban = 2 AND user_join < '{$threshold}' ");
}
//
// B: Send HTTP headers (these come before ANY html)
// moved to boot.php
//
// B.2: Include admin LAN and icon defines
// Moved to boot.php
//
// C: Send start of HTML
//
// HTML 5 default.
if(!defined('XHTML4'))
{
echo "\n";
echo "\n";
echo "\n";
echo "\n";
}
else // XHTML
{
echo(defined("STANDARDS_MODE") ? "" : "\n")."\n";
echo "\n";
echo "
\n";
echo(defined("CORE_LC")) ? "\n" : "";
echo "\n";
}
echo (defined("VIEWPORT")) ? "\n" : "";
echo "".(defined("e_PAGETITLE") ? e_PAGETITLE." - " : (defined("PAGE_NAME") ? PAGE_NAME." - " : "")).LAN_head_4." :: ".SITENAME."\n";
//
// D: Send CSS
//
echo "\n";
$e_js = e107::getJs();
// Core CSS - XXX awaiting for path changes
if (!isset($no_core_css) || !$no_core_css)
{
//echo "\n";
$e_js->otherCSS('{e_WEB_CSS}e107.css');
}
// Register Plugin specific CSS
// DEPRECATED, use $e_js->pluginCSS('myplug', 'style/myplug.css'[, $media = 'all|screen|...']);
if (isset($eplug_css) && $eplug_css)
{
if(!is_array($eplug_css))
{
$eplug_css = array($eplug_css);
}
foreach($eplug_css as $kcss)
{
// echo ($kcss[0] == "<") ? $kcss : "\n";
$e_js->otherCSS($kcss);
}
}
//NEW - Iframe mod
if (!defsettrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss'])
{
$css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? 'admin_'.$pref['admincss'] : $pref['admincss'];
//echo "\n";
$e_js->themeCSS($css_file);
}
elseif (isset($pref['themecss']) && $pref['themecss'])
{
$css_file = file_exists(THEME.'admin_'.$pref['themecss']) ? 'admin_'.$pref['themecss'] : $pref['themecss'];
//echo "\n";
$e_js->themeCSS($css_file);
}
else
{
$css_file = file_exists(THEME.'admin_style.css') ? 'admin_style.css' : 'style.css';
//echo "\n";
$e_js->themeCSS($css_file);
}
// FIXME: TEXTDIRECTION compatibility CSS (marj?)
// TODO: probably better to externalise along with some other things above
// possibility to overwrite some CSS definition according to TEXTDIRECTION
// especially usefull for rtl.css
// see _blank theme for examples
if(defined('TEXTDIRECTION') && file_exists(THEME.'/'.strtolower(TEXTDIRECTION).'.css'))
{
//echo '
//';
$e_js->themeCSS(strtolower(TEXTDIRECTION).'.css');
}
// ################### RENDER CSS
// Other CSS - from unknown location, different from core/theme/plugin location or backward compatibility
$e_js->renderJs('other_css', false, 'css', false);
echo "\n\n";
// Core CSS
$e_js->renderJs('core_css', false, 'css', false);
echo "\n\n";
// Plugin CSS
$e_js->renderJs('plugin_css', false, 'css', false);
echo "\n\n";
// Theme CSS
//echo "\n";
$e_js->renderJs('theme_css', false, 'css', false);
echo "\n\n";
// Inline CSS - not sure if this should stay at all!
$e_js->renderJs('inline_css', false, 'css', false);
echo "\n\n";
//
// Unobtrusive JS via CSS, prevent 3rd party code overload
//
// require_once(e_FILE."/e_css.php"); //moved to e107_web/css/e107.css
//
// E: Send JS
//
echo "\n";
// Wysiwyg JS support on or off.
// your code should run off e_WYSIWYG
// Moved to boot.php
// [JSManager] Load JS Includes - Zone 1 - Before Library
e107::getJs()->renderJs('header', 1);
e107::getJs()->renderJs('header_inline', 1);
// Load Javascript Library consolidation script
$jslib = e107::getObject('e_jslib', null, e_HANDLER.'jslib_handler.php');
$jslib->renderHeader('admin', false);
// [JSManager] Load JS Includes - Zone 2 - After Library, before CSS
e107::getJs()->renderJs('header', 2);
e107::getJs()->renderJs('header_inline', 2);
//DEPRECATED - use e107::getJs()->headerFile('{e_PLUGIN}myplug/js/my.js', $zone = 2)
if (isset($eplug_js) && $eplug_js)
{
echo "\n\n";
echo "\n";
}
//FIXME - theme.js/user.js should be registered/rendered through e_jsmanager
if (file_exists(THEME.'theme.js'))
{
echo "\n";
}
if (is_readable(e_FILE.'user.js') && filesize(e_FILE.'user.js'))
{
echo "\n";
}
// [JSManager] Load JS Includes - Zone 3 - before e_meta and headerjs()
e107::getJs()->renderJs('header', 3);
e107::getJs()->renderJs('header_inline', 3);
//
// F: Send Meta Tags and Icon links
//
echo "\n";
// --- Load plugin Meta files and eplug_ before others --------
if (vartrue($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");
}
}
}
//XXX - do we still need it? Now we have better way of doing this - admin tools (see below)
if (function_exists('headerjs'))
{
echo headerjs();
}
// Admin UI - send header content if any - headerjs() replacement
$tmp = e107::getAdminUI();
if($tmp)
{
// Note: normally you shouldn't send JS content here, former is (much better) handled by JS manager (both files and inline)
echo $tmp->getHeader();
}
unset($tmp);
// [JSManager] Load JS Includes - Zone 4 - After e_meta, headerjs, before Admin UI headers
e107::getJs()->renderJs('header', 4);
e107::getJs()->renderJs('header_inline', 4);
// ---------- 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
//
/*
* Admin LAN
* TODO - remove it from here
*/
e107::js('inline',"
(".e_jshelper::toString(LAN_JSCONFIRM).").addModLan('core', 'delete_confirm');
(".e_jshelper::toString(LAN_DELETE).").addModLan('core', 'delete');
",'prototype',5);
// [JSManager] Load JS Includes - Zone 5 - After theme_head, before e107:loaded trigger
// unobtrusive JS - moved here from external e_css.php
e107::getJs()->renderJs('header', 5);
/*
* Fire Event e107:loaded - Prototype only
*/
//\$('e-js-css').remove();
e107::js('inline',"
document.observe('dom:loaded', function () {
e107Event.trigger('loaded', null, document);
});
",'prototype',5);
e107::getJs()->renderJs('header_inline', 5);
echo "
\n";
// Header included notification, from this point header includes are not possible
define('HEADER_INIT', TRUE);
e107::getDb()->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
//
// moved to boot.php
//$ns = new e107table;
//$e107_var = array();
// function e_admin_me/nu moved to boot.php (e107::getNav()->admin)
// legacy function show_admin_menu moved to boot.php
// include admin_template.php moved to boot.php
// function parse_admin moved to boot.php
// legacy function admin_update moved to boot.php
// (legacy?) function admin_purge_related moved to boot.php
$sql->db_Mark_Time('Parse Admin Header');
//NEW - Iframe mod
if (!deftrue('e_IFRAME'))
{
//removed check strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE
parse_admin($ADMIN_HEADER);
}
$sql->db_Mark_Time('(End: Parse Admin Header)');
}
// XXX - we don't need this (use e107::getMessage()) - find out what's using it and remove it
if (!varset($emessage) && !is_object($emessage))
{
$emessage = e107::getMessage();
}