db_Mark_Time('(Header Top)'); // // *** 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: Admin Defines and Links // B: Send HTTP headers that come before any html // C: Send start of HTML // D: Send JS // E: Send CSS // F: Send Meta Tags and Icon links // G: Send final theme headers (theme_head() function) // H: Generate JS for image preloading (setup for onload) // I: Calculate onload() JS functions to be called // J: Send end of html and start of // K: (The rest is ignored for popups, which have no menus) // L: (optional) Body JS to disable right clicks // M: Send top of body for custom pages and for news // N: Send other top-of-body HTML // // Load order notes for devs // * Browsers wait until ALL HTML has loaded before executing ANY JS // * The last CSS tag downloaded supercedes earlier CSS tags // * Browsers don't care when Meta tags are loaded. We load last due to // a quirk of e107's log subsystem. // * Multiple external file references slow down page load. Each one requires // browser-server interaction even when cached. // // // A: Admin Defines and Links // require_once(e_ADMIN.'ad_links.php'); // // B: Send HTTP headers (these come before ANY html) // // send the charset to the browser - overrides spurious server settings with the lan pack settings. header("Content-type: text/html; charset=".CHARSET, true); echo (defined("STANDARDS_MODE") ? "" : "\n")."\n"; // // B.2: Include admin LAN defines // if (file_exists(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_header.php')) { @include_once(e_LANGUAGEDIR.e_LANGUAGE."/admin/lan_header.php"); } else { @include_once(e_LANGUAGEDIR."English/admin/lan_header.php"); } if (file_exists(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_footer.php')) { @include_once(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_footer.php'); } else { @include_once(e_LANGUAGEDIR.'English/admin/lan_footer.php'); } if (!defined('ADMIN_WIDTH')) { define('ADMIN_WIDTH', 'width: 95%'); } if (!defined('ADMIN_TRUE_ICON')) { define("ADMIN_TRUE_ICON", ""); define("ADMIN_TRUE_ICON_PATH", e_IMAGE."fileinspector/integrity_pass.png"); } if (!defined('ADMIN_FALSE_ICON')) { define("ADMIN_FALSE_ICON", ""); define("ADMIN_FALSE_ICON_PATH", e_IMAGE."fileinspector/integrity_fail.png"); } if (!defined('ADMIN_EDIT_ICON')) { define("ADMIN_EDIT_ICON", ""); define("ADMIN_EDIT_ICON_PATH", e_IMAGE."admin_images/edit_16.png"); } if (!defined('ADMIN_DELETE_ICON')) { define("ADMIN_DELETE_ICON", ""); define("ADMIN_DELETE_ICON_PATH", e_IMAGE."admin_images/delete_16.png"); } // // C: Send start of HTML // echo " ".SITENAME." : ".LAN_head_4."\n"; // // D: Send JS // echo "\n"; // Wysiwyg JS support on or off. // your code should run off e_WYSIWYG if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html']) && varset($e_wysiwyg) != "") { require_once(e_HANDLER."tiny_mce/wysiwyg.php"); define("e_WYSIWYG",TRUE); echo wysiwyg($e_wysiwyg); }else{ define("e_WYSIWYG",FALSE); } if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) { echo "\n"; } if (file_exists(THEME.'theme.js')) { echo "\n"; } if (filesize(e_FILE.'user.js')) { echo "\n"; } if (isset($eplug_js) && $eplug_js) { echo "\n\n"; echo "\n"; } if (isset($htmlarea_js) && $htmlarea_js) { echo $htmlarea_js; } if ((strpos(e_SELF, 'fileinspector.php') === FALSE) && getperms("0")) { echo "\n"; } if (function_exists('headerjs')){echo headerjs(); } // // E: Send CSS // echo "\n"; if (isset($eplug_css) && $eplug_css) { echo "\n\n"; echo "\n"; } echo "\n"; if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE && isset($pref['admincss']) && $pref['admincss'] && file_exists(THEME.$pref['admincss'])) { $css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? THEME_ABS.'admin_'.$pref['admincss'] : THEME_ABS.$pref['admincss']; echo "\n"; } else if (isset($pref['themecss']) && $pref['themecss'] && file_exists(THEME.$pref['themecss'])) { $css_file = file_exists(THEME.'admin_'.$pref['themecss']) ? THEME_ABS.'admin_'.$pref['themecss'] : THEME_ABS.$pref['themecss']; echo "\n"; } else { $css_file = file_exists(THEME.'admin_style.css') ? THEME_ABS.'admin_style.css' : THEME_ABS.'style.css'; echo "\n"; } if (!isset($no_core_css) || !$no_core_css) { echo "\n"; } // // F: Send Meta Tags and Icon links // echo "\n"; // Multi-Language meta-tags with merge and override option. echo " \n"; // --- Load plugin Meta files and eplug_ before others -------- if (is_array($pref['e_meta_list'])) { foreach($pref['e_meta_list'] as $val) { if(is_readable(e_PLUGIN.$val."/e_meta.php")) { echo "\n"; require_once(e_PLUGIN.$val."/e_meta.php"); } } } // ---------- Favicon --------- if (file_exists(THEME."favicon.ico")) { echo "\n\n"; }elseif (file_exists(e_BASE."favicon.ico")) { echo "\n\n"; } // // G: Send Theme Headers // if(function_exists('theme_head')){ echo "\n\n"; echo theme_head(); } // // H: Generate JS for image preloads [user mode only] // echo "\n\n"; // // I: Calculate JS onload() functions for the BODY tag [user mode only] // $body_onload = ""; // // J: Send end of and start of // echo " \n"; $sql->db_Mark_Time("End Head, Start Body"); // // K: (The rest is ignored for popups, which have no menus) // // require $e107_popup =1; to use it as header for popup without menus if(!isset($e107_popup)) { $e107_popup = 0; } if ($e107_popup != 1) { // // L: (optional) Body JS to disable right clicks [reserved; user mode] // // // M: Send top of body for custom pages and for news [user mode only] // // // N: Send other top-of-body HTML // $ns = new e107table; $e107_var = array(); if (!function_exists('show_admin_menu')) { function show_admin_menu($title, $active_page, $e107_vars, $js = FALSE, $sub_link = FALSE, $sortlist = FALSE) { global $ns, $BUTTON, $BUTTON_OVER, $BUTTONS_START, $BUTTONS_END, $SUB_BUTTON, $SUB_BUTTON_OVER, $SUB_BUTTONS_START, $SUB_BUTTONS_END; $id_title = "yop_".str_replace(" ", "", $title); if (!isset($BUTTONS_START)) { $BUTTONS_START = "
\n"; } if (!isset($BUTTON)) { $BUTTON = "\n"; } if (!isset($BUTTON_OVER)) { $BUTTON_OVER = "\n"; } if (!isset($BUTTONS_END)) { $BUTTONS_END = "
\n"; } if (!isset($SUB_BUTTON)) { $SUB_BUTTON = "{LINK_TEXT}
"; } if (!isset($SUB_BUTTON_OVER)) { $SUB_BUTTON_OVER = " « {LINK_TEXT} »
"; } if (!isset($SUB_BUTTONS_START)) { $SUB_BUTTONS_START = "
{SUB_HEAD}
"; } if ($sortlist == TRUE) { $temp = $e107_vars; unset($e107_vars); foreach (array_keys($temp) as $key) { $func_list[] = $temp[$key]['text']; } usort($func_list, 'strcoll'); foreach ($func_list as $func_text) { foreach (array_keys($temp) as $key) { if ($temp[$key]['text'] == $func_text) { $e107_vars[] = $temp[$key]; } } } } $search[0] = "/\{LINK_TEXT\}(.*?)/si"; $search[1] = "/\{LINK_URL\}(.*?)/si"; $search[2] = "/\{ONCLICK\}(.*?)/si"; $search[3] = "/\{SUB_HEAD\}(.*?)/si"; $search[4] = "/\{SUB_HEAD_ID\}(.*?)/si"; if ($sub_link) { $replace[0] = ''; $replace[1] = ''; $replace[2] = ''; $replace[3] = $title; $replace[4] = $id_title; $text = preg_replace($search, $replace, $SUB_BUTTONS_START); } else { $text = $BUTTONS_START; } foreach (array_keys($e107_vars) as $act) { if (!isset($e107_vars[$act]['perm']) || !$e107_vars[$act]['perm'] || getperms($e107_vars[$act]['perm'])) { if ($active_page == $act || (str_replace("?", "", e_PAGE.e_QUERY) == str_replace("?", "", $act))) { $BUTTON_TEMPLATE = $sub_link ? $SUB_BUTTON_OVER : $BUTTON_OVER; } else { $BUTTON_TEMPLATE = $sub_link ? $SUB_BUTTON : $BUTTON; } $replace[0] = str_replace(" ", " ", $e107_vars[$act]['text']); $replace[1] = $e107_vars[$act]['link']; if (!empty($e107_vars[$act]['include'])) { $replace[2] = $e107_vars[$act]['include']; } else { $replace[2] = $js ? "onclick=\"showhideit('".$act."');\"" : "onclick=\"document.location='".$e107_vars[$act]['link']."'; disabled=true;\""; } $replace[3] = $title; $replace[4] = $id_title; $text .= preg_replace($search, $replace, $BUTTON_TEMPLATE); } } $text .= $sub_link ? $SUB_BUTTONS_END : $BUTTONS_END; if ($title == "" || $sub_link) { return $text; } else { $ns -> tablerender($title, $text, array('id' => $id_title, 'style' => 'button_menu')); } } } if (file_exists(THEME.'admin_template.php')) { require_once(THEME.'admin_template.php'); } else { require_once(e_BASE.$THEMES_DIRECTORY.'templates/admin_template.php'); } if (!function_exists("parse_admin")) { function parse_admin($ADMINLAYOUT) { global $tp; $adtmp = explode("\n", $ADMINLAYOUT); for ($a = 0; $a < count($adtmp); $a++) { if (preg_match("/{.+?}/", $adtmp[$a])) { echo $tp->parseTemplate($adtmp[$a]); } else { echo $adtmp[$a]; } } } } function admin_update($update, $type = 'update', $success = false, $failed = false) { global $ns; if (($type == 'update' && $update) || ($type == 'insert' && $update !== false)) { $caption = LAN_UPDATE; $text = "".($success ? $success : LAN_UPDATED).""; } else if ($type == 'delete' && $update) { $caption = LAN_DELETE; $text = "".($success ? $success : LAN_DELETED).""; } else if (!mysql_errno()) { if ($type == 'update') { $caption = LAN_UPDATED_FAILED; $text = "".LAN_NO_CHANGE."
".LAN_TRY_AGAIN."
"; } else if ($type == 'delete') { $caption = LAN_DELETE; $text = "".LAN_DELETED_FAILED.".
".LAN_TRY_AGAIN."
"; } } else { $caption = LAN_UPDATED_FAILED; $text = "".($failed ? $failed : LAN_UPDATED_FAILED." - ".LAN_TRY_AGAIN)."
".LAN_ERROR." ".mysql_errno().": ".mysql_error(); } $ns -> tablerender($caption, "
".$text."
"); return $update; } function admin_purge_related($table, $id) { global $ns, $tp; $msg = ""; $tp->parseTemplate(""); // Delete any related comments require_once(e_HANDLER."comment_class.php"); $_com = new comment; $num = $_com->delete_comments($table, $id); if($num) { $msg .= $num." ".ADLAN_114." ".LAN_DELETED."
"; } // Delete any related ratings require_once(e_HANDLER."rate_class.php"); $_rate = new rater; $num = $_rate->delete_ratings($table, $id); if($num) { $msg .= LAN_RATING." ".LAN_DELETED."
"; } if($msg) { $ns->tablerender(LAN_DELETE, $msg); } } $sql->db_Mark_Time('Parse Admin Header'); if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) { parse_admin($ADMIN_HEADER); } $sql->db_Mark_Time('(End: Parse Admin Header)'); } ?>