From fc5befff0f1aec5f9529a1892dd274350ab0f9e6 Mon Sep 17 00:00:00 2001
From: Aleksander Machniak <alec@alec.pl>
Date: Fri, 08 Jan 2016 04:58:16 -0500
Subject: [PATCH] Fix missing language name in "Add to Dictionary" request in HTML mode (#1490634)

---
 CHANGELOG            |    3 +++
 program/js/editor.js |    3 +++
 2 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index e05a1ae..01974c0 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,9 @@
 CHANGELOG Roundcube Webmail
 ===========================
 
+
+- Fix missing language name in "Add to Dictionary" request in HTML mode (#1490634)
+
 RELEASE 1.1.4
 -------------
 - Add workaround for https://bugs.php.net/bug.php?id=70757 (#1490582)
diff --git a/program/js/editor.js b/program/js/editor.js
index 50b7228..ddf599a 100644
--- a/program/js/editor.js
+++ b/program/js/editor.js
@@ -71,6 +71,9 @@
     tinymce.registered_request_token = true;
     tinymce.util.XHR.on('beforeSend', function(e) {
       e.xhr.setRequestHeader('X-Roundcube-Request', rcmail.env.request_token);
+      // Fix missing lang parameter on addToDictionary request (#1490634)
+      if (e.settings && e.settings.data && /^method=addToDictionary/.test(e.settings.data) && !/&lang=/.test(e.settings.data))
+        e.settings.data += '&lang=' + ref.editor.plugins.spellchecker.getLanguage();
     });
   }
 

--
Gitblit v1.9.1