From eab5c8411f58bc4acf375110146c1fd6e95ff9e9 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 21 Apr 2017 15:35:04 -0400 Subject: [PATCH 1/5] HOR-3017 --- workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php | 1 + workflow/engine/templates/processes/webentryPost.tpl | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index d6e6add93..a87056233 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -406,6 +406,7 @@ class WebEntry $fileContent .= "\$_SESSION[\"PROCESS\"] = \"" . $processUid . "\";\n"; $fileContent .= "\$_SESSION[\"CURRENT_DYN_UID\"] = \"" . $dynaFormUid . "\";\n"; $fileContent .= "\$G_PUBLISH = new Publisher();\n"; + $fileContent .= "\$_SESSION[\"__submitFormWebEntry__\"] = false;\n"; $fileContent .= "G::LoadClass(\"pmDynaform\");\n"; $fileContent .= "\$a = new pmDynaform(array(\"CURRENT_DYNAFORM\" => \"" . $arrayWebEntryData["DYN_UID"] . "\"));\n"; diff --git a/workflow/engine/templates/processes/webentryPost.tpl b/workflow/engine/templates/processes/webentryPost.tpl index 85c80bee2..b9f29befe 100644 --- a/workflow/engine/templates/processes/webentryPost.tpl +++ b/workflow/engine/templates/processes/webentryPost.tpl @@ -16,6 +16,11 @@ define("WS_USER_PASS", "{wsPass}"); define("WS_ROUNDROBIN", "{wsRoundRobin}"); try { + if (isset($_SESSION["__submitFormWebEntry__"]) && $_SESSION["__submitFormWebEntry__"] === true) { + header("location:/sysworkflow/en/neoclassic/84823022258da8428b8bae5013752026/11315111158da8453481cb0056624392.php"); + exit(); + } + @include_once ("wsClient.php"); if (!function_exists("ws_open")){ @@ -196,6 +201,7 @@ try { $G_PUBLISH = new Publisher(); $G_PUBLISH->AddContent("xmlform", "xmlform", "login/showInfo", "", $aMessage); G::RenderPage("publish", "blank"); + $_SESSION["__submitFormWebEntry__"] = true; } catch (Exception $e) { $G_PUBLISH = new Publisher(); $suggest_message = "This web entry should be regenerated, please contact to your system administrator."; From 90a8a96c02329f0e23bb890d0cb0a7a2cef9c807 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 21 Apr 2017 16:14:19 -0400 Subject: [PATCH 2/5] HOR-3017 --- workflow/engine/templates/processes/webentryPost.tpl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/workflow/engine/templates/processes/webentryPost.tpl b/workflow/engine/templates/processes/webentryPost.tpl index b9f29befe..2cbccfb60 100644 --- a/workflow/engine/templates/processes/webentryPost.tpl +++ b/workflow/engine/templates/processes/webentryPost.tpl @@ -17,7 +17,9 @@ define("WS_ROUNDROBIN", "{wsRoundRobin}"); try { if (isset($_SESSION["__submitFormWebEntry__"]) && $_SESSION["__submitFormWebEntry__"] === true) { - header("location:/sysworkflow/en/neoclassic/84823022258da8428b8bae5013752026/11315111158da8453481cb0056624392.php"); + $G_PUBLISH = new Publisher(); + $G_PUBLISH->AddContent("xmlform", "xmlform", "login/showInfo", "", $_SESSION["__submitFormWebEntryData__"]); + G::RenderPage("publish", "blank"); exit(); } @@ -202,6 +204,7 @@ try { $G_PUBLISH->AddContent("xmlform", "xmlform", "login/showInfo", "", $aMessage); G::RenderPage("publish", "blank"); $_SESSION["__submitFormWebEntry__"] = true; + $_SESSION["__submitFormWebEntryData__"] = $aMessage; } catch (Exception $e) { $G_PUBLISH = new Publisher(); $suggest_message = "This web entry should be regenerated, please contact to your system administrator."; From 87de43d90acff22e56162da5b2e5c96eecaa2593 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Thu, 4 May 2017 10:59:38 -0400 Subject: [PATCH 3/5] HOR-3017 --- workflow/engine/classes/class.processMap.php | 4 +- .../processes/processes_webEntryGenerate.php | 24 +++++++++++- .../ProcessMaker/BusinessModel/WebEntry.php | 38 ++++++++++++++----- .../templates/processes/webentryPost.tpl | 19 ++-------- 4 files changed, 59 insertions(+), 26 deletions(-) diff --git a/workflow/engine/classes/class.processMap.php b/workflow/engine/classes/class.processMap.php index e25409106..b5546c23f 100644 --- a/workflow/engine/classes/class.processMap.php +++ b/workflow/engine/classes/class.processMap.php @@ -2916,13 +2916,15 @@ class processMap if ($archivo != '..') { $one = 0; $two = 0; + $three = 0; $alink = $link . $archivo; $one = count(explode('wsClient.php', $archivo)); $two = count(explode('Post.php', $archivo)); + $three = count(explode('Info.php', $archivo)); - if ($one == 1 && $two == 1) { + if ($one == 1 && $two == 1 && $three == 1) { $arlink = "" . $alink . ""; $linkdelete = sprintf("delete", $alink, $archivo, $sProcessUID); $row[] = array('W_LINK' => $arlink, 'W_FILENAME' => $archivo, 'W_PRO_UID' => $sProcessUID ); diff --git a/workflow/engine/methods/processes/processes_webEntryGenerate.php b/workflow/engine/methods/processes/processes_webEntryGenerate.php index 551c0cd87..7e42df04b 100644 --- a/workflow/engine/methods/processes/processes_webEntryGenerate.php +++ b/workflow/engine/methods/processes/processes_webEntryGenerate.php @@ -60,7 +60,28 @@ try { $sContent .= "\$G_PUBLISH->AddContent('dynaform', 'xmlform', '" . $sPRO_UID . '/' . $sDYNAFORM . "', '', array(), '" . $dynTitle . 'Post.php' . "');\n"; $sContent .= "G::RenderPage('publish', 'blank');"; file_put_contents( $pathProcess . $dynTitle . '.php', $sContent ); - //creating the second file, the post file who receive the post form. + + //Create file to display information and prevent resubmission data (Post/Redirect/Get). + $fileNamePreventResubmission = $pathProcess . $dynTitle . "Info.php"; + $filePreventResubmission = "" + . "AddContent(\"xmlform\", \"xmlform\", \$show, \"\", \$message);\n" + . "G::RenderPage(\"publish\", \"blank\");\n" + . "\n"; + file_put_contents($fileNamePreventResubmission, $filePreventResubmission); + +//creating the second file, the post file who receive the post form. $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower( $pluginTpl ); $template->prepare(); @@ -72,6 +93,7 @@ try { $template->assign( 'wsUser', $sWS_USER ); $template->assign( 'wsPass', Bootstrap::hashPassword($sWS_PASS, '', true) ); $template->assign( 'wsRoundRobin', $sWS_ROUNDROBIN ); + $template->assign( 'weTitle', $dynTitle); G::auditLog('WebEntry','Generate web entry with web services ('.$dynTitle.'.php) in process "'.$resultProcess['PRO_TITLE'].'"'); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index a87056233..91c5ef326 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -398,27 +398,46 @@ class WebEntry $weTitle = $this->sanitizeFilename($arrayWebEntryData["WE_TITLE"]); $fileName = $weTitle; - $fileContent = " \"" . $arrayWebEntryData["DYN_UID"] . "\"));\n"; - $fileContent .= "if (\$a->isResponsive()) {"; - $fileContent .= " \$a->printWebEntry(\"" . $fileName . "Post.php\");"; - $fileContent .= "} else {"; - $fileContent .= " \$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . PATH_SEP . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n"; - $fileContent .= " G::RenderPage(\"publish\", \"blank\");"; - $fileContent .= "}"; + $fileContent .= "if (\$a->isResponsive()) {\n"; + $fileContent .= " \$a->printWebEntry(\"" . $fileName . "Post.php\");\n"; + $fileContent .= "} else {\n"; + $fileContent .= " \$G_PUBLISH->AddContent(\"dynaform\", \"xmlform\", \"" . $processUid . PATH_SEP . $dynaFormUid . "\", \"\", array(), \"" . $fileName . "Post.php\");\n"; + $fileContent .= " G::RenderPage(\"publish\", \"blank\");\n"; + $fileContent .= "}\n"; file_put_contents($pathDataPublicProcess . PATH_SEP . $fileName . ".php", $fileContent); + //Create file to display information and prevent resubmission data (Post/Redirect/Get). + $fileNamePreventResubmission = $pathDataPublicProcess . PATH_SEP . $weTitle . "Info.php"; + $filePreventResubmission = "" + . "AddContent(\"xmlform\", \"xmlform\", \$show, \"\", \$message);\n" + . "G::RenderPage(\"publish\", \"blank\");\n" + . "\n"; + file_put_contents($fileNamePreventResubmission, $filePreventResubmission); + //Creating the second file, the post file who receive the post form. $pluginTpl = PATH_TPL . "processes" . PATH_SEP . "webentryPost.tpl"; @@ -433,6 +452,7 @@ class WebEntry $template->assign("wsUser", $usrUsername); $template->assign("wsPass", \Bootstrap::getPasswordHashType() . ':' . $usrPassword); $template->assign("wsRoundRobin", $wsRoundRobin); + $template->assign("weTitle", $weTitle); if ($webEntryInputDocumentAccess == 0) { //Restricted to process permissions diff --git a/workflow/engine/templates/processes/webentryPost.tpl b/workflow/engine/templates/processes/webentryPost.tpl index 92785f237..ae6b5f0a2 100644 --- a/workflow/engine/templates/processes/webentryPost.tpl +++ b/workflow/engine/templates/processes/webentryPost.tpl @@ -16,13 +16,6 @@ define("WS_USER_PASS", "{wsPass}"); define("WS_ROUNDROBIN", "{wsRoundRobin}"); try { - if (isset($_SESSION["__submitFormWebEntry__"]) && $_SESSION["__submitFormWebEntry__"] === true) { - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent("xmlform", "xmlform", "login/showInfo", "", $_SESSION["__submitFormWebEntryData__"]); - G::RenderPage("publish", "blank"); - exit(); - } - @include_once ("wsClient.php"); if (!function_exists("ws_open")){ @@ -200,15 +193,11 @@ try { exit( 0 ); } /*----------------------------------********---------------------------------*/ - $G_PUBLISH = new Publisher(); - $G_PUBLISH->AddContent("xmlform", "xmlform", "login/showInfo", "", $aMessage); - G::RenderPage("publish", "blank"); - $_SESSION["__submitFormWebEntry__"] = true; - $_SESSION["__submitFormWebEntryData__"] = $aMessage; + $_SESSION["__webEntrySuccess__"] = $aMessage; + header("location:{weTitle}Info.php"); } catch (Exception $e) { - $G_PUBLISH = new Publisher(); $suggest_message = "This web entry should be regenerated, please contact to your system administrator."; $aMessage["MESSAGE"] = "
" . $e->getMessage() . "
" . $suggest_message . "
"; - $G_PUBLISH->AddContent("xmlform", "xmlform", "login/showMessage", "", $aMessage); - G::RenderPage("publish", "blank"); + $_SESSION["__webEntryError__"] = $aMessage; + header("location:{weTitle}Info.php"); } From 6a0e1afc659df7cb486250e9f6a6c5c2745ca041 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 5 May 2017 10:18:04 -0400 Subject: [PATCH 4/5] HOR-3017 --- .../processes/processes_webEntryGenerate.php | 21 +-------- .../ProcessMaker/BusinessModel/WebEntry.php | 44 +++++++++++-------- .../templates/processes/webentryPost.tpl | 2 +- 3 files changed, 29 insertions(+), 38 deletions(-) diff --git a/workflow/engine/methods/processes/processes_webEntryGenerate.php b/workflow/engine/methods/processes/processes_webEntryGenerate.php index 7e42df04b..6d24135fe 100644 --- a/workflow/engine/methods/processes/processes_webEntryGenerate.php +++ b/workflow/engine/methods/processes/processes_webEntryGenerate.php @@ -62,26 +62,9 @@ try { file_put_contents( $pathProcess . $dynTitle . '.php', $sContent ); //Create file to display information and prevent resubmission data (Post/Redirect/Get). - $fileNamePreventResubmission = $pathProcess . $dynTitle . "Info.php"; - $filePreventResubmission = "" - . "AddContent(\"xmlform\", \"xmlform\", \$show, \"\", \$message);\n" - . "G::RenderPage(\"publish\", \"blank\");\n" - . "\n"; - file_put_contents($fileNamePreventResubmission, $filePreventResubmission); + \ProcessMaker\BusinessModel\WebEntry::createFileInfo($pathProcess . $dynTitle . "Info.php"); -//creating the second file, the post file who receive the post form. + //creating the second file, the post file who receive the post form. $pluginTpl = PATH_CORE . 'templates' . PATH_SEP . 'processes' . PATH_SEP . 'webentryPost.tpl'; $template = new TemplatePower( $pluginTpl ); $template->prepare(); diff --git a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php index 91c5ef326..bc8fb90c1 100644 --- a/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php +++ b/workflow/engine/src/ProcessMaker/BusinessModel/WebEntry.php @@ -419,24 +419,7 @@ class WebEntry file_put_contents($pathDataPublicProcess . PATH_SEP . $fileName . ".php", $fileContent); //Create file to display information and prevent resubmission data (Post/Redirect/Get). - $fileNamePreventResubmission = $pathDataPublicProcess . PATH_SEP . $weTitle . "Info.php"; - $filePreventResubmission = "" - . "AddContent(\"xmlform\", \"xmlform\", \$show, \"\", \$message);\n" - . "G::RenderPage(\"publish\", \"blank\");\n" - . "\n"; - file_put_contents($fileNamePreventResubmission, $filePreventResubmission); + self::createFileInfo($pathDataPublicProcess . PATH_SEP . $weTitle . "Info.php"); //Creating the second file, the post file who receive the post form. $pluginTpl = PATH_TPL . "processes" . PATH_SEP . "webentryPost.tpl"; @@ -1054,5 +1037,30 @@ class WebEntry return $result; } + /** + * Create file to display information and prevent resubmission data (Post/Redirect/Get). + * @param string $pathFileName + */ + public static function createFileInfo($pathFileName) + { + $code = "" + . "AddContent(\"xmlform\", \"xmlform\", \$show, \"\", \$message);\n" + . "G::RenderPage(\"publish\", \"blank\");\n" + . "\n"; + file_put_contents($pathFileName, $code); + } + } diff --git a/workflow/engine/templates/processes/webentryPost.tpl b/workflow/engine/templates/processes/webentryPost.tpl index ae6b5f0a2..c7942063c 100644 --- a/workflow/engine/templates/processes/webentryPost.tpl +++ b/workflow/engine/templates/processes/webentryPost.tpl @@ -194,7 +194,7 @@ try { } /*----------------------------------********---------------------------------*/ $_SESSION["__webEntrySuccess__"] = $aMessage; - header("location:{weTitle}Info.php"); + G::header("location:{weTitle}Info.php"); } catch (Exception $e) { $suggest_message = "This web entry should be regenerated, please contact to your system administrator."; $aMessage["MESSAGE"] = "
" . $e->getMessage() . "
" . $suggest_message . "
"; From e6326dc1d934bb4c945e19a8a651eb5517afc551 Mon Sep 17 00:00:00 2001 From: Roly Rudy Gutierrez Pinto Date: Fri, 5 May 2017 10:19:48 -0400 Subject: [PATCH 5/5] HOR-3017 --- workflow/engine/templates/processes/webentryPost.tpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/engine/templates/processes/webentryPost.tpl b/workflow/engine/templates/processes/webentryPost.tpl index c7942063c..772f5d021 100644 --- a/workflow/engine/templates/processes/webentryPost.tpl +++ b/workflow/engine/templates/processes/webentryPost.tpl @@ -199,5 +199,5 @@ try { $suggest_message = "This web entry should be regenerated, please contact to your system administrator."; $aMessage["MESSAGE"] = "
" . $e->getMessage() . "
" . $suggest_message . "
"; $_SESSION["__webEntryError__"] = $aMessage; - header("location:{weTitle}Info.php"); + G::header("location:{weTitle}Info.php"); }