1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 04:38:27 +01:00

Admin template upgraded to v2 standards. Admin boot, header, footer cleanup.

This commit is contained in:
Cameron 2021-01-27 12:20:58 -08:00
parent 5fb7ef6ee8
commit e45a3a7b55
13 changed files with 242 additions and 252 deletions

View File

@ -1085,7 +1085,7 @@ if(!isset($_E107['no_theme']))
}
}
$dbg->logTime("Init Theme Class");
e107::getRender()->_init(); // initialize theme class.
e107::getRender()->_init(e_ADMIN_AREA); // initialize theme class.
if ($pref['anon_post'])
{

View File

@ -26,14 +26,14 @@ if(varset($_GET['mode']) == 'customize')
}
// check that the bootstrap library path is up-to-date before the header is loaded.
if($info = e107::getLibrary()->load('bootstrap'))
/*if($info = e107::getLibrary()->load('bootstrap'))
{
if($info['path'] !== '3')
{
e107::getCache()->clearAll('library');
e107::getCache()->clearAll('browser');
}
}
}*/
e107::getDebug()->logTime('[admin.php: Loading admin_icons]');
//include_once(e107::coreTemplatePath('admin_icons'));
@ -210,6 +210,9 @@ class admin_start
e107::getRedirect()->go(e_REQUEST_SELF);
}
// delete half-completed user accounts. (previously called in header.php )
e107::getUserSession()->deleteExpired();
}
private function checkPaths()

View File

