-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathindex.php
122 lines (100 loc) · 2.55 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<?php
$page_slug = (isset($_GET['page'])) ? strtolower( trim($_GET['page']) ) : 'home';
if ($page_slug == '') { $page = 'home'; }
include('inc/functions.php');
check_pages('config/pages.php');
include('config/pages.php');
// prevent LFI -- allows only alphnum, dash and underscore
// does not allow slashes and dots to prevent include to other
// than allowed location
if (!validate_slug($page_slug)) {
$page_slug = "404";
}
$page = "pages/$page_slug.php";
if (!file_exists($page)) {
$page = 'pages/404.php';
}
?>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title>No DB CMS</title>
<!-- Bootstrap core CSS -->
<link href="assets/css/bootstrap.min.css" rel="stylesheet">
<style>
main {
padding-top: 30px;
padding-bottom: 100px;
min-height: 400px;
background-color: #fff;
}
body {
background-color: #333;
}
footer {
background-color: #333;
color: #fff;
min-height: 100px;
}
#sidebar {
border-right: 1px dotted #ccc;
}
</style>
</head>
<body>
<!-- As a heading -->
<nav class="navbar navbar-light bg-light">
<span class="navbar-brand mb-0 h1">NODBCMS</span>
</nav>
<main>
<div class="container-fluid">
<div class="row">
<div class="col-md-3 col-lg-2" id="sidebar">
<ul class="nav flex-column nav-pills">
<?php
// generating sidebar menu
foreach($pages as $m) {
$active = '';
if ($m['page_slug'] == $page_slug) {
$active = ' active';
}
?>
<li class="nav-item">
<a class="nav-link<?php echo $active;?>" href="index.php?page=<?php echo $m['page_slug'];?>">
<?php echo $m['label'];?>
</a>
</li>
<?php } ?>
</ul>
</div>
<div class="col-md-9 col-lg-10">
<?php
// outputing content
include($page);
echo $content;
?>
</div>
</div>
</div>
</main>
<footer>
<div class="container-fluid">
<div class="row">
<div class="col-12">
<p>Hakcipta terpelihara</p>
</div>
</div>
</div>
</footer>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="assets/js/jquery.min.js"></script>
<script src="assets/js/popper.min.js"></script>
<script src="assets/js/bootstrap.min.js"></script>
</body>
</html>