Merged in bugfix/HOR-3017 (pull request #5632)

HOR-3017

Approved-by: Julio Cesar Laura Avendaño <contact@julio-laura.com>
This commit is contained in:
Roly
2017-05-05 17:45:22 +00:00
committed by Julio Cesar Laura Avendaño
4 changed files with 49 additions and 15 deletions

View File

@@ -398,10 +398,10 @@ class WebEntry
$weTitle = $this->sanitizeFilename($arrayWebEntryData["WE_TITLE"]);
$fileName = $weTitle;
$fileContent = "<?php\n";
$fileContent = "<?php\n\n";
$fileContent .= "global \$_DBArray;\n";
$fileContent .= "if (!isset(\$_DBArray)) {\n";
$fileContent .= " \$_DBArray = array();\n";
$fileContent .= " \$_DBArray = array();\n";
$fileContent .= "}\n";
$fileContent .= "\$_SESSION[\"PROCESS\"] = \"" . $processUid . "\";\n";
$fileContent .= "\$_SESSION[\"CURRENT_DYN_UID\"] = \"" . $dynaFormUid . "\";\n";
@@ -409,15 +409,18 @@ class WebEntry
$fileContent .= "G::LoadClass(\"pmDynaform\");\n";
$fileContent .= "\$a = new pmDynaform(array(\"CURRENT_DYNAFORM\" => \"" . $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).
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";
@@ -432,6 +435,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
@@ -1033,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 = ""
. "<?php\n"
. "\n"
. "\$G_PUBLISH = new Publisher();\n"
. "\$show = \"login/showMessage\";\n"
. "\$message = \"\";\n"
. "if (isset(\$_SESSION[\"__webEntrySuccess__\"])) {\n"
. " \$show = \"login/showInfo\";\n"
. " \$message = \$_SESSION[\"__webEntrySuccess__\"];\n"
. "} else {\n"
. " \$show = \"login/showMessage\";\n"
. " \$message = \$_SESSION[\"__webEntryError__\"];\n"
. "}\n"
. "\$G_PUBLISH->AddContent(\"xmlform\", \"xmlform\", \$show, \"\", \$message);\n"
. "G::RenderPage(\"publish\", \"blank\");\n"
. "\n";
file_put_contents($pathFileName, $code);
}
}