/
index.php
executable file
·63 lines (53 loc) · 2.28 KB
/
index.php
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
<?php
ini_set("display_errors", "E_ALL");
include_once 'core/functions.php';
sec_session_start();
if (isset($_GET["cp"]) && !empty($_GET["cp"])) {
$currentpage = htmlspecialchars($_GET["cp"]);
} else {
$currentpage = CONST_DefaultPage;
}
?>
<!DOCTYPE html>
<html>
<head>
<?php include ("content/htmlhead.php"); //add head of html ?>
</head>
<body>
<?php include ("content/head.php"); //add head content of page ?>
<!-- in case we need to do something with _all_ content, we put it in a div with id main
For example, we need to get the content 250px to the left for the sidebar -->
<div id="main">
<?php
if (isset($_GET['msg'])) {
// checking for more than one message
$query = explode('&', $_SERVER['QUERY_STRING']);
$messages = array();
// get all msg params manually
foreach ($query as $param) {
list($name, $value) = explode('=', $param, 2);
if (urldecode($name) == "msg")
array_push($messages, urldecode($value));
}
foreach ($messages as $message) {
$message = htmlspecialchars($message);
if ($message !== "Success") {
/* in addition to the content class, which generates standard output, add the info/error class for overwriting background color */
if (startsWith($message, "I"))
$class = "info";
else if (startsWith($message, "E"))
$class = "error";
else if (startsWith($message, "W"))
$class = "warn";
$message = language::get_msg($message);
/* if there is actually a message with this error/information code, show it - otherwise, don't */
if (!empty($message))
echo '<div class="content ' . $class . ' ">' . $message . '</div>';
}
}
}
?>
<?php include ("content/content.php"); //add page content ?>
</div>
</body>
</html>