From 6e8bad37aa490a49a3b71c74cb4450e5c40c7347 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Sun, 5 Nov 2017 23:15:08 +0100
Subject: [PATCH] FEAT #6157 translation + disable load template on server

---
 modules/templates/addTemplateBase.php | 4 ++--
 modules/templates/js/functions.js     | 8 ++++----
 modules/templates/lang/en.php         | 3 +++
 modules/templates/lang/fr.php         | 3 +++
 4 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/modules/templates/addTemplateBase.php b/modules/templates/addTemplateBase.php
index b24d485713a..8f4a74f4a5c 100644
--- a/modules/templates/addTemplateBase.php
+++ b/modules/templates/addTemplateBase.php
@@ -1,8 +1,8 @@
 <?php 
 require 'modules/templates/class/templates_controler.php';
 $templatesControler = new templates_controler();
-if (!in_array($_REQUEST['fileMimeType'],array('application/msword','application/vnd.openxmlformats-officedocument.wordprocessing‌​ml.document','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/vnd.ms-excel','application/vnd.ms-powerpoint','application/vnd.openxmlformats-officedocument.presentationml‌​.slideshow','application/vnd.oasis.opendocument.text','application/vnd.oasis.opendocument.presentation','application/vnd.oasis.opendocument.spreadsheet'))) {
-    echo "{\"status\":1,\"error_txt\":\"EXTENSION_NOT_ALLOWED\"}";
+if (!in_array($_REQUEST['fileMimeType'],array('application/msword','application/vnd.openxmlformats-officedocument.wordprocessingml.document','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet','application/vnd.ms-excel','application/vnd.ms-powerpoint','application/vnd.openxmlformats-officedocument.presentationml‌​.slideshow','application/vnd.oasis.opendocument.text','application/vnd.oasis.opendocument.presentation','application/vnd.oasis.opendocument.spreadsheet'))) {
+    echo "{\"status\":1,\"error_txt\":\""._EXTENSION_NOT_ALLOWED."\"}";
     exit();
 }
 if (isset($_REQUEST['fileContent'])) {
diff --git a/modules/templates/js/functions.js b/modules/templates/js/functions.js
index 1ff1b1d2d13..48bb9918236 100755
--- a/modules/templates/js/functions.js
+++ b/modules/templates/js/functions.js
@@ -103,11 +103,11 @@ function select_template(path_to_script, attachment_type)
 
 function addTemplateBase(file)
 {
-    if (confirm('En cliquant sur ok, le modèle sera ajouté dans la liste des natures de modèle.')) {
-        saveTemplateBase = "yes";
-    }else{
+    // if (confirm('En cliquant sur ok, le modèle sera ajouté dans la liste des natures de modèle.')) {
+    //     saveTemplateBase = "yes";
+    // }else{
         saveTemplateBase = "no";
-    }
+    // }
     var reader = new FileReader();
     reader.readAsDataURL(file.files[0]);
     reader.onload = function () {
diff --git a/modules/templates/lang/en.php b/modules/templates/lang/en.php
index 1bb96bc9dc8..f0382e994b1 100755
--- a/modules/templates/lang/en.php
+++ b/modules/templates/lang/en.php
@@ -144,3 +144,6 @@ if (!defined("_TEMPLATE_TARGET"))
 
 if (!defined("_NO_TARGET"))
     define("_NO_TARGET", "No target");
+
+if (!defined("_EXTENSION_NOT_ALLOWED"))
+    define("_EXTENSION_NOT_ALLOWED", "Extension not allowed");
diff --git a/modules/templates/lang/fr.php b/modules/templates/lang/fr.php
index c86f0de6dad..fe51c03c42f 100755
--- a/modules/templates/lang/fr.php
+++ b/modules/templates/lang/fr.php
@@ -143,3 +143,6 @@ if (!defined("_TEMPLATE_TARGET"))
 
 if (!defined("_NO_TARGET"))
     define("_NO_TARGET", "Pas de cible");
+
+if (!defined("_EXTENSION_NOT_ALLOWED"))
+    define("_EXTENSION_NOT_ALLOWED", "Extension non autorisée");
-- 
GitLab