]>
Commit | Line | Data |
---|---|---|
1 | <?php | |
2 | $nav_shown = true; | |
3 | $arr = []; Hook::run(HOOKTYPE_PRE_HEADER, $arr); | |
4 | ?> | |
5 | <!DOCTYPE html> | |
6 | <head> | |
7 | <div class="media"> | |
8 | <div class="media-body"> | |
9 | ||
10 | <meta name="viewport" content="width=device-width, initial-scale=1"> | |
11 | <meta name="HandheldFriendly" content="true"> | |
12 | ||
13 | <link href="<?php echo get_config("base_url"); ?>css/unrealircd-admin.css" rel="stylesheet"> | |
14 | ||
15 | <link rel="stylesheet" href="<?php echo get_config("base_url"); ?>css/datatables.min.css" /> | |
16 | ||
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 | ||
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 | ||
24 | <!-- Font Awesome icons --> | |
25 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css"> | |
26 | <title>UnrealIRCd Panel</title> | |
27 | <link rel="icon" type="image/x-icon" href="<?php echo get_config("base_url"); ?>img/favicon.ico"> | |
28 | </head> | |
29 | <body role="document"> | |
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> | |
35 | <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> | |
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> | |
38 | <script src="<?php echo get_config("base_url"); ?>js/unrealircd-admin.js"></script> | |
39 | <script src="<?php echo get_config("base_url"); ?>js/datatables.min.js"></script> | |
40 | <script src="<?php echo get_config("base_url"); ?>js/datatables-natural-sort.js"></script> | |
41 | <script> | |
42 | var BASE_URL = "<?php echo get_config("base_url"); ?>"; | |
43 | function timeoutCheck() { | |
44 | var xhttp = new XMLHttpRequest(); | |
45 | xhttp.onreadystatechange = function() { | |
46 | if (this.readyState == 4 && this.status == 200) { | |
47 | var data = JSON.parse(this.responseText); | |
48 | if (data.session == 'none') | |
49 | window.location = BASE_URL + 'login/?timeout=1&redirect=' + encodeURIComponent(window.location.pathname); | |
50 | } | |
51 | }; | |
52 | xhttp.open("GET", BASE_URL + "api/timeout.php", true); | |
53 | xhttp.send(); | |
54 | } | |
55 | ||
56 | timeoutCheck(); | |
57 | StartStreamNotifs(BASE_URL + "api/notification.php"); | |
58 | setInterval(timeoutCheck, 15000); | |
59 | ||
60 | function change_active_server(name) | |
61 | { | |
62 | fetch(BASE_URL + 'api/set_rpc_server.php', { | |
63 | method:'POST', | |
64 | headers: {'Content-Type':'application/x-www-form-urlencoded'}, | |
65 | body: 'server='+encodeURIComponent(name) | |
66 | }) | |
67 | .then(response => response.json()) | |
68 | .then(data => { | |
69 | location.reload(); | |
70 | }) | |
71 | .catch(error => { | |
72 | // handle error? nah. | |
73 | }); | |
74 | } | |
75 | </script> | |
76 | <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css"> | |
77 | <style> | |
78 | #optionsopen { | |
79 | transition: left 0.3s; | |
80 | } | |
81 | #optionsclose { | |
82 | transition: left 0.3s; | |
83 | } | |
84 | .w3-sidebar { | |
85 | top: 52px; | |
86 | color: white; | |
87 | transition: left 0.3s; | |
88 | width: 160px; | |
89 | } | |
90 | .container-fluid { | |
91 | transition: padding-left 0.3s; | |
92 | } | |
93 | .list-group-item-action { | |
94 | color: #e0e0e0; | |
95 | } | |
96 | </style> | |
97 | <nav id="sidebarlol" style="left: 0" class="w3-sidebar navbar-expand-md bg-dark padding-top me-5 ma-5"> | |
98 | <div class="list-group"> | |
99 | <div class="badge badge-secondary rounded-pill">Main Menu</div> | |
100 | <?php | |
101 | ||
102 | function show_page_item($name, $page, $nestlevel) | |
103 | { | |
104 | $active_page = NULL; | |
105 | $icon = $style = ""; | |
106 | $class = "nav-link nav-item"; | |
107 | if (is_string($active_page) && $page == $active_page) | |
108 | $class .= " active"; | |
109 | ||
110 | if ($nestlevel > 0) | |
111 | { | |
112 | echo "<small>"; | |
113 | $name = " ".$name; | |
114 | $style = "padding-bottom: 1px; padding-top: 1px"; | |
115 | } else { | |
116 | echo "<b>"; | |
117 | } | |
118 | if (is_array($page)) | |
119 | { | |
120 | $style = "padding-bottom: 0px;"; | |
121 | } else { | |
122 | echo "<a href=\"".get_config("base_url").$page."\" style=\"text-decoration: none\">\n"; | |
123 | } | |
124 | echo "<div class=\"big-page-item d-flex justify-content-between align-items-center $class list-group-item-action\" style=\"$style\">$name | |
125 | <div class=\"text-right padding-top\"> | |
126 | <i class=\"fa fa-$icon\"></i> | |
127 | </div></div>\n"; | |
128 | if (!is_array($page)) | |
129 | echo "</a>"; | |
130 | if ($nestlevel > 0) | |
131 | echo "</small>"; | |
132 | else | |
133 | echo "</b>"; | |
134 | if (is_array($page)) | |
135 | { | |
136 | foreach ($page as $subname=>$subpage) | |
137 | show_page_item($subname, $subpage, 1); | |
138 | } | |
139 | } | |
140 | ||
141 | function show_page_item_mobile($name, $page, $nestlevel) | |
142 | { | |
143 | $active_page = NULL; | |
144 | $icon = $style = ""; | |
145 | $class = "nav-link nav-item"; | |
146 | if (is_string($active_page) && $page == $active_page) | |
147 | $class .= " active"; | |
148 | ||
149 | if ($nestlevel > 0) | |
150 | { | |
151 | echo "<small>"; | |
152 | $name = " ".$name; | |
153 | $style = "padding-bottom: 1px; padding-top: 1px"; | |
154 | } else { | |
155 | echo "<b>"; | |
156 | } | |
157 | if (is_array($page)) | |
158 | { | |
159 | $style = "padding-bottom: 0px;"; | |
160 | } else { | |
161 | echo "<a href=\"".get_config("base_url").$page."\" >\n"; | |
162 | } | |
163 | echo "<div class=\"bg-dark lil-page-item d-flex justify-content-between align-items-center $class\" style=\"$style\">$name | |
164 | <div class=\"text-right padding-top\"> | |
165 | <i class=\"fa fa-$icon\"></i> | |
166 | </div></div>\n"; | |
167 | if (!is_array($page)) | |
168 | echo "</a>"; | |
169 | if ($nestlevel > 0) | |
170 | echo "</small>"; | |
171 | else | |
172 | echo "</b>"; | |
173 | if (is_array($page)) | |
174 | { | |
175 | foreach ($page as $subname=>$subpage) | |
176 | show_page_item($subname, $subpage, 1); | |
177 | } | |
178 | } | |
179 | ||
180 | function rpc_server_nav() | |
181 | { | |
182 | $active_server = get_active_rpc_server(); | |
183 | if (!$active_server) | |
184 | return; // eg empty servers | |
185 | $servers = get_config("unrealircd"); | |
186 | $cnt = count($servers); | |
187 | ?> | |
188 | <div class="dropdown" style="color: #d0d0d0"> | |
189 | <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo $active_server ?> <span class="caret"></span></a> | |
190 | <div class="dropdown-menu"> | |
191 | <?php | |
192 | foreach($servers as $name=>$d) | |
193 | { | |
194 | $link = ""; | |
195 | if ($name != $active_server) | |
196 | echo "<a class=\"dropdown-item\" href=\"javascript:change_active_server('".htmlspecialchars($name)."')\">".htmlspecialchars($name)."</a>\n"; | |
197 | else | |
198 | echo "<div class=\"dropdown-item\">".htmlspecialchars($name)." <i>(current)</i></div>\n"; // current | |
199 | } | |
200 | ?> | |
201 | </div> | |
202 | </div> | |
203 | <?php | |
204 | } | |
205 | ||
206 | ||
207 | foreach($pages as $name=>$page) | |
208 | show_page_item($name, $page, 0); | |
209 | ?> | |
210 | </div> | |
211 | </nav> | |
212 | ||
213 | <div class="container-fluid"> | |
214 | ||
215 | <!-- Fixed navbar --> | |
216 | <nav class="topbar navbar navbar-expand-md navbar-dark bg-dark fixed-top z-index padding-top"> | |
217 | <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar" aria-controls="collapsibleNavbar" aria-expanded="false" aria-label="Toggle navigation"> | |
218 | <span class="navbar-toggler-icon"></span> | |
219 | </button> | |
220 | <div> | |
221 | <a class="navbar-brand" href="<?php echo get_config("base_url"); ?>"> | |
222 | <img src="<?php echo get_config("base_url"); ?>img/favicon.ico" height="25" width="25"> UnrealIRCd Admin Panel</a> | |
223 | </div> | |
224 | <?php rpc_server_nav(); ?> | |
225 | <div class="collapse navbar-collapse" id="collapsibleNavbar"> | |
226 | <ul id="big-nav-items" class="navbar-nav mr-auto"> | |
227 | ||
228 | <?php | |
229 | ||
230 | foreach ($pages as $name => $page) | |
231 | show_page_item($name, $page, 0); | |
232 | ||
233 | ||
234 | ?> | |
235 | ||
236 | </ul> | |
237 | ||
238 | </nav><br> | |
239 | </div> | |
240 | ||
241 | <div id="main_contain" class="container-fluid" style="padding-left: 180px" role="main"> | |
242 | ||
243 | <script> | |
244 | function nav_resize_check() | |
245 | { | |
246 | var width = window.innerWidth; | |
247 | var sidebar = document.getElementById('sidebarlol'); | |
248 | var top = document.getElementById('big-nav-items'); | |
249 | var maincontainer = document.getElementById('main_contain'); | |
250 | ||
251 | if (width < 768) | |
252 | { | |
253 | sidebar.style.display = 'none'; | |
254 | top.style.display = ''; | |
255 | maincontainer.style.paddingLeft = "10px"; | |
256 | } | |
257 | else | |
258 | { | |
259 | sidebar.style.display = ''; | |
260 | top.style.display = 'none'; | |
261 | maincontainer.style.paddingLeft = "180px"; | |
262 | } | |
263 | } | |
264 | nav_resize_check(); | |
265 | window.addEventListener('resize', function() { | |
266 | nav_resize_check(); | |
267 | }); | |
268 | </script> |