/**
 * Dispatches the given sidebar type to return the right content
 *
 * @author Michael Klier <*****@*****.**>
 */
function tpl_sidebar_dispatch($sb, $pos)
{
    global $lang;
    global $conf;
    global $ID;
    global $REV;
    global $INFO;
    global $TOC;
    $svID = $ID;
    // save current ID
    $svREV = $REV;
    // save current REV
    $svTOC = $TOC;
    // save current TOC
    $pname = tpl_getConf('pagename');
    switch ($sb) {
        case 'main':
            if (tpl_getConf('closedwiki') && !isset($_SERVER['REMOTE_USER'])) {
                return;
            }
            $main_sb = $pname;
            if (@page_exists($main_sb) && auth_quickaclcheck($main_sb) >= AUTH_READ) {
                $always = tpl_getConf('main_sidebar_always');
                if ($always or !$always && !getNS($ID)) {
                    print '<div class="main_sidebar sidebar_box">' . DOKU_LF;
                    print p_sidebar_xhtml($main_sb, $pos) . DOKU_LF;
                    print '</div>' . DOKU_LF;
                }
            } elseif (!@page_exists($main_sb) && auth_quickaclcheck($main_sb) >= AUTH_CREATE) {
                if (@file_exists(DOKU_TPLINC . 'lang/' . $conf['lang'] . '/nonidebar.txt')) {
                    $out = p_render('xhtml', p_get_instructions(io_readFile(DOKU_TPLINC . 'lang/' . $conf['lang'] . '/nosidebar.txt')), $info);
                } else {
                    $out = p_render('xhtml', p_get_instructions(io_readFile(DOKU_TPLINC . 'lang/en/nosidebar.txt')), $info);
                }
                $link = '<a href="' . wl($pname) . '" class="wikilink2">' . $pname . '</a>' . DOKU_LF;
                print '<div class="main_sidebar sidebar_box">' . DOKU_LF;
                print str_replace('LINK', $link, $out);
                print '</div>' . DOKU_LF;
            }
            break;
        case 'namespace':
            if (tpl_getConf('closedwiki') && !isset($_SERVER['REMOTE_USER'])) {
                return;
            }
            $user_ns = tpl_getConf('user_sidebar_namespace');
            $group_ns = tpl_getConf('group_sidebar_namespace');
            if (!preg_match("/^" . $user_ns . ":.*?\$|^" . $group_ns . ":.*?\$/", $svID)) {
                // skip group/user sidebars and current ID
                $ns_sb = _getNsSb($svID);
                if ($ns_sb && auth_quickaclcheck($ns_sb) >= AUTH_READ) {
                    print '<div class="namespace_sidebar sidebar_box">' . DOKU_LF;
                    print p_sidebar_xhtml($ns_sb, $pos) . DOKU_LF;
                    print '</div>' . DOKU_LF;
                }
            }
            break;
        case 'user':
            if (tpl_getConf('closedwiki') && !isset($_SERVER['REMOTE_USER'])) {
                return;
            }
            $user_ns = tpl_getConf('user_sidebar_namespace');
            if (isset($INFO['userinfo']['name'])) {
                $user = $_SERVER['REMOTE_USER'];
                $user_sb = $user_ns . ':' . $user . ':' . $pname;
                if (@page_exists($user_sb)) {
                    $subst = array('pattern' => array('/@USER@/'), 'replace' => array($user));
                    print '<div class="user_sidebar sidebar_box">' . DOKU_LF;
                    print p_sidebar_xhtml($user_sb, $pos, $subst) . DOKU_LF;
                    print '</div>';
                }
                // check for namespace sidebars in user namespace too
                if (preg_match('/' . $user_ns . ':' . $user . ':.*/', $svID)) {
                    $ns_sb = _getNsSb($svID);
                    if ($ns_sb && $ns_sb != $user_sb && auth_quickaclcheck($ns_sb) >= AUTH_READ) {
                        print '<div class="namespace_sidebar sidebar_box">' . DOKU_LF;
                        print p_sidebar_xhtml($ns_sb, $pos) . DOKU_LF;
                        print '</div>' . DOKU_LF;
                    }
                }
            }
            break;
        case 'group':
            if (tpl_getConf('closedwiki') && !isset($_SERVER['REMOTE_USER'])) {
                return;
            }
            $group_ns = tpl_getConf('group_sidebar_namespace');
            if (isset($INFO['userinfo']['name'], $INFO['userinfo']['grps'])) {
                foreach ($INFO['userinfo']['grps'] as $grp) {
                    $group_sb = $group_ns . ':' . $grp . ':' . $pname;
                    if (@page_exists($group_sb) && auth_quickaclcheck(cleanID($group_sb)) >= AUTH_READ) {
                        $subst = array('pattern' => array('/@GROUP@/'), 'replace' => array($grp));
                        print '<div class="group_sidebar sidebar_box">' . DOKU_LF;
                        print p_sidebar_xhtml($group_sb, $pos, $subst) . DOKU_LF;
                        print '</div>' . DOKU_LF;
                    }
                }
            }
            break;
        case 'index':
            if (tpl_getConf('closedwiki') && !isset($_SERVER['REMOTE_USER'])) {
                return;
            }
            print '<div class="index_sidebar sidebar_box">' . DOKU_LF;
            print '  ' . p_index_xhtml($svID, $pos) . DOKU_LF;
            print '</div>' . DOKU_LF;
            break;
        case 'toc':
            if (tpl_getConf('closedwiki') && !isset($_SERVER['REMOTE_USER'])) {
                return;
            }
            if (auth_quickaclcheck($svID) >= AUTH_READ) {
                $toc = tpl_toc(true);
                // replace ids to keep XHTML compliance
                if (!empty($toc)) {
                    $toc = preg_replace('/id="(.*?)"/', 'id="sb__' . $pos . '__\\1"', $toc);
                    print '<div class="toc_sidebar sidebar_box">' . DOKU_LF;
                    print $toc;
                    print '</div>' . DOKU_LF;
                }
            }
            break;
        case 'toolbox':
            if (tpl_getConf('hideactions') && !isset($_SERVER['REMOTE_USER'])) {
                return;
            }
            if (tpl_getConf('closedwiki') && !isset($_SERVER['REMOTE_USER'])) {
                print '<div class="toolbox_sidebar sidebar_box">' . DOKU_LF;
                print '  <div class="level1">' . DOKU_LF;
                print '    <ul>' . DOKU_LF;
                print '      <li><div class="li">';
                tpl_actionlink('login');
                print '      </div></li>' . DOKU_LF;
                print '    </ul>' . DOKU_LF;
                print '  </div>' . DOKU_LF;
                print '</div>' . DOKU_LF;
            } else {
                $actions = array('admin', 'revert', 'edit', 'history', 'recent', 'backlink', 'subscription', 'index', 'login', 'profile', 'top');
                print '<div class="toolbox_sidebar sidebar_box">' . DOKU_LF;
                print '  <div class="level1">' . DOKU_LF;
                print '    <ul>' . DOKU_LF;
                foreach ($actions as $action) {
                    if (!actionOK($action)) {
                        continue;
                    }
                    // start output buffering
                    if ($action == 'edit') {
                        // check if new page button plugin is available
                        if (!plugin_isdisabled('npd') && ($npd =& plugin_load('helper', 'npd'))) {
                            $npb = $npd->html_new_page_button(true);
                            if ($npb) {
                                print '    <li><div class="li">';
                                print $npb;
                                print '</div></li>' . DOKU_LF;
                            }
                        }
                    }
                    ob_start();
                    print '     <li><div class="li">';
                    if (tpl_actionlink($action)) {
                        print '</div></li>' . DOKU_LF;
                        ob_end_flush();
                    } else {
                        ob_end_clean();
                    }
                }
                print '    </ul>' . DOKU_LF;
                print '  </div>' . DOKU_LF;
                print '</div>' . DOKU_LF;
            }
            break;
        case 'trace':
            if (tpl_getConf('closedwiki') && !isset($_SERVER['REMOTE_USER'])) {
                return;
            }
            print '<div class="trace_sidebar sidebar_box">' . DOKU_LF;
            print '  <h1>' . $lang['breadcrumb'] . '</h1>' . DOKU_LF;
            print '  <div class="breadcrumbs">' . DOKU_LF;
            $conf['youarehere'] != 1 ? tpl_breadcrumbs() : tpl_youarehere();
            print '  </div>' . DOKU_LF;
            print '</div>' . DOKU_LF;
            break;
        case 'extra':
            if (tpl_getConf('closedwiki') && !isset($_SERVER['REMOTE_USER'])) {
                return;
            }
            print '<div class="extra_sidebar sidebar_box">' . DOKU_LF;
            @(include dirname(__FILE__) . '/' . $pos . '_sidebar.html');
            print '</div>' . DOKU_LF;
            break;
        default:
            if (tpl_getConf('closedwiki') && !isset($_SERVER['REMOTE_USER'])) {
                return;
            }
            // check for user defined sidebars
            if (@file_exists(DOKU_TPLINC . 'sidebars/' . $sb . '/sidebar.php')) {
                print '<div class="' . $sb . '_sidebar sidebar_box">' . DOKU_LF;
                @(require_once DOKU_TPLINC . 'sidebars/' . $sb . '/sidebar.php');
                print '</div>' . DOKU_LF;
            }
            break;
    }
    // restore ID, REV and TOC
    $ID = $svID;
    $REV = $svREV;
    $TOC = $svTOC;
}
">

              <?php 
