BUG 9087 Adjustment for standardization of code SOLVED
- Adjustment workflow/engine/classes/class.pmScript.php file.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* class.pmScript.php
|
||||
* @package workflow.engine.ProcessMaker
|
||||
@@ -38,7 +39,6 @@
|
||||
* last modify comment was added and adapted the catch errors
|
||||
* @copyright 2007 COLOSA
|
||||
*/
|
||||
|
||||
function __autoload($sClassName)
|
||||
{
|
||||
if (defined('SYS_SYS')) {
|
||||
@@ -59,12 +59,12 @@ if (class_exists('folderData')) {
|
||||
$aAvailablePmFunctions = $oPluginRegistry->getPmFunctions();
|
||||
foreach ($aAvailablePmFunctions as $key => $class) {
|
||||
$filePlugin = PATH_PLUGINS . $class . PATH_SEP . 'classes' . PATH_SEP . 'class.pmFunctions.php';
|
||||
if ( file_exists ( $filePlugin ) )
|
||||
if (file_exists($filePlugin)) {
|
||||
include_once( $filePlugin);
|
||||
}
|
||||
}
|
||||
}
|
||||
//end plugin
|
||||
|
||||
//Add External Triggers
|
||||
$dir = G::ExpandPath("classes") . 'triggers';
|
||||
$filesArray = array();
|
||||
@@ -73,10 +73,11 @@ if (file_exists($dir)){
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if (($file != ".") && ($file != "..")) {
|
||||
$extFile = explode(".", $file);
|
||||
if($extFile[sizeof($extFile)-1] == 'php')
|
||||
if ($extFile[sizeof($extFile) - 1] == 'php') {
|
||||
include_once( $dir . PATH_SEP . $file);
|
||||
}
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
}
|
||||
@@ -88,36 +89,37 @@ if (file_exists($dir)){
|
||||
*/
|
||||
class PMScript
|
||||
{
|
||||
|
||||
/**
|
||||
* Original fields
|
||||
*/
|
||||
var $aOriginalFields = array();
|
||||
public $aOriginalFields = array();
|
||||
|
||||
/**
|
||||
* Fields to use
|
||||
*/
|
||||
var $aFields = array();
|
||||
public $aFields = array();
|
||||
|
||||
/**
|
||||
* Script
|
||||
*/
|
||||
var $sScript = '';
|
||||
public $sScript = '';
|
||||
|
||||
/**
|
||||
* Error has happened?
|
||||
*/
|
||||
var $bError = false;
|
||||
public $bError = false;
|
||||
|
||||
/**
|
||||
* Affected fields
|
||||
*/
|
||||
var $affected_fields;
|
||||
public $affected_fields;
|
||||
|
||||
/**
|
||||
* Constructor of the class PMScript
|
||||
* @return void
|
||||
*/
|
||||
function PMScript()
|
||||
public function PMScript()
|
||||
{
|
||||
$this->aFields['__ERROR__'] = 'none';
|
||||
}
|
||||
@@ -127,7 +129,7 @@ class PMScript
|
||||
* @param array $aFields
|
||||
* @return void
|
||||
*/
|
||||
function setFields($aFields = array())
|
||||
public function setFields($aFields=array())
|
||||
{
|
||||
if (!is_array($aFields)) {
|
||||
$aFields = array();
|
||||
@@ -140,7 +142,7 @@ class PMScript
|
||||
* @param string $sScript
|
||||
* @return void
|
||||
*/
|
||||
function setScript($sScript = '')
|
||||
public function setScript($sScript='')
|
||||
{
|
||||
$this->sScript = $sScript;
|
||||
}
|
||||
@@ -150,13 +152,13 @@ class PMScript
|
||||
* @param string $sScript
|
||||
* @return boolean
|
||||
*/
|
||||
function validSyntax($sScript)
|
||||
public function validSyntax($sScript)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function executeAndCatchErrors($sScript, $sCode) {
|
||||
public function executeAndCatchErrors($sScript, $sCode)
|
||||
{
|
||||
ob_start('handleFatalErrors');
|
||||
set_error_handler('handleErrors');
|
||||
$_SESSION['_CODE_'] = $sCode;
|
||||
@@ -169,20 +171,21 @@ class PMScript
|
||||
* Execute the current script
|
||||
* @return void
|
||||
*/
|
||||
function execute()
|
||||
public function execute()
|
||||
{
|
||||
$sScript = "";
|
||||
$iAux = 0;
|
||||
$bEqual = false;
|
||||
$iOcurrences = preg_match_all('/\@(?:([\@\%\#\?\$\=])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/', $this->sScript, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
|
||||
$iOcurrences = preg_match_all( '/\@(?:([\@\%\#\?\$\=])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]'
|
||||
. '*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/',
|
||||
$this->sScript, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
|
||||
if ($iOcurrences) {
|
||||
for ($i = 0; $i < $iOcurrences; $i++) {
|
||||
$sAux = substr($this->sScript, $iAux, $aMatch[0][$i][1] - $iAux);
|
||||
if (!$bEqual) {
|
||||
if (strpos($sAux, '==') !== false) {
|
||||
$bEqual = false;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
if (strpos($sAux, '=') !== false) {
|
||||
$bEqual = true;
|
||||
}
|
||||
@@ -195,30 +198,38 @@ class PMScript
|
||||
}
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
eval("if (!isset(\$this->aFields['" . $aMatch[2][$i][0] . "'])) { \$this->aFields['" . $aMatch[2][$i][0] . "'] = null; }");
|
||||
}
|
||||
else {
|
||||
eval("if (!isset(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")) { \$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . " = null; }");
|
||||
eval("if (!isset(\$this->aFields['" . $aMatch[2][$i][0] . "'])) { \$this->aFields['"
|
||||
. $aMatch[2][$i][0] . "'] = null; }");
|
||||
} else {
|
||||
eval( "if (!isset(\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0] . ")) { \$this->aFields"
|
||||
. (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0]
|
||||
. "']" : '') . $aMatch[5][$i][0] . " = null; }");
|
||||
}
|
||||
}
|
||||
$sScript .= $sAux;
|
||||
$iAux = $aMatch[0][$i][1] + strlen($aMatch[0][$i][0]);
|
||||
switch ($aMatch[1][$i][0])
|
||||
{ case '@':
|
||||
switch ($aMatch[1][$i][0]) {
|
||||
case '@':
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "pmToString(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
|
||||
} else {
|
||||
$sScript .= "pmToString(\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
else {
|
||||
$sScript .= "pmToString(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -226,17 +237,20 @@ class PMScript
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "pmToInteger(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
|
||||
} else {
|
||||
$sScript .= "pmToInteger(\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
else {
|
||||
$sScript .= "pmToInteger(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -244,17 +258,20 @@ class PMScript
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "pmToFloat(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
|
||||
} else {
|
||||
$sScript .= "pmToFloat(\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
else {
|
||||
$sScript .= "pmToFloat(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -262,17 +279,20 @@ class PMScript
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "pmToUrl(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
|
||||
} else {
|
||||
$sScript .= "pmToUrl(\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
else {
|
||||
$sScript .= "pmToUrl(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -280,17 +300,20 @@ class PMScript
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "pmSqlEscape(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
|
||||
} else {
|
||||
$sScript .= "pmSqlEscape(\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
else {
|
||||
$sScript .= "pmSqlEscape(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -298,17 +321,20 @@ class PMScript
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -317,13 +343,16 @@ class PMScript
|
||||
}
|
||||
}
|
||||
$sScript .= substr($this->sScript, $iAux);
|
||||
$sScript = "try {\n" . $sScript . "\n} catch (Exception \$oException) {\n \$this->aFields['__ERROR__'] = utf8_encode(\$oException->getMessage());\n}";
|
||||
$sScript = "try {\n" . $sScript . "\n} catch (Exception \$oException) {\n "
|
||||
. " \$this->aFields['__ERROR__'] = utf8_encode(\$oException->getMessage());\n}";
|
||||
//echo '<pre>-->'; print_r($this->aFields); echo '<---</pre>';
|
||||
$this->executeAndCatchErrors($sScript, $this->sScript);
|
||||
for ($i = 0; $i < count($this->affected_fields); $i++) {
|
||||
$_SESSION['TRIGGER_DEBUG']['DATA'][] = Array(
|
||||
'key' => $this->affected_fields[$i],
|
||||
'value' => isset($this->aFields[$this->affected_fields[$i]]) ? $this->aFields[$this->affected_fields[$i]] : ''
|
||||
'value' => isset($this->aFields[$this->affected_fields[$i]])
|
||||
? $this->aFields[$this->affected_fields[$i]]
|
||||
: ''
|
||||
);
|
||||
}
|
||||
//echo '<pre>-->'; print_r($_SESSION['TRIGGER_DEBUG']['DATA']); echo '<---</pre>';
|
||||
@@ -333,17 +362,20 @@ class PMScript
|
||||
* Evaluate the current script
|
||||
* @return void
|
||||
*/
|
||||
function evaluate()
|
||||
public function evaluate()
|
||||
{
|
||||
$bResult = null;
|
||||
$sScript = '';
|
||||
$iAux = 0;
|
||||
$bEqual = false;
|
||||
$variableIsDefined = true;
|
||||
$iOcurrences = preg_match_all('/\@(?:([\@\%\#\?\$\=])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/', $this->sScript, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
|
||||
$iOcurrences = preg_match_all('/\@(?:([\@\%\#\?\$\=])([a-zA-Z\_]\w*)|([a-zA-Z\_][\w\-\>\:]*)\(((?:[^\\\\\)]'
|
||||
. '*(?:[\\\\][\w\W])?)*)\))((?:\s*\[[\'"]?\w+[\'"]?\])+)?/',
|
||||
$this->sScript, $aMatch, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE);
|
||||
if ($iOcurrences) {
|
||||
for ($i = 0; $i < $iOcurrences; $i++) {
|
||||
// if the variables for that condition has not been previously defined then $variableIsDefined is set to false
|
||||
// if the variables for that condition has not been previously defined then $variableIsDefined
|
||||
// is set to false
|
||||
if (!isset($this->aFields[$aMatch[2][$i][0]])) {
|
||||
// $variableIsDefined = false;
|
||||
$this->aFields[$aMatch[2][$i][0]] = '';
|
||||
@@ -355,8 +387,7 @@ class PMScript
|
||||
}
|
||||
}
|
||||
if ($bEqual) {
|
||||
if (strpos($sAux, ';') !== false)
|
||||
{
|
||||
if (strpos($sAux, ';') !== false) {
|
||||
$bEqual = false;
|
||||
}
|
||||
}
|
||||
@@ -367,17 +398,20 @@ class PMScript
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "pmToString(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
|
||||
} else {
|
||||
$sScript .= "pmToString(\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
else {
|
||||
$sScript .= "pmToString(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -385,17 +419,20 @@ class PMScript
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "pmToInteger(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
|
||||
} else {
|
||||
$sScript .= "pmToInteger(\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
else {
|
||||
$sScript .= "pmToInteger(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -403,17 +440,20 @@ class PMScript
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "pmToFloat(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
|
||||
} else {
|
||||
$sScript .= "pmToFloat(\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
else {
|
||||
$sScript .= "pmToFloat(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -421,17 +461,20 @@ class PMScript
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "pmToUrl(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
|
||||
} else {
|
||||
$sScript .= "pmToUrl(\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
else {
|
||||
$sScript .= "pmToUrl(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -439,17 +482,20 @@ class PMScript
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "pmSqlEscape(\$this->aFields['" . $aMatch[2][$i][0] . "'])";
|
||||
} else {
|
||||
$sScript .= "pmSqlEscape(\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
else {
|
||||
$sScript .= "pmSqlEscape(\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0] . ")";
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -457,17 +503,20 @@ class PMScript
|
||||
if ($bEqual) {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
if (!isset($aMatch[5][$i][0])) {
|
||||
$sScript .= "\$this->aFields['" . $aMatch[2][$i][0] . "']";
|
||||
}
|
||||
else {
|
||||
$sScript .= "\$this->aFields" . (isset($aMatch[2][$i][0]) ? "['" . $aMatch[2][$i][0] . "']" : '') . $aMatch[5][$i][0];
|
||||
} else {
|
||||
$sScript .= "\$this->aFields"
|
||||
. (isset($aMatch[2][$i][0])
|
||||
? "['" . $aMatch[2][$i][0] . "']"
|
||||
: '') . $aMatch[5][$i][0];
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -480,8 +529,7 @@ class PMScript
|
||||
if ($this->validSyntax($sScript) && $variableIsDefined) {
|
||||
$this->bError = false;
|
||||
eval($sScript);
|
||||
}
|
||||
else{
|
||||
} else {
|
||||
// echo "<script> alert('".G::loadTranslation('MSG_CONDITION_NOT_DEFINED')."'); </script>";
|
||||
G::SendTemporalMessage('MSG_CONDITION_NOT_DEFINED', 'error', 'labels');
|
||||
$this->bError = true;
|
||||
@@ -575,6 +623,7 @@ function handleErrors($errno, $errstr, $errfile, $errline)
|
||||
* @param variant $buffer
|
||||
* @return buffer
|
||||
*/
|
||||
|
||||
function handleFatalErrors($buffer)
|
||||
{
|
||||
if (preg_match('/(error<\/b>:)(.+)(<br)/', $buffer, $regs)) {
|
||||
@@ -587,7 +636,10 @@ function handleFatalErrors($buffer)
|
||||
if (strpos($_SERVER['REQUEST_URI'], '&ACTION=GENERATE') !== false) {
|
||||
G::LoadClass('case');
|
||||
$oCase = new Cases();
|
||||
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
|
||||
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'],
|
||||
$_SESSION['APPLICATION'],
|
||||
$_SESSION['INDEX'],
|
||||
$_SESSION['STEP_POSITION']);
|
||||
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
|
||||
$_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER';
|
||||
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
|
||||
@@ -599,11 +651,13 @@ function handleFatalErrors($buffer)
|
||||
$_SESSION['_NO_EXECUTE_TRIGGERS_'] = 1;
|
||||
G::header('Location: ' . $_SERVER['REQUEST_URI']);
|
||||
die;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
G::LoadClass('case');
|
||||
$oCase = new Cases();
|
||||
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'], $_SESSION['APPLICATION'], $_SESSION['INDEX'], $_SESSION['STEP_POSITION']);
|
||||
$aNextStep = $oCase->getNextStep($_SESSION['PROCESS'],
|
||||
$_SESSION['APPLICATION'],
|
||||
$_SESSION['INDEX'],
|
||||
$_SESSION['STEP_POSITION']);
|
||||
if ($_SESSION['TRIGGER_DEBUG']['ISSET']) {
|
||||
$_SESSION['TRIGGER_DEBUG']['TIME'] = 'AFTER';
|
||||
$_SESSION['TRIGGER_DEBUG']['BREAKPAGE'] = $aNextStep['PAGE'];
|
||||
@@ -618,6 +672,7 @@ function handleFatalErrors($buffer)
|
||||
}
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
* Register Error
|
||||
* @param string $iType
|
||||
@@ -626,10 +681,12 @@ function handleFatalErrors($buffer)
|
||||
* @param string $sCode
|
||||
* @return void
|
||||
*/
|
||||
|
||||
function registerError($iType, $sError, $iLine, $sCode)
|
||||
{
|
||||
$sType = ($iType == 1 ? 'ERROR' : 'FATAL');
|
||||
$_SESSION['TRIGGER_DEBUG']['ERRORS'][][$sType] = $sError . ($iLine > 0 ? ' (line ' . $iLine . ')' : '') . ':<br /><br />' . $sCode;
|
||||
$_SESSION['TRIGGER_DEBUG']['ERRORS'][][$sType] = $sError . ($iLine > 0 ? ' (line ' . $iLine . ')' : '')
|
||||
. ':<br /><br />' . $sCode;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -660,10 +717,10 @@ function executeQueryOci($sql, $connection, $aParameter = array())
|
||||
$sDatabse = $aDNS["database"];
|
||||
$sPort = $aDNS["port"];
|
||||
|
||||
if ($sPort != "1521") { // if not default port
|
||||
if ($sPort != "1521") {
|
||||
// if not default port
|
||||
$conn = oci_connect($sUsername, $sPassword, $sHostspec . ":" . $sPort . "/" . $sDatabse);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
$conn = oci_connect($sUsername, $sPassword, $sHostspec . "/" . $sDatabse);
|
||||
}
|
||||
|
||||
@@ -703,8 +760,7 @@ function executeQueryOci($sql, $connection, $aParameter = array())
|
||||
$objExecute = oci_execute($stid, OCI_DEFAULT);
|
||||
if ($objExecute) {
|
||||
oci_commit($conn);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
oci_rollback($conn);
|
||||
$isValid = false;
|
||||
}
|
||||
@@ -712,8 +768,7 @@ function executeQueryOci($sql, $connection, $aParameter = array())
|
||||
oci_close($conn);
|
||||
if ($isValid) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
return oci_error();
|
||||
}
|
||||
break;
|
||||
@@ -734,5 +789,5 @@ function executeQueryOci($sql, $connection, $aParameter = array())
|
||||
return $aParameterRet;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user