From 0b8c4b49b15aaf47d2dc89cf538ed5d8498aa17b Mon Sep 17 00:00:00 2001 From: Pietro Carrara Date: Wed, 30 Dec 2020 20:08:47 -0300 Subject: [PATCH] Enable non-country flags on the JSON api --- inc/api.php | 6 +++--- inc/instance-config.php | 0 2 files changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 inc/instance-config.php diff --git a/inc/api.php b/inc/api.php index d306be5d..6fed6d42 100644 --- a/inc/api.php +++ b/inc/api.php @@ -119,8 +119,8 @@ class Api { // Handle country field if (isset($post->body_nomarkup) && $this->config['country_flags']) { $modifiers = extract_modifiers($post->body_nomarkup); - if (isset($modifiers['flag']) && isset($modifiers['flag alt']) && preg_match('/^[a-z]{2}$/', $modifiers['flag'])) { - $country = strtoupper($modifiers['flag']); + if (isset($modifiers['flag']) && isset($modifiers['flag alt']) && preg_match('/^[1-9a-z_-]{2,}$/', $modifiers['flag'])) { + $country = strtolower($modifiers['flag']); if ($country) { $apiPost['country'] = $country; $apiPost['country_name'] = $modifiers['flag alt']; @@ -141,7 +141,7 @@ class Api { $extra_files = array(); foreach ($post->files as $i => $f) { if ($i == 0) continue; - + $extra_file = array(); $this->translateFile($f, $post, $extra_file); diff --git a/inc/instance-config.php b/inc/instance-config.php old mode 100644 new mode 100755