-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
41 lines (38 loc) · 1.41 KB
/
Copy pathindex.php
File metadata and controls
41 lines (38 loc) · 1.41 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
<?php
/* PARAMETERS */
require_once('data/config.php');
/* BASE URL */
$protocol = !empty($_SERVER["HTTPS"]) ? "https" : "http";
$url_base = $protocol . '://' . $domain . '/';
$default_langage = $possible_langage[0];
/* REDIRECTION */
if (!isset($_GET) || empty($_GET["lang"])) {
$site_url = $protocol . '://' . $domain . '/' . $default_langage . "/";
header("Location: $site_url");
exit;
} else if ($_GET["lang"] && empty($_GET["page"])) {
if (in_array(htmlspecialchars($_GET["lang"]), $possible_langage) === true) {
$get_lang = htmlspecialchars($_GET["lang"]);
include('data/lang/' . $get_lang . '.php');
$slug_page = "";
} else {
$get_lang = $default_langage;
include('data/lang/' . $get_lang . '.php');
$slug_page = "404";
}
} else if ($_GET["lang"] && $_GET["page"]) {
if (in_array(htmlspecialchars($_GET["lang"]), $possible_langage) === true) {
$get_lang = htmlspecialchars($_GET["lang"]);
include('data/lang/' . $get_lang . '.php');
$slug_page = htmlspecialchars($_GET["page"]);
} else {
$get_lang = $default_langage;
include('data/lang/' . $get_lang . '.php');
$slug_page = "404";
}
}
include("data/rewriting.php");
$uri = $slug_page ?? '';
$slug_page = $routes[$get_lang ?? $default_langage][$slug_page] ?? '404';
$template_page = "content/pages/" . $slug_page . ".php";
include_once($template_page);