1<?php
2/**
3 * Kiwiki Template
4 *
5 * @link     http://dokuwiki.org/template:kiwiki
6 * @author   Anika Henke <anika@selfthinker.org>
7 * @author   Nicolas Prigent
8 * @license  GPL 2 (http://www.gnu.org/licenses/gpl.html)
9 */
10
11if (!defined('DOKU_INC')) die(); /* must be run from within DokuWiki */
12@require_once(dirname(__FILE__).'/tpl_functions.php'); /* include hook for template functions */
13
14/*Get all template configurations*/
15$showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && !empty($_SERVER['REMOTE_USER']) );
16$showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
17$sidebar = $conf['sidebar'];
18$sidebarElement = tpl_getConf('sidebarIsNav') ? 'nav' : 'aside';
19$sidebarMaxHeight = tpl_getConf('SidebarMaxHeight');
20$sidebar_right = tpl_getConf('SidebarRight');
21$toc = tpl_toc(true);
22$tocMaxHeight = tpl_getConf('TocMaxHeight');
23$toc_right = tpl_getConf('TocRight');
24$contentMaxWidth = tpl_getConf('ContentMaxWidth');
25$themeMode = tpl_getConf('DefaultTheme');
26$forceTheme = tpl_getConf('ForceTheme');
27$contentWidth = '100%';
28$asideWidth = '20%';
29if(($toc!='' || ($ACT == 'show' && page_exists($sidebar))) && $sidebar_right == $toc_right){
30    $contentWidth = '80%';
31}
32if($sidebar_right != $toc_right ){
33    $contentWidth = '68%';
34    $asideWidth = '16%';
35}
36
37if (!empty($_COOKIE['theme'])){
38    if(!$forceTheme){
39        $themeMode = in_array($_COOKIE['theme'], ['darkmode', 'lightmode', 'system-color']) ? $_COOKIE['theme'] : $themeMode;
40    }else{
41        setcookie("theme",$themeMode);
42    }
43}
44if (!isset($_COOKIE['theme']) || empty($_COOKIE['theme'] || !in_array($_COOKIE['theme'], ['darkmode', 'lightmode', 'system-color']))){
45    setcookie("theme",$themeMode);
46}
47
48$logoSize = array();
49
50$logodark = tpl_getMediaFile(array(':wiki:logo-dark.png', ':logo-dark.png', 'images/logo-dark.png'), true, $logoSize, false);
51$logolight = tpl_getMediaFile(array(':wiki:logo-light.png', ':logo-light.png', 'images/logo-light.png'), true, $logoSize, false);
52$logo = tpl_getMediaFile(array(':wiki:logo.png', ':logo.png', 'images/logo.png'), true, $logoSize);
53
54/*Main html template*/
55
56?><!DOCTYPE html>
57<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $conf['lang'] ?>"
58  lang="<?php echo $conf['lang'] ?>" dir="<?php echo $lang['direction'] ?>" class="no-js">
59<head>
60    <meta charset="UTF-8" />
61    <title><?php tpl_pagetitle() ?> [<?php echo strip_tags($conf['title']) ?>]</title>
62    <script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
63    <?php tpl_metaheaders() ?>
64    <meta name="viewport" content="width=device-width,initial-scale=1" />
65    <?php echo tpl_favicon(array('favicon', 'mobile')) ?>
66    <?php tpl_includeFile('meta.html')?>
67    <?php include('css/inline-css.php');?>
68</head>
69
70
71<body id="kiwiki" class="<?php echo $themeMode; ?>">
72    <?php    /* the "dokuwiki__top" id is needed somewhere at the top, because that's where the "back to top" button/link links to */ ?>
73    <?php /* tpl_classes() provides useful CSS classes; if you choose not to use it, the 'dokuwiki' class at least
74             should always be in one of the surrounding elements (e.g. plugins and templates depend on it) */ ?>
75    <?php $admin_page = (($ACT == "admin") && (isset($_REQUEST['page']))) ? explode("#",$_REQUEST['page'])[0]: "" ;?>
76    <div id="dokuwiki__site">
77        <div id="dokuwiki__top" class="site <?php echo tpl_classes() ." " . $admin_page; ?>">
78        <!-- ********** HEADER ********** -->
79        <?php include('partial/header.php');?>
80
81        <?php include('partial/before_content.php'); ?>
82
83        <?php include('partial/content.php');?>
84
85        </div>
86        <!-- ********** FOOTER ********** -->
87    <?php include('partial/footer.php'); ?>
88    <!-- GO TOP -->
89    <div id="go">
90    <?php
91
92    $items = (new \dokuwiki\Menu\KiwikiGo())->getItems();
93    foreach ($items as $item){
94        if ($item -> getType() == 'bottom' && !tpl_getConf('GoBottomBtn')){
95            continue;
96        }else{
97            echo '<a href="'.$item->getLink().'" title="'.$item->getTitle().'">'
98            .'<span class="icon">'.inlineSVG($item->getSvg()).'</span>'
99            . '<span class="a11y">'.$item->getLabel().'</span>'
100            . '</a>';
101        }
102    }
103    ?>
104    </div>
105    </div><!-- /site -->
106    <div id="dokuwiki__bottom"></div>
107    <div class="no"><?php tpl_indexerWebBug() /* provide DokuWiki housekeeping, required in all templates */ ?></div>
108</body>
109</html>
110