tpl_flush();
/* flush the output buffer */
// Page-Header DokuWiki page
tpl_includeFile('pageheader.html');
// Page-Header DokuWiki page
if ($ACT == 'show') {
    tpl_include_page('pageheader', 1, 1);
}
// render the content into buffer for later use
ob_start();
tpl_content(false);
$content = ob_get_clean();
$toc = bootstrap3_toc(tpl_toc(true), true);
$content = '<div class="dw-content">' . $content . '</div>';
// Include Page Tools
require_once 'tpl_page_tools.php';
// Include the TOC layout
if ($toc) {
    require_once 'tpl_toc.php';
} else {
    echo $content;
}
tpl_flush();
// Page-Footer hook
tpl_includeFile('pagefooter.html');
// Page-Footer DokuWiki page
if ($ACT == 'show') {
    tpl_include_page('pagefooter', 1, 1);
Esempio n. 3
0
/**
 * Show a wiki page
 *
 * @author Andreas Gohr <*****@*****.**>
 *
 * @param null|string $txt wiki text or null for showing $ID
 */
function html_show($txt = null)
{
    global $ID;
    global $REV;
    global $HIGH;
    global $INFO;
    global $DATE_AT;
    //disable section editing for old revisions or in preview
    if ($txt || $REV) {
        $secedit = false;
    } else {
        $secedit = true;
    }
    if (!is_null($txt)) {
        //PreviewHeader
        echo '<br id="scroll__here" />';
        echo p_locale_xhtml('preview');
        echo '<div class="preview"><div class="pad">';
        $html = html_secedit(p_render('xhtml', p_get_instructions($txt), $info), $secedit);
        if ($INFO['prependTOC']) {
            $html = tpl_toc(true) . $html;
        }
        echo $html;
        echo '<div class="clearer"></div>';
        echo '</div></div>';
    } else {
        if ($REV || $DATE_AT) {
            $data = array('rev' => &$REV, 'date_at' => &$DATE_AT);
            trigger_event('HTML_SHOWREV_OUTPUT', $data, 'html_showrev');
        }
        $html = p_wiki_xhtml($ID, $REV, true, $DATE_AT);
        $html = html_secedit($html, $secedit);
        if ($INFO['prependTOC']) {
            $html = tpl_toc(true) . $html;
        }
        $html = html_hilight($html, $HIGH);
        echo $html;
    }
}
Esempio n. 4
0
/**
 * Export a wiki page for various formats
 *
 * Triggers ACTION_EXPORT_POSTPROCESS
 *
 *  Event data:
 *    data['id']      -- page id
 *    data['mode']    -- requested export mode
 *    data['headers'] -- export headers
 *    data['output']  -- export output
 *
 * @author Andreas Gohr <*****@*****.**>
 * @author Michael Klier <*****@*****.**>
 */
function act_export($act)
{
    global $ID;
    global $REV;
    global $conf;
    global $lang;
    $pre = '';
    $post = '';
    $output = '';
    $headers = array();
    // search engines: never cache exported docs! (Google only currently)
    $headers['X-Robots-Tag'] = 'noindex';
    $mode = substr($act, 7);
    switch ($mode) {
        case 'raw':
            $headers['Content-Type'] = 'text/plain; charset=utf-8';
            $headers['Content-Disposition'] = 'attachment; filename=' . noNS($ID) . '.txt';
            $output = rawWiki($ID, $REV);
            break;
        case 'xhtml':
            $pre .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"' . DOKU_LF;
            $pre .= ' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">' . DOKU_LF;
            $pre .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $conf['lang'] . '"' . DOKU_LF;
            $pre .= ' lang="' . $conf['lang'] . '" dir="' . $lang['direction'] . '">' . DOKU_LF;
            $pre .= '<head>' . DOKU_LF;
            $pre .= '  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />' . DOKU_LF;
            $pre .= '  <title>' . $ID . '</title>' . DOKU_LF;
            // get metaheaders
            ob_start();
            tpl_metaheaders();
            $pre .= ob_get_clean();
            $pre .= '</head>' . DOKU_LF;
            $pre .= '<body>' . DOKU_LF;
            $pre .= '<div class="dokuwiki export">' . DOKU_LF;
            // get toc
            $pre .= tpl_toc(true);
            $headers['Content-Type'] = 'text/html; charset=utf-8';
            $output = p_wiki_xhtml($ID, $REV, false);
            $post .= '</div>' . DOKU_LF;
            $post .= '</body>' . DOKU_LF;
            $post .= '</html>' . DOKU_LF;
            break;
        case 'xhtmlbody':
            $headers['Content-Type'] = 'text/html; charset=utf-8';
            $output = p_wiki_xhtml($ID, $REV, false);
            break;
        default:
            $output = p_cached_output(wikiFN($ID, $REV), $mode);
            $headers = p_get_metadata($ID, "format {$mode}");
            break;
    }
    // prepare event data
    $data = array();
    $data['id'] = $ID;
    $data['mode'] = $mode;
    $data['headers'] = $headers;
    $data['output'] =& $output;
    trigger_event('ACTION_EXPORT_POSTPROCESS', $data);
    if (!empty($data['output'])) {
        if (is_array($data['headers'])) {
            foreach ($data['headers'] as $key => $val) {
                header("{$key}: {$val}");
            }
        }
        print $pre . $data['output'] . $post;
        exit;
    }
    return 'show';
}
Esempio n. 5
0
/**
 * Handle the admin page contents
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function tpl_admin()
{
    global $INFO;
    global $TOC;
    $plugin = null;
    if (!empty($_REQUEST['page'])) {
        $pluginlist = plugin_list('admin');
        if (in_array($_REQUEST['page'], $pluginlist)) {
            // attempt to load the plugin
            $plugin =& plugin_load('admin', $_REQUEST['page']);
        }
    }
    if ($plugin !== null) {
        if ($plugin->forAdminOnly() && !$INFO['isadmin']) {
            msg('For admins only', -1);
            html_admin();
        } else {
            if (!is_array($TOC)) {
                $TOC = $plugin->getTOC();
            }
            //if TOC wasn't requested yet
            if ($INFO['prependTOC']) {
                tpl_toc();
            }
            $plugin->html();
        }
    } else {
        html_admin();
    }
    return true;
}
Esempio n. 6
0
 /**
  * Handle the "partial" action, using the blank template to deliver nothing but the inner page content.
  *
  * @param {Doku_Event} $event - The DokuWiki event object.
  * @param {mixed} $param  - The fifth argument to register_hook().
  */
 public function handle_action(Doku_Event &$event, $param)
 {
     if (!$this->m_inPartial) {
         return;
     }
     global $ACT, $INPUT, $ID;
     // Compare permissions between the current page and the passed-in id.
     $compareid = $INPUT->str('fastwiki_compareid');
     if ($compareid && auth_quickaclcheck($ID) != auth_quickaclcheck($compareid)) {
         echo 'PERMISSION_CHANGE';
     } else {
         if (!$this->m_no_content) {
             if ($ACT == 'show') {
                 tpl_toc();
             }
             // Section save. This won't work, unless I return new "range" inputs for all sections.
             //			$secedit = $ACT == 'show' && $INPUT->str('target') == 'section' && ($INPUT->str('prefix') || $INPUT->str('suffix'));
             //			if ($secedit)
             //				$this->render_text($INPUT->str('wikitext')); //+++ render_text isn't outputting anything.
             //			else
             tpl_content(false);
         }
     }
     // Output error messages.
     html_msgarea();
 }
Esempio n. 7
0
            <?php 
}
?>

            <?php 
