-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
65 lines (56 loc) · 1.94 KB
/
index.php
File metadata and controls
65 lines (56 loc) · 1.94 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
65
<!DOCTYPE html>
<?php
# Define the API endpoit of the website
$API_ENDPOINT = "UPDATE WITH YOUR API_ENDPOINT DEFINED BY A READER ROLE YOU CREATED ON COCKPIT";
/**
* define a simple fucntion to communicate easily with the API
* @property string $url - basic route to the API
* @property array $get - filter of information to get from the return call
* @property array $options - general options to define the call
*/
function curl_get($url, array $get = NULL, array $options = array())
{
$defaults = array(
CURLOPT_URL => $url. (strpos($url, '?') === FALSE ? '?' : ''). http_build_query($get),
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => TRUE,
CURLOPT_TIMEOUT => 4
);
$ch = curl_init();
curl_setopt_array($ch, ($options + $defaults));
if( ! $result = curl_exec($ch))
{
trigger_error(curl_error($ch));
}
curl_close($ch);
return json_decode($result, true);
}
?>
<html lang="en">
<head>
<!-- Contient les informations générales sur site (la langue, la fiche de style, les plugins et autres à importer) -->
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- Contenu principal du site -->
<div class="menu">
<?php include('./modules/_menu.php'); # Inclut un sous-module de menu ?>
</div>
<?php
/**
* Importe les différents modules selon une valeurs passée dans l'adresse URL
*/
switch (htmlspecialchars($_GET['d'], ENT_QUOTES, 'UTF-8')) {
case 'w':
# Inclut le module qui affiche un travail en particulier
include('./modules/works.php');
break;
default:
# Cas de base, qui peut être utilisé pour un splashcreen
break;
}
?>
</body>
</html>