1<?php
2/**
3 * functions for r7throot3 template
4 *
5 * License: GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 *
7 * @author:         Michael Klier <chi@chimeric.de>
8 * @homepage:       http://www.chimeric.de
9 * @modified-by:    Xan <DXpublica@telefonica.net>
10 * @modified-by:    Oscar M. Lage <r0sk10@gmail.com>
11 */
12
13require_once('conf.php');
14
15/**
16 * fetches the page menu1 and displays it
17 *
18 * @author Oscar M. Lage <r0sk10@gmail.com>
19 */
20function tpl_menu1()
21{
22    global $conf, $ID, $REV, $INFO;
23    print p_wiki_xhtml("menu1", '', false);
24}
25
26/**
27 * fetches the sidebar-pages and displays the sidebar
28 *
29 * @author Michael Klier <chi@chimeric.de>
30 */
31function tpl_sidebar() {
32    global $conf, $ID, $REV, $INFO, $lang;
33
34    $svID  = $ID;
35    $svREV = $REV;
36
37        $nom = $ID.'_'.$conf['sidebar-theme']['sidebar_pagename'];
38        $default_nom = $conf['sidebar-theme']['default_sidebar_name'];
39
40    if (file_exists(wikiFN($nom)))
41      {
42        echo '<div class="sidebar"><div class="sidebar-top">&nbsp;</div><div class="sidebar-middle">'.p_sidebar_xhtml($nom).'</div><div class="sidebar-bottom">&nbsp;</div></div>';
43      }
44    else
45      {
46        if (file_exists(wikiFN($default_nom)))
47        {
48           print '<div class="sidebar"><div class="sidebar-top">&nbsp;</div><div class="sidebar-middle">'.p_sidebar_xhtml($default_nom).'</div><div class="sidebar-bottom">&nbsp;</div></div>';
49        }
50        else
51        {
52          print '&nbsp;';
53
54        }
55       }
56
57    $ID = $svID;
58    $REV = $svREV;
59
60}
61
62/**
63 * removes the TOC of the sidebar-pages and shows a edit-button if user has enough rights
64 *
65 * @author Michael Klier <chi@chimeric.de>
66 */
67function p_sidebar_xhtml($Sb) {
68    $data = p_wiki_xhtml($Sb,'',false);
69    if(auth_quickaclcheck($Sb) >= AUTH_EDIT) {
70        $data .= '<div class="secedit">'.html_btn('secedit',$Sb,'',array('do'=>'edit','rev'=>'','post')).'</div>';
71    }
72    return preg_replace('/<div class="toc">.*?(<\/div>\n<\/div>)/s', '', $data);
73}
74
75?>