} elseif ($vars['page'] == $defaultpage) {
        $display_title = $page_title;
        $heading_title = make_pagelink($vars['page'], $page_title);
    } else {
        $display_title = $vars['page'] . ' - ' . $page_title;
        $heading_title = make_pagelink($vars['page'], get_short_pagename($vars['page']));
    }
} else {
    $display_title = $title . ' - ' . $page_title;
    $heading_title = $title;
}
// Navigation tab (Wikinote)
$wikinote_navi = '';
if (exist_plugin('wikinote')) {
    $wikinote = new PluginWikinote($wikinote_ini);
    if ($wikinote->is_effect()) {
        if ($wikinote->is_notepage()) {
            $wikinote_navi = $wikinote->show_tabs($wikinote_notepage_tabs);
        } else {
            $wikinote_navi = $wikinote->show_tabs($wikinote_mainpage_tabs);
        }
        if ($wikinote_autocreate_notepage) {
            $wikinote->autocreate_notepage();
        }
    }
}
// Footer
$lastmodified = empty($lastmodified) ? '' : '<li id="lastmod">Last-modified: ' . $lastmodified . '</li>';
$siteadmin = !empty($modifierlink) && !empty($modifier) ? '<li>Site admin: <a href="' . $modifierlink . '">' . $modifier . '</a></li>' : '';
// ------------------------------------------------------------
// Output
Пример #2
0
function plugin_wikinote_action()
{
    global $vars, $post;
    $_post = array();
    foreach ($post as $key => $value) {
        if (strpos($key, '_wikinote_') === 0) {
            $_post[substr($key, 10)] = $value;
        }
    }
    $page = '';
    if (isset($_post['refer'])) {
        $page = $_post['refer'];
    } elseif (isset($vars['page'])) {
        $page = $vars['page'];
    }
    if ($page === '') {
        return;
    }
    // if the notepage exists already, do nothing
    if (is_page($page)) {
        header('Location: ' . get_script_uri() . '?' . rawurlencode($page));
        exit;
    }
    $wikinote = new PluginWikinote();
    if (!$wikinote->is_effect($page)) {
        return;
    }
    if (!$wikinote->is_notepage($page)) {
        return;
    }
    // if the wikinote page does not exist, show template html
    if (empty($_post)) {
        return $wikinote->show_template_html($page);
    }
    // if POST, create the notepage
    // Check whether the POST is for allowed plugins or not
    $allowed = TRUE;
    if (isset($_post['plugin']) && isset($wikinote->allowed_plugin[$_post['plugin']])) {
        foreach ($wikinote->allowed_plugin[$_post['plugin']] as $name) {
            if ($_post[$name] === NULL || $_post[$name] === '') {
                $allowed = FALSE;
                break;
            }
        }
    } else {
        $allowed = FALSE;
    }
    if (!$allowed) {
        header('Location: ' . get_script_uri() . '?cmd=wikinote&page=' . rawurlencode($page));
        exit;
    }
    // create the notepage
    $vars['cmd'] = 'read';
    if (!$wikinote->create_notepage($page)) {
        header('Location: ' . get_script_uri() . '?cmd=wikinote&page=' . rawurlencode($page));
        exit;
    }
    $_post['digest'] = md5(@join('', get_source($page)));
    $vars = $post = $_post;
    return do_plugin_action($post['plugin']);
}