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

@@ -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);