Merged in victorsl/processmaker/HOR-722-31 (pull request #4587)
HOR-722
This commit is contained in:
@@ -2732,7 +2732,7 @@ function run_check_plugin_disabled_code($task, $args)
|
|||||||
if (count($arrayData) > 0) {
|
if (count($arrayData) > 0) {
|
||||||
G::LoadClass("codeScanner");
|
G::LoadClass("codeScanner");
|
||||||
|
|
||||||
$cs = new CodeScanner("DISABLED_CODE");
|
$cs = new CodeScanner(true);
|
||||||
|
|
||||||
$strFoundDisabledCode = "";
|
$strFoundDisabledCode = "";
|
||||||
|
|
||||||
|
|||||||
@@ -14,15 +14,33 @@ class CodeScanner
|
|||||||
/**
|
/**
|
||||||
* Constructor of the class
|
* Constructor of the class
|
||||||
*
|
*
|
||||||
* return void
|
* @param mixed $option Option
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __construct($option)
|
public function __construct($option = null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
switch ($option) {
|
$flag = false;
|
||||||
case "DISABLED_CODE":
|
|
||||||
$this->setArrayDisabledCode();
|
if (!is_null($option)) {
|
||||||
break;
|
switch (gettype($option)) {
|
||||||
|
case 'string':
|
||||||
|
$workspace = new workspaceTools($option);
|
||||||
|
|
||||||
|
if ($workspace->workspaceExists()) {
|
||||||
|
$arraySystemConfiguration = System::getSystemConfiguration('', '', $workspace->name);
|
||||||
|
$flag = (int)($arraySystemConfiguration['enable_blacklist']) == 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'boolean':
|
||||||
|
$flag = $option;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($flag) {
|
||||||
|
$this->setArrayDisabledCode();
|
||||||
}
|
}
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
@@ -32,9 +50,9 @@ class CodeScanner
|
|||||||
/**
|
/**
|
||||||
* Set disabled code
|
* Set disabled code
|
||||||
*
|
*
|
||||||
* return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function setArrayDisabledCode()
|
private function setArrayDisabledCode()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
//Disabled functions (PHP)
|
//Disabled functions (PHP)
|
||||||
@@ -61,9 +79,9 @@ class CodeScanner
|
|||||||
/**
|
/**
|
||||||
* Get disabled code
|
* Get disabled code
|
||||||
*
|
*
|
||||||
* return array Return array with disabled code
|
* @return array Returns an array with disabled code
|
||||||
*/
|
*/
|
||||||
public function getArrayDisabledCode()
|
private function getArrayDisabledCode()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return $this->arrayDisabledCode;
|
return $this->arrayDisabledCode;
|
||||||
@@ -75,9 +93,9 @@ class CodeScanner
|
|||||||
/**
|
/**
|
||||||
* Verify if exists disabled code
|
* Verify if exists disabled code
|
||||||
*
|
*
|
||||||
* return bool Return true if exists disabled code, false otherwise
|
* @return bool Returns true if exists disabled code, false otherwise
|
||||||
*/
|
*/
|
||||||
public function existsDisabledCode()
|
private function existsDisabledCode()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
return !empty($this->arrayDisabledCode);
|
return !empty($this->arrayDisabledCode);
|
||||||
@@ -91,9 +109,9 @@ class CodeScanner
|
|||||||
*
|
*
|
||||||
* @param string $source Source
|
* @param string $source Source
|
||||||
*
|
*
|
||||||
* return array Return array with disabled code found, array empty otherwise
|
* @return array Returns an array with disabled code found, array empty otherwise
|
||||||
*/
|
*/
|
||||||
public function checkDisabledCodeInSource($source)
|
private function checkDisabledCodeInSource($source)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
if (!$this->existsDisabledCode()) {
|
if (!$this->existsDisabledCode()) {
|
||||||
@@ -155,7 +173,7 @@ class CodeScanner
|
|||||||
* @param string $option Option (SOURCE, PATH, FILE)
|
* @param string $option Option (SOURCE, PATH, FILE)
|
||||||
* @param string $data Data
|
* @param string $data Data
|
||||||
*
|
*
|
||||||
* return array Return array with disabled code found, array empty otherwise
|
* return array Returns an array with disabled code found, array empty otherwise
|
||||||
*/
|
*/
|
||||||
public function checkDisabledCode($option, $data)
|
public function checkDisabledCode($option, $data)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3555,10 +3555,8 @@ class Cases
|
|||||||
$oPMScript = new PMScript();
|
$oPMScript = new PMScript();
|
||||||
$oPMScript->setFields($aFields);
|
$oPMScript->setFields($aFields);
|
||||||
|
|
||||||
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
|
|
||||||
|
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
$cs = new CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
|
$cs = new CodeScanner(SYS_SYS);
|
||||||
|
|
||||||
$strFoundDisabledCode = "";
|
$strFoundDisabledCode = "";
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
|
|||||||
@@ -5913,11 +5913,12 @@ class Processes
|
|||||||
/**
|
/**
|
||||||
* Get disabled code
|
* Get disabled code
|
||||||
*
|
*
|
||||||
* @param string $processUid Unique id of Process
|
* @param string $processUid Unique id of Process
|
||||||
|
* @param string $workspaceName Workspace name
|
||||||
*
|
*
|
||||||
* return array Return array with disabled code found, array empty otherwise
|
* @return array Returns an array with disabled code found, array empty otherwise
|
||||||
*/
|
*/
|
||||||
public function getDisabledCode($processUid = "")
|
public function getDisabledCode($processUid = null, $workspaceName = null)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
/*----------------------------------********---------------------------------*/
|
/*----------------------------------********---------------------------------*/
|
||||||
@@ -5933,7 +5934,7 @@ class Processes
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Set variables
|
//Set variables
|
||||||
$cs = new CodeScanner("DISABLED_CODE");
|
$cs = new CodeScanner((!is_null($workspaceName))? $workspaceName : SYS_SYS);
|
||||||
|
|
||||||
$delimiter = DBAdapter::getStringDelimiter();
|
$delimiter = DBAdapter::getStringDelimiter();
|
||||||
|
|
||||||
@@ -5949,7 +5950,7 @@ class Processes
|
|||||||
$arrayCondition[] = array(ContentPeer::CON_LANG, $delimiter . SYS_LANG . $delimiter, Criteria::EQUAL);
|
$arrayCondition[] = array(ContentPeer::CON_LANG, $delimiter . SYS_LANG . $delimiter, Criteria::EQUAL);
|
||||||
$criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
|
$criteria->addJoinMC($arrayCondition, Criteria::LEFT_JOIN);
|
||||||
|
|
||||||
if ($processUid != "") {
|
if (!is_null($processUid)) {
|
||||||
$criteria->add(ProcessPeer::PRO_UID, $processUid, Criteria::EQUAL);
|
$criteria->add(ProcessPeer::PRO_UID, $processUid, Criteria::EQUAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -72,6 +72,7 @@ class System
|
|||||||
'safari_cookie_lifetime' => 1,
|
'safari_cookie_lifetime' => 1,
|
||||||
'error_reporting' => "",
|
'error_reporting' => "",
|
||||||
'display_errors' => 'On',
|
'display_errors' => 'On',
|
||||||
|
'enable_blacklist' => 0,
|
||||||
'system_utc_time_zone' => 0,
|
'system_utc_time_zone' => 0,
|
||||||
'server_protocol' => '',
|
'server_protocol' => '',
|
||||||
'server_hostname_requests_frontend' => ''
|
'server_hostname_requests_frontend' => ''
|
||||||
|
|||||||
@@ -1946,7 +1946,7 @@ class workspaceTools
|
|||||||
/**
|
/**
|
||||||
* Get disabled code
|
* Get disabled code
|
||||||
*
|
*
|
||||||
* return array Return array with disabled code found, array empty otherwise
|
* @return array Returns an array with disabled code found, array empty otherwise
|
||||||
*/
|
*/
|
||||||
public function getDisabledCode()
|
public function getDisabledCode()
|
||||||
{
|
{
|
||||||
@@ -1958,7 +1958,7 @@ class workspaceTools
|
|||||||
$process = new Processes();
|
$process = new Processes();
|
||||||
|
|
||||||
//Return
|
//Return
|
||||||
return $process->getDisabledCode();
|
return $process->getDisabledCode(null, $this->name);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,9 +71,7 @@ if (PMLicensedFeatures::getSingleton()->verifyfeature("B0oWlBLY3hHdWY0YUNpZEtFQm
|
|||||||
if (!empty($arrayTrigger)) {
|
if (!empty($arrayTrigger)) {
|
||||||
G::LoadClass("codeScanner");
|
G::LoadClass("codeScanner");
|
||||||
|
|
||||||
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
|
$cs = new CodeScanner(SYS_SYS);
|
||||||
|
|
||||||
$cs = new CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
|
|
||||||
|
|
||||||
$strFoundDisabledCode = "";
|
$strFoundDisabledCode = "";
|
||||||
|
|
||||||
@@ -313,7 +311,7 @@ if (isset($_POST["PRO_FILENAME"]) &&
|
|||||||
G::LoadClass( 'Process' );
|
G::LoadClass( 'Process' );
|
||||||
$oProcess = new Process();
|
$oProcess = new Process();
|
||||||
$processData = $oProcess->load( $prjUid );
|
$processData = $oProcess->load( $prjUid );
|
||||||
$proType = $processData["PRO_TYPE"];
|
$proType = $processData["PRO_TYPE"];
|
||||||
|
|
||||||
$result = array(
|
$result = array(
|
||||||
"success" => true,
|
"success" => true,
|
||||||
|
|||||||
@@ -58,9 +58,7 @@ if ($handle = opendir( PATH_PLUGINS )) {
|
|||||||
//Check disabled code
|
//Check disabled code
|
||||||
G::LoadClass("codeScanner");
|
G::LoadClass("codeScanner");
|
||||||
|
|
||||||
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
|
$cs = new CodeScanner(SYS_SYS);
|
||||||
|
|
||||||
$cs = new CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
|
|
||||||
|
|
||||||
$arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"), $cs->checkDisabledCode("PATH", PATH_PLUGINS . $pluginName));
|
$arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", PATH_PLUGINS . $pluginName . ".php"), $cs->checkDisabledCode("PATH", PATH_PLUGINS . $pluginName));
|
||||||
|
|
||||||
|
|||||||
@@ -252,9 +252,7 @@ try {
|
|||||||
//Check disabled code
|
//Check disabled code
|
||||||
G::LoadClass("codeScanner");
|
G::LoadClass("codeScanner");
|
||||||
|
|
||||||
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
|
$cs = new CodeScanner(SYS_SYS);
|
||||||
|
|
||||||
$cs = new CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
|
|
||||||
|
|
||||||
$arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", $path . $pluginFile), $cs->checkDisabledCode("PATH", $path . $sClassName));
|
$arrayFoundDisabledCode = array_merge($cs->checkDisabledCode("FILE", $path . $pluginFile), $cs->checkDisabledCode("PATH", $path . $sClassName));
|
||||||
|
|
||||||
|
|||||||
@@ -87,9 +87,7 @@ if (isset( $sfunction ) && $sfunction == 'lookforNameTrigger') {
|
|||||||
//Check disabled code
|
//Check disabled code
|
||||||
G::LoadClass("codeScanner");
|
G::LoadClass("codeScanner");
|
||||||
|
|
||||||
$arraySystemConfiguration = System::getSystemConfiguration(PATH_CONFIG . "env.ini");
|
$cs = new CodeScanner(SYS_SYS);
|
||||||
|
|
||||||
$cs = new CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
|
|
||||||
|
|
||||||
$arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $value["TRI_WEBBOT"]);
|
$arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $value["TRI_WEBBOT"]);
|
||||||
|
|
||||||
|
|||||||
@@ -188,9 +188,7 @@ class Trigger
|
|||||||
//Check disabled code
|
//Check disabled code
|
||||||
\G::LoadClass("codeScanner");
|
\G::LoadClass("codeScanner");
|
||||||
|
|
||||||
$arraySystemConfiguration = \System::getSystemConfiguration(PATH_CONFIG . "env.ini");
|
$cs = new \CodeScanner(SYS_SYS);
|
||||||
|
|
||||||
$cs = new \CodeScanner((isset($arraySystemConfiguration["enable_blacklist"]) && (int)($arraySystemConfiguration["enable_blacklist"]) == 1)? "DISABLED_CODE" : "");
|
|
||||||
|
|
||||||
$arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $dataTrigger["TRI_WEBBOT"]);
|
$arrayFoundDisabledCode = $cs->checkDisabledCode("SOURCE", $dataTrigger["TRI_WEBBOT"]);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user