]>
Commit | Line | Data |
---|---|---|
39206f24 | 1 | <?php |
13fec680 | 2 | if (is_auth_provided() && !str_ends_with($_SERVER['SCRIPT_FILENAME'], "setup.php")) |
39206f24 VP |
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); ?> | |
e98b5a51 | 23 | <!DOCTYPE html> |
911a6472 | 24 | <head> |
ce9cf366 VP |
25 | <div class="media"> |
26 | <div class="media-body"> | |
27 | ||
33f512fa VP |
28 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
29 | <meta name="HandheldFriendly" content="true"> | |
30 | ||
31ef838c VP |
31 | <link href="<?php echo BASE_URL; ?>css/unrealircd-admin.css" rel="stylesheet"> |
32 | ||
ce9cf366 | 33 | |
0ab180bf VP |
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 | ||
185d5d5d VP |
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 | ||
bca6dbd2 VP |
41 | <!-- Font Awesome icons --> |
42 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.2.1/css/all.min.css"> | |
238a4024 | 43 | <script src="<?php echo BASE_URL; ?>js/unrealircd-admin.js"></script> |
e98b5a51 | 44 | <title>UnrealIRCd Panel</title> |
27efe895 | 45 | <link rel="icon" type="image/x-icon" href="<?php echo BASE_URL; ?>img/favicon.ico"> |
911a6472 BM |
46 | </head> |
47 | <body role="document"> | |
f88a8f2f VP |
48 | |
49 | <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script> | |
185d5d5d VP |
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> | |
71b40b19 VP |
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 { | |
242b9f53 | 70 | color: #e0e0e0; |
71b40b19 VP |
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 | ||
d6f10d25 | 80 | function show_page_item($name, $page, $nestlevel) |
71b40b19 | 81 | { |
19f86a66 | 82 | $icon = $style = ""; |
71b40b19 VP |
83 | $class = "nav-link nav-item"; |
84 | if (is_string($active_page) && $page == $active_page) | |
85 | $class .= " active"; | |
86 | ||
d6f10d25 BM |
87 | if ($nestlevel > 0) |
88 | { | |
8178904e BM |
89 | echo "<small>"; |
90 | $name = " ".$name; | |
242b9f53 BM |
91 | $style = "padding-bottom: 1px; padding-top: 1px"; |
92 | } else { | |
93 | echo "<b>"; | |
94 | } | |
19f86a66 | 95 | if (is_array($page)) |
242b9f53 | 96 | { |
19f86a66 | 97 | $style = "padding-bottom: 0px;"; |
242b9f53 BM |
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 | |
71b40b19 VP |
102 | <div class=\"text-right padding-top\"> |
103 | <i class=\"fa fa-$icon\"></i> | |
242b9f53 BM |
104 | </div></div>\n"; |
105 | if (!is_array($page)) | |
106 | echo "</a>"; | |
d6f10d25 | 107 | if ($nestlevel > 0) |
8178904e | 108 | echo "</small>"; |
242b9f53 BM |
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 | } | |
d6f10d25 BM |
116 | } |
117 | foreach($pages as $name=>$page) | |
118 | show_page_item($name, $page, 0); | |
119 | ?> | |
71b40b19 VP |
120 | </div> |
121 | </nav> | |
122 | ||
4896fbb9 VP |
123 | <div class="container-fluid"> |
124 | ||
5cc8ca4a | 125 | <!-- Fixed navbar --> |
71b40b19 VP |
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> | |
33f512fa VP |
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"> | |
0ce9e377 | 133 | |
1e6ffd06 | 134 | <?php |
d1d9caa9 | 135 | |
a2712ef5 VP |
136 | foreach ($pages as $name => $page) |
137 | { | |
138 | $script = $_SERVER['SCRIPT_FILENAME']; | |
7720c0cb | 139 | $tok = split($script, "/"); |
33f512fa VP |
140 | if (is_array($page)) |
141 | continue; | |
142 | if (is_string($page) && strlen($page) == 0) { | |
a2712ef5 VP |
143 | $active_page = ""; |
144 | } | |
15b6679d VP |
145 | else if (str_ends_with($script, BASE_URL . "index.php") && BASE_URL != "/" && !strlen($tok[0])) |
146 | { | |
15b6679d VP |
147 | $active_page = $tok[0]; |
148 | } | |
a2712ef5 VP |
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 | { | |
27efe895 | 157 | $active_page = $page; |
4d71d431 VP |
158 | } elseif (!$active_page) |
159 | $active_page = false; | |
a2712ef5 | 160 | } |
33f512fa | 161 | |
9d4cdf37 VP |
162 | $ToD = time_of_day(); |
163 | $user = unreal_get_current_user(); | |
164 | if ($user) | |
165 | { | |
6497dd52 | 166 | $name = ($user->first_name && strlen($user->first_name)) ? $user->first_name : $user->username; // address them by first name, else username |
9d4cdf37 | 167 | } |
1e6ffd06 | 168 | ?> |
4896fbb9 | 169 | |
9e2a2ac0 | 170 | </ul> |
9d4cdf37 VP |
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 } ?> | |
d843c1de | 184 | </nav><br> |
e98b5a51 | 185 | </div> |
911a6472 | 186 | |
71b40b19 VP |
187 | <div id="main_contain" class="container-fluid" style="padding-left: 210px" role="main"> |
188 |