diff --git a/ajax/edit_translation.php b/ajax/edit_translation.php index 01afec065..0f1f9b02d 100644 --- a/ajax/edit_translation.php +++ b/ajax/edit_translation.php @@ -41,10 +41,10 @@ die(); } -if (!isset($_POST['plugin_formcreator_translations_id'])) { - http_response_code(400); - die(); -} +// if (!isset($_POST['plugin_formcreator_translations_id'])) { +// http_response_code(400); +// die(); +// } $formLanguage = new PluginFormcreatorForm_Language(); if (!$formLanguage->getFromDB((int) $_POST['plugin_formcreator_form_languages_id'])) { @@ -52,4 +52,4 @@ die(); } -echo PluginFormcreatorTranslation::getEditor($formLanguage, $_POST['plugin_formcreator_translations_id']); \ No newline at end of file +echo PluginFormcreatorTranslation::getEditorFieldsHtml($formLanguage, $_POST['plugin_formcreator_translations_id']); \ No newline at end of file diff --git a/ajax/translation.php b/ajax/translation.php new file mode 100644 index 000000000..703066852 --- /dev/null +++ b/ajax/translation.php @@ -0,0 +1,56 @@ +. + * --------------------------------------------------------------------- + * @copyright Copyright © 2011 - 2021 Teclib' + * @license http://www.gnu.org/licenses/gpl.txt GPLv3+ + * @link https://github.com/pluginsGLPI/formcreator/ + * @link https://pluginsglpi.github.io/formcreator/ + * @link http://plugins.glpi-project.org/#/plugin/formcreator + * --------------------------------------------------------------------- + */ + +include ('../../../inc/includes.php'); +// Check if plugin is activated... +if (!(new Plugin())->isActivated('formcreator')) { + Html::displayNotFoundError(); +} + +Session::checkRight('entity', UPDATE); + +if (!isset($_POST['plugin_formcreator_forms_languages_id'])) { + http_response_code(400); + die(); +} +if (!isset($_POST['id'])) { + http_response_code(400); + die(); +} +if (!isset($_POST['value'])) { + http_response_code(400); + die(); +} + +if (!(new PluginFormcreatorTranslation())->add($_POST)) { + http_response_code(400); + die(); +} diff --git a/front/form_language.form.php b/front/form_language.form.php index 4862b6318..f5ca1896c 100644 --- a/front/form_language.form.php +++ b/front/form_language.form.php @@ -45,24 +45,6 @@ } else if (isset($_POST['update'])) { $formLanguage->update($_POST); Html::back(); -} else if (isset($_POST['save_translation'])) { - if (!isset($_POST['plugin_formcreator_forms_languages_id'])) { - http_response_code(400); - die(); - } - if (!isset($_POST['id'])) { - http_response_code(400); - die(); - } - if (!isset($_POST['value'])) { - http_response_code(400); - die(); - } - if (!(new PluginFormcreatorTranslation())->add($_POST)) { - http_response_code(400); - die(); - } - Html::back(); } else if (isset($_POST['delete'])) { if ($formLanguage->getFromDB((int) $_POST['id'])) { $formLanguage->massDeleteTranslations($_POST); diff --git a/inc/form.class.php b/inc/form.class.php index 3186a838f..16fc11bb5 100644 --- a/inc/form.class.php +++ b/inc/form.class.php @@ -1237,7 +1237,6 @@ public function displayUserForm() : void { if (file_exists($phpfile)) { $TRANSLATE->addTranslationFile('phparray', $phpfile, $domain, $_SESSION['glpilanguage']); } - // form title echo "