@(include dirname(__FILE__) . '/header.html');
?>
            <div class="clearer"></div>
            <hr class="a11y" />
        </div></div><!-- /header -->

		<div class="wrapper">

			<div id="dokuwiki__toc" title="Table of Contents">
				<?php 
tpl_toc();
?>
			</div>

            <!-- ********** CONTENT ********** -->
            <div id="dokuwiki__content"><div class="pad">
                <?php 
tpl_flush();
?>
                <?php 
@(include dirname(__FILE__) . '/pageheader.html');
?>

                <div class="page">
                    <!-- wikipage start -->
                    <?php 
         //get the rendered content of the defined wiki article to use as custom navigation
         $interim = tpl_include_page($nav_location, false);
         if ($interim === "" || $interim === false) {
             //creation/edit link if the defined page got no content
             $_monobook_boxes["p-x-navigation"]["xhtml"] = "[&#160;" . html_wikilink($nav_location, hsc($lang["monobook_fillplaceholder"] . " (" . $nav_location . ")")) . "&#160;]<br />";
         } else {
             //the rendered page content
             $_monobook_boxes["p-x-navigation"]["xhtml"] = $interim;
         }
     }
     unset($nav_location);
 }
 //table of contents (TOC) - show outside the article? (this is a dirty hack but often requested)
 if (tpl_getConf("monobook_toc_position") === "sidebar") {
     //check if the current page got a TOC
     $toc = tpl_toc(true);
     if (!empty($toc)) {
         //headline
         $_monobook_boxes["p-toc"]["headline"] = $lang["toc"];
         //language comes from DokuWiki core
         //content
         $_monobook_boxes["p-toc"]["xhtml"] = str_replace(array("<div class=\"tocheader toctoggle\" id=\"toc__header\">" . $lang["toc"] . "</div>", " class=\"toc\"", " id=\"toc__inside\"", " id=\"dw__toc\"", "<h3 class=\"toggle\">" . $lang["toc"] . "</h3>"), "", $toc);
     }
     unset($toc);
 }
 //search
 if (tpl_getConf("monobook_search") && actionOK("search")) {
     //check if action is disabled
     //headline
     $_monobook_boxes["p-search"]["headline"] = $lang["monobook_bar_search"];
     //content
Esempio n. 9
0
/**
 * Handle 'edit', 'preview'
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function act_export($act)
{
    global $ID;
    global $REV;
    // search engines: never cache exported docs! (Google only currently)
    header('X-Robots-Tag: noindex');
    // no renderer for this
    if ($act == 'export_raw') {
        header('Content-Type: text/plain; charset=utf-8');
        print rawWiki($ID, $REV);
        exit;
    }
    // html export #FIXME what about the template's style?
    if ($act == 'export_xhtml') {
        global $conf;
        global $lang;
        header('Content-Type: text/html; charset=utf-8');
        ptln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"');
        ptln(' "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
        ptln('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $conf['lang'] . '"');
        ptln(' lang="' . $conf['lang'] . '" dir="' . $lang['direction'] . '">');
        ptln('<head>');
        ptln('  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
        ptln('  <title>' . $ID . '</title>');
        tpl_metaheaders();
        ptln('</head>');
        ptln('<body>');
        ptln('<div class="dokuwiki export">');
        $html = p_wiki_xhtml($ID, $REV, false);
        tpl_toc();
        echo $html;
        ptln('</div>');
        ptln('</body>');
        ptln('</html>');
        exit;
    }
    // html body only
    if ($act == 'export_xhtmlbody') {
        $html = p_wiki_xhtml($ID, $REV, false);
        tpl_toc();
        echo $html;
        exit;
    }
    // try to run renderer
    $mode = substr($act, 7);
    $text = p_cached_output(wikiFN($ID, $REV), $mode);
    $headers = p_get_metadata($ID, "format {$mode}");
    if (!is_null($text)) {
        if (is_array($headers)) {
            foreach ($headers as $key => $val) {
                header("{$key}: {$val}");
            }
        }
        print $text;
        exit;
    }
    return 'show';
}
Esempio n. 10
0
 * @link     https://github.com/ryanwmoore/dokutwitterbootstrap
 * @author   Ryan Moore <*****@*****.**>
 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
 */
// error_reporting(E_ALL & ~E_DEPRECATED & ~E_NOTICE); ini_set('display_errors', '1');  // Switch on for error reporting
if (!defined('DOKU_INC')) {
    die;
}
/* must be run from within DokuWiki */
@(require_once dirname(__FILE__) . '/tpl_functions.php');
/* include hook for template functions */
$showTools = !tpl_getConf('hideTools') || tpl_getConf('hideTools') && $_SERVER['REMOTE_USER'];
# calling tpl_toc() here returns null if the toc wouldn't normally be rendered
# so $showTOC will be true if TOC would be rendered, false if not
# this affects our grid layout later ( see 'if ($showTOC)' )
$showTOC = $ACT == "show" && tpl_toc(true);
?>
<!DOCTYPE html>
<html lang="<?php 
echo $conf['lang'];
?>
" dir="<?php 
echo $lang['direction'];
?>
">
<head>
    <meta charset="UTF-8" />
    <!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><![endif]-->
    <title><?php 
tpl_pagetitle();
?>
Esempio n. 11
0
 /**
  * Print the whole entry, reformat it or cut it when needed
  *
  * @param bool   $included   - set true if you want content to be reformated
  * @param string $readmore   - where to cut the entry valid: 'syntax', FIXME
  * @param bool   $inc_level  - FIXME
  * @param bool   $skipheader - Remove the first header
  * @return bool false if a recursion was detected and the entry could not be printed, true otherwise
  */
 function tpl_entry($included = true, $readmore = 'syntax', $inc_level = true, $skipheader = false)
 {
     $content = $this->get_entrycontent($readmore, $inc_level, $skipheader);
     if ($included) {
         $content = $this->_convert_footnotes($content);
         $content .= $this->_edit_button();
     } else {
         $content = tpl_toc(true) . $content;
     }
     echo html_secedit($content, !$included);
     return true;
 }
Esempio n. 12
0
        echo $html;
    }
}
$evt->advise_after();
unset($data);
unset($evt);
?>
                    </ul>
                </div>
            </div>
        </div><!-- /wrapper -->

