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