shopping-list/index.php

103 lines
2.5 KiB
PHP
Raw Normal View History

2018-10-24 15:00:27 +02:00
<?php
2019-05-19 18:37:00 +02:00
session_start();
if (in_array("site", array_keys($_GET))) {
$site = $_GET["site"];
} else {
$site = "-1";
}
2018-10-24 15:00:27 +02:00
2019-05-19 18:37:00 +02:00
if (!(isset($_SESSION["docroot"]))) {
$_SESSION["docroot"] = __DIR__;
}
include $_SESSION["docroot"] . '/config/config.php';
if (($CONFIG["installed"] == false) && ($site != "error")) {
header("Location: /install/install.php");
exit;
}
if ($site != "error") {
include $_SESSION["docroot"] . '/php/auth.php';
}
2019-05-19 18:37:00 +02:00
include $_SESSION["docroot"] . '/version.php';
include $_SESSION["docroot"] . '/php/classes.user.php';
$user = new user();
$user->get_info($_COOKIE["token"]);
2018-10-24 15:00:27 +02:00
?>
2019-05-19 18:37:00 +02:00
<html lang="de" dir="ltr">
<head>
<meta charset="utf-8">
<meta name="theme-color" content="#4CAF50" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="apple-touch-icon" href="/pic/fav.ico">
<link rel="shortcut icon" type="image/png" href="/pic/fav.ico" />
<link rel="stylesheet" href="/style/fontawesome/css/all.css">
<?php
if (file_exists($_SESSION["docroot"] . '/style/themes/' . $user->theme . ".css")) {
print_r('<link rel="stylesheet" href="/style/themes/' . $user->theme . '.css">');
} else {
print_r('<link rel="stylesheet" href="/style/main.css">');
2018-10-24 15:00:27 +02:00
}
2019-05-19 18:37:00 +02:00
?>
<link rel="stylesheet" href="/style/helper.css">
<script src="/bin/jquery.js"></script>
<script src="/bin/main.js"></script>
<title>Einkaufsliste</title>
</head>
<body>
<?php
if ($site && ($site != "login")) {
include $_SESSION["docroot"] . '/cont/nav.php';
2018-10-24 15:00:27 +02:00
}
2019-05-19 18:37:00 +02:00
echo '<div id="content" class="container">';
2018-10-24 15:00:27 +02:00
switch ($site) {
case "login":
2019-05-19 18:37:00 +02:00
include $_SESSION["docroot"] . '/cont/login.php';
2018-10-24 15:00:27 +02:00
break;
case "list":
2019-05-19 18:37:00 +02:00
include $_SESSION["docroot"] . '/cont/list.php';
2018-10-24 15:00:27 +02:00
break;
2018-10-27 18:32:43 +02:00
case "settings":
2019-05-19 18:37:00 +02:00
include $_SESSION["docroot"] . '/cont/settings.php';
2018-10-27 18:32:43 +02:00
break;
2018-10-24 15:00:27 +02:00
case "recipes":
2019-05-19 18:37:00 +02:00
include $_SESSION["docroot"] . '/cont/recipes.php';
2018-10-24 15:00:27 +02:00
break;
case "recipe":
2019-05-19 18:37:00 +02:00
include $_SESSION["docroot"] . '/cont/recipe.php';
2018-10-24 15:00:27 +02:00
break;
case "new-recipe":
2019-05-19 18:37:00 +02:00
include $_SESSION["docroot"] . '/cont/manageRecipe.php';
2018-10-24 15:00:27 +02:00
break;
case "edit-recipe":
2019-05-19 18:37:00 +02:00
include $_SESSION["docroot"] . '/cont/manageRecipe.php';
2018-10-24 15:00:27 +02:00
break;
case "new-user":
2019-05-19 18:37:00 +02:00
include $_SESSION["docroot"] . '/cont/adduser.php';
2018-10-24 15:00:27 +02:00
break;
case "error":
2019-05-19 18:37:00 +02:00
include $_SESSION["docroot"] . '/cont/error.php';
2018-10-24 15:00:27 +02:00
break;
default:
2019-05-19 18:37:00 +02:00
include $_SESSION["docroot"] . '/cont/list.php';
2018-10-24 15:00:27 +02:00
$site = "list";
break;
}
echo "</div>";
2019-05-19 18:37:00 +02:00
?>
<script src="bin/bootstrap.bundle.min.js"></script>
</body>
</html>