1
0
forked from fr/deguapp
deguapp/frontend-plain/index.php
2023-12-13 19:10:39 +01:00

172 lines
4.4 KiB
PHP

<?php
require_once("./libs/Router.php");
// Display Errors
ini_set('display_startup_errors', 1);
ini_set('display_errors', 1);
error_reporting(-1);
// Display var_dump
#var_dump($_SESSION);
// Date Time Zone
date_default_timezone_set('Europe/Prague');
$API_URL = "http://localhost:6060";
$LOGGEDIN = !false;
?>
<!DOCTYPE html>
<html lang="cs">
<head>
<title>DeguApp</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="/img/icons/beer.svg" type="image/svg+xml">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap">
<link rel="stylesheet" href="/css/_general.css">
<link rel="stylesheet" href="/css/_variables.css">
<link rel="stylesheet" href="/css/nav.css">
<link rel="stylesheet" href="/css/home.css">
<link rel="stylesheet" href="/css/md-add.css">
<link rel="stylesheet" href="/css/modal.css">
</head>
<body>
<header class="f-row nav-wrapper">
<div class="f-row f-center">
<a href="/" class="f-row f-center">
<img src="/img/icons/beer.svg" alt="degu app home">
<span>Degu App</span>
</a>
</div>
<div class="f-row nav-2">
<?php
if(!$LOGGEDIN) {
?>
<div id="nav-login" class="nav-item">
<p>Přihlásit se</p>
</div>
<div id="nav-signup" class="nav-item">
<p>Registrace</p>
</div>
<?php
} else{
?>
<div class="nav-item">
<img src="/img/icons/search.svg" alt="">
</div>
<div class="nav-item nav-add">
<img src="/img/icons/plus.svg" alt="add beer or review">
</div>
<div class="nav-item nav-user">
<img src="/img/icons/user.svg" alt="user icon">
<a href="#">Test Testovic</a>
</div>
<div class="nav-user-dropdown">
<a href="#">Můj účet</a>
<a href="#">Nastavení</a>
<a href="#">Odhlásit se</a>
</div>
<?php } ?>
</div>
</header>
<section class="main-wrapper">
<!-- routing shits -->
<?php
$R = new Router();
if(!$LOGGEDIN) {
$R->route('GET', '/', 'home');
$R->route('GET', '/login', 'login');
$R->route('GET', '/signup', 'signup');
}
if($LOGGEDIN) {
$R->route('GET', '/', 'beer_get');
$R->route('GET', '/beer/add', 'beer_add');
$R->route('GET', '/beer/get/{id}', 'beer_get');
$R->route('GET', '/review/add', 'review_add');
$R->route('POST', '/contact/send', 'contact');
}
if(!$LOGGEDIN && $R->getUrl() == '/') {
// show login page
}
//$R = null;
?>
<!-- modals -->
<!-- add modal -->
<?php if($LOGGEDIN) {?>
<section class="modal" id="md-add-tree">
<div class="modal-content">
<span class="md-close">&times;</span>
<div class="f-row f-center">
<a class="select-box" href="/beer/add">
<b>Add Beer</b>
</a>
<a class="select-box" href="/review/add">
<b>Add Review</b>
</a>
</div>
</div>
</section>
<!-- user actions modal -->
<section class="modal" id="md-user-tree">
<div class="modal-content">
<span class="md-close">&times;</span>
<div class="f-col f-center">
<h2>Ahoj Pepo!</h2>
<a href="/my-account">Můj účet</a>
<a href="/settings">Nastavení</a>
<a href="/logout">Odhlásit se</a>
</div>
</div>
</section>
<?php }?>
<?php if(!$LOGGEDIN) {?>
<!-- login modal -->
<section class="modal" id="md-login">
<div class="modal-content">
<span class="md-close">&times;</span>
<div class="f-col f-center">
<p>Přihlaste se</p>
<?php
require_once("./pages/login/login.php");
?>
</div>
</div>
</section>
<!-- login modal -->
<section class="modal" id="md-signup">
<div class="modal-content">
<span class="md-close">&times;</span>
<div class="f-col f-center">
<p>Zaregistrujte se</p>
<?php
require_once("./pages/signup/signup.php");
?>
</div>
</div>
</section>
<?php }?>
</section>
<footer>
<a href="https://git.filiprojek.cz/fr/deguapp">Source</a>
<a href="http://filiprojek.cz/">(c) Filip Rojek, 2023</a>
</footer>
<script defer src="/js/general.js"></script>
<script defer src="/js/modal.js"></script>
<script defer src="/js/nav.js"></script>
<script defer src="/js/home.js"></script>
</body>
</html>