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