Solving conflict in workflow/engine/content/languages/translation.en

This commit is contained in:
Julio Cesar Laura Avendaño
2020-04-24 22:45:18 +00:00
30 changed files with 1184 additions and 224 deletions

View File

@@ -1,25 +1,9 @@
<?php
/**
* cases_CatchExecute.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.
* This page is executed when we claim the case
*
* @link https://wiki.processmaker.com/3.2/Cases/Cases#Unassigned
*/
if (!isset($_SESSION['USER_LOGGED'])) {
$responseObject = new stdclass();
@@ -50,23 +34,23 @@ if (isset($_POST['form']['BTN_CANCEL'])) {
/* Includes */
$oCase = new Cases();
$sAppUid = $_SESSION['APPLICATION'];
$iDelIndex = $_SESSION['INDEX'];
$case = new Cases();
$appUid = $_SESSION['APPLICATION'];
$delIndex = $_SESSION['INDEX'];
$oAppDelegation = new AppDelegation();
$aDelegation = $oAppDelegation->load($sAppUid, $iDelIndex);
$appDelegation = new AppDelegation();
$delegation = $appDelegation->load($appUid, $delIndex);
//if there are no user in the delegation row, this case is still in selfservice
if ($aDelegation['USR_UID'] == "") {
$oCase->setCatchUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED']);
// if there are no user in the delegation row, this case is still in selfservice
if (empty($delegation['USR_UID'])) {
$case->setCatchUser($_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['USER_LOGGED']);
/*----------------------------------********---------------------------------*/
$licensedFeatures = PMLicensedFeatures::getSingleton();
if ($licensedFeatures->verifyfeature('7qhYmF1eDJWcEdwcUZpT0k4S0xTRStvdz09')) {
$pmGoogle = new PmGoogleApi();
if ($pmGoogle->getServiceGmailStatus()) {
$labGmail = new labelsGmail();
$labGmail->addRelabelingToQueue($sAppUid, $iDelIndex, -1, true);
$labGmail->addRelabelingToQueue($appUid, $delIndex, -1, true);
}
}
@@ -76,7 +60,7 @@ if ($aDelegation['USR_UID'] == "") {
//add users email next task
$user = new Users();
$userInfo = $user->load($_SESSION['USER_LOGGED']);
$drive->addUsersDocumentDrive($sAppUid, array($userInfo['USR_EMAIL']));
$drive->addUsersDocumentDrive($appUid, [$userInfo['USR_EMAIL']]);
}
}
/*----------------------------------********---------------------------------*/
@@ -97,11 +81,11 @@ unset($_SESSION['TASK']);
die('<script type="text/javascript">
if (' . $validation . ') {
if (window.parent.frames.length != 0) {
parent.location = "open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned";
parent.location = "open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=jump";
} else {
window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned";
window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=jump";
}
} else {
window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=unassigned";
window.location = "../cases/cases_Open?APP_UID=' . $_SESSION['APPLICATION'] . '&DEL_INDEX=' . $_SESSION['INDEX'] . '&action=jump";
}
</script>');

View File

@@ -46,7 +46,7 @@ if (empty($_GET['v'])) {
//Send the parameter a = Case UID
if ($RBAC->userCanAccess('PM_FOLDERS_ALL') != 1 && defined('DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION') && DISABLE_DOWNLOAD_DOCUMENTS_SESSION_VALIDATION == 0) {
if (!$oAppDocument->canDownloadInput($_SESSION['USER_LOGGED'], $_GET['a'], $docVersion)) {
G::header('Location: /errors/error403.php');
G::header('Location: /errors/error403.php?url=' . urlencode($_SERVER['REQUEST_URI']));
die();
}
}

View File

@@ -53,20 +53,21 @@ if ($RBAC->userCanAccess('PM_FOLDERS_ALL') != 1 && defined('DISABLE_DOWNLOAD_DOC
$sAppDocUid
)
) {
G::header('Location: /errors/error403.php');
G::header('Location: /errors/error403.php?url=' . urlencode($_SERVER['REQUEST_URI']));
die();
}
}
$docFileName = fixContentDispositionFilename($oAppDocument->getAppDocFilename());
$info = pathinfo($docFileName);
if (!isset($_GET['ext'])) {
$ext = $info['extension'];
$ext = (!empty($info['extension'])) ? $info['extension']: 'pdf';
} else {
if ($_GET['ext'] != '') {
$ext = $_GET['ext'];
} else {
$ext = $info['extension'];
$ext = (!empty($info['extension'])) ? $info['extension']: 'pdf';
}
}
$ver = (isset($_GET['v']) && $_GET['v'] != '') ? '_' . $_GET['v'] : '';

View File

@@ -39,20 +39,40 @@ $aFields = array();
//Validated redirect url
$aFields['URL'] = '';
if (!empty($_GET['u'])) {
if (!empty($_GET['u']) || !empty($_GET['url'])) {
//clean url with protocols
$flagUrl = true;
//Most used protocols
$protocols = ['https://', 'http://', 'ftp://', 'sftp://','smb://', 'file:', 'mailto:'];
foreach ($protocols as $protocol) {
if (strpos($_GET['u'], $protocol) !== false) {
$_GET['u'] = '';
$flagUrl = false;
break;
if (!empty($_GET['u'])) {
if (strpos($_GET['u'], $protocol) !== false) {
$_GET['u'] = '';
$flagUrl = false;
break;
}
}
if (!empty($_GET['url'])) {
if (strpos($_GET['url'], $protocol) !== false) {
$_GET['url'] = '';
$flagUrl = false;
break;
}
}
}
if ($flagUrl) {
$aFields['URL'] = htmlspecialchars(addslashes(stripslashes(strip_tags(trim(urldecode($_GET['u']))))));
if (!empty($_GET['u'])) {
$aFields['URL'] = htmlspecialchars(addslashes(stripslashes(strip_tags(trim(urldecode($_GET['u']))))));
} elseif (!empty($_GET['url'])) {
$aFields['URL'] = htmlspecialchars(addslashes(stripslashes(strip_tags(trim(urldecode($_GET['url']))))));
}
//The following validations are only for the links to an output document
if(!empty($_GET['v']) && (strpos($aFields['URL'], '/cases/cases_ShowOutputDocument') != false)) {
$aFields['URL'] .= "&v=" . $_GET['v'];
}
if(!empty($_GET['ext']) && (strpos($aFields['URL'], '/cases/cases_ShowOutputDocument') != false)) {
$aFields['URL'] .= "&ext=" . $_GET['ext'];
}
}
}

View File

@@ -1,107 +1,12 @@
<?php
use Processmaker\Core\System;
$filter = new InputFilter();
$_POST = $filter->xssFilterHard($_POST);
$_GET = $filter->xssFilterHard($_GET);
$request = isset($_POST['request']) ? $_POST['request'] : (isset($_GET['request']) ? $_GET['request'] : null);
function testConnection($type, $server, $user, $passwd, $port = 'none', $dbName = "")
{
if (($port == 'none') || ($port == '') || ($port == 0)) {
//setting defaults ports
switch ($type) {
case 'mysql':
$port = 3306;
break;
case 'pgsql':
$port = 5432;
break;
case 'mssql':
$port = 1433;
break;
case 'oracle':
$port = 1521;
break;
}
}
$Server = new Net($server);
$filter = new InputFilter();
if ($Server->getErrno() == 0) {
$Server->scannPort($port);
if ($Server->getErrno() == 0) {
$Server->loginDbServer($user, $passwd);
$Server->setDataBase($dbName, $port);
if ($Server->errno == 0) {
$response = $Server->tryConnectServer($type);
if ($response->status == 'SUCCESS') {
if ($Server->errno == 0) {
$message = "";
$response = $Server->tryConnectServer($type);
$server = $filter->validateInput($server);
$user = $filter->validateInput($user);
$passwd = $filter->validateInput($passwd);
$connDatabase = mysqli_connect($server, $user, $passwd);
$dbNameTest = "PROCESSMAKERTESTDC";
$dbNameTest = $filter->validateInput($dbNameTest, 'nosql');
$query = "CREATE DATABASE %s";
$query = $filter->preventSqlInjection($query, array($dbNameTest), $connDatabase);
$db = mysqli_query($connDatabase, $query);
$success = false;
if (!$db) {
$message = mysqli_error($connDatabase);
} else {
$usrTest = "wfrbtest";
$chkG = "GRANT ALL PRIVILEGES ON `%s`.* TO %s@'%%' IDENTIFIED BY 'sample' WITH GRANT OPTION";
$chkG = $filter->preventSqlInjection($chkG, array($dbNameTest, $usrTest), $connDatabase);
$ch = mysqli_query($connDatabase, $chkG);
if (!$ch) {
$message = mysqli_error($connDatabase);
} else {
$sqlCreateUser = "CREATE USER '%s'@'%%' IDENTIFIED BY '%s'";
$user = $filter->validateInput($user, 'nosql');
$sqlCreateUser = $filter->preventSqlInjection($sqlCreateUser, array($user . "_usertest", "sample"), $connDatabase);
$result = mysqli_query($connDatabase, $sqlCreateUser);
if (!$result) {
$message = mysqli_error($connDatabase);
} else {
$success = true;
$message = G::LoadTranslation('ID_SUCCESSFUL_CONNECTION');
}
$sqlDropUser = "DROP USER '%s'@'%%'";
$user = $filter->validateInput($user, 'nosql');
$sqlDropUser = $filter->preventSqlInjection($sqlDropUser, array($user . "_usertest"), $connDatabase);
mysqli_query($connDatabase, $sqlDropUser);
$sqlDropUser = "DROP USER %s@'%%'";
$usrTest = $filter->validateInput($usrTest, 'nosql');
$sqlDropUser = $filter->preventSqlInjection($sqlDropUser, array($usrTest), $connDatabase);
mysqli_query($connDatabase, $sqlDropUser);
}
$sqlDropDb = "DROP DATABASE %s";
$dbNameTest = $filter->validateInput($dbNameTest, 'nosql');
$sqlDropDb = $filter->preventSqlInjection($sqlDropDb, array($dbNameTest), $connDatabase);
mysqli_query($connDatabase, $sqlDropDb);
}
return array($success, ($message != "") ? $message : $Server->error);
} else {
return array(false, $Server->error);
}
} else {
return array(false, $Server->error);
}
} else {
return array(false, $Server->error);
}
} else {
return array(false, $Server->error);
}
} else {
return array(false, $Server->error);
}
}
switch ($request) {
//check if the APP_CACHE VIEW table and their triggers are installed
case 'info':
@@ -271,46 +176,25 @@ switch ($request) {
break;
case 'recreate-root':
$user = $_POST['user'];
$passwd = $_POST['password'];
$pass = $_POST['password'];
$server = $_POST['host'];
$code = $_POST['codeCaptcha'];
$aServer = explode(':', $server);
$serverName = $aServer[0];
$port = (count($aServer) > 1) ? $aServer[1] : "none";
$server = explode(':', $server);
$serverName = $server[0];
$port = (count($server) > 1) ? $server[1] : '';
if ($code !== $_SESSION['securimage_code_disp']['default']) {
echo G::loadTranslation('ID_CAPTCHA_CODE_INCORRECT');
break;
}
list($sucess, $msgErr) = testConnection(DB_ADAPTER, $serverName, $user, $passwd, $port);
if ($sucess) {
$sh = G::encryptOld(filemtime(PATH_GULLIVER . "/class.g.php"));
$h = G::encrypt($_POST['host'] . $sh . $_POST['user'] . $sh . $_POST['password'] . $sh . (1), $sh);
$insertStatements = "define ( 'HASH_INSTALLATION','{$h}' ); \ndefine ( 'SYSTEM_HASH', '{$sh}' ); \n";
$lines = [];
$content = '';
$filename = PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php';
$lines = file($filename);
$count = 1;
foreach ($lines as $line_num => $line) {
$pos = strpos($line, "define");
if ($pos !== false && $count < 3) {
$content = $content . $line;
$count++;
}
list($success, $message) = System::checkPermissionsDbUser(DB_ADAPTER, $serverName, $port, $user, $pass);
if ($success) {
$id = 'ID_MESSAGE_ROOT_CHANGE_FAILURE';
if (System::regenerateCredentiaslPathInstalled($server, $user, $pass)) {
$id = 'ID_MESSAGE_ROOT_CHANGE_SUCESS';
}
$content = "<?php \n" . $content . "\n" . $insertStatements . "\n";
if (file_put_contents($filename, $content) != false) {
echo G::loadTranslation('ID_MESSAGE_ROOT_CHANGE_SUCESS');
} else {
echo G::loadTranslation('ID_MESSAGE_ROOT_CHANGE_FAILURE');
}
} else {
echo $msgErr;
$message = G::loadTranslation($id);
}
echo $message;
break;
case 'captcha':
require_once PATH_TRUNK . 'vendor/dapphp/securimage/securimage.php';

View File

@@ -1,37 +1,37 @@
<?php
/**
* Rebuilding the cases list cache and changing the MySQL credentials
*
* @see processWorkspace()
*
* @link https://wiki.processmaker.com/3.2/Clearing_the_Case_List_Cache
*/
use ProcessMaker\Core\Installer;
global $RBAC;
$RBAC->requirePermissions('PM_SETUP');
// header('Pragma: no-cache');
// header('Cache-Control: no-store, no-cache, must-revalidate');
// Define the content of the case list cache builder
$headPublisher = headPublisher::getSingleton();
$headPublisher->addExtJsScript('setup/appCacheViewConf', false); //adding a javascript file .js
$headPublisher->addContent('setup/appCacheViewConf'); //adding a html file .html.
// Get some configurations
$conf = new Configurations();
$conf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '');
$lang = isset($conf->aConfig['LANG']) ? $conf->aConfig['LANG'] : 'en';
$oHeadPublisher = headPublisher::getSingleton();
//$oHeadPublisher->setExtSkin( 'xtheme-blue');
// Assign the language configured
$headPublisher->assign('currentLang', $lang);
$oHeadPublisher->addExtJsScript('setup/appCacheViewConf', false); //adding a javascript file .js
$oHeadPublisher->addContent('setup/appCacheViewConf'); //adding a html file .html.
$oConf = new Configurations();
$oConf->loadConfig($x, 'APP_CACHE_VIEW_ENGINE', '', '', '', '');
//first check about APP_CACHE_VIEW is enabled or not,
if (isset($oConf->aConfig['LANG']) && isset($oConf->aConfig['STATUS']) && $oConf->aConfig['STATUS'] == 'active') {
$appCacheViewEnabled = true;
// Get the mysql version
$mysqlVersion = getMysqlVersion();
$maxMysqlVersion = InstallerModule::MYSQL_VERSION_MAXIMUM_SUPPORTED;
if (version_compare($mysqlVersion, $maxMysqlVersion, '<')) {
$userNameMaxLength = 16;
} else {
$appCacheViewEnabled = false;
$userNameMaxLength = 32;
}
$lang = isset($oConf->aConfig['LANG']) ? $oConf->aConfig['LANG'] : 'en';
$headPublisher->assign('userNameMaxLength', $userNameMaxLength);
//$oHeadPublisher->assign('appCacheViewEnabled', $appCacheViewEnabled);
$labels = G::getTranslations(array('ID_PROCESSING','ID_CACHE_LANGUAGE','ID_CACHE_HOST','ID_CACHE_USER','ID_CACHE_PASSWORD','ID_CACHE_TITLE_INFO','ID_CACHE_SUBTITLE_REBUILD','ID_CACHE_BTN_BUILD','ID_CACHE_BUILDING','ID_CACHE_SUBTITLE_SETUP_DB','ID_CACHE_BTN_SETUP_PASSWRD','ID_CACHE_SUBTITLE_SETUP_SESSION','ID_CACHE_BTN_SETUP_SESSION'
));
// $oHeadPublisher->assign('TRANSLATIONS', $labels);
// $TRANSLATIONS->ID_PROCESSING = G::LoadTranslation('ID_PROCESSING');
// $oHeadPublisher->assign( 'TRANSLATIONS', $TRANSLATIONS); //translations
$oHeadPublisher->assign('currentLang', $lang); //current language
G::RenderPage('publish', 'extJs');
G::RenderPage('publish', 'extJs');