From 7002bc7698353482c266b6267c1e5d87d5a89c9a Mon Sep 17 00:00:00 2001 From: Pietro Carrara Date: Mon, 4 Jan 2021 18:57:47 -0300 Subject: [PATCH] Add warning and ban messages to the API --- inc/api.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/inc/api.php b/inc/api.php index d8dc86a2..d7fb0633 100644 --- a/inc/api.php +++ b/inc/api.php @@ -116,7 +116,7 @@ class Api { if (isset($config['poster_ids']) && $config['poster_ids']) $apiPost['id'] = poster_id($post->ip, $post->thread, $board['uri']); if ($threadsPage) return $apiPost; - // Handle country field + // Handle special fields if (isset($post->body_nomarkup) && ($this->config['country_flags'] || $this->config['user_flag'])) { $modifiers = extract_modifiers($post->body_nomarkup); if (isset($modifiers['flag']) && isset($modifiers['flag alt']) && preg_match('/^[1-9a-z_-]{2,}$/', $modifiers['flag'])) { @@ -126,6 +126,12 @@ class Api { $apiPost['country_name'] = $modifiers['flag alt']; } } + if (isset($modifiers['warning message'])) { + $apiPost['warning_msg'] = $modifiers['warning message']; + } + if (isset($modifiers['ban message'])) { + $apiPost['ban_msg'] = $modifiers['ban message']; + } } if ($config['slugify'] && !$post->thread) {