1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-12 18:46:20 +02:00

Catch missing THEME_LAYOUT constant on very old themes.

This commit is contained in:
Cameron
2021-02-16 12:11:05 -08:00
parent 4203bdb2c5
commit 766b50338f

View File

@ -109,7 +109,7 @@ $js_body_onload = array(); // Legacy array of code to load with page.
//else //else
if(!e107::isCli()) if(!e107::isCli())
{ {
header("Content-type: text/html; charset=utf-8", true); header("Content-type: text/html; charset=utf-8");
} }
// NEW - HTML5 default // NEW - HTML5 default
// TODO - more precise controlo over page header depending on the HTML5 mode // TODO - more precise controlo over page header depending on the HTML5 mode
@ -678,20 +678,24 @@ else
{ {
trigger_error('<b>BODYTAG is deprecated.</b> Use a theme.html file instead.', E_USER_DEPRECATED); // NO LAN trigger_error('<b>BODYTAG is deprecated.</b> Use a theme.html file instead.', E_USER_DEPRECATED); // NO LAN
$BODYTAG = str_replace('THEME_LAYOUT', THEME_LAYOUT, BODYTAG); // BC Fix, but will fail with PHP8.
if ($body_onload) if ($body_onload)
{ {
// Kludge to get the CHAP code included // Kludge to get the CHAP code included
echo substr(trim(BODYTAG), 0, -1).' '.$body_onload.">\n"; echo substr(trim($BODYTAG), 0, -1).' '.$body_onload.">\n";
} }
else else
{ {
echo BODYTAG."\n"; echo $BODYTAG."\n";
} }
if(isset($pref['meta_bodystart'][e_LANGUAGE])) if(isset($pref['meta_bodystart'][e_LANGUAGE]))
{ {
echo $pref['meta_bodystart'][e_LANGUAGE]."\n"; echo $pref['meta_bodystart'][e_LANGUAGE]."\n";
} }
unset($BODYTAG);
} }
// Bootstrap Modal Window // Bootstrap Modal Window
@ -775,9 +779,10 @@ e107::getDebug()->logTime('Render Layout');
'{THEME}' => THEME_ABS, '{THEME}' => THEME_ABS,
'{BODY_ONLOAD}' => $body_onload, '{BODY_ONLOAD}' => $body_onload,
'{LAYOUT_ID}' => 'layout-'.e107::getForm()->name2id(THEME_LAYOUT), '{LAYOUT_ID}' => 'layout-'.e107::getForm()->name2id(THEME_LAYOUT),
'THEME_LAYOUT' => THEME_LAYOUT, // BC Fall-back: Catch and replace the missing constant- ony works with PHP < 8
'{---MODAL---}' => (isset($LAYOUT['_modal_']) ? $LAYOUT['_modal_'] : '') , '{---MODAL---}' => (isset($LAYOUT['_modal_']) ? $LAYOUT['_modal_'] : '') ,
'{---HEADER---}' => e107::getParser()->parseTemplate('{HEADER}',true), '{---HEADER---}' => e107::getParser()->parseTemplate('{HEADER}'),
'{---FOOTER---}' => e107::getParser()->parseTemplate('{FOOTER}',true), '{---FOOTER---}' => e107::getParser()->parseTemplate('{FOOTER}'),
), ),
'bodyStart' => varset($pref['meta_bodystart'][e_LANGUAGE]) 'bodyStart' => varset($pref['meta_bodystart'][e_LANGUAGE])
); );