-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnavigation.php
124 lines (93 loc) · 3.39 KB
/
navigation.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
<?php
require_once("models/config.php");
if (!securePage($_SERVER['PHP_SELF'])){die();}
require_once("models/header.php");
if(!isUserLoggedIn()){
require_once("loginnav.php");
}
function echoActiveClassIfRequestMatches($requestUri)
{
$current_file_name = basename($_SERVER['REQUEST_URI'], ".php");
if ($current_file_name == $requestUri){
return "class='active'";
}
}
echo "
<body>
<div class='navbar navbar-inverse navbar-fixed-top'>
<div class='container'>
<div class='navbar-header'>
<button type='button' class='navbar-toggle' data-toggle='collapse' data-target='.navbar-collapse'>
<span class='icon-bar'></span>
<span class='icon-bar'></span>
<span class='icon-bar'></span>
</button>
<a class='navbar-brand' href='index.php'><img src='/img/smalllogo.png'></a>
</div>
<div class='navbar-collapse collapse'>
<ul class='nav navbar-nav'>
<li ".echoActiveClassIfRequestMatches('index')."><a href='index.php'>Home</a></li>";
if(isUserLoggedIn()){
echo"
<li ".echoActiveClassIfRequestMatches('graph')."><a href='graph.php'>Graphs</a></li>";
}
echo"
<li ".echoActiveClassIfRequestMatches('about')."><a href='about.php'>About</a></li>
<li ".echoActiveClassIfRequestMatches('blog')."><a href='blog.php'>Blog</a></li>
<li ".echoActiveClassIfRequestMatches('comp2014')."><a href='comp2014.php'>COMP2014</a></li>
<li class='dropdown'>
<a href='#' class='dropdown-toggle' data-toggle='dropdown'>More <b class='caret'></b></a>
<ul class='dropdown-menu'>
<li ><a href='manual.php'>How To</a></li>
<li><a href='about.php'>About</a></li>
<li><a href='contact.php'>Contact</a></li>
<li class='divider'></li>
<li><a href='http://makesense.boards.net'>Forum </a></li>
<li><a href='/wiki/index.php?title=Main_Page'>Wiki </a></li>
<li class='divider'></li>
";
if(isUserLoggedIn()){
echo"
<li><a href='user_settings.php'>User Settings</a></li>";
}
echo"
<li class='dropdown-header'>Login Difficulties</li>
<li><a href='forgot-password.php'>Forgot Password</a></li>";
if ($emailActivation)
{
echo "<li><a href='resend-activation.php'>Resend Activation Email</a></li>";
}
echo"
</ul>
</li>
</ul>";
if(!isUserLoggedIn()){
echo "
<form class='navbar-form navbar-right' action='register.php'>
<button type='submit' class='btn btn-success'>Register</button>
</form>
<form class='navbar-form navbar-right' name='login' action='".$_SERVER['PHP_SELF']."' method='post'>
<div class='form-group'>
<input type='text' name='username' placeholder='Username' class='form-control'/>
</div>
<div class='form-group'>
<input type='password' name='password' placeholder='Password' class='form-control'/>
</div>
<label> </label>
<input type='submit' value='Login' class='btn btn-success' />
</form>
";
}
if(isUserLoggedIn()){
echo "
<form class='navbar-form navbar-right' action='logout.php'>
<button type='submit' class='btn btn-success'>Sign Out</button>
</form>";
}
echo"
</div><!--/.navbar-collapse -->
</div>
</div>
</body>
</html>";
?>