Exemple #1
0
/**
 * 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, $privs;
    if ($app_mode == 'async') {
        return;
    }
    $area = gps('area');
    $event = !$event ? 'article' : $event;
    $bm = gps('bm');
    $privs = safe_field("privs", "txp_users", "name = '" . doSlash($txp_user) . "'");
    $areas = areas();
    $area = false;
    foreach ($areas as $k => $v) {
        if (in_array($event, $v)) {
            $area = $k;
            break;
        }
    }
    if (gps('logout')) {
        $body_id = 'page-logout';
    } elseif (!$txp_user) {
        $body_id = 'page-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';
    }
    ?>
<!DOCTYPE html>
<html lang="<?php 
    echo LANG;
    ?>
" dir="<?php 
    echo $lang_direction;
    ?>
">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow">
<title><?php 
    echo admin_title($pagetitle);
    ?>
</title><?php 
    echo script_js('vendors/jquery/jquery/jquery.js', TEXTPATTERN_SCRIPT_URL) . script_js('vendors/jquery/ui/js/jquery-ui.js', TEXTPATTERN_SCRIPT_URL) . script_js('//code.jquery.com/jquery-migrate-1.2.1.js', TEXTPATTERN_SCRIPT_URL) . script_js('var textpattern = ' . json_encode(array('event' => $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
    ?>
<style>
.not-ready .doc-ready,
.not-ready form.async input[type="submit"],
.not-ready a.async
{
    visibility: hidden;
}
</style>
<?php 
    echo $theme->html_head();
    callback_event('admin_side', 'head_end');
    ?>
</head>
<body id="<?php 
    echo $body_id;
    ?>
" class="not-ready <?php 
    echo $area;
    ?>
">
<header role="banner" class="txp-header">
<?php 
    callback_event('admin_side', 'pagetop');
    $theme->set_state($area, $event, $bm, $message);
    echo pluggable_ui('admin_side', 'header', $theme->header());
    callback_event('admin_side', 'pagetop_end');
    echo n . '</header><!-- /txp-header -->' . n . '<main role="main" class="txp-body" aria-label="' . gTxt('main_content') . '">';
    callback_event('admin_side', 'main_content');
}
/**
 * Renders the &lt;title&gt; element for the 'Write' page.
 *
 * @param  array $rs Article data
 * @return string HTML
 */
function article_partial_html_title($rs)
{
    return tag(admin_title($rs['Title']), 'title');
}
Exemple #3
0
function admin_header()
{
    header('Content-Type: text/html; charset=' . (getConfig('rss.output.encoding') ? getConfig('rss.output.encoding') : DEFAULT_OUTPUT_ENCODING));
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n";
    echo "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n";
    echo "<head>";
    $header = new Header(admin_title(), LOCATION_ADMIN, null, '', HDR_NONE | HDR_NO_CACHECONTROL | HDR_NO_OUPUTBUFFERING);
    $header->render();
    echo "</head>";
    echo "<body>\n";
    echo "" . "<div id=\"nav\" class=\"frame\">" . "<h1 id=\"top\">" . rss_main_title() . "</h1>";
    $nav = new Navigation();
    $nav->render();
    echo "</div>";
}