-
Notifications
You must be signed in to change notification settings - Fork 0
/
nav.php
163 lines (152 loc) · 3.66 KB
/
nav.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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<?php
/******************************************************************************
*
* Copyright © Tobias Kühne
*
* You may use and distribute this software free of charge for non-commercial
* purposes. The software must be distributed in its entirety, i.e. containing
* ALL binary and source files without modification.
* Publication of modified versions of the source code provided herein,
* is permitted only with the author's written consent. In this case the
* copyright notice must not be removed or altered, all modifications to the
* source code must be clearly marked as such.
*
******************************************************************************/
function navitem($item, $href)
{
global $lang;
global $mobile;
if ($href)
echo '<a href="'.$href.'">';
if ($mobile)
echo '<img src="img/'.$item.'-'.($href ? 'grey' : 'white').'-24x24.png" width="24" height="24" alt="'.$lang[$item].'">';
else
echo $lang[$item];
if ($href)
echo '</a>';
}
?>
<nav>
<ul class="menu left">
<?php
if (!$mobile)
{
?>
<li><a href="http://www.frankfurt-aviation-friends.de/"><?php echo $lang['home']; ?></a></li>
<?php
}
if ($db)
{
if (isset($_GET['page']))
{
?>
<li class="sep"><?php navitem('arrival', '?arrival'); ?></li>
<li class="sep"><?php navitem('departure', '?departure'); ?></li>
<?php
if ($user && !$mobile && $_GET['page'] != 'addflight')
{
if ($user->IsMemberOf('addflights'))
{
?>
<li class="sep"><?php navitem('addflight', '?page=addflight'); ?></li>
<?php
}
}
}
else if (isset($_GET['req']))
{
?>
<li class="sep"><?php navitem('arrival', '?arrival'); ?></li>
<li class="sep"><?php navitem('departure', '?departure'); ?></li>
<?php
if ($user && !$mobile)
{
?>
<li class="sep"><a href="?page=addflight"><?php echo $lang['addflight']; ?></a></li>
<?php
}
}
else
{
if ('arrival' == $dir)
{
?>
<li class="sep"><?php navitem('arrival', NULL); ?></li>
<li class="sep"><?php navitem('departure', '?departure'); ?></li>
<?php } else { ?>
<li class="sep"><?php navitem('arrival', '?arrival'); ?></li>
<li class="sep"><?php navitem('departure', NULL); ?></li>
<?php
}
if ($user && !$mobile)
{
?>
<li class="sep"><a href="javascript:watchlist('show');"><?php echo $lang['watchlist']; ?></a></li>
<?php
if ($user->IsMemberOf('addflights'))
{
?>
<li class="sep"><a href="?page=addflight"><?php echo $lang['addflight']; ?></a></li>
<?php
}
}
}
}
if (isset($_GET['page']))
{
?>
<li class="sep"><?php navitem('help', 'help' == $_GET['page'] ? NULL : '?page=help'); ?></li>
<?php
}
else
{
?>
<li class="sep"><?php navitem('help', '?page=help'); ?></li>
<?php
}
?>
</ul>
<ul class="menu right">
<?php
if ($db)
{
if ($user)
{
/* user has successfully logged in */
if (!isset($_GET['req']))
{
?>
<li class="sep"><?php navitem('profile', '?req=profile'); ?></li>
<?php
}
else
{
?>
<li class="sep"><?php navitem('profile', 'profile' == $_GET['req'] ? NULL : '?req=profile'); ?></li>
<?php
}
?>
<li class="sep"><?php navitem('logout', '?req=logout'); ?></li>
<?php
}
else
{
?>
<li class="sep"><?php navitem('register', '?req=register'); ?></li>
<li class="sep"><?php navitem('login', '?req=login'); ?></li>
<?php
}
}
?>
<li style="vertical-align: baseline;">
<a href="<?php echo get('lang=de'); ?>">
<img class="flag" src="img/de.png" alt="<?php echo $lang['de']; ?>" width="16" height="12">
</a>
</li>
<li style="vertical-align: baseline;">
<a href="<?php echo get('lang=en'); ?>">
<img class="flag" src="img/en.png" alt="<?php echo $lang['en']; ?>" width="16" height="12">
</a>
</li>
</ul>
</nav>