<?php 
/*include('tpl_footer.php') */
?>
    </div></div><!-- /site -->

    <div class="no"><?php 
tpl_indexerWebBug();
?>
</div>
    <div id="screen__mode" class="no"></div><?php 
/* helper to detect CSS media query in script.js */
?>
    <!--[if ( lte IE 7 | IE 8 ) ]></div><![endif]-->
</section>

<?php 
$SECONDSCREEN = tpl_toc(true);
$JS = false;
include __DIR__ . "/../../../shared/templates/footer.inc";
Esempio n. 13
0
function _tpl_toc_to_twitter_bootstrap()
{
    //Force generation of TOC, request that the TOC is returned as HTML, but then ignore the returned string. The hook will instead dump out the TOC.
    global $EVENT_HANDLER;
    $EVENT_HANDLER->register_hook('TPL_TOC_RENDER', 'AFTER', NULL, '_tpl_toc_to_twitter_bootstrap_event_hander');
    tpl_toc(true);
}
              <?php 
tpl_includeFile('pageheader.html');
?>
              <?php 
// render the content into buffer for later use
ob_start();
tpl_content(false);
$content = ob_get_clean();
?>

              <div class="toc-affix pull-right hidden-print" data-spy="affix" data-offset-top="150">
                <?php 
#tpl_toc()
?>
                <?php 
