This commit is contained in:
Paula Quispe
2018-03-07 16:01:39 -04:00
301 changed files with 64229 additions and 68335 deletions

View File

@@ -110,7 +110,7 @@ $response = array ();
switch ($option) {
case "LST":
$pageSize = $_REQUEST["pageSize"];
$workspace = SYS_SYS;
$workspace = config("system.workspace");
$action = $_REQUEST["action"];
$description = $_REQUEST["description"];
$dateFrom = $_REQUEST["dateFrom"];

View File

@@ -116,7 +116,7 @@ $response = array ();
switch ($option) {
case "LST":
$pageSize = $_REQUEST["pageSize"];
$workspace = SYS_SYS;
$workspace = config("system.workspace");
$status = $_REQUEST["status"];
$dateFrom = $_REQUEST["dateFrom"];
$dateTo = $_REQUEST["dateTo"];

View File

@@ -1,60 +1,41 @@
<?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";
global $RBAC;
$access = $RBAC->userCanAccess( 'PM_SETUP_ADVANCE' );
$access = $RBAC->userCanAccess('PM_SETUP_ADVANCE');
if ($access != 1) {
switch ($access) {
case - 1:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
break;
case - 2:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
break;
default:
G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
break;
}
G::header( 'location: ../login/login' );
exit( 0 );
G::header('location: ../login/login');
exit(0);
}
$result = new stdClass();
try {
//if the xmlform path is writeable
if (! is_writable( PATH_XMLFORM ))
throw new Exception( G::LoadTranslation( 'IMPORT_LANGUAGE_ERR_NO_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
if (! G::is_rwritable( PATH_XMLFORM ))
throw new Exception( G::LoadTranslation( 'IMPORT_LANGUAGE_ERR_NO_WRITABLE2' ) );
//if all xml files within the xmlform directory are writeable
if (!G::is_rwritable(PATH_XMLFORM)) {
throw new Exception(G::LoadTranslation('IMPORT_LANGUAGE_ERR_NO_WRITABLE2'));
}
$sMaxExecutionTime = ini_get( 'max_execution_time' );
ini_set( 'max_execution_time', '0' );
$sMaxExecutionTime = ini_get('max_execution_time');
ini_set('max_execution_time', '0');
$filter = new InputFilter();
@@ -62,56 +43,51 @@ try {
$languageFilename = $_FILES['form']['name']['LANGUAGE_FILENAME'];
$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__, '' );
$handle = fopen( $languageFile, "w" );
while (! gzeof( $zp )) {
$data = gzread( $zp, 1024 );
fwrite( $handle, $data );
if (substr_compare($languageFilename, ".gz", - 3, 3, true) == 0) {
$zp = gzopen($languageFile, "r");
$languageFile = tempnam(__FILE__, '');
$handle = fopen($languageFile, "w");
while (!gzeof($zp)) {
$data = gzread($zp, 1024);
fwrite($handle, $data);
}
gzclose( $zp );
fclose( $handle );
gzclose($zp);
fclose($handle);
}
$language = new Language();
$configuration = new Configurations();
$importResults = $language->import( $languageFile );
$importResults = $language->import($languageFile);
$renegerateContent = new WorkspaceTools( SYS_SYS );
$messs = $renegerateContent->upgradeContent();
$result->msg = G::LoadTranslation( 'IMPORT_LANGUAGE_SUCCESS' ) . "\n";
$result->success = true;
$result->msg = G::LoadTranslation('IMPORT_LANGUAGE_SUCCESS') . "\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_FAILED_RECORD") . ($importResults->recordsCount - $importResults->recordsCountSuccess) . "\n";
if ($importResults->errMsg != '') {
$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
$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 = 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);
$renegerateContent = new WorkspaceTools(config("system.workspace"));
$messs = $renegerateContent->upgradeContent();
$dir = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP;
if (! is_writable( $dir )) {
throw new Exception( G::LoadTranslation( 'ID_TRANSLATIONS_FOLDER_PERMISSIONS' ) );
if (!is_writable($dir)) {
throw new Exception(G::LoadTranslation('ID_TRANSLATIONS_FOLDER_PERMISSIONS'));
}
G::uploadFile($languageFile, $dir, $languageFilename, 0777);
ini_set( 'max_execution_time', $sMaxExecutionTime );
ini_set('max_execution_time', $sMaxExecutionTime);
} catch (Exception $oError) {
$result->msg = $oError->getMessage();
//print_r($oError->getTrace());
$result->success = false;
//G::SendTemporalMessage($oError->getMessage(), 'error', 'string');
//G::header('location: languages_ImportForm');
$result->msg = $oError->getMessage();
}
echo G::json_encode( $result );
ob_clean();
echo G::json_encode($result);

View File

@@ -19,7 +19,7 @@ switch ($request) {
print (G::json_encode( $result )) ;
break;
case 'saveSettings':
$memcache = & PMmemcached::getSingleton( defined( 'SYS_SYS' ) ? SYS_SYS : '' );
$memcache = & PMmemcached::getSingleton( !empty(config("system.workspace")) ? config("system.workspace") : '' );
$conf = new Configurations();
$conf->loadConfig( $obj, 'ENVIRONMENT_SETTINGS', '' );

View File

@@ -56,7 +56,7 @@ if ($handle = opendir(PATH_PLUGINS)) {
) {
//Check disabled code
$cs = new CodeScanner(SYS_SYS);
$cs = new CodeScanner(config("system.workspace"));
$arrayFoundDisabledCode = array_merge(
$cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"),

View File

@@ -251,7 +251,7 @@ try {
if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm5CeTJhQlIwN3IxMEkwaG4=")) {
//Check disabled code
$cs = new CodeScanner(SYS_SYS);
$cs = new CodeScanner(config("system.workspace"));
$arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", $path . $pluginFile), $cs->checkDisabledCode("PATH", $path . $sClassName));

View File

@@ -24,5 +24,5 @@
*/
$RBAC->requirePermissions('PM_SETUP_ADVANCE');
$items = \PMPlugin::getListPluginsManager(SYS_SYS);
$items = \PMPlugin::getListPluginsManager(config("system.workspace"));
echo G::json_encode($items);

View File

@@ -30,7 +30,7 @@ $RBAC->requirePermissions( 'PM_SETUP' );
$headPublisher = & headPublisher::getSingleton();
$headPublisher->addExtJsScript( 'setup/pluginsMain', false );
$headPublisher->assign( "PROCESSMAKER_URL", "/sys" . SYS_SYS . "/" . SYS_LANG . "/" . SYS_SKIN );
$headPublisher->assign( "PROCESSMAKER_URL", "/sys" . config("system.workspace") . "/" . SYS_LANG . "/" . SYS_SKIN );
$headPublisher->assign( "SYS_SKIN", SYS_SKIN );
$oPluginRegistry = PluginRegistry::loadSingleton();

View File

@@ -63,7 +63,7 @@ try { //ini_set('display_errors','1');
$snameLogo = changeNamelogo( $snameLogo );
$oConf = new Configurations();
$aConf = Array ('WORKSPACE_LOGO_NAME' => SYS_SYS,'DEFAULT_LOGO_NAME' => $snameLogo
$aConf = Array ('WORKSPACE_LOGO_NAME' => config("system.workspace"),'DEFAULT_LOGO_NAME' => $snameLogo
);
$oConf->aConfig = $aConf;

View File

@@ -162,7 +162,7 @@ function newSkin ($baseSkin = 'classic')
$xmlConfiguration = file_get_contents( $configFileOriginal );
$workspace = ($_REQUEST['workspace'] == 'global') ? '' : SYS_SYS;
$workspace = ($_REQUEST['workspace'] == 'global') ? '' : config("system.workspace");
$xmlConfigurationObj = G::xmlParser($xmlConfiguration);
$skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"];
@@ -282,7 +282,7 @@ function importSkin ()
$configFileFinal = PATH_CUSTOM_SKINS . $skinName . PATH_SEP . 'config.xml';
$xmlConfiguration = file_get_contents( $configFileOriginal );
$workspace = ($_REQUEST['workspace'] == 'global') ? '' : SYS_SYS;
$workspace = ($_REQUEST['workspace'] == 'global') ? '' : config("system.workspace");
$xmlConfigurationObj = G::xmlParser($xmlConfiguration);
$skinInformationArray = $xmlConfigurationObj->result["skinConfiguration"]["__CONTENT__"]["information"]["__CONTENT__"];

View File

@@ -44,7 +44,7 @@ $oHeadPublisher->addExtJsScript( 'setup/skinList', false ); //adding a javascrip
$oHeadPublisher->addContent( 'setup/skinList' ); //adding a html file .html.
$oHeadPublisher->assign( 'CONFIG', $Config );
$oHeadPublisher->assign( 'SYS_SKIN', SYS_SKIN );
$oHeadPublisher->assign( 'SYS_SYS', "sys".SYS_SYS );
$oHeadPublisher->assign( 'SYS_SYS', "sys".config("system.workspace") );
$oHeadPublisher->assign( 'FORMATS', $c->getFormats() );

View File

@@ -66,7 +66,7 @@ switch ($_POST['action']) {
if (! isset( $_SESSION['END_POINT'] )) {
$aFields['WS_HOST'] = $_SERVER['HTTP_HOST'];
$aFields['WS_WORKSPACE'] = SYS_SYS;
$aFields['WS_WORKSPACE'] = config("system.workspace");
} else {
if (strpos( $_SESSION['END_POINT'], 'https' ) !== false) {
preg_match( '@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias );
@@ -94,15 +94,14 @@ switch ($_POST['action']) {
$_SESSION['_DBArray'] = $_DBArray;
if (! isset( $_SESSION['END_POINT'] )) {
//$wsdl = 'http://'.$_SERVER['HTTP_HOST'].'/sys'.SYS_SYS. '/'. SYS_LANG .'/classic/services/wsdl';
$wsdl = 'http://' . $_SERVER['HTTP_HOST'];
$workspace = SYS_SYS;
$workspace = config("system.workspace");
} else {
$wsdl = $_SESSION['END_POINT'];
$workspace = $_SESSION['WS_WORKSPACE'];
}
$defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2';
$defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/classic/services/wsdl2';
$wsdl = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : $defaultEndpoint;
@@ -144,7 +143,7 @@ try {
if (isset( $_POST["epr"] )) {
$_SESSION['END_POINT'] = $_POST["epr"];
}
$defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/wsdl2';
$defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/classic/services/wsdl2';
$endpoint = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : $defaultEndpoint;
@@ -616,7 +615,7 @@ try {
$caseNumber = $oCases->getAppNumber();
// generating the path for the template msj
$templateFile = PATH_DB . SYS_SYS . PATH_SEP . 'mailTemplates' . PATH_SEP . $proUid . PATH_SEP . 'tempTemplate.hml';
$templateFile = PATH_DB . config("system.workspace") . PATH_SEP . 'mailTemplates' . PATH_SEP . $proUid . PATH_SEP . 'tempTemplate.hml';
// generating the file adding the msj variable
$messageBody = "message for case: " . $caseNumber . "<br>" . $message;
file_put_contents( $templateFile, $messageBody );
@@ -1461,7 +1460,7 @@ try {
function sendFile ($FILENAME, $USR_UID, $APP_UID, $DEL_INDEX = 1, $DOC_UID = null, $title = null, $comment = null)
{
$defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . SYS_SYS . '/' . SYS_LANG . '/classic/services/upload';
$defaultEndpoint = 'http://' . $_SERVER['SERVER_NAME'] . ':' . $_SERVER['SERVER_PORT'] . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/classic/services/upload';
$upload = isset( $_SESSION['END_POINT'] ) ? $_SESSION['END_POINT'] : $defaultEndpoint;
$DOC_UID = ($DOC_UID != null) ? $DOC_UID : - 1;

View File

@@ -29,7 +29,7 @@ $ses = new DBSession( $dbc );
if (! isset( $_SESSION['END_POINT'] )) {
$aFields['WS_HOST'] = $_SERVER['HTTP_HOST'];
$aFields['WS_WORKSPACE'] = SYS_SYS;
$aFields['WS_WORKSPACE'] = config("system.workspace");
} else {
if (strpos( $_SESSION['END_POINT'], 'https' ) !== false) {
preg_match( '@^(?:https://)?([^/]+)@i', $_SESSION['END_POINT'], $coincidencias );