xssbook2/web/_views/header.php

85 lines
2 KiB
PHP
Raw Normal View History

2024-03-30 16:14:42 +00:00
<?php /* Copyright (c) 2024 Freya Murphy */ ?>
<?php /* vi: syntax=php */ ?>
<?php
$self = $this->main->user();
?>
<!DOCTYPE html>
<html>
<head>
2024-03-30 16:14:42 +00:00
<script>
<?php if ($this->main->session): ?>
var jwtStr = <?=json_encode($this->main->session['jwt'])?>;
<?php else: ?>
var jwtStr = null;
<?php endif; ?>
</script>
<?php
foreach ($js_files as $js) {
echo $this->main->link_js($js);
}
foreach ($css_files as $css) {
echo $this->main->link_css($css);
}
?>
<title><?=$title?></title>
</head>
<body>
<header class="nav">
<div class="nav-left">
<span class="logo">xssbook</span>
</div>
<div class="nav-center" :class="{hidden: !visible}">
<a
id="action-home"
class="header-entry btn btn-hover btn-action btn-blue"
href="/home"
title="<?=lang('action_home_tip')?>"
>
<i class="mi mi-lg">home</i>
<span><?=lang('action_home_text')?></span>
</a>
<a
id="action-people"
class="header-entry btn btn-hover btn-action btn-blue"
href="/people"
title="<?=lang('action_people_tip')?>"
>
<i class="mi mi-lg">people</i>
<span><?=lang('action_people_text')?></span>
</a>
<a
id="action-chat"
class="header-entry btn btn-hover btn-action btn-blue"
href="/chat"
title="<?=lang('action_chat_tip')?>"
>
<i class="mi mi-lg">chat</i>
<span><?=lang('action_chat_text')?></span>
</a>
</div>
<div class="nav-right">
<button
id="action-hamburger"
title="<?=lang('action_hamburger_tip')?>"
>
<i class="mi mi-lg">menu</i>
</button>
<?php if($self): ?>
<?php $this->view('template/pfp', array(
'user' => $self,
'class' => 'pfp-sm ml',
)); ?>
<?php else: ?>
<?=ilang('action_login', class: 'btn btn-action', href: '/auth/login')?>
<?php endif; ?>
</div>
<script>
$('#action-hamburger').on('click', function() {
let menu = $('.nav-center');
menu.toggleClass('visible');
});
</script>
2024-03-30 16:14:42 +00:00
</header>
<div id="toast-container">
</div>