This commit is contained in:
Roly Rudy Gutierrez Pinto
2017-05-04 10:59:38 -04:00
parent edeea2eb98
commit 87de43d90a
4 changed files with 59 additions and 26 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,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 = ""
. "<?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($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'].'"');

View File

@@ -398,7 +398,7 @@ 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";
@@ -406,19 +406,38 @@ 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";
$fileContent .= "if (\$a->isResponsive()) {";
$fileContent .= " \$a->printWebEntry(\"" . $fileName . "Post.php\");";
$fileContent .= "} else {";
$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\");";
$fileContent .= "}";
$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 = ""
. "<?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($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

View File

@@ -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"] = "<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;
header("location:{weTitle}Info.php");
}