From cbf344a26ed449040bb6287810bc87d5f6911e4c Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Tue, 13 Feb 2018 15:44:09 +0100 Subject: [translation] Fix saving language tags containing dots --- modules-available/translation/page.inc.php | 25 +++++++++-------------- modules-available/translation/templates/edit.html | 2 +- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/modules-available/translation/page.inc.php b/modules-available/translation/page.inc.php index e41d4786..df7bc15e 100644 --- a/modules-available/translation/page.inc.php +++ b/modules-available/translation/page.inc.php @@ -997,24 +997,19 @@ class Page_Translation extends Page $data = array(); //find the tag requests to change the file - foreach ($_POST as $key => $value) { - $str = explode('#!#', $key, 2); - if (count($str) !== 2) + $tags = Request::post('langtag', array(), 'array'); + foreach ($tags as $tag => $value) { + $tag = trim($tag); + if (empty($tag)) { + Message::addWarning('i18n-empty-tag'); continue; - if ($str[0] === 'lang') { - $tag = trim($str[1]); - if (empty($tag)) { - Message::addWarning('i18n-empty-tag'); - continue; - } - if (empty($value)) { - unset($data[$tag]); - } else { - $data[$tag] = $value; - } + } + if (empty($value)) { + unset($data[$tag]); + } else { + $data[$tag] = $value; } } - $translation = Request::post('new-text', array(), 'array'); foreach (Request::post('new-id', array(), 'array') as $k => $tag) { if (empty($translation[$k]) || empty($tag)) diff --git a/modules-available/translation/templates/edit.html b/modules-available/translation/templates/edit.html index 7a41d9b4..15e69f3b 100644 --- a/modules-available/translation/templates/edit.html +++ b/modules-available/translation/templates/edit.html @@ -35,7 +35,7 @@ {{^big}} - + {{/big}} {{#big}} -- cgit v1.2.3-55-g7522