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';
|
2022-02-03 21:35:18 +01:00
|
|
|
if (($CONFIG["first_launch"] == true) && ($site != "error")) {
|
|
|
|
header("Location: /install/install_adduser.php");
|
2019-05-19 18:37:00 +02:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
if ($site != "error") {
|
|
|
|
include $_SESSION["docroot"] . '/php/auth.php';
|
|
|
|
}
|
2019-01-23 15:43:17 +01:00
|
|
|
|
2019-05-19 18:37:00 +02:00
|
|
|
include $_SESSION["docroot"] . '/version.php';
|
|
|
|
include $_SESSION["docroot"] . '/php/classes.user.php';
|
2022-02-03 21:35:18 +01:00
|
|
|
|
|
|
|
$token = isset($_COOKIE["token"]) ? $_COOKIE["token"] : "";
|
2019-05-19 18:37:00 +02:00
|
|
|
$user = new user();
|
2022-02-03 21:35:18 +01:00
|
|
|
$user->get_info($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="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")) {
|
2019-05-19 19:55:51 +02:00
|
|
|
$cssFileContents = file_get_contents($_SESSION["docroot"]."/style/themes/".$user->theme.".css");
|
|
|
|
preg_match_all('/\s+--primary:\s#(.{3,6})/m', $cssFileContents, $matches, PREG_SET_ORDER, 0);
|
|
|
|
$themecolor = $matches[0][1];
|
2019-05-19 18:37:00 +02:00
|
|
|
print_r('<link rel="stylesheet" href="/style/themes/' . $user->theme . '.css">');
|
2019-05-19 19:55:51 +02:00
|
|
|
print_r('<meta name="theme-color" content="#'.$themecolor.'">');
|
2019-05-19 18:37:00 +02:00
|
|
|
} else {
|
|
|
|
print_r('<link rel="stylesheet" href="/style/main.css">');
|
2019-05-19 19:55:51 +02:00
|
|
|
print_r('<meta name="theme-color" content="#007bff">');
|
2018-10-24 15:00:27 +02:00
|
|
|
}
|
2019-05-19 18:37:00 +02:00
|
|
|
?>
|
|
|
|
<link rel="stylesheet" href="/style/helper.css">
|
2019-05-23 08:58:48 +02:00
|
|
|
<script src="/js/jquery.js"></script>
|
|
|
|
<script src="/js/main.js"></script>
|
2019-05-23 14:14:16 +02:00
|
|
|
<title>ShoppingList</title>
|
2019-05-19 18:37:00 +02:00
|
|
|
</head>
|
|
|
|
|
|
|
|
<body>
|
|
|
|
<?php
|
|
|
|
if ($site && ($site != "login")) {
|
|
|
|
include $_SESSION["docroot"] . '/cont/nav.php';
|
2018-10-24 15:00:27 +02:00
|
|
|
}
|
2019-05-23 11:58:26 +02:00
|
|
|
echo '<div id="content" class="container pt-4">';
|
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
|
|
|
?>
|
2019-05-23 08:58:48 +02:00
|
|
|
<script src="js/bootstrap.bundle.min.js"></script>
|
2019-05-19 18:37:00 +02:00
|
|
|
</body>
|
|
|
|
|
|
|
|
</html>
|