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

@@ -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 = "<a href='" . $alink . "' target='blank'><font color='#9999CC'>" . $alink . "</font></a>";
$linkdelete = sprintf("<a href='javascript:webEntry_delete(\"%s\",\"%s\",\"%s\");'><font color='red'>delete</font></a>", $alink, $archivo, $sProcessUID);
$row[] = array('W_LINK' => $arlink, 'W_FILENAME' => $archivo, 'W_PRO_UID' => $sProcessUID );

View File

@@ -60,6 +60,10 @@ 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 );
//Create file to display information and prevent resubmission data (Post/Redirect/Get).
\ProcessMaker\BusinessModel\WebEntry::createFileInfo($pathProcess . $dynTitle . "Info.php");
//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 );
@@ -72,6 +76,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'].'"');

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);
}
}

View File

@@ -193,13 +193,11 @@ try {
exit( 0 );
}
/*----------------------------------********---------------------------------*/
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent("xmlform", "xmlform", "login/showInfo", "", $aMessage);
G::RenderPage("publish", "blank");
$_SESSION["__webEntrySuccess__"] = $aMessage;
G::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"] = "<font color=\"red\"><pre>" . $e->getMessage() . "</pre>" . $suggest_message . "</font>";
$G_PUBLISH->AddContent("xmlform", "xmlform", "login/showMessage", "", $aMessage);
G::RenderPage("publish", "blank");
$_SESSION["__webEntryError__"] = $aMessage;
G::header("location:{weTitle}Info.php");
}