. */ /** * Used for generating admin-side headers. * * @package HTML */ /** * Creates and outputs an admin-side header. * * The output contains HTML <head> section and the main navigation. * The results are echoed as opposed to returned. * * This function offers a way to invoke modal activity messages and set the * page title. * * Output will automatically become silent on asynchronous script responses * that do not want HTML headers. * * @param string $pagetitle The page title * @param string|array $message A message show to the user * @example * pagetop('Title', array('My error message', E_ERROR)); * echo 'My page contents.'; */ function pagetop($pagetitle, $message = '') { global $siteurl, $sitename, $txp_user, $event, $step, $app_mode, $theme; if ($app_mode == 'async') { return; } $area = gps('area'); $event = (!$event) ? 'article' : $event; $bm = gps('bm'); $areas = areas(); $area = false; foreach ($areas as $k => $v) { if (in_array($event, $v)) { $area = $k; break; } } if (gps('logout')) { $body_id = 'page-logout'; $area = 'login'; } elseif (!$txp_user) { $body_id = 'page-login'; $area = 'login'; } else { $body_id = 'page-'.txpspecialchars($event); } header('X-Frame-Options: '.X_FRAME_OPTIONS); header('X-UA-Compatible: '.X_UA_COMPATIBLE); $lang_direction = gTxt('lang_dir'); if (!in_array($lang_direction, array('ltr', 'rtl'))) { // Apply biased default for missing translations. $lang_direction = 'ltr'; } ?> <?php echo admin_title($pagetitle)?> $event, 'step' => $step, '_txp_token' => form_token(), 'ajax_timeout' => (int) AJAX_TIMEOUT, 'textarray' => (object) null, 'do_spellcheck' => get_pref('do_spellcheck', '#page-article #body, #page-article #title,'. '#page-image #alt-text, #page-image #caption,'. '#page-file #description,'. '#page-link #link-title, #page-link #link-description'), 'production_status' => get_pref('production_status'), )).';'). script_js('textpattern.js', TEXTPATTERN_SCRIPT_URL).n; gTxtScript(array('form_submission_error', 'are_you_sure', 'cookies_must_be_enabled', 'ok', 'save', 'publish')); // Mandatory un-themable Textpattern core styles ?> html_head(); callback_event('admin_side', 'head_end'); ?>
set_state($area, $event, $bm, $message); echo pluggable_ui('admin_side', 'header', $theme->header()); callback_event('admin_side', 'pagetop_end'); echo n.'
'. n.'
'. n.'
'.$theme->announce($message).'
'; callback_event('admin_side', 'main_content'); } /** * Return the HTML <title> contents for an admin-side page. * * The rendered title can be customised via a 'admin_side > html_title' * pluggable UI callback event. * * @param string $pagetitle Specific page title part * @return string * @since 4.6.0 */ function admin_title($pagetitle) { global $sitename; if ((string) $pagetitle === '') { $title = gTxt('untitled'); } else { $title = $pagetitle; } $title = escape_title($title).' - '.txpspecialchars($sitename).' | Textpattern CMS'; return pluggable_ui('admin_side', 'html_title', $title, compact('pagetitle')); } /** * Creates an area tab. * * This can be used to create table based navigation bars. * * @param string $label * @param string $event * @param string $tarea * @param string $area * @return string HTML table column * @deprecated in 4.6.0 */ function areatab($label, $event, $tarea, $area) { $tc = ($area == $event) ? 'tabup' : 'tabdown'; $atts = ' class="'.$tc.'"'; $hatts = ' href="?event='.$tarea.'"'; return tda(tag($label, 'a', $hatts), $atts); } /** * Creates a secondary area tab. * * This can be used to create table based navigation bars. * * @param string $label * @param string $tabevent * @param string $event * @return string HTML table column * @deprecated in 4.6.0 */ function tabber($label, $tabevent, $event) { $tc = ($event == $tabevent) ? 'tabup' : 'tabdown2'; $out = ''.$label.''; return $out; } /** * Creates a table based navigation bar row. * * This can be used to create table based navigation bars. * * @param string $area * @param string $event * @return string HTML table columns * @deprecated in 4.6.0 */ function tabsort($area, $event) { if ($area) { $areas = areas(); $out = array(); foreach ($areas[$area] as $a => $b) { if (has_privs($b)) { $out[] = tabber($a, $b, $event, 2); } } return ($out) ? join('', $out) : ''; } return ''; } /** * Gets the main menu structure as an array. * * @return array * @example * print_r( * areas() * ); */ function areas() { global $plugin_areas; $areas['start'] = array( ); $areas['content'] = array( gTxt('tab_write') => 'article', gTxt('tab_list') => 'list', gTxt('tab_image') => 'image', gTxt('tab_file') => 'file', gTxt('tab_link') => 'link', gTxt('tab_organise') => 'category', ); $areas['presentation'] = array( gTxt('tab_sections') => 'section', gTxt('tab_pages') => 'page', gTxt('tab_forms') => 'form', gTxt('tab_style') => 'css', ); $areas['admin'] = array( gTxt('tab_diagnostics') => 'diag', gTxt('tab_preferences') => 'prefs', gTxt('tab_languages') => 'lang', gTxt('tab_site_admin') => 'admin', gTxt('tab_plugins') => 'plugin', ); $areas['extensions'] = array( ); if (get_pref('use_comments', 1)) { $areas['content'][gTxt('tab_comments')] = 'discuss'; } if (get_pref('logging') !== 'none' && get_pref('expire_logs_after')) { $areas['admin'][gTxt('tab_logs')] = 'log'; } if (is_array($plugin_areas)) { $areas = array_merge_recursive($areas, $plugin_areas); } return $areas; } /** * Creates an admin-side main menu as a <select> dropdown. * * @param mixed $inline Is not used. * @return string A HTML form * @example * echo navPop(); */ function navPop($inline = '') { $areas = areas(); $out = array(); foreach ($areas as $a => $b) { if (!has_privs('tab.'.$a)) { continue; } if (count($b) > 0) { $out[] = n.''; foreach ($b as $c => $d) { if (has_privs($d)) { $out[] = n.''; } } $out[] = n.''; } } if ($out) { return n.''; } } /** * Generates a button link. * * @param string $label * @param string $link * @deprecated in 4.6.0 */ function button($label, $link) { return ''.$label.''; }