function tpl_sidebar($user_defined_page_name = "")
{
    global $ID, $REV, $conf;
    // save globals
    $saveID = $ID;
    $saveREV = $REV;
    // discover file to be displayed in navigation sidebar
    $fileSidebar = '';
    // damien
    $pagename = "";
    if ($user_defined_page_name != "") {
        $pagename = $user_defined_page_name;
    } else {
        if (isset($conf['sidebar']['page'])) {
            $pagename = $conf['sidebar']['page'];
        }
    }
    if ($pagename != "") {
        $fileSidebar = getSidebarFN(getNS($ID), $pagename);
    }
    // determine what to display
    if ($fileSidebar) {
        $ID = $fileSidebar;
        $REV = '';
        print p_wiki_xhtml($ID, $REV, false);
    } else {
        global $IDX;
        html_index($IDX);
    }
    // restore globals
    $ID = $saveID;
    $REV = $saveREV;
}
示例#2
0
function renderBar($page, $fallbackToIndex = false)
{
    global $ID, $REV;
    // save globals
    $saveID = $ID;
    $saveREV = $REV;
    $fileSidebar = getBarFN(getNS($ID), $page);
    // determine what to display
    if ($fileSidebar) {
        $ID = $fileSidebar;
        $REV = '';
        print p_wiki_xhtml($ID, $REV, false);
    } elseif ($fallbackToIndex) {
        global $IDX;
        html_index($IDX);
    }
    // restore globals
    $ID = $saveID;
    $REV = $saveREV;
}
function tpl_sidebar()
{
    global $ID, $REV, $conf;
    // save globals
    $saveID = $ID;
    $saveREV = $REV;
    // discover file to be displayed in navigation sidebar
    $fileSidebar = '';
    $sidebar_name = tpl_getConf('btl_sidebar_name');
    if (isset($sidebar_name)) {
        $fileSidebar = getSidebarFN(getNS($ID), $sidebar_name);
    }
    // determine what to display
    if ($fileSidebar) {
        $ID = $fileSidebar;
        $REV = '';
        $sidebar = p_wiki_xhtml($ID, $REV, false);
        $lines = explode("\n", $sidebar);
        $open_ul = 0;
        for ($i = 0; $i < count($lines); $i++) {
            if (trim($lines[$i]) == '<ul>') {
                $open_ul = $open_ul + 1;
                if ($open_ul == 1) {
                    $lines[$i] = '<ul class="primary">' . "\n";
                }
            } else {
                if (strpos($lines[$i], '</ul>') != false) {
                    $open_ul = $open_ul - 1;
                }
            }
        }
        print implode($lines);
    } else {
        global $IDX;
        html_index($IDX);
    }
    // restore globals
    $ID = $saveID;
    $REV = $saveREV;
}
示例#4
0
/**
 * Default Action of TPL_ACT_RENDER
 *
 * @return bool
 */
function tpl_content_core()
{
    global $ACT;
    global $TEXT;
    global $PRE;
    global $SUF;
    global $SUM;
    global $IDX;
    global $INPUT;
    switch ($ACT) {
        case 'show':
            html_show();
            break;
            /** @noinspection PhpMissingBreakStatementInspection */
        /** @noinspection PhpMissingBreakStatementInspection */
        case 'locked':
            html_locked();
        case 'edit':
        case 'recover':
            html_edit();
            break;
        case 'preview':
            html_edit();
            html_show($TEXT);
            break;
        case 'draft':
            html_draft();
            break;
        case 'search':
            html_search();
            break;
        case 'revisions':
            html_revisions($INPUT->int('first'));
            break;
        case 'diff':
            html_diff();
            break;
        case 'recent':
            html_recent($INPUT->extract('first')->int('first'), $INPUT->str('show_changes'));
            break;
        case 'index':
            html_index($IDX);
            #FIXME can this be pulled from globals? is it sanitized correctly?
            break;
        case 'backlink':
            html_backlinks();
            break;
        case 'conflict':
            html_conflict(con($PRE, $TEXT, $SUF), $SUM);
            html_diff(con($PRE, $TEXT, $SUF), false);
            break;
        case 'login':
            html_login();
            break;
        case 'register':
            html_register();
            break;
        case 'resendpwd':
            html_resendpwd();
            break;
        case 'denied':
            print p_locale_xhtml('denied');
            break;
        case 'profile':
            html_updateprofile();
            break;
        case 'admin':
            tpl_admin();
            break;
        case 'subscribe':
            tpl_subscribe();
            break;
        case 'media':
            tpl_media();
            break;
        default:
            $evt = new Doku_Event('TPL_ACT_UNKNOWN', $ACT);
            if ($evt->advise_before()) {
                msg("Failed to handle command: " . hsc($ACT), -1);
            }
            $evt->advise_after();
            unset($evt);
            return false;
    }
    return true;
}
function tpl_sidebar_content()
{
    global $ID, $REV, $conf;
    // save globals
    $saveID = $ID;
    $saveREV = $REV;
    // discover file to be displayed in navigation sidebar
    $fileSidebar = '';
    if (tpl_getConf('page')) {
        $fileSidebar = getSidebarFN(getNS($ID), tpl_getConf('page'));
    }
    // determine what to display
    if ($fileSidebar) {
        $ID = $fileSidebar;
        $REV = '';
        print p_wiki_xhtml($ID, $REV, false);
    } else {
        global $IDX;
        html_index($IDX);
    }
    // restore globals
    $ID = $saveID;
    $REV = $saveREV;
}
示例#6
0
function tpl_content_core()
{
    global $ACT;
    global $TEXT;
    global $PRE;
    global $SUF;
    global $SUM;
    global $IDX;
    switch ($ACT) {
        case 'show':
            html_show();
            break;
        case 'locked':
            html_locked();
        case 'edit':
        case 'recover':
            html_edit();
            break;
        case 'preview':
            html_edit();
            html_show($TEXT);
            break;
        case 'draft':
            html_draft();
            break;
        case 'search':
            html_search();
            break;
        case 'revisions':
            $first = isset($_REQUEST['first']) ? intval($_REQUEST['first']) : 0;
            html_revisions($first);
            break;
        case 'diff':
            html_diff();
            break;
        case 'recent':
            if (is_array($_REQUEST['first'])) {
                $_REQUEST['first'] = array_keys($_REQUEST['first']);
                $_REQUEST['first'] = $_REQUEST['first'][0];
            }
            $first = is_numeric($_REQUEST['first']) ? intval($_REQUEST['first']) : 0;
            html_recent($first);
            break;
        case 'index':
            html_index($IDX);
            #FIXME can this be pulled from globals? is it sanitized correctly?
            break;
        case 'backlink':
            html_backlinks();
            break;
        case 'conflict':
            html_conflict(con($PRE, $TEXT, $SUF), $SUM);
            html_diff(con($PRE, $TEXT, $SUF), false);
            break;
        case 'login':
            html_login();
            break;
        case 'register':
            html_register();
            break;
        case 'resendpwd':
            html_resendpwd();
            break;
        case 'denied':
            print p_locale_xhtml('denied');
            break;
        case 'profile':
            html_updateprofile();
            break;
        case 'admin':
            tpl_admin();
            break;
        case 'subscribe':
            tpl_subscribe();
            break;
        default:
            $evt = new Doku_Event('TPL_ACT_UNKNOWN', $ACT);
            if ($evt->advise_before()) {
                msg("Failed to handle command: " . hsc($ACT), -1);
            }
            $evt->advise_after();
            unset($evt);
            return false;
    }
    return true;
}