summaryrefslogtreecommitdiff
path: root/pages/parser.php
diff options
context:
space:
mode:
Diffstat (limited to 'pages/parser.php')
-rw-r--r--pages/parser.php14
1 files changed, 11 insertions, 3 deletions
diff --git a/pages/parser.php b/pages/parser.php
index b49fd00..1c3dea4 100644
--- a/pages/parser.php
+++ b/pages/parser.php
@@ -1,4 +1,9 @@
-<?php $title = "Message parser"; require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php'; ?>
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.php"; global $title; global $isLoggedIn;
+require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.php';
+
+?>
<br>
<div class="container">
@@ -57,7 +62,7 @@
<br>
<div id="host-alert" class="alert alert-secondary">
- The entered message does not contain a prefix/suffix corresponding to a member of the selected system(s); therefore, the host was selected as a fallback. We assume that the host is talking when there is no prefix/suffix in the current message.
+ The entered message does not contain a prefix/suffix corresponding to a member of the selected system(s); therefore, the most common fronter was selected as a fallback. While the most common fronter is supposed to use their prefix too, we assume they are talking when there is no prefix/suffix in the current message.
</div>
<script>
@@ -90,6 +95,8 @@
$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-members.json"), true);
foreach ($members as $member) {
+ if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json")) continue;
+
$data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd-$member[id]-metadata.json"), true));
if ($data["host"]) {
echo $member['id'];
@@ -101,6 +108,8 @@
$members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-members.json"), true);
foreach ($members as $member) {
+ if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json")) continue;
+
$data = parseMetadata(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/ynmuc-$member[id]-metadata.json"), true));
if ($data["host"]) {
echo $member['id'];
@@ -204,7 +213,6 @@
document.getElementById("result-" + system + "-name").innerText = member['display_name'] ?? member['name'];
document.getElementById("result-" + system + "-prefix").innerText = member['proxy_tags'][0]['prefix'] + (member['proxy_tags'][0]['suffix'] !== null ? "..." + member['proxy_tags'][0]['suffix'] : "");
-
if (prefix !== null) {
if (suffix !== null) {
textHTML = "<span><span class='prefix'>" + prefix + "</span>" + text + "<span class='suffix'>" + suffix + "</span></span>";