bootstrap_toc(tpl_toc(true));
?>
              </div>

              <!-- wikipage start -->
              <?php 
echo $content;
?>
              <!-- wikipage stop -->

              <?php 
tpl_flush();
?>
              <?php 
tpl_includeFile('pagefooter.html');
?>
Esempio n. 15
0
/**
 * Handle the admin page contents
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function tpl_admin()
{
    global $INFO;
    global $TOC;
    global $INPUT;
    $plugin = null;
    $class = $INPUT->str('page');
    if (!empty($class)) {
        $pluginlist = plugin_list('admin');
        if (in_array($class, $pluginlist)) {
            // attempt to load the plugin
            /** @var $plugin DokuWiki_Admin_Plugin */
            $plugin =& plugin_load('admin', $class);
        }
    }
    if ($plugin !== null) {
        if (!is_array($TOC)) {
            $TOC = $plugin->getTOC();
        }
        //if TOC wasn't requested yet
        if ($INFO['prependTOC']) {
            tpl_toc();
        }
        $plugin->html();
    } else {
        html_admin();
    }
    return true;
}
 function document_end()
 {
     // Pump the last doc
     $this->sections[$this->sectionNumber] = array('level' => $this->previousNodeLevel, 'position' => $this->previousNodePosition, 'content' => $this->doc, 'text' => $this->previousSectionTextHeader);
     // Recreate the doc
     $this->doc = '';
     foreach ($this->sections as $sectionNumber => $section) {
         // The content
         $this->doc .= $section['content'];
         // No TOC or bar for an admin page
         global $ACT;
         if ($ACT != 'admin' and $ACT != 'search') {
             // TOC After the content
             if ($this->info['toc'] == true and $section['level'] == 1 and $section['position'] == 1) {
                 global $conf;
                 if (count($this->toc) > $conf['tocminheads']) {
                     global $TOC;
                     $TOC = $this->toc;
                     $this->doc .= tpl_toc($return = true);
                 }
             }
             // Adbar after the content
             // Adbar later
             //                if ($section['level'] == 2 and
             //                    $section['position'] == 1 and
             //                    $ID <> 'adbar12' and
             //                    $ID <> 'start'
             //                ) {
             //
             //                    // $ID <> 'adbar12' to not come in a recursive call
             //                    // as tpl_include_call also the renderer process
             //
             //                    $this->doc .= tpl_include_page('adbar12', $print = false, $propagate = true);
             //
             //                }
         }
     }
     parent::document_end();
 }
