2006-12-02 04:36:16 +00:00
< ? php
/*
2009-08-20 09:03:02 +00:00
* e107 website system
*
2013-03-24 13:07:15 +01:00
* Copyright ( C ) 2008 - 2013 e107 Inc ( e107 . org )
2009-08-20 09:03:02 +00:00
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
* Default Header
*
2006-12-02 04:36:16 +00:00
*/
if ( ! defined ( 'e107_INIT' )) { exit ; }
2009-08-20 09:03:02 +00:00
if ( ! defined ( 'USER_AREA' ))
{
2009-09-29 17:42:23 +00:00
//overload is now possible, prevent warnings
2009-08-20 09:03:02 +00:00
define ( 'USER_AREA' , TRUE );
}
2021-01-19 18:52:56 -08:00
if ( ! defined ( 'ADMIN_AREA' ))
{
define ( 'ADMIN_AREA' , false );
}
2009-09-29 17:42:23 +00:00
2021-02-14 10:36:45 -08:00
e107 :: getDebug () -> logTime ( '(Header Top)' );
e_theme :: initThemeLayout (); // set THEME_LAYOUT
2021-02-13 18:55:44 -08:00
if ( ! isset ( $_E107 [ 'no_menus' ]))
{
e107 :: getDebug () -> logTime ( 'Init Menus' );
e107 :: getMenu () -> init ();
}
2008-12-04 21:05:05 +00:00
$e107 = e107 :: getInstance ();
2013-03-24 13:07:15 +01:00
$sql = e107 :: getDb ();
2021-02-14 10:36:45 -08:00
2021-02-14 08:14:57 -08:00
if ( $themeSC = e107 :: getScBatch ( 'theme' )) // init theme_shortcodes after THEME_LAYOUT is available.
{
$themeSC -> init ();
unset ( $themeSC );
}
2021-02-14 10:36:45 -08:00
e107 :: getRender () -> init (); // init 'theme' class.
2019-04-11 10:47:50 -07:00
2012-05-27 10:42:16 +00:00
2017-01-27 18:30:46 -08:00
//e107::js('core', 'bootstrap/js/bootstrap-tooltip.js','jquery');
// e107::css('core', 'bootstrap/css/tooltip.css','jquery');
2012-11-28 18:56:52 -08:00
2016-01-13 18:07:05 -08:00
if ( deftrue ( 'BOOTSTRAP' ))
{
2017-07-25 19:20:11 +02:00
e107 :: js ( 'footer' , '{e_WEB}js/bootstrap-notify/js/bootstrap-notify.js' , 'jquery' , 2 );
e107 :: css ( 'core' , 'bootstrap-notify/css/bootstrap-notify.css' , 'jquery' );
2016-01-13 18:07:05 -08:00
}
2015-01-25 20:27:45 -08:00
2012-06-02 08:12:16 +00:00
// ------------------
2012-05-31 06:07:33 +00:00
2017-07-25 19:20:11 +02:00
e107 :: js ( 'footer' , '{e_WEB}js/rate/js/jquery.raty.js' , 'jquery' , 2 );
e107 :: css ( 'core' , 'core/all.jquery.css' , 'jquery' );
2012-06-02 08:12:16 +00:00
2017-07-25 19:20:11 +02:00
e107 :: js ( 'footer' , '{e_WEB}js/core/front.jquery.js' , 'jquery' , 5 ); // Load all default functions.
e107 :: js ( 'footer' , '{e_WEB}js/core/all.jquery.js' , 'jquery' , 5 ); // Load all default functions.
2012-05-27 10:42:16 +00:00
2013-06-07 22:43:03 +01:00
$js_body_onload = array (); // Legacy array of code to load with page.
2012-05-31 06:07:33 +00:00
2006-12-02 04:36:16 +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.
//
// A: Define themable header parsing
// B: Send HTTP headers that come before any html
// C: Send start of HTML
2008-11-09 20:31:10 +00:00
// D: Send CSS
// E: Send JS
2006-12-02 04:36:16 +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)
2009-10-28 22:37:30 +00:00
// L: Removed
2006-12-02 04:36:16 +00:00
// 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: Define themeable header parsing
//
//
// B: Send HTTP headers (these come before ANY html)
//
// send the charset to the browser - overrides spurious server settings with the lan pack settings.
2007-09-02 08:42:11 +00:00
// Would like to set the MIME type appropriately - but it broke other things
2008-12-04 21:05:05 +00:00
//if (stristr($_SERVER["HTTP_ACCEPT"], "application/xhtml+xml"))
2009-07-19 11:44:30 +00:00
// header("Content-type: application/xhtml+xml; charset=utf-8", TRUE);
2007-09-02 08:42:11 +00:00
//else
2021-01-16 10:02:52 -08:00
if ( ! e107 :: isCli ())
{
2021-02-16 12:11:05 -08:00
header ( " Content-type: text/html; charset=utf-8 " );
2021-01-16 10:02:52 -08:00
}
2012-06-18 09:06:20 +00:00
// NEW - HTML5 default
2011-09-14 11:36:23 +00:00
// TODO - more precise controlo over page header depending on the HTML5 mode
2012-06-18 09:06:20 +00:00
if ( ! defined ( " XHTML4 " ))
2011-09-14 11:36:23 +00:00
{
echo " <!doctype html> \n " ;
2017-03-07 10:28:05 -08:00
$htmlTag = " <html " . ( defined ( " TEXTDIRECTION " ) ? " dir=' " . TEXTDIRECTION . " ' " : " " ) . ( defined ( " CORE_LC " ) ? " lang= \" " . CORE_LC . " \" " : " " ) . " > " ;
2021-02-16 13:32:34 -08:00
echo ( defined ( 'HTMLTAG' ) ? str_replace ( 'THEME_LAYOUT' , THEME_LAYOUT , HTMLTAG ) : $htmlTag ) . " \n " ;
2012-06-18 09:06:20 +00:00
echo " <head> \n " ;
echo " <meta charset='utf-8' /> \n " ;
2011-09-14 11:36:23 +00:00
}
else
{
echo ( defined ( " STANDARDS_MODE " ) ? " " : " <?xml version='1.0' encoding='utf-8' " . " ? " . " > \n " ) . " <!DOCTYPE html PUBLIC \" -//W3C//DTD XHTML 1.1//EN \" \" http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd \" > \n " ;
echo " <html xmlns='http://www.w3.org/1999/xhtml' " . ( defined ( " TEXTDIRECTION " ) ? " dir=' " . TEXTDIRECTION . " ' " : " " ) . ( defined ( " XMLNS " ) ? " " . XMLNS . " " : " " ) . ( defined ( " CORE_LC " ) ? " xml:lang= \" " . CORE_LC . " \" " : " " ) . " > \n " ;
2012-06-18 09:06:20 +00:00
echo " <head>
< meta http - equiv = 'content-type' content = 'text/html; charset=utf-8' />
< meta http - equiv = 'content-style-type' content = 'text/css' />
" ;
echo ( defined ( " CORE_LC " )) ? " <meta http-equiv='content-language' content=' " . CORE_LC . " ' /> \n " : " " ;
2011-09-14 11:36:23 +00:00
}
2006-12-02 04:36:16 +00:00
2020-12-08 18:15:08 -08:00
// Load early
if ( ! defined ( 'e_PAGETITLE' ) && ( $_PAGE_TITLE = e107 :: getSingleton ( 'eResponse' ) -> getMetaTitle ())) // use e107::title() to set.
{
define ( 'e_PAGETITLE' , $_PAGE_TITLE );
unset ( $_PAGE_TITLE );
}
2021-02-16 13:32:34 -08:00
if ( deftrue ( 'e_FRONTPAGE' ))
{
// Ignore any additional title when current page is the frontpage
echo " <title> " . SITENAME . " </title> \n \n " ;
}
else
{
echo " <title> " . ( deftrue ( 'e_PAGETITLE' ) ? e_PAGETITLE . ' - ' : ( defined ( 'PAGE_NAME' ) ? PAGE_NAME . ' - ' : " " )) . SITENAME . " </title> \n \n " ;
unset ( $_PAGE_TITLE );
}
2020-12-08 18:15:08 -08:00
2006-12-02 04:36:16 +00:00
//
// C: Send start of HTML
//
2012-06-18 09:06:20 +00:00
2018-08-26 13:54:25 -07:00
if ( ! empty ( $pref [ 'meta_copyright' ][ e_LANGUAGE ])) e107 :: meta ( 'dcterms.rights' , $pref [ 'meta_copyright' ][ e_LANGUAGE ]);
if ( ! empty ( $pref [ 'meta_author' ][ e_LANGUAGE ])) e107 :: meta ( 'author' , $pref [ 'meta_author' ][ e_LANGUAGE ]);
if ( ! empty ( $pref [ 'sitebutton' ]))
{
2020-12-08 18:15:08 -08:00
$siteButton = ( strpos ( $pref [ 'sitebutton' ], '{e_MEDIA' ) !== false ) ? e107 :: getParser () -> thumbUrl ( $pref [ 'sitebutton' ], 'w=800' , false , true ) : e107 :: getParser () -> replaceConstants ( $pref [ 'sitebutton' ], 'full' );
2018-08-26 13:54:25 -07:00
e107 :: meta ( 'og:image' , $siteButton );
unset ( $siteButton );
}
elseif ( ! empty ( $pref [ 'sitelogo' ])) // fallback to sitelogo
{
2020-12-08 18:15:08 -08:00
$siteLogo = ( strpos ( $pref [ 'sitelogo' ], '{e_MEDIA' ) !== false ) ? e107 :: getParser () -> thumbUrl ( $pref [ 'sitelogo' ], 'w=800' , false , true ) : e107 :: getParser () -> replaceConstants ( $pref [ 'sitelogo' ], 'full' );
2018-08-26 13:54:25 -07:00
e107 :: meta ( 'og:image' , $siteLogo );
unset ( $siteLogo );
}
2016-07-09 10:49:55 -07:00
if ( defined ( " VIEWPORT " )) e107 :: meta ( 'viewport' , VIEWPORT ); //BC ONLY
2012-05-11 03:52:57 +00:00
2015-04-08 22:05:32 -07:00
// Load Plugin Header Files, allow them to load CSS/JSS/Meta via JS Manager early enouhg
// NOTE: e_header.php should not output content, it should only register stuff!
// e_meta.php is more appropriate for outputting header content.
$e_headers = e107 :: pref ( 'core' , 'e_header_list' );
if ( $e_headers && is_array ( $e_headers ))
{
foreach ( $e_headers as $val )
{
// no checks fore existing file - performance
e107_include ( e_PLUGIN . $val . " /e_header.php " );
}
}
unset ( $e_headers );
2019-07-05 13:48:35 -07:00
echo e107 :: getSingleton ( 'eResponse' ) -> renderMeta () . " \n " ; // render all the e107::meta() entries.
2012-05-11 03:52:57 +00:00
2020-12-08 18:15:08 -08:00
2006-12-02 04:36:16 +00:00
2008-11-09 20:31:10 +00:00
//
2010-02-01 17:15:59 +00:00
// D: Register CSS
2008-11-09 20:31:10 +00:00
//
2010-02-01 17:15:59 +00:00
$e_js = e107 :: getJs ();
2018-05-11 17:39:26 -07:00
2020-12-08 18:15:08 -08:00
$e_pref = e107 :: getConfig ();
2008-06-13 20:20:23 +00:00
2012-05-11 10:17:20 +00:00
// Other Meta tags.
2012-05-11 03:52:57 +00:00
2020-05-02 15:35:30 -07:00
// Register Core CSS first
2010-02-01 17:15:59 +00:00
// NOTE: PREVIEWTHEME check commented - It shouldn't break anything as it's overridden by theme CSS now
2014-07-03 19:45:50 -07:00
if ( /*!defined("PREVIEWTHEME") && */ ! ( isset ( $no_core_css ) && $no_core_css !== true ) && defset ( 'CORE_CSS' ) !== false )
2010-02-01 17:15:59 +00:00
{
//echo "<link rel='stylesheet' href='".e_FILE_ABS."e107.css' type='text/css' />\n";
2012-06-02 08:12:16 +00:00
$e_js -> otherCSS ( '{e_WEB_CSS}e107.css' );
2006-12-02 04:36:16 +00:00
}
2018-07-22 21:24:06 +02:00
if ( THEME_LEGACY === true || ! deftrue ( 'BOOTSTRAP' ))
2016-01-13 18:07:05 -08:00
{
$e_js -> otherCSS ( '{e_WEB_CSS}backcompat.css' );
2020-05-06 16:15:52 -07:00
$e_js -> footerFile ( '{e_WEB_JS}core/backcompat.js' );
2016-01-13 18:07:05 -08:00
}
2015-04-08 22:05:32 -07:00
2010-02-01 17:15:59 +00:00
// re-initalize in case globals are destroyed from $e_headers includes
$e_js = e107 :: getJs ();
2020-12-08 18:15:08 -08:00
$e_pref = e107 :: getConfig ();
2021-01-21 09:38:38 -08:00
$pref = e107 :: getPref ();
2012-05-11 03:52:57 +00:00
2010-12-16 16:56:00 +00:00
// --- Load plugin Meta files - now possible to add to all zones! --------
$e_meta_content = '' ;
if ( is_array ( $pref [ 'e_meta_list' ]))
2012-12-04 00:14:43 -08:00
{
// $pref = e107::getPref();
2010-12-16 16:56:00 +00:00
ob_start ();
2012-12-04 00:14:43 -08:00
2010-12-16 16:56:00 +00:00
foreach ( $pref [ 'e_meta_list' ] as $val )
2012-12-04 00:14:43 -08:00
{
$fname = e_PLUGIN . $val . " /e_meta.php " ; // Do not place inside a function - BC $pref required. .
if ( is_readable ( $fname ))
{
2020-04-26 13:32:18 -07:00
$ret = ( deftrue ( 'e_DEBUG' ) || isset ( $_E107 [ 'debug' ])) ? include_once ( $fname ) : @ include_once ( $fname );
2012-12-04 00:14:43 -08:00
}
2010-12-16 16:56:00 +00:00
}
// content will be added later
// NOTE: not wise to do e_meta output, use JS Manager!
$e_meta_content = ob_get_contents ();
ob_end_clean ();
2012-12-04 00:14:43 -08:00
unset ( $ret );
2010-12-16 16:56:00 +00:00
}
2013-12-17 11:12:42 -08:00
// -------- Generate Apple Touch Icon ---------
if ( isset ( $pref [ 'sitebutton' ]))
{
2020-12-08 18:15:08 -08:00
$appleIcon = e107 :: getParser () -> thumbUrl ( $pref [ 'sitebutton' ], 'w=144&h=144&crop=1' , null , true );
2013-12-17 11:12:42 -08:00
echo " <link rel='apple-touch-icon' href=' " . $appleIcon . " ' /> \n " ;
unset ( $appleIcon );
}
2012-05-11 03:52:57 +00:00
2010-02-01 17:15:59 +00:00
// 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 ))
2007-07-03 03:24:35 +00:00
{
2010-02-01 17:15:59 +00:00
$eplug_css = array ( $eplug_css );
2007-07-03 03:24:35 +00:00
}
2010-02-01 17:15:59 +00:00
foreach ( $eplug_css as $kcss )
{
// echo ($kcss[0] == "<") ? $kcss : "<link rel='stylesheet' href='{$kcss}' type='text/css' />\n";
$e_js -> otherCSS ( $kcss );
}
2006-12-02 04:36:16 +00:00
}
2010-02-01 17:15:59 +00:00
// Register Theme CSS
// Writing link tags is DEPRECATED, use $e_js->themeCSS('style/mytheme.css'[, $media = 'all|screen|...']); - current theme is auto-detected
if ( defined ( " PREVIEWTHEME " ))
{
// XXX - can be PREVIEWTHEME done in a better way than this?
//echo "<link rel='stylesheet' href='".PREVIEWTHEME."style.css' type='text/css' />\n";
2012-11-28 13:51:48 +02:00
//var_dump(PREVIEWTHEMENAME);
$e_js -> otherCSS ( PREVIEWTHEME . 'style.css' );
2010-02-01 17:15:59 +00:00
}
else
{
$css_default = " all " ; // TODO - default should be defined by the theme
// theme-css.php auto-detection TODO - convert it to constant or anything different from GLOBAL
if ( isset ( $theme_css_php ) && $theme_css_php )
{
//echo "<link rel='stylesheet' href='".THEME_ABS."theme-css.php' type='text/css' />\n";
$e_js -> themeCSS ( 'theme-css.php' , $css_default );
}
else
{
// Theme default
2013-06-17 15:40:39 -07:00
$e_js -> themeCSS ( THEME_STYLE , $css_default );
2017-03-25 13:01:50 -07:00
// Support for style.css - override theme default CSS
if ( file_exists ( THEME . " style_custom.css " ))
2006-12-02 04:36:16 +00:00
{
2017-03-25 13:01:50 -07:00
$e_js -> themeCSS ( 'style_custom.css' , $css_default );
2010-02-01 17:15:59 +00:00
}
2017-03-25 13:01:50 -07:00
2012-05-14 11:07:04 +00:00
// Support for print and handheld media - override theme default CSS
2010-02-01 17:15:59 +00:00
if ( file_exists ( THEME . " style_mobile.css " ))
{
$e_js -> themeCSS ( 'style_mobile.css' , 'handheld' );
}
2017-03-25 13:01:50 -07:00
2010-02-01 17:15:59 +00:00
if ( file_exists ( THEME . " style_print.css " ))
{
$e_js -> themeCSS ( 'style_print.css' , 'print' );
2006-12-02 04:36:16 +00:00
}
2008-11-09 20:31:10 +00:00
}
2010-02-01 17:15:59 +00:00
// 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 '
//<link rel="stylesheet" href="'.THEME_ABS.strtolower(TEXTDIRECTION).'.css" type="text/css" media="all" />';
2020-12-08 18:15:08 -08:00
$e_js -> themeCSS ( TEXTDIRECTION . '.css' );
2010-02-01 17:15:59 +00:00
}
2008-11-09 20:31:10 +00:00
}
2020-12-03 11:00:53 -08:00
$e_js -> renderLinks ();
2008-11-09 20:31:10 +00:00
2010-02-01 17:15:59 +00:00
//
// Render CSS - all in once
// Read here why - http://code.google.com/speed/page-speed/docs/rtt.html#PutStylesBeforeScripts
//
// Other CSS - from unknown location, different from core/theme/plugin location or backward compatibility; NOTE - could be removed in the future!!!
2013-06-17 15:40:39 -07:00
//TODO Additional options for 'bootstrap' and 'style' (ie. THEME_STYLE loaded above). Requires changes to js_manager.php
2015-06-03 15:44:07 -07:00
2018-05-11 17:39:26 -07:00
$CSSORDER = deftrue ( 'CSSORDER' ) ? explode ( " , " , CSSORDER ) : array ( 'library' , 'other' , 'core' , 'plugin' , 'theme' , 'inline' );
2013-06-17 15:40:39 -07:00
2015-06-03 15:44:07 -07:00
2013-06-17 15:40:39 -07:00
foreach ( $CSSORDER as $val )
{
$cssId = $val . " _css " ;
2020-12-08 18:15:08 -08:00
$e_js -> renderJs ( $cssId , false , 'css' );
2013-06-17 15:40:39 -07:00
}
unset ( $CSSORDER );
2015-06-03 15:44:07 -07:00
$e_js -> renderCached ( 'css' );
2020-12-03 11:00:53 -08:00
2008-11-09 20:31:10 +00:00
//
2010-02-01 17:15:59 +00:00
// E: Send JS all in once
// Read here why - http://code.google.com/speed/page-speed/docs/rtt.html#PutStylesBeforeScripts
2021-01-25 13:23:28 -08:00
function renderAllJavascript ()
{
2010-02-01 17:15:59 +00:00
// [JSManager] Load JS Includes - Zone 1 - Before Library
2021-01-25 13:23:28 -08:00
e107 :: getJs () -> renderJs ( 'header' , 1 );
e107 :: getJs () -> renderJs ( 'header_inline' , 1 );
2010-02-01 17:15:59 +00:00
2015-06-03 15:44:07 -07:00
// Send Javascript Libraries ALWAYS (for now) - loads e_jslib.php
2021-01-25 13:23:28 -08:00
$jslib = e107 :: getObject ( 'e_jslib' , null , e_HANDLER . 'jslib_handler.php' );
$jslib -> renderHeader ( 'front' , false );
2009-10-01 15:05:41 +00:00
// [JSManager] Load JS Includes - Zone 2 - After Library
2021-01-25 13:23:28 -08:00
e107 :: getJs () -> renderJs ( 'header' , 2 );
e107 :: getJs () -> renderJs ( 'header_inline' , 2 );
// [JSManager] Load JS Includes - Zone 3 - After e_plug/theme.js, before headerjs()
e107 :: getJs () -> renderJs ( 'header' , 3 );
e107 :: getJs () -> renderJs ( 'header_inline' , 3 );
// [JSManager] Load JS Includes - Zone 4 - After headerjs
e107 :: getJs () -> renderJs ( 'header' , 4 );
e107 :: getJs () -> renderJs ( 'header_inline' , 4 );
// [JSManager] Load JS Includes - Zone 5 - End of header JS, just before e_meta content and e107:loaded trigger
e107 :: getJs () -> renderJs ( 'header' , 5 );
}
if ( ! deftrue ( 'e_DEBUG_JS_FOOTER' ))
{
renderAllJavascript ();
}
2008-11-09 20:31:10 +00:00
// Send Plugin JS Files
2010-02-01 17:15:59 +00:00
//DEPRECATED, $eplug_js will be removed soon - use e107::getJs()->headerPlugin('myplug', 'myplug/js/my.js');
2008-12-04 21:05:05 +00:00
if ( isset ( $eplug_js ) && $eplug_js )
2008-11-09 20:31:10 +00:00
{
echo " \n <!-- eplug_js --> \n " ;
if ( is_array ( $eplug_js ))
{
$eplug_js_unique = array_unique ( $eplug_js );
foreach ( $eplug_js_unique as $kjs )
{
echo ( $kjs [ 0 ] == " < " ) ? $kjs : " <script type='text/javascript' src=' { $kjs } '></script> \n " ;
}
}
else
{
echo " <script type='text/javascript' src=' { $eplug_js } '></script> \n " ;
}
}
// Send Theme JS Files
2009-10-01 15:05:41 +00:00
//DEPRECATE this as well?
2008-12-04 21:05:05 +00:00
if ( isset ( $theme_js_php ) && $theme_js_php )
2008-11-09 20:31:10 +00:00
{
echo " <script type='text/javascript' src=' " . THEME_ABS . " theme-js.php'></script> \n " ;
2008-12-04 21:05:05 +00:00
}
else
2008-11-09 20:31:10 +00:00
{
if ( file_exists ( THEME . 'theme.js' )) { echo " <script type='text/javascript' src=' " . THEME_ABS . " theme.js'></script> \n " ; }
if ( is_readable ( e_FILE . 'user.js' ) && filesize ( e_FILE . 'user.js' )) { echo " <script type='text/javascript' src=' " . e_FILE_ABS . " user.js'></script> \n " ; }
if ( file_exists ( THEME . 'theme.vbs' )) { echo " <script type='text/vbscript' src=' " . THEME_ABS . " theme.vbs'></script> \n " ; }
if ( is_readable ( e_FILE . 'user.vbs' ) && filesize ( e_FILE . 'user.vbs' )) { echo " <script type='text/vbscript' src=' " . e_FILE_ABS . " user.vbs'></script> \n " ; }
}
2020-05-02 15:35:30 -07:00
// Old Deprecated CHAP Support.
2008-11-09 20:31:10 +00:00
if ( ! USER && ( $pref [ 'user_tracking' ] == " session " ) && varset ( $pref [ 'password_CHAP' ], 0 ))
{
2010-12-16 16:56:00 +00:00
if ( $pref [ 'password_CHAP' ] == 2 )
{
2008-11-09 20:31:10 +00:00
// *** Add in the code to swap the display tags
2013-06-07 22:43:03 +01:00
// $js_body_onload[] = "expandit('loginmenuchap','nologinmenuchap');";
$js_body_onload [] = " expandit('loginmenuchap'); " ;
$js_body_onload [] = " expandit('nologinmenuchap'); " ;
2010-12-16 16:56:00 +00:00
}
2012-11-24 01:59:15 -08:00
echo " <script type='text/javascript' src=' " . e_JS . " chap_script.js'></script> \n " ;
2010-12-16 16:56:00 +00:00
$js_body_onload [] = " getChallenge(); " ;
2008-11-09 20:31:10 +00:00
}
2006-12-02 04:36:16 +00:00
//
2021-01-25 13:23:28 -08:00
// F: Send Legacy Meta Tags, Icon links
2006-12-02 04:36:16 +00:00
//
2010-12-16 16:56:00 +00:00
// --- Send plugin Meta --------
echo $e_meta_content ; // e_meta already loaded
2008-11-09 20:31:10 +00:00
2021-01-25 13:23:28 -08:00
// G: Send Legacy Theme Headers
2010-02-01 17:15:59 +00:00
//
if ( function_exists ( 'theme_head' ))
{
echo theme_head ();
}
2009-10-01 15:05:41 +00:00
2017-03-31 15:49:33 -07:00
/* @deprecated */
2006-12-02 04:36:16 +00:00
$diz_merge = ( defined ( " META_MERGE " ) && META_MERGE != FALSE && $pref [ 'meta_description' ][ e_LANGUAGE ]) ? $pref [ 'meta_description' ][ e_LANGUAGE ] . " " : " " ;
$key_merge = ( defined ( " META_MERGE " ) && META_MERGE != FALSE && $pref [ 'meta_keywords' ][ e_LANGUAGE ]) ? $pref [ 'meta_keywords' ][ e_LANGUAGE ] . " , " : " " ;
2020-12-08 18:15:08 -08:00
/**
* @ param $type
* @ return string
*/
2006-12-02 04:36:16 +00:00
function render_meta ( $type )
{
2015-05-31 09:25:59 -07:00
$tp = e107 :: getParser ();
$pref = e107 :: getPref ();
2006-12-02 04:36:16 +00:00
2015-05-31 09:25:59 -07:00
$key = 'meta_' . $type ;
$language = e_LANGUAGE ;
if ( empty ( $pref [ $key ][ $language ]))
{
// e107::getMessage()->addError("Couldn't find: pref - ".$key);
2009-08-20 09:03:02 +00:00
return '' ;
}
2006-12-02 04:36:16 +00:00
if ( $type == " tag " )
{
2021-01-26 11:55:10 -08:00
$ret = " \n <!-- Start custom head tag --> \n " ;
$ret .= varset ( $pref [ 'meta_tag' ][ e_LANGUAGE ]) . " \n " ;
// $ret .= str_replace("<", "<", $pref['meta_tag'][e_LANGUAGE]."\n";
$ret .= " <!-- End custom head tag --> \n \n " ;
2006-12-02 04:36:16 +00:00
}
else
{
2021-01-26 11:55:10 -08:00
$ret = '<meta name="' . $type . '" content="' . $pref [ 'meta_' . $type ][ e_LANGUAGE ] . '" />' . " \n " ;
2006-12-02 04:36:16 +00:00
}
2021-01-26 11:55:10 -08:00
return $ret ;
2006-12-02 04:36:16 +00:00
}
2017-03-31 19:04:34 -07:00
// legay meta-tag checks.
2017-06-05 17:49:49 -07:00
/*
2017-04-02 12:09:57 -07:00
$isKeywords = e107 :: getUrl () -> response () -> getMetaKeywords ();
$isDescription = e107 :: getUrl () -> response () -> getMetaDescription ();
2017-06-05 17:49:49 -07:00
*/
$isKeywords = e107 :: getSingleton ( 'eResponse' ) -> getMetaKeywords ();
$isDescription = e107 :: getSingleton ( 'eResponse' ) -> getMetaDescription ();
2017-04-02 12:09:57 -07:00
if ( empty ( $isKeywords ))
2017-03-31 15:49:33 -07:00
{
echo ( defined ( " META_KEYWORDS " )) ? " \n <meta name= \" keywords \" content= \" " . $key_merge . META_KEYWORDS . " \" /> \n " : render_meta ( 'keywords' );
}
2017-04-02 12:09:57 -07:00
if ( empty ( $isDescription ))
2017-03-31 15:49:33 -07:00
{
echo ( defined ( " META_DESCRIPTION " )) ? " \n <meta name= \" description \" content= \" " . $diz_merge . META_DESCRIPTION . " \" /> \n " : render_meta ( 'description' );
}
2012-07-02 01:32:56 +00:00
2012-05-13 05:26:11 +00:00
//echo render_meta('copyright');
//echo render_meta('author');
2006-12-02 04:36:16 +00:00
echo render_meta ( 'tag' );
2017-04-02 12:09:57 -07:00
unset ( $key_merge , $diz_merge , $isKeywords , $isDescription );
2006-12-02 04:36:16 +00:00
// ---------- Favicon ---------
2009-08-20 09:03:02 +00:00
if ( file_exists ( THEME . " favicon.ico " ))
{
2006-12-02 04:36:16 +00:00
echo " <link rel='icon' href=' " . THEME_ABS . " favicon.ico' type='image/x-icon' /> \n <link rel='shortcut icon' href=' " . THEME_ABS . " favicon.ico' type='image/xicon' /> \n " ;
2009-08-20 09:03:02 +00:00
}
elseif ( file_exists ( e_BASE . " favicon.ico " ))
{
2006-12-02 04:36:16 +00: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 " ;
}
2007-09-27 20:58:11 +00:00
// Theme JS
2020-05-02 15:35:30 -07:00
/** const THEME_ONLOAD @deprecated */
2020-12-21 10:00:28 -08:00
if ( defined ( 'THEME_ONLOAD' ))
{
trigger_error ( '<b>THEME_ONLOAD is deprecated.</b> Use e107::js() instead.' , E_USER_DEPRECATED ); // NO LAN
$js_body_onload [] = THEME_ONLOAD ;
}
$body_onload = '' ;
if ( count ( $js_body_onload ))
{
$body_onload = " onload= \" " . implode ( " " , $js_body_onload ) . " \" " ;
}
2006-12-02 04:36:16 +00:00
//
// J: Send end of <head> and start of <body>
//
2008-11-09 20:31:10 +00:00
/*
2008-12-04 21:05:05 +00:00
* Fire Event e107 : loaded
2012-10-16 07:20:29 +00:00
* core JS available only in Prototype front - end environment
2008-11-09 20:31:10 +00:00
*/
2012-11-26 20:06:19 +02:00
// e_css.php is removed
//\$('e-js-css').remove();
2012-10-16 07:18:44 +00:00
2012-11-26 20:06:19 +02:00
e107 :: js ( 'inline' , "
document . observe ( 'dom:loaded' , function () {
e107Event . trigger ( 'loaded' , null , document );
});
" ,'prototype',5);
2020-12-02 20:15:13 -08:00
if ( empty ( $pref [ 'jscsscachestatus' ])) // render in header when cache disabled, otherwise render in footer. (see footer_default.php)
{
e107 :: getJs () -> renderCached ( 'js' );
e107 :: getJs () -> renderJs ( 'header_inline' , 5 );
}
2012-10-16 07:18:44 +00:00
2015-06-03 15:44:07 -07:00
2020-11-30 11:26:09 -08:00
2015-06-03 15:44:07 -07:00
2013-02-27 04:03:13 -08:00
echo " </head> \n " ;
// ---------- New in 2.0 -------------------------------------------------------
2019-06-11 15:53:08 -07:00
$def = THEME_LAYOUT ; // The active layout based on custompage matches.
2019-06-21 14:09:10 -07:00
$noBody = false ;
2020-04-28 14:00:19 -07:00
// v2.2.2
2019-06-11 15:53:08 -07:00
if ( $tmp = e_theme :: loadLayout ( THEME_LAYOUT ))
{
$LAYOUT = $tmp ;
2020-05-04 12:10:22 -07:00
$HEADER = array ();
$FOOTER = array ();
2019-06-21 14:09:10 -07:00
$noBody = true ;
2019-06-11 15:53:08 -07:00
unset ( $tmp );
2020-04-28 14:00:19 -07:00
if ( ! class_exists ( 'theme' ) && ADMIN ) // 2.3.0+ required class.
{
// debug - no translation needed.
echo " <div class='alert alert-danger'>Required class <b>theme</b> is missing. See <b> " . e_THEME . " bootstrap3/theme.php</b> for an example.</div> " ;
}
2019-06-11 15:53:08 -07:00
}
2021-03-23 10:17:22 -07:00
else // Legacy Theme.
{
$legacyGlobals = [ 'HEADER' , 'FOOTER' , 'LAYOUT' , 'CUSTOMHEADER' , 'CUSTOMFOOTER' ];
foreach ( $legacyGlobals as $lg )
{
if ( isset ( $GLOBALS [ $lg ]))
{
$$lg = $GLOBALS [ $lg ];
}
}
}
2019-06-11 15:53:08 -07:00
if ( isset ( $LAYOUT ) && is_array ( $LAYOUT )) // $LAYOUT is a combined $HEADER,$FOOTER.
2013-12-21 01:32:39 -08:00
{
foreach ( $LAYOUT as $key => $template )
{
2016-02-16 10:12:45 -08:00
if ( $key == '_header_' || $key == '_footer_' || $key == '_modal_' )
2014-02-21 06:30:25 -08:00
{
continue ;
}
if ( strpos ( $template , '{---}' ) !== false )
{
list ( $hd , $ft ) = explode ( " { ---} " , $template );
$HEADER [ $key ] = isset ( $LAYOUT [ '_header_' ]) ? $LAYOUT [ '_header_' ] . $hd : $hd ;
$FOOTER [ $key ] = isset ( $LAYOUT [ '_footer_' ]) ? $ft . $LAYOUT [ '_footer_' ] : $ft ;
}
else
{
e107 :: getMessage () -> addDebug ( 'Missing "{---}" in $LAYOUT["' . $key . '"] ' );
}
2013-12-21 01:32:39 -08:00
}
unset ( $hd , $ft );
}
2013-02-27 04:03:13 -08:00
// echo "DEF = ".$def."<br />";
if ( $def == 'legacyCustom' || $def == 'legacyDefault' ) // 0.6 themes.
{
// echo "MODE 0.6";
if ( $def == 'legacyCustom' )
{
2020-12-08 18:15:08 -08:00
$HEADER = isset ( $CUSTOMHEADER ) ? $CUSTOMHEADER : $HEADER ;
$FOOTER = isset ( $CUSTOMFOOTER ) ? $CUSTOMFOOTER : $FOOTER ;
2013-02-27 04:03:13 -08:00
}
}
2013-03-26 20:13:34 -07:00
elseif ( $def && $def != " legacyCustom " && ( isset ( $CUSTOMHEADER [ $def ]) || isset ( $CUSTOMFOOTER [ $def ]))) // 0.7/1.x themes
2013-02-27 04:03:13 -08:00
{
// echo " MODE 0.7";
$HEADER = ( $CUSTOMHEADER [ $def ]) ? $CUSTOMHEADER [ $def ] : $HEADER ;
$FOOTER = ( $CUSTOMFOOTER [ $def ]) ? $CUSTOMFOOTER [ $def ] : $FOOTER ;
}
2016-02-09 15:57:07 -08:00
elseif ( ! empty ( $def ) && is_array ( $HEADER )) // 2.0 themes - we use only $HEADER and $FOOTER arrays.
2013-02-27 04:03:13 -08:00
{
// echo " MODE 0.8";
2016-02-05 21:09:06 -08:00
if ( isset ( $HEADER [ $def ]) && isset ( $FOOTER [ $def ]))
{
$HEADER = $HEADER [ $def ];
$FOOTER = $FOOTER [ $def ];
}
else // Debug info only. No need for LAN.
{
echo e107 :: getMessage () -> addError ( " There is no layout in theme.php with the key: <b> " . $def . " </b> " ) -> render ();
}
2013-02-27 04:03:13 -08:00
}
if ( deftrue ( 'e_IFRAME' ))
{
2020-12-08 18:15:08 -08:00
$HEADER = deftrue ( 'e_IFRAME_HEADER' );
$FOOTER = deftrue ( 'e_IFRAME_FOOTER' );
2013-10-18 14:14:42 +03:00
$body_onload .= " class='e-iframe' " ;
2013-02-27 04:03:13 -08:00
}
2020-12-08 18:15:08 -08:00
$HEADER = str_replace ( " { e_PAGETITLE} " , deftrue ( 'e_PAGETITLE' ), $HEADER );
2016-06-03 19:40:17 -07:00
2017-01-22 16:29:54 +01:00
//$body_onload .= " id='layout-".e107::getForm()->name2id(THEME_LAYOUT)."' ";
2016-06-03 19:40:17 -07:00
2019-06-21 14:09:10 -07:00
if ( $noBody === true ) // New in v2.2.2 - remove need for BODYTAG.
{
echo " \n <!-- Start theme.html --> \n " ;
}
2020-12-08 18:15:08 -08:00
elseif ( ! defined ( 'BODYTAG' )) // @deprecated.
2013-05-29 01:22:11 -07:00
{
2020-12-21 10:00:28 -08:00
2017-01-22 16:29:54 +01:00
$body_onload .= " id='layout- " . e107 :: getForm () -> name2id ( THEME_LAYOUT ) . " ' " ;
2013-05-29 01:22:11 -07:00
echo " <body " . $body_onload . " > \n " ;
2021-01-26 11:55:10 -08:00
if ( isset ( $pref [ 'meta_bodystart' ][ e_LANGUAGE ]))
{
echo $pref [ 'meta_bodystart' ][ e_LANGUAGE ] . " \n " ;
}
2013-05-29 01:22:11 -07:00
}
else
{
2020-12-21 10:00:28 -08:00
trigger_error ( '<b>BODYTAG is deprecated.</b> Use a theme.html file instead.' , E_USER_DEPRECATED ); // NO LAN
2021-02-16 12:11:05 -08:00
$BODYTAG = str_replace ( 'THEME_LAYOUT' , THEME_LAYOUT , BODYTAG ); // BC Fix, but will fail with PHP8.
2013-06-07 22:43:03 +01:00
if ( $body_onload )
{
// Kludge to get the CHAP code included
2021-02-16 12:11:05 -08:00
echo substr ( trim ( $BODYTAG ), 0 , - 1 ) . ' ' . $body_onload . " > \n " ;
2013-06-07 22:43:03 +01:00
}
else
{
2020-12-21 10:00:28 -08:00
2021-02-16 12:11:05 -08:00
echo $BODYTAG . " \n " ;
2013-06-07 22:43:03 +01:00
}
2021-01-26 11:55:10 -08:00
if ( isset ( $pref [ 'meta_bodystart' ][ e_LANGUAGE ]))
{
echo $pref [ 'meta_bodystart' ][ e_LANGUAGE ] . " \n " ;
}
2021-02-16 12:11:05 -08:00
unset ( $BODYTAG );
2013-05-29 01:22:11 -07:00
}
2009-10-01 15:05:41 +00:00
2016-02-16 10:12:45 -08:00
// Bootstrap Modal Window
if ( deftrue ( 'BOOTSTRAP' ))
{
// if(empty($LAYOUT['_modal_'])) // leave it set for now.
{
2016-02-28 20:50:09 -08:00
$LAYOUT [ '_modal_' ] = ' < 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 >
2016-02-16 10:12:45 -08:00
</ div >
</ div >
' ;
2016-02-28 20:50:09 -08:00
2016-02-16 10:12:45 -08:00
}
2019-06-21 14:09:10 -07:00
if ( $noBody === false )
{
echo $LAYOUT [ '_modal_' ];
}
2016-02-16 10:12:45 -08:00
}
2013-05-17 17:34:05 -07: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' ))
{
define ( 'HEADER_INIT' , TRUE );
}
2009-10-01 15:05:41 +00:00
2020-05-02 15:35:30 -07:00
e107 :: getDebug () -> logTime ( " Main Page Body " );
2006-12-02 04:36:16 +00:00
//
// 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 ) {
2006-12-22 18:47:10 +00:00
2006-12-02 04:36:16 +00:00
//
2009-10-28 22:37:30 +00:00
// L: Removed
//
2006-12-02 04:36:16 +00:00
//
// M: Send top of body for custom pages and for news
//
2020-12-20 13:25:03 -08:00
e107 :: getDebug () -> logTime ( 'Render Layout' );
2020-05-02 15:35:30 -07:00
// BC Fix
2016-02-15 19:59:47 -08:00
if ( defset ( 'e_PAGE' ) == 'news.php' && isset ( $NEWSHEADER ))
2009-07-07 12:54:47 +00:00
{
2020-12-20 13:25:03 -08:00
e107 :: renderLayout ( $NEWSHEADER );
2006-12-02 04:36:16 +00:00
}
2009-07-07 12:54:47 +00:00
else
2013-03-26 20:13:34 -07:00
{
if ( deftrue ( 'DEMO_CONTENT' )) // embedded content relative to THEME directory - update paths.
{
$HEADER = preg_replace ( '#(src|href)=("|\')([^:\'"]*)("|\')#' , '$1=$2' . THEME . '$3$4' , $HEADER );
$FOOTER = preg_replace ( '#(src|href)=("|\')([^:\'"]*)("|\')#' , '$1=$2' . THEME . '$3$4' , $FOOTER );
}
2019-06-21 14:09:10 -07:00
$psc = array (
2021-01-26 11:55:10 -08:00
'magicSC' => array (
'{THEME}' => THEME_ABS ,
'{BODY_ONLOAD}' => $body_onload ,
'{LAYOUT_ID}' => 'layout-' . e107 :: getForm () -> name2id ( THEME_LAYOUT ),
2021-02-16 12:11:05 -08:00
'THEME_LAYOUT' => THEME_LAYOUT , // BC Fall-back: Catch and replace the missing constant- ony works with PHP < 8
2021-01-26 11:55:10 -08:00
'{---MODAL---}' => ( isset ( $LAYOUT [ '_modal_' ]) ? $LAYOUT [ '_modal_' ] : '' ) ,
2021-02-16 12:11:05 -08:00
'{---HEADER---}' => e107 :: getParser () -> parseTemplate ( '{HEADER}' ),
'{---FOOTER---}' => e107 :: getParser () -> parseTemplate ( '{FOOTER}' ),
2021-01-26 11:55:10 -08:00
),
'bodyStart' => varset ( $pref [ 'meta_bodystart' ][ e_LANGUAGE ])
);
2020-12-20 13:25:03 -08:00
e107 :: renderLayout ( $HEADER , $psc );
2019-06-21 14:09:10 -07:00
2013-03-26 20:13:34 -07:00
// echo $HEADER;
2009-07-07 12:54:47 +00:00
}
2019-06-21 14:09:10 -07:00
unset ( $def , $noBody , $psc );
2006-12-02 04:36:16 +00:00
2009-07-07 12:54:47 +00:00
// -----------------------------------------------------------------------------
2006-12-02 04:36:16 +00:00
//
// N: Send other top-of-body HTML
//
2020-12-20 13:25:03 -08:00
e107 :: getDebug () -> logTime ( 'Render Other' );
2006-12-02 04:36:16 +00:00
2013-05-25 18:24:02 -07:00
if ( ADMIN && ! vartrue ( $_SERVER [ 'E_DEV' ]) && file_exists ( e_BASE . 'install.php' ))
2009-08-20 09:03:02 +00:00
{
2013-05-25 18:24:02 -07:00
echo " <div class='installer alert alert-danger alert-block text-center'><b>*** " . CORE_LAN4 . " ***</b><br /> " . CORE_LAN5 . " </div> " ;
2006-12-02 04:36:16 +00:00
}
2020-05-03 17:43:50 +02:00
2020-05-04 21:22:13 +02:00
if ( ADMIN && $pref [ 'developer' ] && ( strpos ( e_SELF , 'localhost' ) === false ) && ( strpos ( e_SELF , '127.0.0.1' ) === false ))
2020-05-03 17:43:50 +02:00
{
2020-05-04 21:22:13 +02:00
echo " <div class='installer alert alert-danger alert-block text-center'> " . e107 :: getParser () -> toHTML ( LAN_DEVELOPERMODE_CHECK , true ) . " </div> " ;
2020-05-03 17:43:50 +02:00
}
2013-11-11 03:36:54 -08:00
//XXX TODO LAN in English.php
2013-12-21 06:23:22 -08:00
echo " <noscript><div class='alert alert-block alert-error alert-danger'><strong>This web site requires that javascript be enabled. <a rel='external' href='http://activatejavascript.org'>Click here for instructions.</a>.</strong></div></noscript> " ;
2006-12-02 04:36:16 +00:00
2013-06-21 01:26:30 -07:00
if ( deftrue ( 'BOOTSTRAP' ))
{
2018-11-22 12:40:38 -08:00
echo " <div id='uiAlert' class='notifications'></div> " ; // Popup Alert Message holder. @see http://nijikokun.github.io/bootstrap-notify/
2013-06-21 01:26:30 -07:00
}
2014-07-24 19:08:55 +03:00
/**
* Display Welcome Message when old method activated .
* fix - only when e_FRONTPAGE set to true
2018-03-10 13:36:32 -08:00
* @ see core_index_index_controller / actionIndex
2014-07-24 19:08:55 +03:00
*/
2020-12-20 11:50:10 -08:00
if ( deftrue ( 'e_FRONTPAGE' ) && strpos ( $HEADER , " { WMESSAGE " ) === false && strpos ( $FOOTER , " { WMESSAGE " ) === false ) // Auto-detection to override old pref.
2013-03-22 19:54:37 -07:00
{
echo e107 :: getParser () -> parseTemplate ( " { WMESSAGE} " );
}
2006-12-02 04:36:16 +00:00
2020-12-20 11:50:10 -08:00
if ( ! deftrue ( 'e_IFRAME' ) && ( strpos ( $HEADER , " { ALERTS} " ) === false && strpos ( $FOOTER , " { ALERTS} " ) === false )) // Old theme, missing {ALERTS}
2015-11-13 18:04:47 -08:00
{
if ( deftrue ( 'e_DEBUG' ))
{
e107 :: getMessage () -> addDebug ( " The { ALERTS} shortcode was not found in the \$ HEADER or \$ FOOTER template. It has been automatically added here. " );
}
echo e107 :: getParser () -> parseTemplate ( " { ALERTS} " );
}
2021-01-01 14:05:51 -08:00
if ( defined ( " PREVIEWTHEME " ))
2009-08-20 09:03:02 +00:00
{
2021-01-01 14:05:51 -08:00
e_theme :: showPreview ();
2006-12-02 04:36:16 +00:00
}
unset ( $text );
}
2021-02-15 07:22:47 -08:00
$GLOBALS [ 'FOOTER' ] = $FOOTER ;
//Trim whitepsaces after end of the script