-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
64 lines (59 loc) · 2.79 KB
/
index.php
File metadata and controls
64 lines (59 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
session_start();
error_reporting(0);
require("model/database.php");
$req = $bdd->query('SELECT page.id, page.name, site.theme as theme FROM site, page');
$request_uri = explode('?', $_SERVER['REQUEST_URI'], 2);
while ($data = $req->fetch()) {
switch ($request_uri[0]) {
case '/'.str_replace('ê', 'e', str_replace('é', 'e', str_replace('è', 'e', str_replace(' ', '', $data['name'])))): // GENERATED PAGES
require('controller/controller.php');
require('model/NewPage.php');
echo "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">";
echo "<title>" . $data['name'] . "</title>";
echo "<link rel=\"icon\" href=\"https://image.flaticon.com/icons/png/512/83/83946.png\">";
echo "<script src=\"vendor/jquery-3.4.1.min.js\"></script>";
echo "<style>";
require_once("vendor/bootstrap-4.3.1-dist/css/bootstrap.min.css");
echo "</style>";
echo "<script src=\"vendor/bootstrap-4.3.1-dist/js/bootstrap.min.js\"></script>";
echo "<style>";
require_once("style/view.css");
echo "</style>";
echo "<link rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.8.1/css/all.css\">";
echo "<link href=\"https://fonts.googleapis.com/css?family=Noto+Sans\" rel=\"stylesheet\">";
echo "<body";
$background = new Background;
echo ">";
echo "<div style=\"font-family: 'Noto Sans', sans-serif;\">";
// echo "<a class=\"fas fa-cogs fa-3x\" href=\"/admin\"></a>";
echo "<div id=\"layoutHeader\">";
$navbar = new Navbar;
if ($data['theme'] == 2) { // CHANGE THEME
echo "<h1 class=\"text-center darkTheme\">" . $data['name'] . "</h1>";
}
else {
echo "<h1 class=\"text-center\">" . $data['name'] . "</h1>";
}
echo "</div>";
$page = new NewPage($data['id']);
$layoutFooter = new LayoutFooter;
echo "</div></body></html>";
break;
case '/': // HOME PAGE
require_once 'view/view.php';
break;
case '/admin': // ADMIN PAGE
if (isset($_SESSION['username']) && isset($_SESSION['password'])) {
require_once 'view/admin.php';
}
else {
require_once 'view/login/login.php';
}
break;
default:
// header('HTTP/1.0 404 Not Found');
// require 'view/404.php';
break;
}
}