1<?php
2/**
3 * DokuWiki Hacker Template: Main Page
4 *
5 * @link     https://www.dokuwiki.org/template:hacker.css
6 * @author   Lionel PLAIS <lionel.plais@ilp-web.net>
7 * @license  MIT License (https://opensource.org/license/MIT)
8 */
9
10// Must be run within DokuWiki
11if (!defined('DOKU_INC')) die();
12
13// Include hook for template functions
14@require_once(dirname(__FILE__) . '/tpl_functions.php');
15
16$showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && !empty($_SERVER['REMOTE_USER']) );
17$showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
18$sidebarElement = tpl_getConf('sidebarIsNav') ? 'nav' : 'aside';
19?>
20<!DOCTYPE html>
21<html
22	xmlns="http://www.w3.org/1999/xhtml"
23	xml:lang="<?php echo $conf['lang'] ?>"
24	lang="<?php echo $conf['lang'] ?>"
25	dir="<?php echo $lang['direction'] ?>"
26	class="no-js">
27<head>
28		<meta charset="UTF-8" />
29		<title>
30			<?php
31				tpl_pagetitle();
32			?>
33			[<?php
34				echo strip_tags($conf['title'])
35			?>]
36		</title>
37		<script>
38			(function(H) {
39				H.className = H.className.replace(/\bno-js\b/,'js')
40			})(
41				document.documentElement
42			)
43		</script>
44		<!-- TEMPLATE HEADERS -->
45		<?php
46			tpl_metaheaders();
47			_tpl_font_headers();
48		?>
49		<!-- /TEMPLATE HEADERS -->
50		<meta name="viewport" content="width=device-width,initial-scale=1" />
51		<!-- FAVICON -->
52		<?php
53			echo tpl_favicon(array('favicon', 'mobile'));
54		?>
55		<!-- /FAVICON -->
56		<?php
57			tpl_includeFile('meta.html')
58		?>
59</head>
60<body>
61	<!-- SITE -->
62	<div id="dokuwiki__site">
63		<!-- TOP -->
64		<div
65				id="dokuwiki__top"
66				class="site <?php
67					echo tpl_classes();
68					echo ($showSidebar) ? 'hasSidebar' : '';
69			?>">
70			<?php
71				// Occasional error and info messages on top of the page
72				html_msgarea();
73			?>
74			<!-- HEADER -->
75			<header id="dokuwiki__header">
76				<!-- PAD -->
77				<div class="pad">
78					<?php
79						tpl_includeFile('header.html');
80					?>
81
82					<!-- HEADING -->
83					<div class="headings group">
84						<h1 class="logo">
85							<?php
86								$logoSize = [];
87								$logo = tpl_getMediaFile([
88										':wiki:logo.svg',
89										':logo.svg',
90										':wiki:logo.png',
91										':logo.png',
92										'images/logo.svg',
93										'images/logo.png'
94									], false, $logoSize);
95
96								tpl_link(
97									wl(),
98									'<img src="' . $logo . '" ' . ($logoSize ? $logoSize[3] : '') . ' alt="Logo" style="box-shadow: none;" />' .
99									'<span>' . $conf['title'] . '</span>',
100									'accesskey="h" title="' . tpl_getLang('home') . '[H]"');
101							?>
102						</h1>
103						<?php if ($conf['tagline']): ?>
104							<p class="claim"><?php echo $conf['tagline'] ?></p>
105						<?php endif ?>
106
107						<ul class="a11y skip">
108							<li>
109								<a href="#dokuwiki__content">
110									<?php
111										echo $lang['skip_to_content'];
112									?>
113								</a>
114							</li>
115						</ul>
116						<div class="clearer"></div>
117					</div>
118					<!-- /HEADING -->
119
120					<!-- TOOLS -->
121					<div class="tools">
122						<?php
123							if ($conf['useacl'] && $showTools):
124						?>
125						<!-- USER TOOLS -->
126						<nav id="dokuwiki__usertools" aria-labelledby="dokuwiki__usertools_heading">
127							<h3 class="a11y" id="dokuwiki__usertools_heading">
128								<?php
129									echo $lang['user_tools'];
130								?>
131							</h3>
132							<ul>
133								<?php
134									if (!empty($_SERVER['REMOTE_USER'])) {
135										echo '<li class="user">';
136										tpl_userinfo(); /* 'Logged in as ...' */
137										echo '</li>';
138									}
139									if (file_exists(DOKU_INC . 'inc/Menu/UserMenu.php')) {
140										echo (new \dokuwiki\Menu\UserMenu())->getListItems('action ', false);
141									} else {
142										_tpl_usertools();
143									}
144								?>
145							</ul>
146						</nav>
147						<?php endif ?>
148						<!-- /USER TOOLS -->
149
150						<!-- SITE TOOLS -->
151						<nav id="dokuwiki__sitetools" aria-labelledby="dokuwiki__sitetools_heading">
152							<h3 class="a11y" id="dokuwiki__sitetools_heading">
153								<?php
154									echo $lang['site_tools'];
155								?>
156							</h3>
157							<?php
158								tpl_searchform();
159							?>
160							<ul>
161								<?php
162									if (file_exists(DOKU_INC . 'inc/Menu/SiteMenu.php')) {
163										echo (new \dokuwiki\Menu\SiteMenu())->getListItems('action ', false);
164									} else {
165										_tpl_sitetools();
166									}
167								?>
168							</ul>
169						</nav>
170						<!-- /SITE TOOLS -->
171
172					</div>
173					<!-- /TOOLS -->
174
175					<div class="clearer"></div>
176
177					<!-- BREADCRUMBS -->
178					<?php
179						if($conf['breadcrumbs']){
180					?>
181							<div class="breadcrumbs">
182								<?php
183									tpl_breadcrumbs();
184								?>
185							</div>
186					<?php
187						}
188					?>
189
190					<?php
191						if($conf['youarehere']){
192					?>
193							<div class="breadcrumbs">
194								<?php
195									tpl_youarehere();
196								?>
197							</div>
198					<?php
199						}
200					?>
201
202					<div class="clearer"></div>
203					<hr class="a11y" />
204				</div>
205				<!-- /PAD -->
206			</header>
207			<!-- /HEADER -->
208
209			<!-- WRAPPER -->
210			<div class="wrapper">
211				<!-- ASIDE -->
212				<?php
213					if ($showSidebar):
214				?>
215				<<?php echo $sidebarElement; ?>
216					id="dokuwiki__aside"
217					aria-label="<?php echo $lang['sidebar']; ?>">
218
219						<div class="pad aside include group">
220							<?php
221								tpl_includeFile('sidebarheader.html');
222							?>
223							<?php
224								// includes the nearest sidebar page
225								tpl_include_page($conf['sidebar'], 1, 1);
226							?>
227							<?php
228								tpl_includeFile('sidebarfooter.html');
229							?>
230							<div class="clearer"></div>
231						</div>
232
233						</<?php echo $sidebarElement; ?>>
234						<!-- /ASIDE -->
235						<?php endif; ?>
236
237						<!-- CONTENT -->
238						<main id="dokuwiki__content">
239							<div class="pad">
240								<?php
241									// Flush the output buffer
242									tpl_flush();
243								?>
244								<?php
245									tpl_includeFile('pageheader.html')
246								?>
247
248								<div class="page">
249									<!-- Wikipage start -->
250									<?php
251										// the main content
252										tpl_content();
253									?>
254									<!-- Wikipage stop -->
255
256									<div class="clearer"></div>
257								</div>
258
259								<?php
260									tpl_flush();
261								?>
262								<?php
263									tpl_includeFile('pagefooter.html');
264								?>
265							</div>
266						</main>
267						<!-- /CONTENT -->
268
269						<div class="clearer"></div>
270						<hr class="a11y" />
271
272						<!-- PAGE TOOLS -->
273						<?php
274							if ($showTools):
275						?>
276								<nav id="dokuwiki__pagetools" aria-labelledby="dokuwiki__pagetools_heading">
277									<h3 class="a11y" id="dokuwiki__pagetools_heading">
278										<?php
279											echo $lang['page_tools'];
280										?>
281									</h3>
282									<ul>
283										<?php
284											if (file_exists(DOKU_INC . 'inc/Menu/PageMenu.php')) {
285												echo (new \dokuwiki\Menu\PageMenu())->getListItems('action ', false);
286											} else {
287												_tpl_pagetools();
288											}
289										?>
290									</ul>
291								</nav>
292								<!-- /PAGE TOOLS -->
293							<?php
294							endif; ?>
295			</div>
296			<!-- /WRAPPER -->
297
298			<!-- FOOTER -->
299			<footer id="dokuwiki__footer">
300				<div class="pad">
301					<div class="doc">
302						<?php
303							/* 'Last modified' etc */
304							tpl_pageinfo();
305						?>
306					</div>
307
308					<?php
309						tpl_license('button');
310					?>
311
312					<?php
313						tpl_includeFile('footer.html');
314					?>
315				</div>
316			</footer>
317			<!-- /FOOTER -->
318		</div>
319		<!-- /TOP -->
320	</div>
321	<!-- /SITE -->
322
323	<div class="no">
324		<?php
325			// Provide DokuWiki housekeeping, required in all templates
326			tpl_indexerWebBug();
327		?>
328	</div>
329</body>
330</html>
331