-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
96 lines (78 loc) · 2.82 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
<?php
$base = "matube/";
function __autoload($cn) {
include "system/$cn.php";
}
$db = new Database();
$user = new User();
$entity = $user->getEntity();
$page = isset($_GET['page'])?$_GET['page']:"home";
$title = $lMenu = $body = "";
include("pages/$page.php");
$loggedIn = $user->isLoggedIn();
$un = $wm = $login = $menu = "";
if($loggedIn){
$un = $user->getUsername();
$wm = "Welcome $un ";
$login = "Logout";
$menu = '<li class=""><a href="?page=upload">Upload video</a></li>';
if($entity->isAdmin()) {
$menu .= '<li class=""><a href="?page=status">Server Status</a></li>';
}
} else {
$login = "Log in";
}
$menu = str_replace('"><a href="?page='.$page,'active"><a href="?page='.$page, $menu);
?>
<html>
<head>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="/<?php echo $base;?>css/bootstrap.min.css">
<!-- Optional theme -->
<link rel="stylesheet" href="/<?php echo $base;?>css/bootstrap-theme.min.css">
<!-- matube css -->
<link rel="stylesheet" href="/<?php echo $base;?>css/matube.css">
<!-- Production jquery -->
<script src="/<?php echo $base;?>js/jquery-2.1.1.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="/<?php echo $base;?>js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.php">MaTube</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<?php echo $menu; ?>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<div id="usernameField">
<span><?php echo $wm; ?></span><span id="username"></span>
</div>
</li>
<li>
<button class="btn btn-sm btn-primary btn-danger" id="logout" onclick="window.location='?page=login'"><span><?php echo $login;?></span><span class="glyphicon"></span></button>
</li>
</ul>
</div><!-- /.navbar-collapse -->
</div><!-- /.container-fluid -->
</nav>
<div class='container'>
<div class='col-md-12'>
<!-- <div class='col-md-2'><?php echo $lMenu; ?></div> -->
<div class='col-md-12'><?php body(); ?></div>
</div>
</div>
</body>
</html>