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$showTools = !tpl_getConf('hideTools') || ( tpl_getConf('hideTools') && !empty($_SERVER['REMOTE_USER']) );
15$showSidebar = page_findnearest($conf['sidebar']) && ($ACT=='show');
16$sidebarElement = tpl_getConf('sidebarIsNav') ? 'nav' : 'aside';
17$menuMaxHeight = tpl_getConf('MenuMaxHeight');
18$tocMaxHeight = tpl_getConf('TocMaxHeight');
19$contentMaxWidth = tpl_getConf('ContentMaxWidth');
20$themeMode = tpl_getConf('DefaultTheme');
21$forceTheme = tpl_getConf('ForceTheme');
22
23
24
25if (!empty($_COOKIE['theme'])){
26    if(!$forceTheme){
27        $themeMode = $_COOKIE['theme'];
28    }else{
29        setcookie("theme",$themeMode);
30    }
31}
32if (!isset($_COOKIE['theme']) || empty($_COOKIE['theme'])){
33    setcookie("theme",$themeMode);
34}
35$logoSize = array();
36
37$logodark = tpl_getMediaFile(array(':wiki:logo-dark.png', ':logo-dark.png', 'images/logo-dark.png'), true, $logoSize, false);
38$logolight = tpl_getMediaFile(array(':wiki:logo-light.png', ':logo-light.png', 'images/logo-light.png'), true, $logoSize, false);
39$logo = tpl_getMediaFile(array(':wiki:logo.png', ':logo.png', 'images/logo.png'), true, $logoSize);
40
41
42?><!DOCTYPE html>
43<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $conf['lang'] ?>"
44  lang="<?php echo $conf['lang'] ?>" dir="<?php echo $lang['direction'] ?>" class="no-js">
45<head>
46    <meta charset="UTF-8" />
47    <title><?php tpl_pagetitle() ?> [<?php echo strip_tags($conf['title']) ?>]</title>
48    <script>(function(H){H.className=H.className.replace(/\bno-js\b/,'js')})(document.documentElement)</script>
49    <?php tpl_metaheaders() ?>
50    <meta name="viewport" content="width=device-width,initial-scale=1" />
51    <?php echo tpl_favicon(array('favicon', 'mobile')) ?>
52    <?php tpl_includeFile('meta.html')?>
53    <style>body{
54        --kiwiki-menu-max-height:<?php echo $menuMaxHeight; ?>px;
55        --kiwiki-toc-max-height:<?php echo $tocMaxHeight; ?>px;
56        --kiwiki-content-max-width:<?php echo $contentMaxWidth; ?>;
57        --kiwiki-logo-url:url(<?php echo $logo; ?>);
58        --kiwiki-logo-light-url:url(<?php echo $logolight ? $logolight : $logo; ?>);
59        --kiwiki-logo-dark-url:url(<?php echo $logodark ? $logodark : $logo; ?>);
60    }
61    </style>
62</head>
63
64
65<body id="kiwiki" class="<?php echo $themeMode; ?>">
66    <?php    /* the "dokuwiki__top" id is needed somewhere at the top, because that's where the "back to top" button/link links to */ ?>
67    <?php /* tpl_classes() provides useful CSS classes; if you choose not to use it, the 'dokuwiki' class at least
68             should always be in one of the surrounding elements (e.g. plugins and templates depend on it) */ ?>
69    <?php $admin_page = (($ACT == "admin") && (isset($_REQUEST['page']))) ? explode("#",$_REQUEST['page'])[0]: "" ;?>
70    <div id="dokuwiki__site">
71        <div id="dokuwiki__top" class="site <?php echo tpl_classes() ." " . $admin_page; ?>">
72        <!-- ********** HEADER ********** -->
73        <?php include('partial/header.php');?>
74
75        <?php include('partial/before_content.php'); ?>
76
77        <?php include('partial/content.php');?>
78
79        </div>
80        <!-- ********** FOOTER ********** -->
81    <?php include('partial/footer.php'); ?>
82    <!-- GO TOP -->
83    <div id="go">
84    <?php
85
86    $items = (new \dokuwiki\Menu\KiwikiGo())->getItems();
87    foreach ($items as $item){
88        if ($item -> getType() == 'bottom' && !tpl_getConf('GoBottomBtn')){
89            continue;
90        }else{
91            echo '<a href="'.$item->getLink().'" title="'.$item->getTitle().'">'
92            .'<span class="icon">'.inlineSVG($item->getSvg()).'</span>'
93            . '<span class="a11y">'.$item->getLabel().'</span>'
94            . '</a>';
95        }
96    }
97    ?>
98    </div>
99    </div><!-- /site -->
100    <div id="dokuwiki__bottom"></div>
101    <div class="no"><?php tpl_indexerWebBug() /* provide DokuWiki housekeeping, required in all templates */ ?></div>
102</body>
103</html>
104