@ -26,8 +26,8 @@ define('e_CAPTCHA_FONTCOLOR','#F9A533');
// Required for a clean v1.x -> v2 upgrade.
$core = e107::getConfig('core');
if($core->get('admintheme') != 'bootstrap3')
$adminTheme = $core->get('admintheme');
if($adminTheme !== 'bootstrap3' && $adminTheme !== 'bootstrap5')
{
$core->update('admintheme','bootstrap3');
$core->update('adminstyle','infopanel');

View File

@ -24,7 +24,6 @@ if(!e107::isCli())
define('ADMINFEED', 'https://e107.org/adminfeed');
if(!empty($_GET['iframe']) && !defined('e_IFRAME')) // global iframe support.
{
define('e_IFRAME', true);
@ -45,7 +44,7 @@ if(e_AJAX_REQUEST && getperms('0') && varset($_GET['mode']) == 'core' && ($_GET
e107::getSession()->set('core-update-checked',false);
$status = (update_check() === true) ? true : false;
$status = update_check() === true;
e107::getSession()->set('core-update-status',$status);
@ -237,7 +236,6 @@ e107::coreLan('footer', true);
e107::getDebug()->logTime('[boot.php: Loading admin_icons]');
e107::loadAdminIcons();
e107::getDebug()->logTime('[boot.php: After Loading admin_icons]');
//include_once(e107::coreTemplatePath('admin_icons'));
if(!defset('e_ADMIN_UI') && !defset('e_PAGETITLE'))
@ -263,9 +261,7 @@ if (!defined('ADMIN_WIDTH')) //BC Only
/**
* Automate DB system messages DEPRECATED
* NOTE: default value of $output parameter will be changed to false (no output by default) in the future
*
* @deprecated
* @param integer|bool $update return result of db::db_Query
* @param string $type update|insert|update
* @param string|bool $success forced success message
@ -273,14 +269,11 @@ if (!defined('ADMIN_WIDTH')) //BC Only
* @param bool $output false suppress any function output
* @return integer|bool db::db_Query result
*/
// TODO - This function often needs to be available BEFORE header.php is loaded.
//XXX DEPRECATED It has been copied to message_handler.php as addAuto();
function admin_updXXate($update, $type = 'update', $success = false, $failed = false, $output = true)
function admin_update($update, $type = 'update', $success = false, $failed = false, $output = true)
{
e107::getMessage()->addDebug("Using deprecated admin_update () which has been replaced by \$mes->addAuto();");
$message = "admin_update() is deprecated (). Use e107::getMessage()->addAuto(); instead. ";
e107::getMessage()->addDebug($message);
trigger_error($message);
return e107::getMessage()->addAuto($update, $type, $success , $failed , $output);
}
@ -320,24 +313,43 @@ function admin_purge_related($table, $id)
$ns = e107::getRender();
$e107_var = array();
// Left in for BC for now.
/**
* @deprecated Left in for BC for now. Use admin-ui instead.
* @param $title
* @param $active_page
* @param $e107_vars
* @param array $tmpl
* @param false $sub_link
* @param false $sortlist
* @return string|null
*/
function e_admin_menu($title, $active_page, $e107_vars, $tmpl = array(), $sub_link = false, $sortlist = false)
{
global $E_ADMIN_MENU;
if (!$tmpl)
$tmpl = $E_ADMIN_MENU;
{
$tmpl = e107::getCoreTemplate('admin', 'menu', false);
}
return e107::getNav()->admin($title, $active_page, $e107_vars, $tmpl, $sub_link , $sortlist );
}
/*
* DEPRECATED - use e_adm/in_menu() e107::getNav()->admin
*/
if (!function_exists('show_admin_menu'))
{
/**
* @deprecated Use admin-ui instead.
* @param $title
* @param $active_page
* @param $e107_vars
* @param false $js
* @param false $sub_link
* @param false $sortlist
* @return string|null
*/
function show_admin_menu($title, $active_page, $e107_vars, $js = FALSE, $sub_link = FALSE, $sortlist = FALSE)
{
unset($js,$sub_link);
@ -345,25 +357,5 @@ if (!function_exists('show_admin_menu'))
}
}
if (!function_exists("parse_admin"))
{
function parse_admin($ADMINLAYOUT)
{
$sc = e107::getScBatch('admin');
$tp = e107::getParser();
// parse_admin() has been replaced by e107::renderLayout()
$adtmp = explode("\n", $ADMINLAYOUT);
for ($a = 0, $aMax = count($adtmp); $a < $aMax; $a++)
{
if (preg_match("/{.+?}/", $adtmp[$a]))
{
echo $tp->parseTemplate($adtmp[$a], true, $sc);
}
else
{
echo $adtmp[$a];
}
}
}
}

View File

@ -21,7 +21,7 @@ if (!defined('e107_INIT'))
$GLOBALS['E107_IN_FOOTER'] = true; // For registered shutdown function
global $error_handler,$db_time,$ADMIN_FOOTER;
global $error_handler,$db_time;
// Legacy fix - call header if not already done, mainly fixing left side menus to work proper
if(!deftrue('e_ADMIN_UI') )
@ -98,7 +98,8 @@ if (varset($e107_popup) != 1)
//NEW - Iframe mod
if (!deftrue('e_IFRAME'))
{
parse_admin($ADMIN_FOOTER);
$ADMIN_FOOTER = e107::getCoreTemplate('admin', 'footer', false);
e107::renderLayout($ADMIN_FOOTER, ['sc'=>'admin']);
}
$eTimingStop = microtime();

View File

@ -12,13 +12,13 @@
* $Id:$
*/
if (!defined('e107_INIT'))
if(!defined('e107_INIT'))
{
exit;
}
if (!defined('ADMIN_AREA'))
if(!defined('ADMIN_AREA')) //avoid PHP warning
{
//avoid PHP warning
define("ADMIN_AREA", true);
}
if(!defined('USER_AREA'))
@ -28,53 +28,31 @@ if(!defined('USER_AREA'))
e107::getDebug()->logTime('(Header Top)');
if(!deftrue('e_MENUMANAGER_ACTIVE'))
{
if (defined('THEME') && file_exists(THEME.'admin_template.php')) // Admin template
{
require_once (THEME.'admin_template.php');
}
else
{
require_once (e_CORE.'templates/admin_template.php');
}
// FIXME - remove ASAP
if (isset($pref['del_unv']) && $pref['del_unv'] && $pref['user_reg_veri'] != 2)
{
$threshold = (time() - ($pref['del_unv'] * 60));
e107::getDb()->delete("user", "user_ban = 2 AND user_join < '{$threshold}' ");
}
}
function loadJSAddons()
{
if(deftrue('e_MENUMANAGER_ACTIVE'))
{
return;
return;
}
// 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);
// e107::css('core', 'bootstrap-multiselect/css/bootstrap-multiselect.css', 'jquery');
e107::js('footer', '{e_WEB}js/bootstrap-multiselect/js/bootstrap-multiselect.js', 'jquery', 2);
// TODO: remove typeahead.
e107::js('footer', '{e_WEB}js/bootstrap-jasny/js/jasny-bootstrap.js', 'jquery', 2);
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);
e107::js('footer','{e_WEB}js/jquery.h5validate.min.js','jquery', 2);
e107::js('footer', '{e_WEB}js/jquery.h5validate.min.js', 'jquery', 2);
e107::js('footer', '{e_WEB}js/jquery.elastic.js', 'jquery', 2);
e107::js('footer', '{e_WEB}js/jquery.at.caret.min.js', 'jquery', 2);
@ -86,10 +64,10 @@ function loadJSAddons()
$plUpload = 'plupload/i18n/' . e_LAN . '.js';
if(e_LAN != 'en' && file_exists(e_WEB_JS . $plUpload))
{
e107::js('footer', e_WEB_JS. $plUpload, 'jquery', 5);
}
if(e_LAN != 'en' && file_exists(e_WEB_JS . $plUpload))
{
e107::js('footer', e_WEB_JS . $plUpload, 'jquery', 5);
}
}
@ -97,10 +75,6 @@ function loadJSAddons()
loadJSAddons();
// e107::js("core", "core/admin.js","prototype",3); // Load all default functions.
@ -152,35 +126,31 @@ loadJSAddons();
// C: Send start of HTML
//
echo "<!doctype html>\n";
echo "<html".(defined("TEXTDIRECTION") ? " dir='".TEXTDIRECTION."'" : "").(defined("CORE_LC") ? " lang=\"".CORE_LC."\"" : "").">\n";
echo "<head>\n";
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";
echo "<meta charset='utf-8' />\n";
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.
echo "<title>".(defined("e_PAGETITLE") ? e_PAGETITLE." - " : (defined("PAGE_NAME") ? PAGE_NAME." - " : "")).LAN_HEADER_04." :: ".SITENAME."</title>\n";
//
// D: Send CSS
//
echo "<!-- *CSS* -->\n";
$e_js = e107::getJs();
$e_js = e107::getJs();
// Core CSS - XXX awaiting for path changes
if (!isset($no_core_css) || !$no_core_css)
if(!isset($no_core_css) || !$no_core_css)
{
//echo "<link rel='stylesheet' href='".e_FILE_ABS."e107.css' type='text/css' />\n";
$e_js->otherCSS('{e_WEB_CSS}e107.css');
}
// Register Plugin specific CSS (BC)
if (isset($eplug_css) && $eplug_css)
if(isset($eplug_css) && $eplug_css)
{
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))
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))
{
$eplug_css = array($eplug_css);
}
@ -192,9 +162,6 @@ if (isset($eplug_css) && $eplug_css)
}
if(deftrue('e_MENUMANAGER_ACTIVE')) // load frontend style.css
{
$css_file = $pref['themecss'];
@ -210,56 +177,50 @@ else // backend css.
$e_js->otherCSS($val['path']);
}
//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);
}
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);
}*/
//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);
}
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);
}*/
}
// 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'))
if(defined('TEXTDIRECTION') && file_exists(THEME . '/' . strtolower(TEXTDIRECTION) . '.css'))
{
$e_js->themeCSS(strtolower(TEXTDIRECTION).'.css');
$e_js->themeCSS(strtolower(TEXTDIRECTION) . '.css');
}
// --- Load plugin Header files before all CSS nad JS zones. --------
if (!empty($pref['e_header_list']) && is_array($pref['e_header_list']))
if(!empty($pref['e_header_list']) && is_array($pref['e_header_list']))
{
foreach($pref['e_header_list'] as $val)
{
// no checks fore existing file - performance
e107_include_once(e_PLUGIN.$val."/e_header.php");
e107_include_once(e_PLUGIN . $val . "/e_header.php");
}
}
unset($e_headers);
@ -269,30 +230,29 @@ unset($e_headers);
echo "\n<!-- Library CSS -->\n";
$e_js->renderJs('library_css', false, 'css', false);
$e_js->renderJs('library_css', false, 'css');
echo "\n<!-- footer_library_css -->\n"; // substituted in footer when detected.
// Other CSS - from unknown location, different from core/theme/plugin location or backward compatibility
$e_js->renderJs('other_css', false, 'css', false);
$e_js->renderJs('other_css', false, 'css');
echo "\n<!-- footer_other_css -->\n"; // substituted in footer when detected.
// Core CSS
$e_js->renderJs('core_css', false, 'css', false);
$e_js->renderJs('core_css', false, 'css');
echo "\n<!-- footer_core_css -->\n";
// Theme CSS
//echo "<!-- Theme css -->\n";
$e_js->renderJs('theme_css', false, 'css', false);
$e_js->renderJs('theme_css', false, 'css');
echo "\n<!-- footer_theme_css -->\n";
// Plugin CSS
$e_js->renderJs('plugin_css', false, 'css', false);
$e_js->renderJs('plugin_css', false, 'css');
echo "\n<!-- footer_plugin_css -->\n";
// Inline CSS - not sure if this should stay at all!
$e_js->renderJs('inline_css', false, 'css', false);
$e_js->renderJs('inline_css', false, 'css');
echo "\n<!-- footer_inline_css -->\n";
//
@ -314,7 +274,7 @@ 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 = e107::getObject('e_jslib', null, e_HANDLER . 'jslib_handler.php');
$jslib->renderHeader('admin', false);
// [JSManager] Load JS Includes - Zone 2 - After Library, before CSS
@ -322,9 +282,9 @@ e107::getJs()->renderJs('header', 2);
e107::getJs()->renderJs('header_inline', 2);
/* @deprecated -use e107::js('myplug','js/my.js') instead; */
if (!empty($eplug_js))
if(!empty($eplug_js))
{
e107::getMessage()->addDebug('Deprecated $eplug_js method detected. Use e107::js() function inside an e_header.php file instead.'.print_a($eplug_js,true));
e107::getMessage()->addDebug('Deprecated $eplug_js method detected. Use e107::js() function inside an e_header.php file instead.' . print_a($eplug_js, true));
echo "\n<!-- eplug_js -->\n";
if(!is_array($eplug_js))
@ -339,18 +299,17 @@ if (!empty($eplug_js))
}
//FIXME - theme.js/user.js should be registered/rendered through e_jsmanager
// BC Fix.
if (file_exists(THEME.'theme.js'))
if(file_exists(THEME . 'theme.js'))
{
e107::js('theme','theme.js',null,3);
e107::js('theme', 'theme.js', null, 3);
// echo "<script type='text/javascript' src='".THEME_ABS."theme.js'></script>\n";
}
if (is_readable(e_FILE.'user.js') && filesize(e_FILE.'user.js'))
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";
echo "<script type='text/javascript' src='" . e_FILE_ABS . "user.js'></script>\n";
}
@ -365,22 +324,22 @@ echo "<!-- *META* -->\n";
// --- Load plugin Meta files and eplug_ before others --------
/** @var array $incompatibleMeta - plugins that may cause jQuery conflicts etc if loaded. */
$incompatibleMeta = array('aa_jquery', 'fancybox', 'lightwindow', 'e107slider' );
/** @var array $incompatibleMeta - plugins that may cause jQuery conflicts etc if loaded. */
$incompatibleMeta = array('aa_jquery', 'fancybox', 'lightwindow', 'e107slider');
if (!empty($pref['e_meta_list']))
if(!empty($pref['e_meta_list']))
{
foreach ($pref['e_meta_list'] as $val)
foreach($pref['e_meta_list'] as $val)
{
if(in_array($val,$incompatibleMeta))
{
continue;
}
if(in_array($val, $incompatibleMeta))
{
continue;
}
if (is_readable(e_PLUGIN.$val."/e_meta.php"))
if(is_readable(e_PLUGIN . $val . "/e_meta.php"))
{
echo "\n\n<!-- $val meta -->\n";
require_once (e_PLUGIN.$val."/e_meta.php");
require_once(e_PLUGIN . $val . "/e_meta.php");
}
}
}
@ -388,21 +347,21 @@ if (!empty($pref['e_meta_list']))
unset($incompatibleMeta);
if (!USER && ($pref['user_tracking'] == "session") && varset($pref['password_CHAP'],0))
if(!USER && ($pref['user_tracking'] == "session") && varset($pref['password_CHAP'], 0))
{
if ($pref['password_CHAP'] == 2)
{
if($pref['password_CHAP'] == 2)
{
// *** 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');";
}
echo "<script type='text/javascript' src='".e_JS."chap_script.js'></script>\n";
$js_body_onload[] = "getChallenge();";
}
echo "<script type='text/javascript' src='" . e_JS . "chap_script.js'></script>\n";
$js_body_onload[] = "getChallenge();";
}
if (function_exists('headerjs'))// required for BC.
if(function_exists('headerjs'))// required for BC.
{
echo headerjs();
}
@ -423,20 +382,20 @@ e107::getJs()->renderJs('header_inline', 4);
// ---------- Favicon ---------
$sitetheme = e107::getPref('sitetheme');
if (file_exists(e_THEME.$sitetheme."/favicon.ico"))
if(file_exists(e_THEME . $sitetheme . "/favicon.ico"))
{
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";
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";
}
elseif (file_exists(e_BASE."favicon.ico"))
elseif(file_exists(e_BASE . "favicon.ico"))
{
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";
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";
}
unset($sitetheme);
//
// G: Send Theme Headers
//
if (function_exists('theme_head'))
if(function_exists('theme_head'))
{
echo "\n<!-- *THEME HEAD* -->\n";
echo theme_head();
@ -465,13 +424,13 @@ if(!empty($js_body_onload))
if(deftrue('e_MENUMANAGER_ACTIVE'))
{
$body_onload .= " id=\"layout-".e107::getForm()->name2id(THEME_LAYOUT)."\" ";
$body_onload .= " id=\"layout-" . e107::getForm()->name2id(THEME_LAYOUT) . "\" ";
}
else
{
$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)."\" ";
$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) . "\" ";
unset($bodyID);
}
@ -519,7 +478,7 @@ if(deftrue('e_MENUMANAGER_ACTIVE') && defset('THEME_LAYOUT') && e_theme::loadLay
else
{
echo "
<body".$body_onload.">\n";
<body" . $body_onload . ">\n";
echo getModal();
echo getAlert();
@ -529,7 +488,7 @@ function getModal()
{
if(deftrue('BOOTSTRAP')) // see bootstrap3/admin_template.php
{
{
return '';
}
@ -537,13 +496,14 @@ function getModal()
{
return null;
}
/*
if(e_PAGE == "image.php")
{
return;
}
*/
return '
<div id="uiModal" class="modal fade" tabindex="-1" role="dialog" aria-hidden="true">
@ -563,21 +523,21 @@ function getModal()
</div>
</div>
</div>
</div>';
</div>';
}
function getAlert()
{
return '<div id="uiAlert" class="notifications center"><!-- empty --></div>';
}
// Header included notification, from this point header includes are not possible
if(!defined('HEADER_INIT'))
{
define('HEADER_INIT', TRUE);
define('HEADER_INIT', true);
}
e107::getDebug()->logTime("End Head, Start Body");
@ -587,11 +547,11 @@ e107::getDebug()->logTime("End Head, Start Body");
//
// require $e107_popup =1; to use it as header for popup without menus
if (!isset($e107_popup))
if(!isset($e107_popup))
{
$e107_popup = 0;
}
if ($e107_popup != 1)
if($e107_popup != 1)
{
//
@ -609,7 +569,7 @@ if ($e107_popup != 1)
// 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
@ -619,23 +579,26 @@ if ($e107_popup != 1)
e107::getDebug()->logTime('Parse Admin Header');
//NEW - Iframe mod
if (!deftrue('e_IFRAME'))
if(!deftrue('e_IFRAME'))
{
//removed check strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE
parse_admin($ADMIN_HEADER);
$ADMIN_HEADER = e107::getCoreTemplate('admin', 'header', false);
$ADMIN_MODAL = e107::getCoreTemplate('admin', 'modal', false);
e107::renderLayout($ADMIN_MODAL . $ADMIN_HEADER, ['sc'=>'admin']);
}
elseif(!vartrue($_GET['configure']))
elseif(!vartrue($_GET['configure']))
{
e107::css("inline","body { padding:0px } "); // default padding for iFrame-only.
e107::css("inline", "body { padding:0px } "); // default padding for iFrame-only.
}
e107::getDebug()->logTime('(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))
if(!varset($emessage) && !is_object($emessage))
{
$emessage = e107::getMessage();
}

View File

@ -305,6 +305,11 @@ class theme_admin_ui extends e_admin_ui
}
}
if(!empty($_POST['selectadmin']))
{
$id = key($_POST['selectadmin']);
$this->setAdminTheme($id);
}
@ -317,6 +322,26 @@ class theme_admin_ui extends e_admin_ui
$this->getTreeModel()->setParams($param)->loadBatch(); // load the tree model above from the class below.
}
private function setAdminTheme($folder)
{
$adminCSS = file_exists(e_THEME.$pref['admintheme'].'/admin_dark.css') ? 'admin_dark.css' : 'admin_light.css';
e107::getConfig()->set('admintheme',$folder)->set('admincss',$adminCSS)->save(true,true,true);
e107::getCache()->clear_sys();
/* if(save_prefs())
{
// Default Message
$mes->add(TPVLAN_40." <b>'".$themeArray[$this->id]."'</b>", E_MESSAGE_SUCCESS);
$this->theme_adminlog('02', $pref['admintheme'].', '.$pref['admincss']);
}*/
// $ns->tablerender("Admin Message", "<br /><div style='text-align:center;'>".TPVLAN_40." <b>'".$themeArray[$this -> id]."'</b>.</div><br />");
// $this->showThemes('admin');
}
public function OnlineObserver()
{
unset($this->fields['checkboxes']);
@ -689,7 +714,7 @@ class theme_admin_ui extends e_admin_ui
* Load data from online
* @param bool $force
*/
function setThemeData($force=false)
private function setThemeData($force=false)
{
$themeList = e107::getTheme()->getList();
@ -983,7 +1008,7 @@ class theme_admin_form_ui extends e_admin_form_ui
if(in_array($theme['path'], $this->approvedAdminThemes))
{
$admin_icon = ($pref['admintheme'] !== $theme['path'] ) ? "<button class='btn btn-default btn-small btn-sm btn-inverse' type='submit' name='selectadmin[".$theme['id']."]' alt=\"".TPVLAN_32."\" title=\"".TPVLAN_32."\" >".$tp->toGlyph('fa-gears',array('size'=>'2x'))."</button>" : "<button class='btn btn-small btn-default btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";
$admin_icon = ($pref['admintheme'] !== $theme['path'] ) ? "<button class='btn btn-default btn-secondary btn-small btn-sm btn-inverse' type='submit' name='selectadmin[".$theme['path']."]' alt=\"".TPVLAN_32."\" title=\"".TPVLAN_32."\" >".$tp->toGlyph('fa-gears',array('size'=>'2x'))."</button>" : "<button class='btn btn-small btn-default btn-secondary btn-sm btn-inverse' type='button'>".$tp->toGlyph('fa-check',array('size'=>'2x'))."</button>";
}
$preview_icon = "<a class='e-modal btn btn-default btn-secondary btn-sm btn-small btn-inverse' title=' ".TPVLAN_70." ".$theme['name']."' data-modal-caption=\"".$theme['name']." ".$theme['version']."\" rel='external' href='".$previewPath."'>".$tp->toGlyph('fa-search',array('size'=>'2x'))."</a>";

View File

@ -2022,7 +2022,8 @@ Inverse 10 <span class="badge badge-inverse">10</span>
}
$tmpl = strtoupper(varset($parms['tmpl'], 'E_ADMIN_NAVIGATION'));
global $$tmpl;
// global $$tmpl;
$template = e107::getCoreTemplate('admin', 'nav', false);
if($parm === 'enav_popover') // @todo move to template and make generic.
@ -2032,7 +2033,7 @@ Inverse 10 <span class="badge badge-inverse">10</span>
return null;
}
$template = $$tmpl;
// $template = $$tmpl;
$upStatus = (e107::getSession()->get('core-update-status') === true) ? '<span title="' .ADLAN_120. '" class="text-info"><i class="fa fa-database"></i></span>' : '<!-- -->';
@ -2043,7 +2044,7 @@ Inverse 10 <span class="badge badge-inverse">10</span>
if($parm == self::ADMIN_NAV_HOME || $parm == self::ADMIN_NAV_LOGOUT || $parm == self::ADMIN_NAV_LANGUAGE || $parm === 'pm')
{
$template = (array) $$tmpl;
// $template = (array) $$tmpl;
$template['start'] = varset($template['start_other']);
@ -2214,7 +2215,7 @@ Inverse 10 <span class="badge badge-inverse">10</span>
// e107::getDebug()->log($menu_vars);
return e107::getNav()->admin('', $active, $menu_vars, $$tmpl);
return e107::getNav()->admin('', $active, $menu_vars, $template);
}

View File

@ -17,16 +17,15 @@
if (!defined('e107_INIT')) { exit(); }
//e107::lan('theme', 'admin',true);
$E_ADMIN_NAVIGATION['start'] = '<ul class="nav nav-admin navbar-nav navbar-left">';
$ADMIN_TEMPLATE['nav']['start'] = '<ul class="nav nav-admin navbar-nav navbar-left">';
$E_ADMIN_NAVIGATION['start_other'] = '<ul class="nav nav-admin navbar-nav navbar-right">';
$ADMIN_TEMPLATE['nav']['start_other'] = '<ul class="nav nav-admin navbar-nav navbar-right">';
$E_ADMIN_NAVIGATION['button'] = '
$ADMIN_TEMPLATE['nav']['button'] = '
<li class="dropdown">
<a class="dropdown-toggle navbar-admin-button" role="button" data-toggle="dropdown" data-bs-toggle="dropdown" data-target="#" href="{LINK_URL}" title="{LINK_TEXT}">
<a class="dropdown-toggle navbar-admin-button" role="button" data-toggle="dropdown" data-target="#" href="{LINK_URL}" title="{LINK_TEXT}">
{LINK_IMAGE}
</a>
@ -36,9 +35,9 @@ $E_ADMIN_NAVIGATION['button'] = '
$E_ADMIN_NAVIGATION['button_active'] = '
$ADMIN_TEMPLATE['nav']['button_active'] = '
<li class="dropdown active">
<a class="dropdown-toggle navbar-admin-button" role="button" data-toggle="dropdown" data-bs-toggle="dropdown" data-target="#" href="{LINK_URL}" title="{LINK_TEXT}">
<a class="dropdown-toggle navbar-admin-button" role="button" data-toggle="dropdown" data-target="#" href="{LINK_URL}" title="{LINK_TEXT}">
{LINK_IMAGE}
</a>
@ -49,12 +48,12 @@ $E_ADMIN_NAVIGATION['button_active'] = '
// Leave Admin Area.
$E_ADMIN_NAVIGATION['button_enav_home'] = '
// Leave Admin Area.
$ADMIN_TEMPLATE['nav']['button_enav_home'] = '
<li class="dropdown">
<a class="dropdown-toggle" style="display:inline-block; margin-right:0;" title="'.ADLAN_53.'" href="'.e_HTTP.'" >
{LINK_IMAGE} {LINK_TEXT}
</a><a style="display:inline-block;border-left:0;margin-left:0;padding-left:4px;" class="dropdown-toggle" title="'.ADLAN_53.'" role="button" data-toggle="dropdown" data-bs-toggle="dropdown" data-target="#" href="{LINK_URL}" >
</a><a style="display:inline-block;border-left:0;margin-left:0;padding-left:4px;" class="dropdown-toggle" title="'.ADLAN_53.'" role="button" data-toggle="dropdown" data-target="#" href="{LINK_URL}" >
<b class="caret"></b>
</a>
{SUB_MENU}
@ -62,9 +61,9 @@ $E_ADMIN_NAVIGATION['button_enav_home'] = '
';
// Change Language
$E_ADMIN_NAVIGATION['button_enav_language'] = '
$ADMIN_TEMPLATE['nav']['button_enav_language'] = '
<li class="dropdown">
<a class="dropdown-toggle" title="'.LAN_CHANGE_LANGUAGE.'" role="button" data-toggle="dropdown" data-bs-toggle="dropdown" data-target="#" href="{LINK_URL}" >
<a class="dropdown-toggle" title="'.LAN_CHANGE_LANGUAGE.'" role="button" data-toggle="dropdown" data-target="#" href="{LINK_URL}" >
{LINK_IMAGE} {LINK_TEXT}
<b class="caret"></b>
</a>
@ -73,7 +72,7 @@ $E_ADMIN_NAVIGATION['button_enav_language'] = '
';
$str = str_replace('.', '', ADMINPERMS);
if ($str == '0')
{
$label = ADLAN_48.': '.ADMINNAME.' ('.ADLAN_49.') ';
@ -81,13 +80,13 @@ $E_ADMIN_NAVIGATION['button_enav_language'] = '
else
{
$label = ADLAN_48.': '.ADMINNAME.' ';
}
}
// Logout / Settings / Personalize
$E_ADMIN_NAVIGATION['button_enav_logout'] = '
// Logout / Settings / Personalize
$ADMIN_TEMPLATE['nav']['button_enav_logout'] = '
<li class="dropdown">
<a class="dropdown-toggle admin-icon-avatar " title="'.$label.'" role="button" data-toggle="dropdown" data-bs-toggle="dropdown" data-target="#" href="{LINK_URL}" >
<a class="dropdown-toggle admin-icon-avatar " title="'.$label.'" role="button" data-toggle="dropdown" data-target="#" href="{LINK_URL}" >
{LINK_IMAGE} {LINK_TEXT}
<b class="caret"></b>
</a>
@ -96,14 +95,14 @@ $E_ADMIN_NAVIGATION['button_enav_logout'] = '
';
// Private Messaging - //TODO Discuss and make this work..
$E_ADMIN_NAVIGATION['button_pm'] = '
// Private Messaging - //TODO Discuss and make this work..
$ADMIN_TEMPLATE['nav']['button_pm'] = '
<li class="dropdown">
<a class="dropdown-toggle" title="Messages" role="button" data-toggle="dropdown" data-bs-toggle="dropdown" href="#" >
<a class="dropdown-toggle" title="Messages" role="button" data-toggle="dropdown" href="#" >
<i class="icon-envelope active"></i> 3
<b class="caret"></b>
</a>
<div id="dropdown" class="dropdown-menu dropdown-menu-end pull-right float-right e-noclick" style="padding:10px;width:300px;">
<div id="dropdown" class="dropdown-menu pull-right dropdown-menu-end float-right e-noclick" style="padding:10px;width:300px;">
<ul class="nav-list">
<li class="dropdown-header nav-header">Unread Messages</li>
<li><a href="#">Incoming Message Number 1</a></li>
@ -119,7 +118,7 @@ $E_ADMIN_NAVIGATION['button_pm'] = '
$E_ADMIN_NAVIGATION['button_other'] = '
$ADMIN_TEMPLATE['nav']['button_other'] = '
<li>
<a role="button" href="{LINK_URL}" >
{LINK_TEXT}
@ -127,28 +126,28 @@ $E_ADMIN_NAVIGATION['button_other'] = '
</li>
';
$E_ADMIN_NAVIGATION['start_sub'] = '
$ADMIN_TEMPLATE['nav']['start_sub'] = '
<ul class="dropdown-menu {LINK_SUB_OVERSIZED}" role="menu" >
';
$E_ADMIN_NAVIGATION['start_other_sub'] = '
$ADMIN_TEMPLATE['nav']['start_other_sub'] = '
<ul class="dropdown-menu dropdown-menu-end pull-right float-right" role="menu" >
';
$E_ADMIN_NAVIGATION['button_sub'] = '
$ADMIN_TEMPLATE['nav']['button_sub'] = '
<li role="menuitem" class="{LINK_CLASS}">
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_TEXT}</a>
</li>
';
$E_ADMIN_NAVIGATION['button_active_sub'] = '
$ADMIN_TEMPLATE['nav']['button_active_sub'] = '
<li role="menuitem" class="active">
<a href="{LINK_URL}">{LINK_IMAGE}{LINK_TEXT}</a>
</li>
';
$E_ADMIN_NAVIGATION['end_sub'] = '</ul>';
$ADMIN_TEMPLATE['nav']['end_sub'] = '</ul>';
$E_ADMIN_NAVIGATION['end'] = '</ul>';
$ADMIN_TEMPLATE['nav']['end'] = '</ul>';
/*
<div class="admin-navigation">
@ -158,9 +157,9 @@ $E_ADMIN_NAVIGATION['end'] = '</ul>';
*/
// $inverse = (e107::getPref('admincss') == "admin_light.css") ? "navbar-inverse" : "";
$ADMIN_MODAL = '
$ADMIN_TEMPLATE['modal'] = '
<div id="uiModal" class="modal fade">
<div id="admin-ui-modal" class="modal-dialog modal-lg">
<div class="modal-content">
@ -183,11 +182,11 @@ $ADMIN_MODAL = '
';
$ADMIN_HEADER = $ADMIN_MODAL . '
$ADMIN_TEMPLATE['header'] = '
<div class="navbar navbar-default navbar-fixed-top" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-bs-toggle="collapse" data-target=".navbar-collapse">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -219,7 +218,7 @@ $ADMIN_HEADER = $ADMIN_MODAL . '
$adminstyle = e107::getConfig()->get('adminstyle', 'infopanel');
if(defset('e_PAGE') == 'admin.php' && $adminstyle == 'flexpanel' && varset($_GET['mode']) != 'customize')
{
$ADMIN_HEADER .= '
$ADMIN_TEMPLATE['header'] .= '
<div class="col-sm-12">
<div class="admin-main-content is-table-row">
';
@ -227,7 +226,7 @@ if(defset('e_PAGE') == 'admin.php' && $adminstyle == 'flexpanel' && varset($_GET
else
{
$ADMIN_HEADER .= '
$ADMIN_TEMPLATE['header'] .= '
<div class="col-md-3 col-lg-2 admin-left-panel hidden-print">
{SETSTYLE=warning}
{ADMIN_ADDON_UPDATES}
@ -269,7 +268,7 @@ else
}
// TODO - LANs
$ADMIN_FOOTER = '
$ADMIN_TEMPLATE['footer'] = '
</div>
</div>
</div><!--/.row-->
@ -282,50 +281,50 @@ $ADMIN_FOOTER = '
/* NEW ADMIN MENU TEMPLATE
* see function e107::getNav()->admin() in e107_admin/header.php
*/
$E_ADMIN_MENU['start'] = '
$ADMIN_TEMPLATE['menu']['start'] = '
<div class="nav-panel-body">
<ul id="admin-ui-nav-menu" class="plugin-navigation nav nav-pills nav-stacked">
';
$E_ADMIN_MENU['button'] = '
$ADMIN_TEMPLATE['menu']['button'] = '
<li>
<a class="link{LINK_CLASS}" {LINK_DATA} href="{LINK_URL}" {ID}{ONCLICK}>&nbsp;{LINK_TEXT}{LINK_BADGE}</a>
{SUB_MENU}
</li>
';
$E_ADMIN_MENU['button_active'] = '
$ADMIN_TEMPLATE['menu']['button_active'] = '
<li class="active">
<a class="link-active{LINK_CLASS}" {LINK_DATA} href="{LINK_URL}" {ID}{ONCLICK}>&nbsp;{LINK_TEXT}{LINK_BADGE}</a>
{SUB_MENU}
</li>
';
$E_ADMIN_MENU['start_sub'] = '
$ADMIN_TEMPLATE['menu']['start_sub'] = '
<ul class="plugin-navigation-sub{SUB_CLASS}" {SUB_ID}>
';
$E_ADMIN_MENU['button_sub'] = '
$ADMIN_TEMPLATE['menu']['button_sub'] = '
<li>
<a class="link" href="{LINK_URL}">&nbsp;{LINK_TEXT}{LINK_BADGE}</a>
{SUB_MENU}
</li>
';
$E_ADMIN_MENU['button_active_sub'] = '
$ADMIN_TEMPLATE['menu']['button_active_sub'] = '
<li>
<a class="link-active" href="{LINK_URL}">&nbsp;{LINK_TEXT}{LINK_BADGE}</a>
{SUB_MENU}
</li>
';
$E_ADMIN_MENU['end_sub'] = '
$ADMIN_TEMPLATE['menu']['end_sub'] = '
</ul>
';
$E_ADMIN_MENU['end'] = '
$ADMIN_TEMPLATE['menu']['end'] = '
</ul>
</div>
';
$E_ADMIN_MENU['divider'] = '<li role="separator" class="divider"></li>';
$ADMIN_TEMPLATE['menu']['divider'] = '<li role="separator" class="divider"></li>';

View File

@ -319,8 +319,7 @@ class e107
$tmp = explode("\n", $LAYOUT);
$sc = self::getScBatch('_theme_'); // include the theme shortcodes.
$sc = isset($opts['sc']) ? self::getScBatch($opts['sc']) : self::getScBatch('_theme_'); // include the theme shortcodes.
$parseMagic = false;
$bodyStart = false;

View File

@ -16,7 +16,7 @@
private $themeClass = 'theme'; // v2.3.0+
private $legacyThemeClass;
private $adminThemeClass;
public $frontend = false;
public $adminarea = false;
private $uniqueId = null;
private $content = array();
private $contentTypes = array('header', 'footer', 'text', 'title', 'image', 'list');
@ -24,8 +24,9 @@
private $thm;
public function _init()
public function _init($adminarea=false)
{
$this->adminarea = (bool) $adminarea;
$this->legacyThemeClass = e107::getPref('sitetheme') . '_theme'; // disabled at the moment.
$this->adminThemeClass = e107::getPref('admintheme') . '_admintheme'; // Check for a class.
@ -60,10 +61,19 @@
return null;
}
if(($this->frontend === false) && class_exists($this->adminThemeClass))
if(($this->adminarea === true))
{
/** @var e_theme_render $thm */
$this->thm = new $this->adminThemeClass();
if(class_exists($this->adminThemeClass))
{
$this->thm = new $this->adminThemeClass();
}
else
{
echo "<h3>COULDN'T FIND ".$this->adminThemeClass." CLASS</h3>";
}
}
elseif(class_exists($this->themeClass)) // v2.3.0+
{

View File

@ -1163,14 +1163,11 @@ i.e-cat_users-32{ background-position: -555px 0; width: 32px; height: 32px; }
function admin($title, $active_page, $e107_vars, $tmpl = array(), $sub_link = false, $sortlist = false)
{
global $E_ADMIN_MENU; //TODO remove me?
$tp = e107::getParser();
if (!$tmpl)
{
$tmpl = $E_ADMIN_MENU;
$tmpl = e107::getCoreTemplate('admin', 'menu', false);
}
/*

View File

@ -1353,12 +1353,12 @@ class themeHandler
}
}*/
if(strpos($key, "selectadmin") !== false)
/* if(strpos($key, "selectadmin") !== false)
{
$this->id = key($post);
$this->setAdminTheme();
$this->refreshPage('admin');
}
}*/
}
@ -3054,7 +3054,7 @@ class themeHandler
function setAdminTheme()
{
global $pref,$e107cache;
$ns = e107::getRender();
$mes = e107::getMessage();