diff options
| author | ctrlcctrlv <wizardchan@hush.com> | 2013-08-20 22:11:32 +0000 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-08-21 22:35:24 +1000 |
| commit | 9d77a4cc4c3a633f163d1e11a4e2ef775dbe95cc (patch) | |
| tree | 67871ea3d49b918b83c28f1e65ff9d9112a29aa2 /inc/api.php | |
| parent | ed142a5e5d47b4e41ebb35ec51d50eba98a3d44b (diff) | |
Only add country to JSON if flag fits country code regex
Diffstat (limited to 'inc/api.php')
| -rw-r--r-- | inc/api.php | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/inc/api.php b/inc/api.php index 9cad8ba0..a8331590 100644 --- a/inc/api.php +++ b/inc/api.php @@ -80,8 +80,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'])) { - $country = mb_convert_case($modifiers['flag'], MB_CASE_UPPER); + if (isset($modifiers['flag']) && isset($modifiers['flag alt']) && preg_match('/^[a-z]{2}$/', $modifiers['flag'])) { + $country = strtoupper($modifiers['flag']); if ($country) { $apiPost['country'] = $country; $apiPost['country_name'] = $modifiers['flag alt']; |
