]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blame - inc/header.php
Update description of user meta add ;D
[irc/unrealircd/unrealircd-webpanel.git] / inc / header.php
CommitLineData
39206f24 1<?php
830edb25
BM
2$nav_shown = true;
3$arr = []; Hook::run(HOOKTYPE_PRE_HEADER, $arr);
4?>
fdebc6e7 5<!DOCTYPE html>
4642afa5 6<head>
ce9cf366
VP
7<div class="media">
8<div class="media-body">
9
33f512fa
VP
10 <meta name="viewport" content="width=device-width, initial-scale=1">
11 <meta name="HandheldFriendly" content="true">
12
ea90b321 13<link href="<?php echo get_config("base_url"); ?>css/unrealircd-admin.css" rel="stylesheet">
f03f7fbc
VP
14<style>
15.big-page-item:hover, .big-page-item:active, .nav-link {
16 color: black;
17}
18</style>
31ef838c 19
96541ea3 20<link rel="stylesheet" href="<?php echo get_config("base_url"); ?>css/datatables.min.css" />
ce9cf366 21
0ab180bf
VP
22 <!-- Latest compiled and minified CSS -->
23 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
24
185d5d5d
VP
25<!-- Font Awesome JS -->
26<script defer src="https://use.fontawesome.com/releases/v6.2.1/js/solid.js" integrity="sha384-tzzSw1/Vo+0N5UhStP3bvwWPq+uvzCMfrN1fEFe+xBmv1C/AtVX5K0uZtmcHitFZ" crossorigin="anonymous"></script>
27<script defer src="https://use.fontawesome.com/releases/v6.2.1/js/fontawesome.js" integrity="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin="anonymous"></script>
28
bca6dbd2
VP
29<!-- Font Awesome icons -->
30<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
e98b5a51 31<title>UnrealIRCd Panel</title>
ea90b321 32<link rel="icon" type="image/x-icon" href="<?php echo get_config("base_url"); ?>img/favicon.ico">
911a6472
BM
33</head>
34<body role="document">
1c363d5e
VP
35<div aria-live="polite" aria-atomic="true">
36 <div id="toaster" style="right: 0; bottom: 50px; z-index: 5;" class="position-fixed bottom-0 right-0 p-4">
37 <!-- insert your javascript bread in here to make toast -->
38 </div>
39</div>
b2f66fb7 40<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js" integrity="sha384-ZvpUoO/+PpLXR1lu4jmpXWu80pZlYUAfxl5NsBMWOEPSjUn/6Z/hRTt8+pR6L4N2" crossorigin="anonymous"></script>
dcc312ec
VP
41<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>
42<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.min.js" integrity="sha384-+sLIOodYLS7CIrQpBjl+C7nPvqq+FbNUBDunl/OZv93DB7Ln/533i8e/mZXLi/P+" crossorigin="anonymous"></script>
ea90b321 43<script src="<?php echo get_config("base_url"); ?>js/unrealircd-admin.js"></script>
96541ea3
BM
44<script src="<?php echo get_config("base_url"); ?>js/datatables.min.js"></script>
45<script src="<?php echo get_config("base_url"); ?>js/datatables-natural-sort.js"></script>
582e5c74 46<script src="<?php echo get_config("base_url"); ?>js/datatables-ellipsis.js"></script>
0ba71cfd 47<script src="<?php echo get_config("base_url"); ?>js/moment-with-locales.min.js"></script>
2751c89d
VP
48<script>
49 var BASE_URL = "<?php echo get_config("base_url"); ?>";
50 function timeoutCheck() {
51 var xhttp = new XMLHttpRequest();
52 xhttp.onreadystatechange = function() {
53 if (this.readyState == 4 && this.status == 200) {
54 var data = JSON.parse(this.responseText);
55 if (data.session == 'none')
56 window.location = BASE_URL + 'login/?timeout=1&redirect=' + encodeURIComponent(window.location.pathname);
57 }
58 };
59 xhttp.open("GET", BASE_URL + "api/timeout.php", true);
60 xhttp.send();
61 }
1c363d5e 62
2751c89d
VP
63 timeoutCheck();
64 StartStreamNotifs(BASE_URL + "api/notification.php");
65 setInterval(timeoutCheck, 15000);
b056895f
BM
66
67 function change_active_server(name)
68 {
69 fetch(BASE_URL + 'api/set_rpc_server.php', {
70 method:'POST',
71 headers: {'Content-Type':'application/x-www-form-urlencoded'},
72 body: 'server='+encodeURIComponent(name)
73 })
74 .then(response => response.json())
75 .then(data => {
76 location.reload();
77 })
78 .catch(error => {
79 // handle error? nah.
80 });
81 }
2751c89d
VP
82</script>
83<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
71b40b19
VP
84<style>
85 #optionsopen {
86 transition: left 0.3s;
87 }
88 #optionsclose {
89 transition: left 0.3s;
90 }
91 .w3-sidebar {
f60a30c1 92 top: 52px;
71b40b19
VP
93 color: white;
94 transition: left 0.3s;
2751c89d 95 width: 160px;
71b40b19
VP
96 }
97 .container-fluid {
98 transition: padding-left 0.3s;
99 }
100 .list-group-item-action {
242b9f53 101 color: #e0e0e0;
71b40b19 102 }
f03f7fbc
VP
103 .list-group-item-action:visited{
104 color: black;
105 }
71b40b19 106</style>
b6762d6f 107<nav id="sidebarlol" style="left: 0" class="w3-sidebar navbar-expand-md bg-dark padding-top me-5 ma-5">
2751c89d 108<div class="list-group">
71b40b19
VP
109 <div class="badge badge-secondary rounded-pill">Main Menu</div>
110 <?php
71b40b19 111
f03f7fbc 112function show_page_item($name, $page, $nestlevel, $small = false)
71b40b19 113{
dcc312ec 114 $active_page = NULL;
19f86a66 115 $icon = $style = "";
71b40b19 116 $class = "nav-link nav-item";
f03f7fbc
VP
117 if ($small)
118 $class .= " list-group-item-action";
dd903e52
BM
119 //if (is_string($active_page) && $page == $active_page)
120 // $class .= " active";
121
e38f7458 122 $is_link = isset($page["script"]) ? true : false;
71b40b19 123
d6f10d25
BM
124 if ($nestlevel > 0)
125 {
8178904e
BM
126 echo "<small>";
127 $name = "&nbsp; ".$name;
242b9f53
BM
128 $style = "padding-bottom: 1px; padding-top: 1px";
129 } else {
130 echo "<b>";
131 }
dd903e52 132 if (!$is_link)
242b9f53 133 {
19f86a66 134 $style = "padding-bottom: 0px;";
242b9f53 135 } else {
e38f7458
BM
136 $url = $page["script"];
137 if (str_ends_with($url, "/index.php"))
138 $url = str_replace('/index.php', '', $url);
139 echo "<a href=\"".get_config("base_url").$url."\" style=\"text-decoration: none\">\n";
242b9f53 140 }
f03f7fbc 141 echo "<div class=\"big-page-item d-flex justify-content-between align-items-center $class\" style=\"$style\">$name
380c96a8
VP
142 <div class=\"text-right padding-top\">
143 <i class=\"fa fa-$icon\"></i>
144 </div></div>\n";
dd903e52 145 if ($is_link)
380c96a8
VP
146 echo "</a>";
147 if ($nestlevel > 0)
148 echo "</small>";
149 else
150 echo "</b>";
dd903e52 151 if (!$is_link)
380c96a8
VP
152 {
153 foreach ($page as $subname=>$subpage)
f03f7fbc 154 show_page_item($subname, $subpage, 1, $small);
380c96a8
VP
155 }
156}
157
158function show_page_item_mobile($name, $page, $nestlevel)
159{
160 $active_page = NULL;
161 $icon = $style = "";
162 $class = "nav-link nav-item";
163 if (is_string($active_page) && $page == $active_page)
164 $class .= " active";
165
166 if ($nestlevel > 0)
167 {
168 echo "<small>";
169 $name = "&nbsp; ".$name;
170 $style = "padding-bottom: 1px; padding-top: 1px";
171 } else {
172 echo "<b>";
173 }
174 if (is_array($page))
175 {
176 $style = "padding-bottom: 0px;";
177 } else {
178 echo "<a href=\"".get_config("base_url").$page."\" >\n";
179 }
180 echo "<div class=\"bg-dark lil-page-item d-flex justify-content-between align-items-center $class\" style=\"$style\">$name
71b40b19
VP
181 <div class=\"text-right padding-top\">
182 <i class=\"fa fa-$icon\"></i>
242b9f53
BM
183 </div></div>\n";
184 if (!is_array($page))
185 echo "</a>";
d6f10d25 186 if ($nestlevel > 0)
8178904e 187 echo "</small>";
242b9f53
BM
188 else
189 echo "</b>";
190 if (is_array($page))
191 {
192 foreach ($page as $subname=>$subpage)
193 show_page_item($subname, $subpage, 1);
194 }
d6f10d25 195}
b056895f
BM
196
197function rpc_server_nav()
198{
199 $active_server = get_active_rpc_server();
200 if (!$active_server)
201 return; // eg empty servers
202 $servers = get_config("unrealircd");
203 $cnt = count($servers);
204?>
f03f7fbc
VP
205
206 <div class="dropdown navbar-expand-md navbar-nav">
207 <a href="#" class="dropdown-toggle nav-link" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo $active_server ?></a>
b056895f
BM
208 <div class="dropdown-menu">
209<?php
210 foreach($servers as $name=>$d)
211 {
212 $link = "";
213 if ($name != $active_server)
214 echo "<a class=\"dropdown-item\" href=\"javascript:change_active_server('".htmlspecialchars($name)."')\">".htmlspecialchars($name)."</a>\n";
215 else
216 echo "<div class=\"dropdown-item\">".htmlspecialchars($name)." <i>(current)</i></div>\n"; // current
217 }
218?>
219 </div>
220 </div>
221<?php
222}
223
224
d6f10d25 225foreach($pages as $name=>$page)
f03f7fbc 226 show_page_item($name, $page, 0, true);
d6f10d25 227?>
71b40b19
VP
228</div>
229</nav>
230
4896fbb9
VP
231<div class="container-fluid">
232
5cc8ca4a 233 <!-- Fixed navbar -->
b6762d6f 234 <nav class="topbar navbar navbar-expand-md navbar-dark bg-dark fixed-top z-index padding-top">
b056895f
BM
235 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar" aria-controls="collapsibleNavbar" aria-expanded="false" aria-label="Toggle navigation">
236 <span class="navbar-toggler-icon"></span>
237 </button>
238 <div>
239 <a class="navbar-brand" href="<?php echo get_config("base_url"); ?>">
240 <img src="<?php echo get_config("base_url"); ?>img/favicon.ico" height="25" width="25"> UnrealIRCd Admin Panel</a>
241 </div>
242 <?php rpc_server_nav(); ?>
33f512fa 243 <div class="collapse navbar-collapse" id="collapsibleNavbar">
380c96a8 244 <ul id="big-nav-items" class="navbar-nav mr-auto">
0ce9e377 245
1e6ffd06 246<?php
d1d9caa9 247
a2712ef5 248foreach ($pages as $name => $page)
380c96a8
VP
249 show_page_item($name, $page, 0);
250
33f512fa 251
1e6ffd06 252?>
4896fbb9 253
9e2a2ac0 254 </ul>
380c96a8 255
d843c1de 256 </nav><br>
e98b5a51 257</div>
911a6472 258
1c363d5e 259<div id="main_contain" class="container-fluid" style="padding-left: 180px" role="main">
71b40b19 260
380c96a8
VP
261<script>
262 function nav_resize_check()
263 {
264 var width = window.innerWidth;
265 var sidebar = document.getElementById('sidebarlol');
266 var top = document.getElementById('big-nav-items');
2f915b1a 267 var maincontainer = document.getElementById('main_contain');
380c96a8 268
b6762d6f 269 if (width < 768)
380c96a8
VP
270 {
271 sidebar.style.display = 'none';
272 top.style.display = '';
2f915b1a 273 maincontainer.style.paddingLeft = "10px";
380c96a8
VP
274 }
275 else
276 {
277 sidebar.style.display = '';
278 top.style.display = 'none';
2f915b1a 279 maincontainer.style.paddingLeft = "180px";
380c96a8
VP
280 }
281 }
282 nav_resize_check();
283 window.addEventListener('resize', function() {
284 nav_resize_check();
285 });
399c9625 286</script>
e38f7458
BM
287
288<?php
b98a5822 289 if ($current_page)
e38f7458 290 {
b98a5822
BM
291 if (!(isset($current_page["no_irc_server_required"]) &&
292 ($current_page["no_irc_server_required"] == true)) &&
293 !get_active_rpc_server())
294 {
295 Message::Fail("No RPC server configured. Go to Settings - RPC Servers.");
296 require_once('footer.php');
297 die;
298 }
299 $current_page_title = "UnrealIRCd Panel";
300 if (!empty($current_page_name))
301 $current_page_title = "$current_page_name - $current_page_title";
302 echo "<script>document.title='".htmlspecialchars($current_page_title)."';</script>\n";
e38f7458 303 }