forked from lisps/template-lisps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.php
207 lines (181 loc) · 7.34 KB
/
main.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
<?php
/**
* DokuWiki LISPS Template 2013
*
* @link http://dokuwiki.org/template
* @author Anika Henke <anika@selfthinker.org>
* @author Clarence Lee <clarencedglee@gmail.com>
* @author lisps
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
*/
if (!defined('DOKU_INC')) die(); /* must be run from within DokuWiki */
/**
* returns lastmod of given page id
*/
function template_getLastModOfGivenPageId($pageid){
global $ID;
global $INFO;
// Backup id of current page
$id_save = $ID;
// Set global page id
$ID = $pageid;
// get page infos
$tmp_info = pageinfo();
// save lastmod
$lastmod = $tmp_info['lastmod'];
// restore global page id
$ID = $id_save;
return $lastmod;
}
/**
* Includes the rendered HTML of a given page
*
* This function is useful to populate sidebars or similar features in a
* template
*/
function template_tpl_include_page($pageid, $print = true, $propagate = false, $rev = '') {
if (!$pageid) return false;
if ($propagate) $pageid = page_findnearest($pageid);
global $TOC;
$oldtoc = $TOC;
$html = p_wiki_xhtml($pageid, $rev, false);
$TOC = $oldtoc;
if(!$print) return $html;
echo $html;
return $html;
}
//Sidebar with replace CONSTANTS
$search=array("_USERNAME_",
"_CLIENTNAME_",
"_PAGEID_");
$replace=array($INFO["userinfo"]["name"],
$_SERVER['REMOTE_USER'],
$ID);
if($_SERVER['REMOTE_USER'] && page_exists('user:'.$_SERVER['REMOTE_USER'].':sidebar')){
$sidebar = template_tpl_include_page('user:'.$_SERVER['REMOTE_USER'].':sidebar', 0, 0, template_getLastModOfGivenPageId('user:'.$_SERVER['REMOTE_USER'].':sidebar'));
} else if($_SERVER['REMOTE_USER'] && page_exists('user:sidebar')){
$sidebar = template_tpl_include_page('user:sidebar', 0, 0, template_getLastModOfGivenPageId('user:sidebar'));
} else {
$sidebar = tpl_include_page('sidebar', 0, 0, '');
}
$sidebar=str_ireplace($search,$replace,$sidebar);
$hasSidebar = $sidebar?true:false;
$showSidebar = $hasSidebar && ($ACT=='show');
?><!DOCTYPE html>
<html lang="<?php echo $conf['lang'] ?>" dir="<?php echo $lang['direction'] ?>" class="no-js">
<head>
<meta charset="utf-8" />
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" /><![endif]-->
<title><?php tpl_pagetitle() ?> [<?php echo strip_tags($conf['title']) ?>]</title>
<script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
<?php tpl_metaheaders() ?>
<meta name="viewport" content="width=device-width,initial-scale=1" />
<?php echo tpl_favicon(array('favicon', 'mobile')) ?>
<?php tpl_includeFile('meta.html') ?>
</head>
<body>
<!--[if lte IE 7 ]><div id="IE7"><![endif]--><!--[if IE 8 ]><div id="IE8"><![endif]-->
<div id="dokuwiki__site"><div id="dokuwiki__top"
class="dokuwiki site mode_<?php echo $ACT ?> <?php echo ($showSidebar) ? 'showSidebar' : '';
?> <?php echo ($hasSidebar) ? 'hasSidebar' : ''; ?>">
<?php include('tpl_header.php') ?>
<div class="wrapper group">
<?php if($showSidebar): ?>
<!-- ********** ASIDE ********** -->
<div id="dokuwiki__aside"><div class="pad include group">
<h3 class="toggle"><?php echo $lang['sidebar'] ?></h3>
<div class="content">
<?php tpl_flush() ?>
<?php tpl_includeFile('sidebarheader.html') ?>
<?php
echo $sidebar;
?>
<?php tpl_includeFile('sidebarfooter.html') ?>
</div>
</div></div><!-- /aside -->
<?php endif; ?>
<!-- ********** CONTENT ********** -->
<div id="dokuwiki__content"><div class="pad group">
<div class="pageId"><span><?php echo hsc($ID) ?></span></div>
<div class="page group">
<?php tpl_flush() ?>
<?php tpl_includeFile('pageheader.html') ?>
<!-- wikipage start -->
<?php tpl_content() ?>
<!-- wikipage stop -->
<?php tpl_includeFile('pagefooter.html') ?>
</div>
<!-- Display permalink -->
<div class="docInfo">
<?php echo '<a class="mainpermalink" href="' . DOKU_BASE . "doku.php?id=" . $ID.'&rev='.($INFO['rev']?$INFO['rev']:$INFO['lastmod']) .' ">Permalink</a> ';?>
<?php tpl_pageinfo() ?>
</div>
<?php tpl_flush() ?>
</div></div><!-- /content -->
<hr class="a11y" />
<!-- PAGE ACTIONS -->
<div id="dokuwiki__pagetools">
<h3 class="a11y"><?php echo $lang['page_tools']; ?></h3>
<div class="tools">
<ul>
<?php
tpl_action('login', 1, 'li', 0, '<span>', '</span>');
tpl_action('register', 1, 'li', 0, '<span>', '</span>');
?>
<li><br><hr></li>
<?php if($INFO['writable'] && ($ACT === 'edit' || $ACT ==='preview') ):?>
<li onmouseup="jQuery('#edbtn__save').click();">
<a href="#" class="action save"><span><?php echo $lang['btn_save']; ?></span></a>
</li>
<li><br><hr></li>
<?php endif;?>
<?php
tpl_action('edit', 1, 'li', 0, '<span>', '</span>');
tpl_action('revert', 1, 'li', 0, '<span>', '</span>');
tpl_action('top', 1, 'li', 0, '<span>', '</span>');
?>
<li onmouseup="window.print()">
<a href="" class="action print"><span><?php echo tpl_getLang('btn_print'); ?></span></a>
</li>
<?php
tpl_action('subscribe', 1, 'li', 0, '<span>', '</span>');
tpl_action('revisions', 1, 'li', 0, '<span>', '</span>');
tpl_action('backlink', 1, 'li', 0, '<span>', '</span>');
?>
<li><br><hr></li>
<?php
tpl_action('admin', 1, 'li', 0, '<span>', '</span>');
tpl_action('profile', 1, 'li', 0, '<span>', '</span>');
tpl_action('recent', 1, 'li', 0, '<span>', '</span>');
tpl_action('media', 1, 'li', 0, '<span>', '</span>');
tpl_action('index', 1, 'li', 0, '<span>', '</span>');
?>
</ul>
</div>
</div>
</div><!-- /wrapper -->
<?php include('tpl_footer.php') ?>
</div>
<div class="watermark">
<?php
if(isset($_SERVER['REMOTE_USER'])) {
echo 'gedruckt von '.hsc($INFO['userinfo']['name']) ;
} else {
echo 'oeffentlich';
}
?>
</div>
<div class="watermark-confidential">
<?php
// get watermark either out of the template images folder or data/media folder
$logoSize = array();
$logo = tpl_getMediaFile(array(':wiki:watermark.png',':watermark.png', 'images/watermark.png'), false, $logoSize);
echo '<img src="'.$logo.'" '.$logoSize[3].' /> ';
?>
</div>
</div><!-- /site -->
<div class="no"><?php tpl_indexerWebBug() /* provide DokuWiki housekeeping, required in all templates */ ?></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]-->
</body>
</html>