PMC-580: release/3.3.7

This commit is contained in:
Paula Quispe
2019-05-07 14:39:05 -04:00
27 changed files with 874 additions and 551 deletions

View File

@@ -451,7 +451,8 @@ class OutputDocument
$oOutputDocument = new \OutputDocument();
$aOD = $oOutputDocument->load($outputID);
$Fields = $oCase->loadCase($sApplication);
$sFilename = preg_replace('[^A-Za-z0-9_]', '_', \G::replaceDataField($aOD['OUT_DOC_FILENAME'], $Fields['APP_DATA']));
$outDocFile = replacePrefixes($aOD['OUT_DOC_FILENAME']);
$sFilename = preg_replace('[^A-Za-z0-9_]', '_', \G::replaceDataField($outDocFile, $Fields['APP_DATA']));
require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppFolder.php");
require_once(PATH_TRUNK . "workflow" . PATH_SEP . "engine" . PATH_SEP . "classes" . PATH_SEP . "model" . PATH_SEP . "AppDocument.php");
//Get the Custom Folder ID (create if necessary)

View File

@@ -1534,7 +1534,8 @@ class System
*/
public static function getServerProtocol()
{
return G::is_https() ? "https://" : "http://";
$envProtocol = defined("REQUEST_SCHEME") && REQUEST_SCHEME === "https";
return G::is_https() || $envProtocol ? "https://" : "http://";
}
/**
@@ -1577,7 +1578,7 @@ class System
public static function getServerHost()
{
$port = self::getServerPort();
if (!empty($port) && $port != '80') {
if (!empty($port) && $port != '80' && $port != '443') {
return self::getServerHostname() . ':' . $port;
}
return self::getServerHostname();
@@ -1597,11 +1598,25 @@ class System
* Get server main path (protocol + host + port + workspace + lang + skin).
*
* @return string
* @see ProcessMaker\BusinessModel\ProjectUser->projectWsUserCanStartTask()
* @see ProcessMaker\BusinessModel\ProjectUser->userLogin()
* @see ProcessMaker\BusinessModel\WebEntry->getWebEntryDataFromRecord()
* @see ProcessMaker\BusinessModel\WebEntryEvent->getGeneratedLink()
* @see ProcessMaker\Core\System\ActionsByEmailCoreClass->sendActionsByEmail()
* @see ProcessMaker\Core\System\webEntryProxy->checkCredentials()
* @see ProcessMaker\Core\System\webEntryProxy->save()
* @see workflow/engine/classes/ProcessMap.php ProcessMap->listNewWebEntry()
* @see workflow/engine/classes/ProcessMap.php ProcessMap->webEntry()
* @see workflow/engine/controllers/caseSchedulerProxy.php caseSchedulerProxy->checkCredentials()
* @see workflow/engine/methods/cases/cases_SchedulerValidateUser.php
* @see workflow/engine/methods/processes/processes_webEntryGenerate.php
* @see workflow/engine/methods/processes/processes_webEntryValidate.php
* @see workflow/engine/methods/processes/webEntry_Val_Assig.php
*/
public static function getServerMainPath()
{
$conf = new Configurations();
$skin = defined("SYS_SKIN") ? SYS_SKIN : $conf->getConfiguration('SKIN_CRON', '');
$config = self::getSystemConfiguration();
$skin = defined("SYS_SKIN") ? SYS_SKIN : $config['default_skin'];
return self::getServerProtocolHost() . '/sys' . config("system.workspace") . '/' . SYS_LANG . '/' . $skin;
}

View File

@@ -2,17 +2,18 @@
namespace ProcessMaker\Util;
use Configurations;
use Criteria;
use ResultSet;
use FieldsPeer;
use ReportTablePeer;
use CaseConsolidatedCorePeer;
use ConsolidatedCases;
use AdditionalTablesPeer;
use PmTable;
use ReportVarPeer;
use AdditionalTables;
use AdditionalTablesPeer;
use CaseConsolidatedCorePeer;
use Configurations;
use ConsolidatedCases;
use Criteria;
use FieldsPeer;
use PmTable;
use ProcessMaker\Core\System;
use ReportTablePeer;
use ReportVarPeer;
use ResultSet;
use stdClass;
/**
@@ -73,6 +74,7 @@ class FixReferencePath
* @param string $directory
* @param string $pathData
* @return void
* @see workflow/engine/classes/WorkspaceTools.php WorkspaceTools->fixReferencePathFiles()
*/
public function runProcess($directory, $pathData)
{
@@ -81,8 +83,8 @@ class FixReferencePath
//task, it is removed at the end of the method.
$_SERVER["REQUEST_URI"] = "";
if (!defined("SYS_SKIN")) {
$conf = new Configurations();
define("SYS_SKIN", $conf->getConfiguration('SKIN_CRON', ''));
$config = System::getSystemConfiguration();
define("SYS_SKIN", $config['default_skin']);
}
$criteria = new Criteria("workflow");

View File

@@ -431,6 +431,50 @@ function arrayDiffRecursive(array $array1, array $array2)
return $difference;
}
/**
* Replace all supported variables prefixes to the prefix sent
*
* @param string $outDocFilename
* @param string $prefix
*
* @return string
*
* @see cases_Step.php
* @see \ProcessMaker\BusinessModel\Cases\OutputDocument::addCasesOutputDocument()
* @link https://wiki.processmaker.com/3.2/Triggers#Typing_rules_for_Case_Variables
*/
function replacePrefixes($outDocFilename, $prefix = '@=')
{
$outDocFile = str_replace(['@@', '@#', '@=', '@%', '@?', '@$', '@&', '@Q', '@q', '@!'], $prefix, $outDocFilename);
return $outDocFile;
}
/**
* Encoding header filename used in Content-Disposition
*
* @param string $fileName
* @param string $replacement
*
* @return string
*
* @see cases_Step.php
* @see \ProcessMaker\BusinessModel\Cases\OutputDocument::addCasesOutputDocument()
*/
function fixContentDispositionFilename($fileName, $replacement = '_')
{
//(double quote) has to be removed
//(forward slash) has to replaced by underscore
//(backslash) has to replaced by underscore
$default = [
'/[\"]/' => '',
'/[\\|\/]/' => $replacement,
'/\\\\/' => $replacement
];
return preg_replace(array_keys($default), array_values($default), $fileName);
}
/**
* Get the current user CSRF token.
*