]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/blob - header.php
df46ea86f975c7e44a6d4b078276f1a3442931d6
[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 get_config("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 = get_config("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 get_config("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 <title>UnrealIRCd Panel</title>
44 <link rel="icon" type="image/x-icon" href="<?php echo get_config("base_url"); ?>img/favicon.ico">
45 </head>
46 <body role="document">
47
48 <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>
49 <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>
50 <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>
51 <script src="<?php echo get_config("base_url"); ?>js/unrealircd-admin.js"></script>
52 <style>
53 #optionsopen {
54 transition: left 0.3s;
55 }
56 #optionsclose {
57 transition: left 0.3s;
58 }
59 .w3-sidebar {
60 top: 50px;
61 color: white;
62 transition: left 0.3s;
63 }
64 .container-fluid {
65 transition: padding-left 0.3s;
66 }
67 .list-group-item-action {
68 color: #e0e0e0;
69 }
70 </style>
71 <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
72 <nav id="sidebarlol" style="left: 0" class="w3-sidebar navbar-expand-sm bg-dark padding-top me-5 ma-5">
73 <div class="sidebarlol list-group">
74 <div class="badge badge-secondary rounded-pill">Main Menu</div>
75 <?php
76
77 function show_page_item($name, $page, $nestlevel)
78 {
79 $active_page = NULL;
80 $icon = $style = "";
81 $class = "nav-link nav-item";
82 if (is_string($active_page) && $page == $active_page)
83 $class .= " active";
84
85 if ($nestlevel > 0)
86 {
87 echo "<small>";
88 $name = "&nbsp; ".$name;
89 $style = "padding-bottom: 1px; padding-top: 1px";
90 } else {
91 echo "<b>";
92 }
93 if (is_array($page))
94 {
95 $style = "padding-bottom: 0px;";
96 } else {
97 echo "<a href=\"".get_config("base_url").$page."\" style=\"text-decoration: none\">\n";
98 }
99 echo "<div class=\"d-flex justify-content-between align-items-center $class list-group-item-action\" style=\"$style\">$name
100 <div class=\"text-right padding-top\">
101 <i class=\"fa fa-$icon\"></i>
102 </div></div>\n";
103 if (!is_array($page))
104 echo "</a>";
105 if ($nestlevel > 0)
106 echo "</small>";
107 else
108 echo "</b>";
109 if (is_array($page))
110 {
111 foreach ($page as $subname=>$subpage)
112 show_page_item($subname, $subpage, 1);
113 }
114 }
115 foreach($pages as $name=>$page)
116 show_page_item($name, $page, 0);
117 ?>
118 </div>
119 </nav>
120
121 <div class="container-fluid">
122
123 <!-- Fixed navbar -->
124 <nav class="navbar navbar-expand-sm navbar-dark bg-dark fixed-top z-index padding-top" style="max-height: 50px">
125 <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>
126 <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
127 <span class="navbar-toggler-icon"></span>
128 </button>
129 <div class="collapse navbar-collapse" id="collapsibleNavbar">
130 <ul class="navbar-nav mr-auto">
131
132 <?php
133
134 foreach ($pages as $name => $page)
135 {
136 $script = $_SERVER['SCRIPT_FILENAME'];
137 $tok = split($script, "/");
138 if (is_array($page))
139 continue;
140 if (is_string($page) && strlen($page) == 0) {
141 $active_page = "";
142 }
143 else if (str_ends_with($script, get_config("base_url") . "index.php") && get_config("base_url") != "/" && !strlen($tok[0]))
144 {
145 $active_page = $tok[0];
146 }
147 else if (!str_ends_with($page, ".php"))
148 {
149 $script2 = rtrim($script, "/index.php");
150 if (str_ends_with($script2, $page))
151 $active_page = $page;
152 }
153 else if (str_ends_with($script, $page))
154 {
155 $active_page = $page;
156 } elseif (!$active_page)
157 $active_page = false;
158 }
159
160 $ToD = time_of_day();
161 $user = unreal_get_current_user();
162 if ($user)
163 {
164 $name = ($user->first_name && strlen($user->first_name)) ? $user->first_name : $user->username; // address them by first name, else username
165 }
166 ?>
167
168 </ul>
169
170
171 <?php if ($user) { ?>
172 <div class="nav-item form-inline my-2 my-lg-0 mr-sm-2">
173 <div class="collapse navbar-collapse" id="collapsibleNavbar">
174 <ul class="navbar-nav mr-auto">
175 <li class="nav-item dropdown">
176 <h6 style="color:white;">Good <?php echo "$ToD, $name!"; ?></h6>
177 </li>
178 </ul>
179 </div>
180 </div>
181 <?php } ?>
182 </nav><br>
183 </div>
184
185 <div id="main_contain" class="container-fluid" style="padding-left: 210px" role="main">
186