]>
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> | |
f88a8f2f | 54 | |
39206f24 | 55 | |
4896fbb9 VP |
56 | <div class="container-fluid"> |
57 | ||
5cc8ca4a | 58 | <!-- Fixed navbar --> |
0ce9e377 | 59 | <nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top z-index padding-top"><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 |
60 | <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar"> |
61 | <span class="navbar-toggler-icon"></span> | |
62 | </button> | |
63 | <div class="collapse navbar-collapse" id="collapsibleNavbar"> | |
64 | <ul class="navbar-nav mr-auto"> | |
0ce9e377 | 65 | |
1e6ffd06 | 66 | <?php |
d1d9caa9 | 67 | |
4d71d431 | 68 | $active_page = NULL; |
10102cdc | 69 | |
f5173b9c | 70 | |
a2712ef5 VP |
71 | foreach ($pages as $name => $page) |
72 | { | |
73 | $script = $_SERVER['SCRIPT_FILENAME']; | |
7720c0cb | 74 | $tok = split($script, "/"); |
33f512fa VP |
75 | if (is_array($page)) |
76 | continue; | |
77 | if (is_string($page) && strlen($page) == 0) { | |
a2712ef5 VP |
78 | $active_page = ""; |
79 | } | |
15b6679d VP |
80 | else if (str_ends_with($script, BASE_URL . "index.php") && BASE_URL != "/" && !strlen($tok[0])) |
81 | { | |
15b6679d VP |
82 | $active_page = $tok[0]; |
83 | } | |
a2712ef5 VP |
84 | else if (!str_ends_with($page, ".php")) |
85 | { | |
86 | $script2 = rtrim($script, "/index.php"); | |
87 | if (str_ends_with($script2, $page)) | |
88 | $active_page = $page; | |
89 | } | |
90 | else if (str_ends_with($script, $page)) | |
91 | { | |
27efe895 | 92 | $active_page = $page; |
4d71d431 VP |
93 | } elseif (!$active_page) |
94 | $active_page = false; | |
a2712ef5 | 95 | } |
1e6ffd06 BM |
96 | foreach($pages as $name=>$page) |
97 | { | |
96de0b9c | 98 | $class = "class=\"nav-item\""; |
4d71d431 | 99 | if (is_string($active_page) && $page == $active_page) |
96de0b9c | 100 | $class = str_replace("\"nav-item\"", "\"nav-item active\"", $class); |
5cc8ca4a | 101 | |
33f512fa VP |
102 | if (is_string($page)) |
103 | echo "<li $class><a class=\"nav-link\" href=\"".BASE_URL.$page."\">$name</a></li>\n"; | |
104 | ||
105 | elseif (is_array($page)) | |
106 | { | |
107 | foreach ($page as $k => $v) | |
108 | { | |
109 | $first_page = $v; | |
110 | break; | |
111 | } | |
112 | ?> | |
113 | <li class="nav-item dropdown"> | |
114 | <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> | |
115 | <?php echo $name; ?> | |
116 | </a> | |
f5173b9c VP |
117 | <div class="dropdown-menu" aria-labelledby="navbarDropdown"> |
118 | <?php foreach($page as $k => $p) | |
119 | { | |
120 | ?> | |
121 | <a class="dropdown-item" href="<?php echo BASE_URL.$p;?>"><?php echo $k; ?></a> | |
122 | <?php | |
123 | } ?> | |
124 | </div> | |
125 | </li> | |
126 | <?php | |
33f512fa VP |
127 | } |
128 | ||
1e6ffd06 | 129 | } |
9d4cdf37 VP |
130 | $ToD = time_of_day(); |
131 | $user = unreal_get_current_user(); | |
132 | if ($user) | |
133 | { | |
6497dd52 | 134 | $name = ($user->first_name && strlen($user->first_name)) ? $user->first_name : $user->username; // address them by first name, else username |
9d4cdf37 | 135 | } |
1e6ffd06 | 136 | ?> |
4896fbb9 | 137 | |
9e2a2ac0 | 138 | </ul> |
9d4cdf37 VP |
139 | |
140 | ||
141 | <?php if ($user) { ?> | |
142 | <div class="nav-item form-inline my-2 my-lg-0 mr-sm-2"> | |
143 | <div class="collapse navbar-collapse" id="collapsibleNavbar"> | |
144 | <ul class="navbar-nav mr-auto"> | |
145 | <li class="nav-item dropdown"> | |
146 | <h6 style="color:white;">Good <?php echo "$ToD, $name!"; ?></h6> | |
147 | </li> | |
148 | </ul> | |
149 | </div> | |
150 | </div> | |
151 | <?php } ?> | |
d843c1de | 152 | </nav><br> |
e98b5a51 | 153 | </div> |
911a6472 BM |
154 | |
155 | <div class="container-fluid" role="main"> |