This commit is contained in:
Roly Rudy Gutierrez Pinto
2018-02-07 16:39:30 -04:00
committed by Paula Quispe
parent 27168ac56f
commit e2793d9e2e
2 changed files with 43 additions and 67 deletions

View File

@@ -23,7 +23,7 @@ class Admin extends Controller
$skinsList = System::getSkingList(); $skinsList = System::getSkingList();
foreach ($skinsList['skins'] as $key => $value) { foreach ($skinsList['skins'] as $key => $value) {
if ($value['SKIN_WORKSPACE'] != 'Global') { if ($value['SKIN_WORKSPACE'] != G::LoadTranslation('ID_GLOBAL')) {
unset( $skinsList['skins'][$key] ); unset( $skinsList['skins'][$key] );
} }
} }

View File

@@ -1,26 +1,5 @@
<?php <?php
/**
* languages_Import.php
*
* ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2008 Colosa Inc.23
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
* Coral Gables, FL, 33134, USA, or email info@colosa.com.
*/
require_once "classes/model/Language.php"; require_once "classes/model/Language.php";
global $RBAC; global $RBAC;
@@ -46,12 +25,14 @@ $result = new stdClass();
try { try {
//if the xmlform path is writeable //if the xmlform path is writeable
if (! is_writable( PATH_XMLFORM )) if (!is_writable(PATH_XMLFORM)) {
throw new Exception(G::LoadTranslation('IMPORT_LANGUAGE_ERR_NO_WRITABLE')); throw new Exception(G::LoadTranslation('IMPORT_LANGUAGE_ERR_NO_WRITABLE'));
}
//if all xml files within the xmlform directory are writeable //if all xml files within the xmlform directory are writeable
if (! G::is_rwritable( PATH_XMLFORM )) if (!G::is_rwritable(PATH_XMLFORM)) {
throw new Exception(G::LoadTranslation('IMPORT_LANGUAGE_ERR_NO_WRITABLE2')); throw new Exception(G::LoadTranslation('IMPORT_LANGUAGE_ERR_NO_WRITABLE2'));
}
$sMaxExecutionTime = ini_get('max_execution_time'); $sMaxExecutionTime = ini_get('max_execution_time');
ini_set('max_execution_time', '0'); ini_set('max_execution_time', '0');
@@ -75,12 +56,9 @@ try {
} }
$language = new Language(); $language = new Language();
$configuration = new Configurations();
$importResults = $language->import($languageFile); $importResults = $language->import($languageFile);
$renegerateContent = new WorkspaceTools( config("system.workspace") ); $result->success = true;
$messs = $renegerateContent->upgradeContent();
$result->msg = G::LoadTranslation('IMPORT_LANGUAGE_SUCCESS') . "\n"; $result->msg = G::LoadTranslation('IMPORT_LANGUAGE_SUCCESS') . "\n";
$result->msg .= G::LoadTranslation("ID_FILE_NUM_RECORD") . $importResults->recordsCount . "\n"; $result->msg .= G::LoadTranslation("ID_FILE_NUM_RECORD") . $importResults->recordsCount . "\n";
$result->msg .= G::LoadTranslation("ID_SUCCESS_RECORD") . $importResults->recordsCountSuccess . "\n"; $result->msg .= G::LoadTranslation("ID_SUCCESS_RECORD") . $importResults->recordsCountSuccess . "\n";
@@ -90,14 +68,14 @@ try {
$result->msg .= G::LoadTranslation("ID_ERROR_REGISTERED") . " \n" . $importResults->errMsg . "\n"; $result->msg .= G::LoadTranslation("ID_ERROR_REGISTERED") . " \n" . $importResults->errMsg . "\n";
} }
//$result->msg = htmlentities($result->msg);
$result->success = true;
//saving metadata //saving metadata
$configuration->aConfig = Array ('headers' => $importResults->headers,'language' => $importResults->lang,'import-date' => date( 'Y-m-d H:i:s' ),'user' => '','version' => '1.0' $configuration = new Configurations();
); $configuration->aConfig = Array('headers' => $importResults->headers, 'language' => $importResults->lang, 'import-date' => date('Y-m-d H:i:s'), 'user' => '', 'version' => '1.0');
$configuration->saveConfig('LANGUAGE_META', $importResults->lang); $configuration->saveConfig('LANGUAGE_META', $importResults->lang);
$renegerateContent = new WorkspaceTools(config("system.workspace"));
$messs = $renegerateContent->upgradeContent();
$dir = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP; $dir = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP;
if (!is_writable($dir)) { if (!is_writable($dir)) {
throw new Exception(G::LoadTranslation('ID_TRANSLATIONS_FOLDER_PERMISSIONS')); throw new Exception(G::LoadTranslation('ID_TRANSLATIONS_FOLDER_PERMISSIONS'));
@@ -105,13 +83,11 @@ try {
G::uploadFile($languageFile, $dir, $languageFilename, 0777); G::uploadFile($languageFile, $dir, $languageFilename, 0777);
ini_set('max_execution_time', $sMaxExecutionTime); ini_set('max_execution_time', $sMaxExecutionTime);
} catch (Exception $oError) { } catch (Exception $oError) {
$result->msg = $oError->getMessage();
//print_r($oError->getTrace());
$result->success = false; $result->success = false;
//G::SendTemporalMessage($oError->getMessage(), 'error', 'string'); $result->msg = $oError->getMessage();
//G::header('location: languages_ImportForm');
} }
ob_clean();
echo G::json_encode($result); echo G::json_encode($result);