2011-05-18 14:04:37 +00:00
< ? php
2006-12-02 04:36:16 +00:00
/*
2009-10-01 15:05:41 +00:00
* e107 website system
*
2012-02-16 14:18:17 +00:00
* Copyright ( C ) 2008 - 2012 e107 Inc ( e107 . org )
2009-10-01 15:05:41 +00:00
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
* Admin Header
*
2012-11-20 15:53:52 -08:00
* $URL : $
* $Id : $
2006-12-02 04:36:16 +00:00
*/
2021-01-27 12:20:58 -08:00
if ( ! defined ( 'e107_INIT' ))
2009-10-01 15:05:41 +00:00
{
exit ;
}
2021-01-27 12:20:58 -08:00
if ( ! defined ( 'ADMIN_AREA' )) //avoid PHP warning
2009-08-19 14:39:57 +00:00
{
2020-12-25 10:23:56 -08:00
define ( " ADMIN_AREA " , true );
2009-08-19 14:39:57 +00:00
}
2013-05-09 00:24:02 -07:00
if ( ! defined ( 'USER_AREA' ))
{
2020-12-25 10:23:56 -08:00
define ( " USER_AREA " , false );
2013-05-09 00:24:02 -07:00
}
2017-01-03 17:57:00 -08:00
2020-05-02 15:35:30 -07:00
e107 :: getDebug () -> logTime ( '(Header Top)' );
2006-12-05 09:28:02 +00:00
2013-03-02 21:07:42 -08:00
function loadJSAddons ()
2012-12-17 13:21:43 -08:00
{
2021-01-27 12:20:58 -08:00
2017-01-03 17:57:00 -08:00
if ( deftrue ( 'e_MENUMANAGER_ACTIVE' ))
2013-03-02 21:07:42 -08:00
{
2021-01-27 12:20:58 -08:00
return ;
2013-03-02 21:07:42 -08:00
}
2012-05-27 10:42:16 +00:00
2017-07-25 19:20:11 +02:00
// TODO use Library Manager. Remove unused libraries...
e107 :: css ( 'core' , 'bootstrap-select/bootstrap-select.min.css' , 'jquery' );
e107 :: js ( 'footer' , '{e_WEB}js/bootstrap-select/bootstrap-select.min.js' , 'jquery' , 2 );
2021-01-27 12:20:58 -08:00
2019-12-02 14:18:25 -08:00
// e107::css('core', 'bootstrap-multiselect/css/bootstrap-multiselect.css', 'jquery');
2017-07-25 19:20:11 +02:00
e107 :: js ( 'footer' , '{e_WEB}js/bootstrap-multiselect/js/bootstrap-multiselect.js' , 'jquery' , 2 );
2015-05-23 14:49:44 +02:00
// TODO: remove typeahead.
2017-07-25 19:20:11 +02:00
e107 :: js ( 'footer' , '{e_WEB}js/bootstrap-jasny/js/jasny-bootstrap.js' , 'jquery' , 2 );
2021-01-27 12:20:58 -08:00
2017-07-25 19:20:11 +02:00
e107 :: css ( 'core' , 'bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css' , 'jquery' );
e107 :: js ( 'footer' , '{e_WEB}js/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js' , 'jquery' , 2 );
2021-01-27 12:20:58 -08:00
e107 :: js ( 'footer' , '{e_WEB}js/jquery.h5validate.min.js' , 'jquery' , 2 );
2017-07-25 19:20:11 +02:00
e107 :: js ( 'footer' , '{e_WEB}js/jquery.elastic.js' , 'jquery' , 2 );
e107 :: js ( 'footer' , '{e_WEB}js/jquery.at.caret.min.js' , 'jquery' , 2 );
2013-07-12 13:52:39 -07:00
2017-07-25 19:20:11 +02:00
e107 :: css ( 'core' , 'core/admin.jquery.css' , 'jquery' );
e107 :: css ( 'core' , 'core/all.jquery.css' , 'jquery' );
2013-03-02 21:07:42 -08:00
2017-07-25 19:20:11 +02:00
e107 :: js ( 'footer' , '{e_WEB}js/core/admin.jquery.js' , 'jquery' , 5 ); // Load all default functions.
e107 :: js ( 'footer' , '{e_WEB}js/core/all.jquery.js' , 'jquery' , 5 ); // Load all default functions.
2017-01-16 14:04:36 -08:00
2018-02-27 14:04:35 +01:00
$plUpload = 'plupload/i18n/' . e_LAN . '.js' ;
2017-01-16 14:04:36 -08:00
2021-01-27 12:20:58 -08:00
if ( e_LAN != 'en' && file_exists ( e_WEB_JS . $plUpload ))
{
e107 :: js ( 'footer' , e_WEB_JS . $plUpload , 'jquery' , 5 );
}
2013-03-02 21:07:42 -08:00
}
2012-07-01 00:56:59 +00:00
2017-03-02 20:55:31 +01:00
// Load other JS files.
2013-03-02 21:07:42 -08:00
loadJSAddons ();
2012-05-27 10:42:16 +00:00
2015-07-26 17:33:15 -07:00
2013-02-25 02:47:23 -08:00
// e107::js("core", "core/admin.js","prototype",3); // Load all default functions.
2012-06-09 04:44:11 +00:00
2006-12-05 09:28:02 +00:00
//
// *** 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.
2012-11-29 10:47:26 +02:00
// FIXME - outdated list
2006-12-05 09:28:02 +00:00
// A: Admin Defines and Links
// B: Send HTTP headers that come before any html
// C: Send start of HTML
2010-01-12 07:38:29 +00:00
// D: Send CSS
// E: Send JS
2006-12-05 09:28:02 +00:00
// 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 <head> and start of <body>
// 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 <link> file references slow down page load. Each one requires
// browser-server interaction even when cached.
//
//
// A: Admin Defines and Links
//
2014-01-19 03:55:07 -08:00
2008-01-06 22:16:37 +00:00
2006-12-05 09:28:02 +00:00
//
// B: Send HTTP headers (these come before ANY html)
2012-11-29 10:47:26 +02:00
// moved to boot.php
2012-05-13 05:26:11 +00:00
2006-12-05 09:28:02 +00:00
//
2012-11-29 10:47:26 +02:00
// B.2: Include admin LAN and icon defines
// Moved to boot.php
2006-12-02 04:36:16 +00:00
2006-12-05 09:28:02 +00:00
//
// C: Send start of HTML
//
2017-01-03 17:57:00 -08:00
echo " <!doctype html> \n " ;
2021-01-27 12:20:58 -08:00
echo " <html " . ( defined ( " TEXTDIRECTION " ) ? " dir=' " . TEXTDIRECTION . " ' " : " " ) . ( defined ( " CORE_LC " ) ? " lang= \" " . CORE_LC . " \" " : " " ) . " > \n " ;
echo " <head> \n <title> " . ( defined ( " e_PAGETITLE " ) ? e_PAGETITLE . " - " : ( defined ( " PAGE_NAME " ) ? PAGE_NAME . " - " : " " )) . LAN_HEADER_04 . " :: " . SITENAME . " </title> \n " ;
2017-01-03 17:57:00 -08:00
echo " <meta charset='utf-8' /> \n " ;
2016-11-05 09:33:16 +00:00
echo " <meta name= \" viewport \" content= \" width=device-width, initial-scale=0.8, maximum-scale=1 \" /> \n " ; // Works better for iOS but still has some issues.
2006-12-02 04:36:16 +00:00
2006-12-05 09:28:02 +00:00
//
2010-01-12 07:38:29 +00:00
// D: Send CSS
//
echo " <!-- *CSS* --> \n " ;
2021-01-27 12:20:58 -08:00
$e_js = e107 :: getJs ();
2018-05-12 10:22:58 -07:00
2010-02-01 17:15:59 +00:00
// Core CSS - XXX awaiting for path changes
2021-01-27 12:20:58 -08:00
if ( ! isset ( $no_core_css ) || ! $no_core_css )
2010-01-12 07:38:29 +00:00
{
2012-06-01 20:50:29 +00:00
$e_js -> otherCSS ( '{e_WEB_CSS}e107.css' );
2010-01-12 07:38:29 +00:00
}
2010-02-01 17:15:59 +00:00
2017-01-01 08:13:42 -08:00
2017-01-03 17:57:00 -08:00
// Register Plugin specific CSS (BC)
2021-01-27 12:20:58 -08:00
if ( isset ( $eplug_css ) && $eplug_css )
2010-02-01 17:15:59 +00:00
{
2021-01-27 12:20:58 -08:00
e107 :: getMessage () -> addDebug ( 'Deprecated $eplug_css method detected. Use e107::css() in an e_header.php file instead.' . print_a ( $eplug_css , true ));
if ( ! is_array ( $eplug_css ))
2010-02-01 17:15:59 +00:00
{
$eplug_css = array ( $eplug_css );
}
foreach ( $eplug_css as $kcss )
{
$e_js -> otherCSS ( $kcss );
}
}
2013-03-18 22:12:27 -07:00
2017-01-03 17:57:00 -08:00
if ( deftrue ( 'e_MENUMANAGER_ACTIVE' )) // load frontend style.css
2013-07-08 05:36:01 -07:00
{
2022-04-06 10:15:11 -07:00
if ( method_exists ( 'theme' , 'css' )) // new v2.3.2 theme styles load override.
{
e107 :: callMethod ( 'theme' , 'css' );
}
else
{
$css_file = $pref [ 'themecss' ];
$e_js -> themeCSS ( $css_file ); // Test with superhero.css for frontend bootstrap and 'dark' for backend bootstrap.
}
2013-07-08 05:36:01 -07:00
}
2017-01-03 17:57:00 -08:00
else // backend css.
2013-07-12 12:06:19 -07:00
{
2017-01-03 17:57:00 -08:00
$custom = e107 :: getThemeGlyphs ();
foreach ( $custom as $val )
{
$e_js -> otherCSS ( $val [ 'path' ]);
}
2021-01-27 12:20:58 -08:00
//NEW - Iframe mod
/*
if ( ! deftrue ( 'e_IFRAME' ) && ! empty ( $pref [ 'admincss' ]))
{
$css_file = file_exists ( THEME . 'admin_' . $pref [ 'admincss' ]) ? 'admin_' . $pref [ 'admincss' ] : $pref [ 'admincss' ];
//echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
$e_js -> themeCSS ( $css_file );
2017-01-03 17:57:00 -08:00
2013-07-12 12:06:19 -07:00
}
2021-01-27 12:20:58 -08:00
elseif ( isset ( $pref [ 'themecss' ]) && $pref [ 'themecss' ])
{
$css_file = ( file_exists ( THEME . 'admin_' . $pref [ 'themecss' ])) ? 'admin_' . $pref [ 'themecss' ] : $pref [ 'themecss' ];
//echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
// $e_js->themeCSS($css_file); // Test with superhero.css for frontend bootstrap and 'dark' for backend bootstrap.
}
else
{
$css_file = ( file_exists ( THEME . 'admin_style.css' )) ? 'admin_style.css' : 'style.css' ;
//echo "<link rel='stylesheet' href='".$css_file."' type='text/css' />\n";
$e_js -> themeCSS ( $css_file );
} */
2013-07-08 05:36:01 -07:00
2021-01-27 12:20:58 -08:00
}
2017-01-03 17:57:00 -08:00
2010-01-12 07:38:29 +00:00
// 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
2021-01-27 12:20:58 -08:00
if ( defined ( 'TEXTDIRECTION' ) && file_exists ( THEME . '/' . strtolower ( TEXTDIRECTION ) . '.css' ))
2010-01-12 07:38:29 +00:00
{
2021-01-27 12:20:58 -08:00
$e_js -> themeCSS ( strtolower ( TEXTDIRECTION ) . '.css' );
2010-01-12 07:38:29 +00:00
}
2015-02-12 13:07:41 -08:00
// --- Load plugin Header files before all CSS nad JS zones. --------
2021-01-27 12:20:58 -08:00
if ( ! empty ( $pref [ 'e_header_list' ]) && is_array ( $pref [ 'e_header_list' ]))
2015-02-12 13:07:41 -08:00
{
foreach ( $pref [ 'e_header_list' ] as $val )
{
// no checks fore existing file - performance
2021-01-27 12:20:58 -08:00
e107_include_once ( e_PLUGIN . $val . " /e_header.php " );
2015-02-12 13:07:41 -08:00
}
}
unset ( $e_headers );
2010-01-12 07:38:29 +00:00
// ################### RENDER CSS
2018-05-12 10:22:58 -07:00
echo " \n <!-- Library CSS --> \n " ;
2021-01-27 12:20:58 -08:00
$e_js -> renderJs ( 'library_css' , false , 'css' );
2018-05-12 11:45:55 -07:00
echo " \n <!-- footer_library_css --> \n " ; // substituted in footer when detected.
2018-05-12 10:22:58 -07:00
2010-01-12 07:38:29 +00:00
// Other CSS - from unknown location, different from core/theme/plugin location or backward compatibility
2021-01-27 12:20:58 -08:00
$e_js -> renderJs ( 'other_css' , false , 'css' );
2018-05-12 10:22:58 -07:00
echo " \n <!-- footer_other_css --> \n " ; // substituted in footer when detected.
2010-01-12 07:38:29 +00:00
// Core CSS
2021-01-27 12:20:58 -08:00
$e_js -> renderJs ( 'core_css' , false , 'css' );
2010-01-12 07:38:29 +00:00
echo " \n <!-- footer_core_css --> \n " ;
2016-11-04 19:36:16 -07:00
2010-01-12 07:38:29 +00:00
// Theme CSS
//echo "<!-- Theme css -->\n";
2021-01-27 12:20:58 -08:00
$e_js -> renderJs ( 'theme_css' , false , 'css' );
2010-01-12 07:38:29 +00:00
echo " \n <!-- footer_theme_css --> \n " ;
2016-11-04 19:36:16 -07:00
// Plugin CSS
2021-01-27 12:20:58 -08:00
$e_js -> renderJs ( 'plugin_css' , false , 'css' );
2016-11-04 19:36:16 -07:00
echo " \n <!-- footer_plugin_css --> \n " ;
2010-01-12 07:38:29 +00:00
// Inline CSS - not sure if this should stay at all!
2021-01-27 12:20:58 -08:00
$e_js -> renderJs ( 'inline_css' , false , 'css' );
2010-01-12 07:38:29 +00:00
echo " \n <!-- footer_inline_css --> \n " ;
2012-02-16 14:18:17 +00:00
//
// Unobtrusive JS via CSS, prevent 3rd party code overload
//
2012-11-20 15:53:52 -08:00
// require_once(e_FILE."/e_css.php"); //moved to e107_web/css/e107.css
2012-02-16 14:18:17 +00:00
2010-01-12 07:38:29 +00:00
//
// E: Send JS
2006-12-05 09:28:02 +00:00
//
echo " <!-- *JS* --> \n " ;
2006-12-02 04:36:16 +00:00
2006-12-05 09:28:02 +00:00
// Wysiwyg JS support on or off.
2006-12-07 12:59:43 +00:00
// your code should run off e_WYSIWYG
2012-11-29 10:47:26 +02:00
// Moved to boot.php
2012-05-15 09:55:27 +00:00
2009-09-29 17:40:56 +00:00
// [JSManager] Load JS Includes - Zone 1 - Before Library
e107 :: getJs () -> renderJs ( 'header' , 1 );
e107 :: getJs () -> renderJs ( 'header_inline' , 1 );
// Load Javascript Library consolidation script
2021-01-27 12:20:58 -08:00
$jslib = e107 :: getObject ( 'e_jslib' , null , e_HANDLER . 'jslib_handler.php' );
2012-05-14 11:07:04 +00:00
$jslib -> renderHeader ( 'admin' , false );
2008-11-09 20:31:10 +00:00
2009-09-29 17:40:56 +00:00
// [JSManager] Load JS Includes - Zone 2 - After Library, before CSS
e107 :: getJs () -> renderJs ( 'header' , 2 );
e107 :: getJs () -> renderJs ( 'header_inline' , 2 );
2006-12-05 09:28:02 +00:00
2016-12-07 16:12:30 -08:00
/* @deprecated -use e107::js('myplug','js/my.js') instead; */
2021-01-27 12:20:58 -08:00
if ( ! empty ( $eplug_js ))
2009-10-01 15:05:41 +00:00
{
2021-01-27 12:20:58 -08:00
e107 :: getMessage () -> addDebug ( 'Deprecated $eplug_js method detected. Use e107::js() function inside an e_header.php file instead.' . print_a ( $eplug_js , true ));
2006-12-05 09:28:02 +00:00
echo " \n <!-- eplug_js --> \n " ;
2016-12-07 16:12:30 -08:00
if ( ! is_array ( $eplug_js ))
{
$eplug_js = array ( $eplug_js );
}
foreach ( $eplug_js as $vjss )
{
2022-03-31 08:24:34 -07:00
echo " <script src=' { $vjss } '></script> \n " ;
2016-12-07 16:12:30 -08:00
}
2006-12-02 04:36:16 +00:00
}
2009-07-23 08:14:55 +00:00
2017-01-03 17:57:00 -08:00
// BC Fix.
2021-01-27 12:20:58 -08:00
if ( file_exists ( THEME . 'theme.js' ))
2009-10-01 15:05:41 +00:00
{
2021-01-27 12:20:58 -08:00
e107 :: js ( 'theme' , 'theme.js' , null , 3 );
2009-10-01 15:05:41 +00:00
}
2017-01-03 17:57:00 -08:00
2021-01-27 12:20:58 -08:00
if ( is_readable ( e_FILE . 'user.js' ) && filesize ( e_FILE . 'user.js' ))
2009-10-01 15:05:41 +00:00
{
2022-03-31 08:24:34 -07:00
echo " <script src=' " . e_FILE_ABS . " user.js'></script> \n " ;
2009-10-01 15:05:41 +00:00
}
2009-07-23 08:14:55 +00:00
2006-12-05 09:28:02 +00:00
2010-01-12 07:38:29 +00:00
// [JSManager] Load JS Includes - Zone 3 - before e_meta and headerjs()
2009-09-29 17:40:56 +00:00
e107 :: getJs () -> renderJs ( 'header' , 3 );
e107 :: getJs () -> renderJs ( 'header_inline' , 3 );
2006-12-05 09:28:02 +00:00
//
// F: Send Meta Tags and Icon links
//
echo " <!-- *META* --> \n " ;
// --- Load plugin Meta files and eplug_ before others --------
2020-05-05 15:11:49 -07:00
2021-01-27 12:20:58 -08:00
/** @var array $incompatibleMeta - plugins that may cause jQuery conflicts etc if loaded. */
$incompatibleMeta = array ( 'aa_jquery' , 'fancybox' , 'lightwindow' , 'e107slider' );
2020-05-05 15:11:49 -07:00
2021-01-27 12:20:58 -08:00
if ( ! empty ( $pref [ 'e_meta_list' ]))
2006-12-02 04:36:16 +00:00
{
2021-01-27 12:20:58 -08:00
foreach ( $pref [ 'e_meta_list' ] as $val )
2006-12-02 04:36:16 +00:00
{
2021-01-27 12:20:58 -08:00
if ( in_array ( $val , $incompatibleMeta ))
{
continue ;
}
2020-05-05 15:11:49 -07:00
2021-01-27 12:20:58 -08:00
if ( is_readable ( e_PLUGIN . $val . " /e_meta.php " ))
2006-12-05 09:28:02 +00:00
{
2020-05-05 15:11:49 -07:00
echo " \n \n <!-- $val meta --> \n " ;
2021-01-27 12:20:58 -08:00
require_once ( e_PLUGIN . $val . " /e_meta.php " );
2006-12-05 09:28:02 +00:00
}
2006-12-02 04:36:16 +00:00
}
}
2020-05-05 15:11:49 -07:00
unset ( $incompatibleMeta );
2015-02-12 13:07:41 -08:00
2013-03-18 22:12:27 -07:00
2021-01-27 12:20:58 -08:00
if ( ! USER && ( $pref [ 'user_tracking' ] == " session " ) && varset ( $pref [ 'password_CHAP' ], 0 ))
2013-06-09 20:53:44 +01:00
{
2021-01-27 12:20:58 -08:00
if ( $pref [ 'password_CHAP' ] == 2 )
{
2013-06-09 20:53:44 +01:00
// *** Add in the code to swap the display tags
// $js_body_onload[] = "expandit('loginmenuchap','nologinmenuchap');";
$js_body_onload [] = " expandit('loginmenuchap'); " ;
$js_body_onload [] = " expandit('nologinmenuchap'); " ;
2021-01-27 12:20:58 -08:00
}
2022-03-31 08:24:34 -07:00
echo " <script src=' " . e_JS . " chap_script.js'></script> \n " ;
2021-01-27 12:20:58 -08:00
$js_body_onload [] = " getChallenge(); " ;
2013-06-09 20:53:44 +01:00
}
2013-03-18 22:12:27 -07:00
2021-01-27 12:20:58 -08:00
if ( function_exists ( 'headerjs' )) // required for BC.
2009-10-01 15:05:41 +00:00
{
echo headerjs ();
}
2009-10-31 17:57:15 +00:00
// 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
2009-09-29 17:40:56 +00:00
e107 :: getJs () -> renderJs ( 'header' , 4 );
e107 :: getJs () -> renderJs ( 'header_inline' , 4 );
2006-12-05 09:28:02 +00:00
// ---------- Favicon ---------
2014-01-23 15:56:53 -08:00
$sitetheme = e107 :: getPref ( 'sitetheme' );
2021-01-27 12:20:58 -08:00
if ( file_exists ( e_THEME . $sitetheme . " /favicon.ico " ))
2009-10-01 15:05:41 +00:00
{
2021-01-27 12:20:58 -08:00
echo " <link rel='icon' href=' " . e_THEME_ABS . $sitetheme . " /favicon.ico' type='image/x-icon' /> \n <link rel='shortcut icon' href=' " . e_THEME_ABS . $sitetheme . " /favicon.ico' type='image/xicon' /> \n " ;
2009-10-01 15:05:41 +00:00
}
2021-01-27 12:20:58 -08:00
elseif ( file_exists ( e_BASE . " favicon.ico " ))
2009-10-01 15:05:41 +00:00
{
2021-01-27 12:20:58 -08:00
echo " <link rel='icon' href=' " . SITEURL . " favicon.ico' type='image/x-icon' /> \n <link rel='shortcut icon' href=' " . SITEURL . " favicon.ico' type='image/xicon' /> \n " ;
2006-12-05 09:28:02 +00:00
}
2014-01-23 15:56:53 -08:00
unset ( $sitetheme );
2006-12-05 09:28:02 +00:00
//
// G: Send Theme Headers
//
2021-01-27 12:20:58 -08:00
if ( function_exists ( 'theme_head' ))
2009-10-01 15:05:41 +00:00
{
2006-12-05 09:28:02 +00:00
echo " \n <!-- *THEME HEAD* --> \n " ;
echo theme_head ();
}
//
// H: Generate JS for image preloads [user mode only]
//
echo " \n <!-- *PRELOAD* --> \n " ;
//
// I: Calculate JS onload() functions for the BODY tag [user mode only]
//
2013-06-09 20:53:44 +01:00
// XXX DEPRECATED $body_onload and related functionality
2021-01-16 13:32:35 -08:00
if ( defined ( 'THEME_ONLOAD' ))
{
$js_body_onload [] = THEME_ONLOAD ;
}
$body_onload = '' ;
if ( ! empty ( $js_body_onload ))
{
$body_onload = " onload= \" " . implode ( " " , $js_body_onload ) . " \" " ;
}
2006-12-05 09:28:02 +00:00
2017-01-03 18:43:01 -08:00
if ( deftrue ( 'e_MENUMANAGER_ACTIVE' ))
{
2021-01-27 12:20:58 -08:00
$body_onload .= " id= \" layout- " . e107 :: getForm () -> name2id ( THEME_LAYOUT ) . " \" " ;
2017-01-03 18:43:01 -08:00
}
2017-03-20 11:18:02 -07:00
else
{
2021-01-27 12:20:58 -08:00
$bodyID = deftrue ( " e_CURRENT_PLUGIN " ) ? e_CURRENT_PLUGIN : str_replace ( " .php " , " " , e_PAGE );
$bodyID .= ( ! empty ( $_GET [ 'mode' ]) && ! empty ( $_GET [ 'action' ])) ? " - " . $_GET [ 'mode' ] . '-' . $_GET [ 'action' ] : '' ;
$body_onload .= " id= \" admin- " . e107 :: getForm () -> name2id ( $bodyID ) . " \" " ;
2021-02-03 13:05:21 -08:00
$body_onload .= deftrue ( 'e_IFRAME' ) ? " class= \" e-modal-content \" " : '' ;
2020-03-25 05:29:39 -07:00
unset ( $bodyID );
2017-03-20 11:18:02 -07:00
}
2017-01-03 18:43:01 -08:00
2006-12-05 09:28:02 +00:00
//
// J: Send end of <head> and start of <body>
//
2008-11-09 20:31:10 +00:00
2008-12-29 15:23:06 +00:00
/*
* Admin LAN
2009-09-29 17:40:56 +00:00
* TODO - remove it from here
2016-02-15 01:07:34 -08:00
*//*
2012-05-16 03:10:56 +00:00
e107 :: js ( 'inline' , "
( " .e_jshelper::toString(LAN_JSCONFIRM). " ) . addModLan ( 'core' , 'delete_confirm' );
( " .e_jshelper::toString(LAN_DELETE). " ) . addModLan ( 'core' , 'delete' );
2008-12-29 15:23:06 +00:00
2016-02-15 01:07:34 -08:00
" ,'prototype',5);*/
2012-05-15 09:55:27 +00:00
2009-09-29 17:40:56 +00:00
// [JSManager] Load JS Includes - Zone 5 - After theme_head, before e107:loaded trigger
2012-05-15 09:55:27 +00:00
// unobtrusive JS - moved here from external e_css.php
2009-09-29 17:40:56 +00:00
e107 :: getJs () -> renderJs ( 'header' , 5 );
2012-05-15 09:55:27 +00:00
2009-09-29 17:40:56 +00:00
2008-11-09 20:31:10 +00:00
/*
2012-11-29 10:47:26 +02:00
* Fire Event e107 : loaded - Prototype only
2008-11-09 20:31:10 +00:00
*/
2012-11-26 20:06:19 +02:00
//\$('e-js-css').remove();
2013-02-25 02:47:23 -08:00
/*
2012-11-26 20:06:19 +02:00
e107 :: js ( 'inline' , "
2012-05-15 09:55:27 +00:00
document . observe ( 'dom:loaded' , function () {
e107Event . trigger ( 'loaded' , null , document );
2012-11-26 20:06:19 +02:00
});
" ,'prototype',5);
2013-02-25 02:47:23 -08:00
*/
2012-05-15 09:55:27 +00:00
e107 :: getJs () -> renderJs ( 'header_inline' , 5 );
2008-11-09 20:31:10 +00:00
2019-06-22 11:43:46 -07:00
echo " </head> " ;
2009-10-01 15:05:41 +00:00
2019-06-22 11:43:46 -07:00
if ( deftrue ( 'e_MENUMANAGER_ACTIVE' ) && defset ( 'THEME_LAYOUT' ) && e_theme :: loadLayout ( THEME_LAYOUT )) // v2.2.2+ html layout is active which contains <body> tag.
{
echo " \n \n <!-- Start theme.html --> \n " ;
}
else
{
echo "
2021-01-27 12:20:58 -08:00
< body " . $body_onload . " > \n " ;
2019-06-22 11:43:46 -07:00
echo getModal ();
echo getAlert ();
}
2013-02-27 03:58:19 -08:00
2019-04-11 10:47:50 -07:00
function getModal ()
{
2015-07-15 22:13:22 -07:00
2019-04-11 10:47:50 -07:00
if ( deftrue ( 'BOOTSTRAP' )) // see bootstrap3/admin_template.php
2021-01-27 12:20:58 -08:00
{
2019-04-11 10:47:50 -07:00
return '' ;
}
2015-07-15 22:13:22 -07:00
2023-01-05 15:47:12 -08:00
if ( e_PAGE == 'menus.php' && ! empty ( $_GET [ 'configure' ])) // Menu Manager iFrame disable
2019-04-11 10:47:50 -07:00
{
return null ;
}
2021-01-27 12:20:58 -08:00
2019-04-11 10:47:50 -07:00
/*
if ( e_PAGE == " image.php " )
{
2013-03-02 21:07:42 -08:00
return ;
2019-04-11 10:47:50 -07:00
}
*/
2021-01-27 12:20:58 -08:00
2019-04-11 10:47:50 -07:00
return '
2013-03-04 22:59:03 -08:00
2016-03-16 19:54:10 -07:00
< div id = " uiModal " class = " modal fade " tabindex = " -1 " role = " dialog " aria - hidden = " true " >
< div class = " modal-dialog modal-lg " >
< div class = " modal-content " >
< div class = " modal-header " >
< button type = " button " class = " close " data - dismiss = " modal " aria - hidden = " true " >& times ; </ button >
< h4 class = " modal-caption " >& nbsp ; </ h4 >
</ div >
< div class = " modal-body " >
< p > Loading… </ p >
</ div >
< div class = " modal-footer " >
< a href = " # " data - dismiss = " modal " class = " btn btn-primary " > Close </ a >
</ div >
</ div >
</ div >
2021-01-27 12:20:58 -08:00
</ div > ' ;
2019-04-11 10:47:50 -07:00
}
2013-02-27 03:58:19 -08:00
2019-04-11 10:47:50 -07:00
function getAlert ()
2013-05-03 21:34:59 -07:00
{
2021-01-27 12:20:58 -08:00
2015-07-11 14:07:04 -07:00
return '<div id="uiAlert" class="notifications center"><!-- empty --></div>' ;
2013-05-03 21:34:59 -07:00
}
2013-02-27 03:58:19 -08:00
2009-10-01 15:05:41 +00:00
// Header included notification, from this point header includes are not possible
2021-01-19 18:52:56 -08:00
if ( ! defined ( 'HEADER_INIT' ))
{
2021-01-27 12:20:58 -08:00
define ( 'HEADER_INIT' , true );
2021-01-19 18:52:56 -08:00
}
2009-10-01 15:05:41 +00:00
2020-05-02 15:35:30 -07:00
e107 :: getDebug () -> logTime ( " End Head, Start Body " );
2006-12-05 09:28:02 +00:00
//
2006-12-07 12:59:43 +00:00
// K: (The rest is ignored for popups, which have no menus)
2006-12-05 09:28:02 +00:00
//
2006-12-07 12:59:43 +00:00
// require $e107_popup =1; to use it as header for popup without menus
2021-01-27 12:20:58 -08:00
if ( ! isset ( $e107_popup ))
2006-12-07 12:59:43 +00:00
{
$e107_popup = 0 ;
}
2021-01-27 12:20:58 -08:00
if ( $e107_popup != 1 )
2008-12-18 16:55:46 +00:00
{
2009-10-01 15:05:41 +00:00
//
// L: (optional) Body JS to disable right clicks [reserved; user mode]
//
2011-05-18 14:04:37 +00:00
2009-10-01 15:05:41 +00:00
//
// M: Send top of body for custom pages and for news [user mode only]
//
2011-05-18 14:04:37 +00:00
2009-10-01 15:05:41 +00:00
//
// N: Send other top-of-body HTML
//
2011-05-18 14:04:37 +00:00
2012-11-29 10:47:26 +02:00
// moved to boot.php
//$ns = new e107table;
//$e107_var = array();
2021-01-27 12:20:58 -08:00
2012-12-03 01:40:47 -08:00
// function e_admin_me/nu moved to boot.php (e107::getNav()->admin)
2012-11-29 10:47:26 +02:00
// legacy function show_admin_menu moved to boot.php
// include admin_template.php moved to boot.php
// function parse_admin moved to boot.php
2012-12-06 20:34:57 -08:00
// legacy function admin_updatXXe moved to boot.php
2012-11-29 10:47:26 +02:00
// (legacy?) function admin_purge_related moved to boot.php
2012-11-28 15:45:21 +02:00
2011-05-18 14:04:37 +00:00
2020-05-02 15:35:30 -07:00
e107 :: getDebug () -> logTime ( 'Parse Admin Header' );
2021-01-27 12:20:58 -08:00
2009-10-01 15:05:41 +00:00
//NEW - Iframe mod
2021-01-27 12:20:58 -08:00
if ( ! deftrue ( 'e_IFRAME' ))
2006-12-02 04:36:16 +00:00
{
2009-10-01 15:05:41 +00:00
//removed check strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE
2021-01-27 12:20:58 -08:00
$ADMIN_HEADER = e107 :: getCoreTemplate ( 'admin' , 'header' , false );
$ADMIN_MODAL = e107 :: getCoreTemplate ( 'admin' , 'modal' , false );
e107 :: renderLayout ( $ADMIN_MODAL . $ADMIN_HEADER , [ 'sc' => 'admin' ]);
2006-12-02 04:36:16 +00:00
}
2023-01-05 15:47:12 -08:00
elseif ( empty ( $_GET [ 'configure' ]))
2013-02-23 23:08:30 -08:00
{
2021-02-03 13:05:21 -08:00
e107 :: css ( " inline " , " body { padding:0px; margin:0; } " ); // default padding for iFrame-only.
2013-02-23 23:08:30 -08:00
}
2011-05-18 14:04:37 +00:00
2020-05-02 15:35:30 -07:00
e107 :: getDebug () -> logTime ( '(End: Parse Admin Header)' );
2006-12-02 04:36:16 +00:00
}
2011-05-18 14:04:37 +00:00
// XXX - we don't need this (use e107::getMessage()) - find out what's using it and remove it
2021-01-27 12:20:58 -08:00
if ( ! varset ( $emessage ) && ! is_object ( $emessage ))
2009-07-14 03:16:16 +00:00
{
2012-11-29 10:47:26 +02:00
$emessage = e107 :: getMessage ();
2009-07-14 03:16:16 +00:00
}