1<?php
2/**
3 * functions for mmClean Template
4 *
5 * License: GPL 2 (http://www.gnu.org/licenses/gpl.html)
6 *
7 * @author:   Marcin Mierzejewski <marcin@mierzejewski.net>
8 * @homepage: http://www.mierzejewski.net
9 */
10
11require_once('conf.php');
12
13/**
14 * Displays the menu1
15 *
16 */
17function tpl_menu1()
18{
19    global $conf, $ID, $REV, $INFO;
20    print p_wiki_xhtml("menu1", '', false);
21
22    if ( $INFO['perm'] > AUTH_READ )
23    {
24        print '<ul><li><a href="?id=menu1&amp;do=edit" class="wikilink1" title="Edit">Edit</a></li></ul>';
25    }
26}
27
28/**
29 * Displays the bottombar
30 *
31 */
32function tpl_bottombar()
33{
34    global $INFO,$ID,$lang;
35    $perm = $INFO['perm'];
36
37    echo '<a href="?do=recent" class="interwiki" title="'.$lang['btn_rec'].'">'.$lang['btn_recent'].'</a>'
38        .'&nbsp;&middot;&nbsp;';
39
40    if($perm > AUTH_READ) {
41        echo '<a href="?do=revisions" class="interwiki" title="'.$lang['btn_revs'].'">'.$lang['btn_revs'].'</a>'
42            .'&nbsp;&middot;&nbsp;';
43        if(file_exists(wikiFN($ID))) {
44            echo '<a href="?id='.$ID.'&amp;do=edit" class="interwiki" title="'.$lang['btn_edit'].'">'.$lang['btn_edit'].'</a>';
45        } else {
46            echo '<a href="?id='.$ID.'&amp;do=edit" class="interwiki" title="'.$lang['btn_create'].'">'.$lang['btn_create'].'</a>';
47        }
48        echo '&nbsp;&middot;&nbsp;';
49    } else {
50        echo '<a href="?id='.$ID.'&amp;do=edit" class="interwiki" title="'.$lang['btn_source'].'">'.$lang['btn_source'].'</a>'
51            .'&nbsp;&middot;&nbsp;';
52    }
53
54    if($perm > AUTH_WRITE) {
55        echo '<a href="?do=admin" class="interwiki" title="'.$lang['btn_admin'].'">'.$lang['btn_admin'].'</a>'
56            .'&nbsp;&middot;&nbsp;';
57    }
58
59    if(isset($INFO['userinfo']['name'])) {
60				echo '<a href="?do=profile" class="interwiki" title="'.$lang['btn_profile'].'">'.$lang['btn_profile'].'</a>'
61            .'&nbsp;&middot;&nbsp;';
62				echo '<a href="?do=logout" class="interwiki" title="'.$lang['btn_logout'].'">'.$lang['btn_logout'].'</a>';
63    } else {
64        echo '<a href="?do=login" class="interwiki" title="'.$lang['btn_login'].'">'.$lang['btn_login'].'</a>';
65    }
66}
67
68/**
69 * Displays the menu2
70 *
71 */
72function tpl_menu2()
73{
74	global $conf, $ID, $REV, $INFO, $lang;
75	$currID = false;
76
77	if ( $conf['tpl_mmClean']['menu2Permanent'] )
78	{
79		$path = "";
80	}
81	else
82	{
83		if ( false != strpos($ID, ":") )
84		{
85			$path = substr($ID, 0, strpos($ID, ":"));
86		}
87		else
88		{
89			$path = $ID;
90		}
91		$path .= ":";
92	}
93
94	print "<h1>";
95	print tpl_pagetitle();
96	print "</h1>";
97	print p_wiki_xhtml($path."menu2", '', false);
98
99	if (  $INFO['perm'] > AUTH_READ )
100	{
101		print '<ul><li><a href="?id='.$path.'menu2&amp;do=edit" class="wikilink1" title="Edit"><b>Edit</b></a></li></ul>';
102	}
103}
104
105/**
106 * Check if menu2 is present for this page
107 *
108 */
109function tpl_isMenu2()
110{
111	global $conf, $ID, $REV, $INFO, $ACT;
112
113	if ( $ACT == 'edit' || $ACT == 'preview' )
114	{
115		return false;
116	}
117
118	// Permanent Sidebar
119	if ( true == $conf['tpl_mmClean']['menu2Permanent'] && true == file_exists( (wikiFN("menu2") ) ) )
120	{
121		return true;
122	}
123
124	if ( false != strpos($ID, ":") )
125	{
126		$path = substr($ID, 0, strpos($ID, ":"));
127	}
128	else
129	{
130		$path = $ID;
131	}
132	$path .= ":";
133
134	if ( file_exists(wikiFN($path."menu2")) )
135	{
136		return true;
137	}
138	else
139	{
140		return false;
141	}
142}
143
144?>
145