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