Esempio n. 17
0
/**
 * show a wiki page
 *
 * @author Andreas Gohr <*****@*****.**>
 */
function html_show($txt = null)
{
    global $ID;
    global $REV;
    global $HIGH;
    global $INFO;
    //disable section editing for old revisions or in preview
    if ($txt || $REV) {
        $secedit = false;
    } else {
        $secedit = true;
    }
    if (!is_null($txt)) {
        //PreviewHeader
        echo '<br id="scroll__here" />';
        echo p_locale_xhtml('preview');
        echo '<div class="preview">';
        $html = html_secedit(p_render('xhtml', p_get_instructions($txt), $info), $secedit);
        if ($INFO['prependTOC']) {
            $html = tpl_toc(true) . $html;
        }
        echo $html;
        echo '<div class="clearer"></div>';
        echo '</div>';
    } else {
        if ($REV) {
            print p_locale_xhtml('showrev');
        }
        $html = p_wiki_xhtml($ID, $REV, true);
        $html = html_secedit($html, $secedit);
        if ($INFO['prependTOC']) {
            $html = tpl_toc(true) . $html;
        }
        $html = html_hilight($html, $HIGH);
        echo $html;
    }
}
/**
 * Dispatches the given sidebar type to return the right content
 *
 * @author Michael Klier <*****@*****.**>
 */
