fixing error importing es language

This commit is contained in:
Fernando Ontiveros
2025-04-23 14:49:32 +00:00
parent e41c442d48
commit 6c5e7e6eca
4 changed files with 35 additions and 15 deletions

View File

@@ -105,7 +105,7 @@ try {
}
$translationRow = new Translation();
$response->data = $languagesList;
print (G::json_encode($response));
print (json_encode($response));
break;
case 'delete':
include_once 'classes/model/Translation.php';
@@ -122,7 +122,7 @@ try {
//Verify if is the current language
if ($locale != SYS_LANG) {
try {
Content::removeLanguageContent($locale);
(new Content)->removeLanguageContent($locale);
$trn->removeTranslationEnvironment($locale);
echo G::LoadTranslation('ID_LANGUAGE_DELETED_SUCCESSFULLY');
} catch (Exception $e) {

View File

@@ -26,28 +26,36 @@ if ($access != 1) {
$result = new stdClass();
try {
// Validate uploaded files
ValidationUploadedFiles::getValidationUploadedFiles()->dispatch(function($validator) {
throw new Exception($validator->getMessage());
});
//if the xmlform path is writeable
// Check if the XML form path is writable
if (!is_writable(PATH_XMLFORM)) {
throw new Exception(G::LoadTranslation('IMPORT_LANGUAGE_ERR_NO_WRITABLE'));
}
//if all xml files within the xmlform directory are writeable
// Check if all XML files within the XML form directory are writable
if (!G::is_rwritable(PATH_XMLFORM)) {
throw new Exception(G::LoadTranslation('IMPORT_LANGUAGE_ERR_NO_WRITABLE2'));
}
$sMaxExecutionTime = ini_get('max_execution_time');
// Set maximum execution time to unlimited
$originalMaxExecutionTime = ini_get('max_execution_time');
ini_set('max_execution_time', '0');
// Create an input filter instance
$filter = new InputFilter();
// Retrieve and filter the uploaded language file
$languageFile = $_FILES['form']['tmp_name']['LANGUAGE_FILENAME'];
$languageFilename = $_FILES['form']['name']['LANGUAGE_FILENAME'];
// Apply XSS filtering
$languageFile = $filter->xssFilterHard($languageFile, 'path');
$languageFilename = $filter->xssFilterHard($languageFilename, 'path');
if (substr_compare($languageFilename, ".gz", - 3, 3, true) == 0) {
$zp = gzopen($languageFile, "r");
$languageFile = tempnam(__FILE__, '');
@@ -94,5 +102,5 @@ try {
}
ob_clean();
echo G::json_encode($result);
echo json_encode($result);

View File

@@ -1,4 +1,4 @@
<?x ml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<dynaForm name="login" version="1.0" basedir="" xmlform_type="NORMAL" width="400px" enabletemplate="1">
<BROWSER_TIME_ZONE_OFFSET type="hidden" />