diff --git a/inc/api.php b/inc/api.php index b280c25b..0ebaaf22 100644 --- a/inc/api.php +++ b/inc/api.php @@ -111,10 +111,10 @@ class Api { if ($threadsPage) return $apiPost; // Handle country field - if (isset($post->body_nomarkup) && $this->config['country_flags']) { + 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('/^[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']; @@ -135,7 +135,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