]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blame - header.php
Add a bug report button to the footer
[irc/unrealircd/unrealircd-webpanel.git] / header.php
CommitLineData
39206f24 1<?php
fdebc6e7
VP
2$arr = []; Hook::run(HOOKTYPE_PRE_HEADER, $arr); ?>
3<!DOCTYPE html>
4642afa5
BM
4<head>
5<?php if (is_auth_provided() && !str_ends_with($_SERVER['SCRIPT_FILENAME'], "setup.php"))
6{?>
4642afa5 7<?php } ?>
ce9cf366
VP
8<div class="media">
9<div class="media-body">
10
33f512fa
VP
11 <meta name="viewport" content="width=device-width, initial-scale=1">
12 <meta name="HandheldFriendly" content="true">
13
ea90b321 14<link href="<?php echo get_config("base_url"); ?>css/unrealircd-admin.css" rel="stylesheet">
31ef838c 15
ce9cf366 16
0ab180bf
VP
17 <!-- Latest compiled and minified CSS -->
18 <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
19
185d5d5d
VP
20<!-- Font Awesome JS -->
21<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>
22<script defer src="https://use.fontawesome.com/releases/v6.2.1/js/fontawesome.js" integrity="sha384-6OIrr52G08NpOFSZdxxz1xdNSndlD4vdcf/q2myIUVO0VsqaGHJsB0RaBE01VTOY" crossorigin="anonymous"></script>
23
bca6dbd2
VP
24<!-- Font Awesome icons -->
25<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css">
e98b5a51 26<title>UnrealIRCd Panel</title>
ea90b321 27<link rel="icon" type="image/x-icon" href="<?php echo get_config("base_url"); ?>img/favicon.ico">
911a6472
BM
28</head>
29<body role="document">
1c363d5e
VP
30<div aria-live="polite" aria-atomic="true">
31 <div id="toaster" style="right: 0; bottom: 50px; z-index: 5;" class="position-fixed bottom-0 right-0 p-4">
32 <!-- insert your javascript bread in here to make toast -->
33 </div>
34</div>
dcc312ec
VP
35<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
36<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>
37<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 38<script src="<?php echo get_config("base_url"); ?>js/unrealircd-admin.js"></script>
2751c89d
VP
39<script>
40 var BASE_URL = "<?php echo get_config("base_url"); ?>";
41 function timeoutCheck() {
42 var xhttp = new XMLHttpRequest();
43 xhttp.onreadystatechange = function() {
44 if (this.readyState == 4 && this.status == 200) {
45 var data = JSON.parse(this.responseText);
46 if (data.session == 'none')
47 window.location = BASE_URL + 'login/?timeout=1&redirect=' + encodeURIComponent(window.location.pathname);
48 }
49 };
50 xhttp.open("GET", BASE_URL + "api/timeout.php", true);
51 xhttp.send();
52 }
1c363d5e 53
2751c89d
VP
54 timeoutCheck();
55 StartStreamNotifs(BASE_URL + "api/notification.php");
56 setInterval(timeoutCheck, 15000);
57</script>
58<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
71b40b19
VP
59<style>
60 #optionsopen {
61 transition: left 0.3s;
62 }
63 #optionsclose {
64 transition: left 0.3s;
65 }
66 .w3-sidebar {
67 top: 50px;
68 color: white;
69 transition: left 0.3s;
2751c89d 70 width: 160px;
71b40b19
VP
71 }
72 .container-fluid {
73 transition: padding-left 0.3s;
74 }
75 .list-group-item-action {
242b9f53 76 color: #e0e0e0;
71b40b19
VP
77 }
78</style>
71b40b19 79<nav id="sidebarlol" style="left: 0" class="w3-sidebar navbar-expand-sm bg-dark padding-top me-5 ma-5">
2751c89d 80<div class="list-group">
71b40b19
VP
81 <div class="badge badge-secondary rounded-pill">Main Menu</div>
82 <?php
71b40b19 83
d6f10d25 84function show_page_item($name, $page, $nestlevel)
71b40b19 85{
dcc312ec 86 $active_page = NULL;
19f86a66 87 $icon = $style = "";
71b40b19
VP
88 $class = "nav-link nav-item";
89 if (is_string($active_page) && $page == $active_page)
90 $class .= " active";
91
d6f10d25
BM
92 if ($nestlevel > 0)
93 {
8178904e
BM
94 echo "<small>";
95 $name = "&nbsp; ".$name;
242b9f53
BM
96 $style = "padding-bottom: 1px; padding-top: 1px";
97 } else {
98 echo "<b>";
99 }
19f86a66 100 if (is_array($page))
242b9f53 101 {
19f86a66 102 $style = "padding-bottom: 0px;";
242b9f53 103 } else {
ea90b321 104 echo "<a href=\"".get_config("base_url").$page."\" style=\"text-decoration: none\">\n";
242b9f53
BM
105 }
106 echo "<div class=\"d-flex justify-content-between align-items-center $class list-group-item-action\" style=\"$style\">$name
71b40b19
VP
107 <div class=\"text-right padding-top\">
108 <i class=\"fa fa-$icon\"></i>
242b9f53
BM
109 </div></div>\n";
110 if (!is_array($page))
111 echo "</a>";
d6f10d25 112 if ($nestlevel > 0)
8178904e 113 echo "</small>";
242b9f53
BM
114 else
115 echo "</b>";
116 if (is_array($page))
117 {
118 foreach ($page as $subname=>$subpage)
119 show_page_item($subname, $subpage, 1);
120 }
d6f10d25
BM
121}
122foreach($pages as $name=>$page)
123 show_page_item($name, $page, 0);
124?>
71b40b19
VP
125</div>
126</nav>
127
4896fbb9
VP
128<div class="container-fluid">
129
5cc8ca4a 130 <!-- Fixed navbar -->
71b40b19 131 <nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top z-index padding-top" style="max-height: 50px">
ea90b321 132 <a class="navbar-brand" href="<?php echo get_config("base_url"); ?>"><img src="<?php echo get_config("base_url"); ?>img/favicon.ico" height="25" width="25"> UnrealIRCd Admin Panel</a>
33f512fa
VP
133 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
134 <span class="navbar-toggler-icon"></span>
135 </button>
136 <div class="collapse navbar-collapse" id="collapsibleNavbar">
137 <ul class="navbar-nav mr-auto">
0ce9e377 138
1e6ffd06 139<?php
d1d9caa9 140
a2712ef5
VP
141foreach ($pages as $name => $page)
142{
143 $script = $_SERVER['SCRIPT_FILENAME'];
7720c0cb 144 $tok = split($script, "/");
33f512fa
VP
145 if (is_array($page))
146 continue;
147 if (is_string($page) && strlen($page) == 0) {
a2712ef5
VP
148 $active_page = "";
149 }
ea90b321 150 else if (str_ends_with($script, get_config("base_url") . "index.php") && get_config("base_url") != "/" && !strlen($tok[0]))
15b6679d 151 {
15b6679d
VP
152 $active_page = $tok[0];
153 }
a2712ef5
VP
154 else if (!str_ends_with($page, ".php"))
155 {
156 $script2 = rtrim($script, "/index.php");
157 if (str_ends_with($script2, $page))
158 $active_page = $page;
159 }
160 else if (str_ends_with($script, $page))
161 {
27efe895 162 $active_page = $page;
4d71d431
VP
163 } elseif (!$active_page)
164 $active_page = false;
a2712ef5 165}
33f512fa 166
9d4cdf37
VP
167$ToD = time_of_day();
168$user = unreal_get_current_user();
169if ($user)
170{
6497dd52 171 $name = ($user->first_name && strlen($user->first_name)) ? $user->first_name : $user->username; // address them by first name, else username
9d4cdf37 172}
1e6ffd06 173?>
4896fbb9 174
9e2a2ac0 175 </ul>
9d4cdf37
VP
176
177
178 <?php if ($user) { ?>
179 <div class="nav-item form-inline my-2 my-lg-0 mr-sm-2">
180 <div class="collapse navbar-collapse" id="collapsibleNavbar">
181 <ul class="navbar-nav mr-auto">
182 <li class="nav-item dropdown">
183 <h6 style="color:white;">Good <?php echo "$ToD, $name!"; ?></h6>
184 </li>
185 </ul>
186 </div>
187 </div>
188 <?php } ?>
d843c1de 189 </nav><br>
e98b5a51 190</div>
911a6472 191
1c363d5e 192<div id="main_contain" class="container-fluid" style="padding-left: 180px" role="main">
71b40b19 193