function tpl_sidebar_dispatch($sb, $pos)
{
    global $lang;
    global $conf;
    global $ID;
    global $REV;
    global $INFO;
    $svID = $ID;
    // save current ID
    $svREV = $REV;
    // save current REV
    $pname = tpl_getConf('pagename');
    switch ($sb) {
        case 'main':
            $main_sb = _getTransSb($pname);
            if ($main_sb && auth_quickaclcheck($main_sb) >= AUTH_READ) {
                $always = tpl_getConf('main_sidebar_always');
                if ($always or !$always && !getNS($ID)) {
                    print '<div class="main_sidebar sidebar_box">' . DOKU_LF;
                    print p_sidebar_xhtml($main_sb, $pos) . DOKU_LF;
                    print '</div>' . DOKU_LF;
                }
            }
            break;
        case 'namespace':
            $user_ns = tpl_getConf('user_sidebar_namespace');
            $group_ns = tpl_getConf('group_sidebar_namespace');
            if (!preg_match("/^" . $user_ns . ":.*?\$|^" . $group_ns . ":.*?\$/", $svID)) {
                // skip group/user sidebars and current ID
                $ns_sb = _getNsSb($svID);
                if ($ns_sb && auth_quickaclcheck($ns_sb) >= AUTH_READ) {
                    print '<div class="namespace_sidebar sidebar_box">' . DOKU_LF;
                    print p_sidebar_xhtml($ns_sb, $pos) . DOKU_LF;
                    print '</div>' . DOKU_LF;
                }
            }
            break;
        case 'user':
            $user_ns = tpl_getConf('user_sidebar_namespace');
            if (isset($INFO['userinfo']['name'])) {
                $user = $_SERVER['REMOTE_USER'];
                $user_sb = _getTransSb($user_ns . ':' . $user . ':' . $pname);
                if (@file_exists(wikiFN($user_sb))) {
                    $subst = array('pattern' => array('/@USER@/'), 'replace' => array($user));
                    print '<div class="user_sidebar sidebar_box">' . DOKU_LF;
                    print p_sidebar_xhtml($user_sb, $pos, $subst) . DOKU_LF;
                    print '</div>';
                }
                // check for namespace sidebars in user namespace too
                if (preg_match('/' . $user_ns . ':' . $user . ':.*/', $svID)) {
                    $ns_sb = _getNsSb($svID);
                    if ($ns_sb && $ns_sb != $user_sb && auth_quickaclcheck($ns_sb) >= AUTH_READ) {
                        print '<div class="namespace_sidebar sidebar_box">' . DOKU_LF;
                        print p_sidebar_xhtml($ns_sb, $pos) . DOKU_LF;
                        print '</div>' . DOKU_LF;
                    }
                }
            }
            break;
        case 'group':
            $group_ns = tpl_getConf('group_sidebar_namespace');
            if (isset($INFO['userinfo']['name'], $INFO['userinfo']['grps'])) {
                foreach ($INFO['userinfo']['grps'] as $grp) {
                    $group_sb = $group_ns . ':' . $grp . ':' . $pname;
                    $group_sb = _getTransSb($group_sb);
                    if ($group_sb && auth_quickaclcheck(cleanID($group_sb)) >= AUTH_READ) {
                        $subst = array('pattern' => array('/@GROUP@/'), 'replace' => array($grp));
                        print '<div class="group_sidebar sidebar_box">' . DOKU_LF;
                        print p_sidebar_xhtml($group_sb, $pos, $subst) . DOKU_LF;
                        print '</div>' . DOKU_LF;
                    }
                }
            }
            break;
        case 'index':
            print '<div class="index_sidebar sidebar_box">' . DOKU_LF;
            print '  ' . p_index_xhtml($svID, $pos) . DOKU_LF;
            print '</div>' . DOKU_LF;
            break;
        case 'toc':
            if (auth_quickaclcheck($svID) >= AUTH_READ) {
                $toc = tpl_toc(true);
                // replace ids to keep XHTML compliance
                if (!empty($toc)) {
                    $toc = preg_replace('/id="(.*?)"/', 'id="sb__' . $pos . '__\\1"', $toc);
                    print '<div class="toc_sidebar sidebar_box">' . DOKU_LF;
                    print $toc;
                    print '</div>' . DOKU_LF;
                }
            }
            break;
        case 'toolbox':
            $act_content = explode(',', tpl_getConf('toolbox_content'));
            $act_order = explode(',', tpl_getConf('toolbox_order'));
            print '<div class="toolbox_sidebar sidebar_box">' . DOKU_LF;
            print '<h1>' . $lang['kunlaborejo_toolbox'] . '</h1>' . DOKU_LF;
            print '  <div class="level1">' . DOKU_LF;
            print '    <ul>' . DOKU_LF;
            tpl_dispatch_ordered_content($act_order, $act_content, "tpl_dispatch_toolbox_item");
            print '    </ul>' . DOKU_LF;
            print '  </div>' . DOKU_LF;
            print '</div>' . DOKU_LF;
            break;
        case 'trace':
            print '<div class="trace_sidebar sidebar_box">' . DOKU_LF;
            print '  <h1>' . $lang['breadcrumb'] . '</h1>' . DOKU_LF;
            print '  <div class="breadcrumbs">' . DOKU_LF;
            $conf['youarehere'] != 1 ? tpl_breadcrumbs() : tpl_youarehere();
            print '  </div>' . DOKU_LF;
            print '</div>' . DOKU_LF;
            break;
        case 'translation':
            print '<div class="translation_sidebar sidebar_box">' . DOKU_LF;
            print '  <h1>' . $lang['kunlaborejo_translations'] . '</h1>' . DOKU_LF;
            $translation =& plugin_load('syntax', 'translation');
            echo $translation->_showTranslations();
            print '</div>' . DOKU_LF;
            break;
        case 'extra':
            print '<div class="extra_sidebar sidebar_box">' . DOKU_LF;
            @(include dirname(__FILE__) . '/' . $pos . '_sidebar.html');
            print '</div>' . DOKU_LF;
            break;
        default:
            // check for user defined sidebars
            if (@file_exists(DOKU_TPLINC . 'sidebars/' . $sb . '/sidebar.php')) {
                print '<div class="' . $sb . '_sidebar sidebar_box">' . DOKU_LF;
                @(require_once DOKU_TPLINC . 'sidebars/' . $sb . '/sidebar.php');
                print '</div>' . DOKU_LF;
            }
            break;
    }
    // restore ID and REV
    $ID = $svID;
    $REV = $svREV;
}