<?php
if (is_auth_provided() && !str_ends_with($_SERVER['SCRIPT_FILENAME'], "setup.php"))
{?>
- <script>
+
+<?php }
+$arr = []; Hook::run(HOOKTYPE_PRE_HEADER, $arr); ?>
+<!DOCTYPE html>
+<head><script>
var BASE_URL = "<?php echo get_config("base_url"); ?>";
function timeoutCheck() {
var xhttp = new XMLHttpRequest();
if (this.readyState == 4 && this.status == 200) {
var data = JSON.parse(this.responseText);
if (data.session == 'none')
- window.location = get_config("base_url") + 'login/?timeout=1&redirect=' + encodeURIComponent(window.location.pathname);
+ window.location = BASE_URL + 'login/?timeout=1&redirect=' + encodeURIComponent(window.location.pathname);
}
};
xhttp.open("GET", BASE_URL + "api/timeout.php", true);
timeoutCheck();
setInterval(timeoutCheck, 15000);
</script>
-<?php }
-$arr = []; Hook::run(HOOKTYPE_PRE_HEADER, $arr); ?>
-<!DOCTYPE html>
-<head>
<div class="media">
<div class="media-body">
--- /dev/null
+<?php
+
+namespace UnrealIRCd;
+
+use Exception;
+use stdClass;
+
+class Stats
+{
+
+ public Connection $connection;
+
+ public function __construct(Connection $conn)
+ {
+ $this->connection = $conn;
+ }
+
+ /**
+ * Get basic statistical information: user counts, channel counts, etc.
+ *
+ * @return stdClass|array|bool
+ */
+ public function get(int $object_detail_level=1): stdClass|array|bool
+ {
+ return $this->connection->query('stats.get', [
+ 'object_detail_level' => $object_detail_level,
+ ]);
+ }
+}