Merge remote branch 'upstream/master'

This commit is contained in:
Marco Antonio Nina
2014-09-01 12:08:48 -04:00
12 changed files with 277 additions and 175 deletions

View File

@@ -225,6 +225,12 @@ class headPublisher
} }
$head = $head . " $head = $head . "
<noscript>
<div>
". G::LoadTranslation( 'ID_ERROR_JS_NOT_AVAILABLE' )."
</div>
</noscript>
<script type=\"text/javascript\"> <script type=\"text/javascript\">
var BROWSER_CACHE_FILES_UID = \"" . G::browserCacheFilesGetUid() . "\"; var BROWSER_CACHE_FILES_UID = \"" . G::browserCacheFilesGetUid() . "\";
</script> </script>

View File

@@ -54,33 +54,47 @@ $bCronIsRunning = false;
$sLastExecution = null; $sLastExecution = null;
$processcTimeProcess = 0; $processcTimeProcess = 0;
$processcTimeStart = 0; $processcTimeStart = 0;
if (file_exists(PATH_DATA . "cron")) {
$force = false; $force = false;
for ($i = 1; $i <= count($argv) - 1; $i++) { $osIsLinux = strtoupper(substr(PHP_OS, 0, 3)) != "WIN";
if (strpos($argv[$i], "+force") !== false) {
$force = true; for ($i = 1; $i <= count($argv) - 1; $i++) {
unset($argv[$i]); if (strpos($argv[$i], "+force") !== false) {
break; $force = true;
} unset($argv[$i]);
} break;
if (!$force) {
$arrayCron = unserialize(trim(@file_get_contents(PATH_DATA . "cron")));
$bCronIsRunning = (boolean)($arrayCron["bCronIsRunning"]);
$sLastExecution = $arrayCron["sLastExecution"];
$processcTimeProcess = (isset($arrayCron["processcTimeProcess"]))? intval($arrayCron["processcTimeProcess"]) : 10; //Minutes
$processcTimeStart = (isset($arrayCron["processcTimeStart"]))? $arrayCron["processcTimeStart"] : 0;
} else {
G::rm_dir(PATH_DATA . "cron");
}
}
if ($bCronIsRunning && $processcTimeStart != 0) {
if ((time() - $processcTimeStart) > ($processcTimeProcess * 60)) {
//Cron finished his execution for some reason
$bCronIsRunning = false;
} }
} }
if (!$bCronIsRunning) { if (!$force && file_exists(PATH_DATA . "cron")) {
//Windows flag
//Get data of cron file
$arrayCron = unserialize(trim(file_get_contents(PATH_DATA . "cron")));
$bCronIsRunning = (boolean)($arrayCron["bCronIsRunning"]);
$sLastExecution = $arrayCron["sLastExecution"];
$processcTimeProcess = (isset($arrayCron["processcTimeProcess"]))? (int)($arrayCron["processcTimeProcess"]) : 10; //Minutes
$processcTimeStart = (isset($arrayCron["processcTimeStart"]))? $arrayCron["processcTimeStart"] : 0;
}
if (!$force && $osIsLinux) {
//Linux flag
//Check if cron it's running
exec("ps -fea | grep cron.php | grep -v grep", $arrayOutput);
if (count($arrayOutput) > 1) {
$bCronIsRunning = true;
}
}
//if (!$force && $bCronIsRunning && $processcTimeStart != 0) {
// if ((time() - $processcTimeStart) > ($processcTimeProcess * 60)) {
// //Cron finished his execution for some reason
// $bCronIsRunning = false;
// }
//}
if ($force || !$bCronIsRunning) {
//Start cron //Start cron
$arrayCron = array("bCronIsRunning" => "1", "sLastExecution" => date("Y-m-d H:i:s")); $arrayCron = array("bCronIsRunning" => "1", "sLastExecution" => date("Y-m-d H:i:s"));
@file_put_contents(PATH_DATA . "cron", serialize($arrayCron)); @file_put_contents(PATH_DATA . "cron", serialize($arrayCron));

View File

@@ -1,6 +1,6 @@
<?php <?php
/** /**
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2012 Colosa Inc.23 * Copyright (C) 2004 - 2012 Colosa Inc.23
* *
@@ -19,7 +19,7 @@
* *
* For more information, contact Colosa Inc, 5304 Ventura Drive, * For more information, contact Colosa Inc, 5304 Ventura Drive,
* Delray Beach, FL, 33484, USA, or email info@colosa.com. * Delray Beach, FL, 33484, USA, or email info@colosa.com.
* *
*/ */
// check script parameters // check script parameters
@@ -28,18 +28,18 @@
//(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip')) //(count ($argv) == 4) || ((count ($argv) == 5) && ($argv [3] != '-skip'))
$commandLineSyntaxMsg = "Invalid command line arguments: \n " . $commandLineSyntaxMsg = "Invalid command line arguments: \n " .
"syntax: ". "syntax: ".
"php reindex_solr.php [workspace_name] [reindexall|reindexmissing|optimizeindex|reindexone] [-skip {record_number}] [-reindextrunksize {trunk_size}] [-appuid {APP_UID}]\n" . "php reindex_solr.php [workspace_name] [reindexall|reindexmissing|optimizeindex|reindexone] [-skip {record_number}] [-reindextrunksize {trunk_size}] [-appuid {APP_UID}]\n" .
" Where \n". " Where \n".
" reindexall : reindex all the database. \n" . " reindexall : reindex all the database. \n" .
" reindexmissing: reindex only the missing records stored in database. \n". " reindexmissing: reindex only the missing records stored in database. \n".
" (records defined in APP_SOLR_QUEUE table are required)\n" . " (records defined in APP_SOLR_QUEUE table are required)\n" .
" optimizeindex: optimize the changes in the search index. (used to get faster results) \n" . " optimizeindex: optimize the changes in the search index. (used to get faster results) \n" .
" Optional Options: \n" . " Optional Options: \n" .
" -skip {record_number}: used to skip a number of records. \n ex: -skip 10000 //skips the first 10000 records. \n" . " -skip {record_number}: used to skip a number of records. \n ex: -skip 10000 //skips the first 10000 records. \n" .
" -reindextrunksize {trunk_size}: specify the number of records sent to index each time. \n ex: -reindextrunksize 100 //(default = 1000) \n Reduce the trunk if using big documents, and memory is not enough. \n"; " -reindextrunksize {trunk_size}: specify the number of records sent to index each time. \n ex: -reindextrunksize 100 //(default = 1000) \n Reduce the trunk if using big documents, and memory is not enough. \n";
if ( (count ($argv) < 3) || ((count ($argv) % 2) == 0) || if ( (count ($argv) < 3) || ((count ($argv) % 2) == 0) ||
($argv [2] != 'reindexall' && $argv [2] != 'reindexmissing' && $argv [2] != 'optimizeindex' && $argv [2] != 'reindexone')) { ($argv [2] != 'reindexall' && $argv [2] != 'reindexmissing' && $argv [2] != 'optimizeindex' && $argv [2] != 'reindexone')) {
print $commandLineSyntaxMsg; print $commandLineSyntaxMsg;
die (); die ();
} }
@@ -64,7 +64,7 @@ if(count ($argv) > 3) {
if($argv [$argNumber] == '-appuid') { if($argv [$argNumber] == '-appuid') {
//use skip option //use skip option
$appUid = $argv [$argNumber + 1]; $appUid = $argv [$argNumber + 1];
} }
} }
else { else {
print $commandLineSyntaxMsg; print $commandLineSyntaxMsg;
@@ -106,7 +106,7 @@ if (! defined ('PATH_HOME')) {
array_pop ($docuroot); array_pop ($docuroot);
$pathOutTrunk = implode (PATH_SEP, $docuroot) . PATH_SEP; $pathOutTrunk = implode (PATH_SEP, $docuroot) . PATH_SEP;
// to do: check previous algorith for Windows $pathTrunk = "c:/home/"; // to do: check previous algorith for Windows $pathTrunk = "c:/home/";
define ('PATH_HOME', $pathhome); define ('PATH_HOME', $pathhome);
define ('PATH_TRUNK', $pathTrunk); define ('PATH_TRUNK', $pathTrunk);
define ('PATH_OUTTRUNK', $pathOutTrunk); define ('PATH_OUTTRUNK', $pathOutTrunk);
@@ -176,20 +176,6 @@ if (! defined ('PATH_HOME')) {
// G::loadClass('pmScript'); // G::loadClass('pmScript');
// //default values
// $bCronIsRunning = false;
// $sLastExecution = '';
// if ( file_exists(PATH_DATA . 'cron') ) {
// $aAux = unserialize( trim( @file_get_contents(PATH_DATA . 'cron')) );
// $bCronIsRunning = (boolean)$aAux['bCronIsRunning'];
// $sLastExecution = $aAux['sLastExecution'];
// }
// else {
// //if not exists the file, just create a new one with current date
// @file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' =>
// '1', 'sLastExecution' => date('Y-m-d H:i:s'))));
// }
print "PATH_HOME: " . PATH_HOME . "\n"; print "PATH_HOME: " . PATH_HOME . "\n";
print "PATH_DB: " . PATH_DB . "\n"; print "PATH_DB: " . PATH_DB . "\n";
print "PATH_CORE: " . PATH_CORE . "\n"; print "PATH_CORE: " . PATH_CORE . "\n";
@@ -199,19 +185,19 @@ if (! defined ('SYS_SYS')) {
$sObject = $workspaceName; $sObject = $workspaceName;
$sNow = ''; // $argv[2]; $sNow = ''; // $argv[2];
$sFilter = ''; $sFilter = '';
for ($i = 3; $i < count ($argv); $i++) { for ($i = 3; $i < count ($argv); $i++) {
$sFilter .= ' ' . $argv [$i]; $sFilter .= ' ' . $argv [$i];
} }
$oDirectory = dir (PATH_DB); $oDirectory = dir (PATH_DB);
if (is_dir (PATH_DB . $sObject)) { if (is_dir (PATH_DB . $sObject)) {
saveLog ('main', 'action', "checking folder " . PATH_DB . $sObject); saveLog ('main', 'action', "checking folder " . PATH_DB . $sObject);
if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) { if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) {
define ('SYS_SYS', $sObject); define ('SYS_SYS', $sObject);
// **************************************** // ****************************************
// read initialize file // read initialize file
require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
@@ -219,16 +205,16 @@ if (! defined ('SYS_SYS')) {
define ('MEMCACHED_ENABLED', $config ['memcached']); define ('MEMCACHED_ENABLED', $config ['memcached']);
define ('MEMCACHED_SERVER', $config ['memcached_server']); define ('MEMCACHED_SERVER', $config ['memcached_server']);
define ('TIME_ZONE', $config ['time_zone']); define ('TIME_ZONE', $config ['time_zone']);
date_default_timezone_set (TIME_ZONE); date_default_timezone_set (TIME_ZONE);
print "TIME_ZONE: " . TIME_ZONE . "\n"; print "TIME_ZONE: " . TIME_ZONE . "\n";
print "MEMCACHED_ENABLED: " . MEMCACHED_ENABLED . "\n"; print "MEMCACHED_ENABLED: " . MEMCACHED_ENABLED . "\n";
print "MEMCACHED_SERVER: " . MEMCACHED_SERVER . "\n"; print "MEMCACHED_SERVER: " . MEMCACHED_SERVER . "\n";
// **************************************** // ****************************************
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php'); include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php');
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
// ***************** PM Paths DATA ************************** // ***************** PM Paths DATA **************************
define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/'); define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
@@ -238,7 +224,7 @@ if (! defined ('SYS_SYS')) {
define ('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/'); define ('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/');
define ('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP); define ('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP);
define ('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP); define ('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP);
// server info file // server info file
if (is_file (PATH_DATA_SITE . PATH_SEP . '.server_info')) { if (is_file (PATH_DATA_SITE . PATH_SEP . '.server_info')) {
$SERVER_INFO = file_get_contents (PATH_DATA_SITE . PATH_SEP . '.server_info'); $SERVER_INFO = file_get_contents (PATH_DATA_SITE . PATH_SEP . '.server_info');
@@ -250,10 +236,10 @@ if (! defined ('SYS_SYS')) {
else { else {
eprintln ("WARNING! No server info found!", 'red'); eprintln ("WARNING! No server info found!", 'red');
} }
// read db configuration // read db configuration
$sContent = file_get_contents (PATH_DB . $sObject . PATH_SEP . 'db.php'); $sContent = file_get_contents (PATH_DB . $sObject . PATH_SEP . 'db.php');
$sContent = str_replace ('<?php', '', $sContent); $sContent = str_replace ('<?php', '', $sContent);
$sContent = str_replace ('<?', '', $sContent); $sContent = str_replace ('<?', '', $sContent);
$sContent = str_replace ('?>', '', $sContent); $sContent = str_replace ('?>', '', $sContent);
@@ -261,7 +247,7 @@ if (! defined ('SYS_SYS')) {
$sContent = str_replace ("('", "$", $sContent); $sContent = str_replace ("('", "$", $sContent);
$sContent = str_replace ("',", '=', $sContent); $sContent = str_replace ("',", '=', $sContent);
$sContent = str_replace (");", ';', $sContent); $sContent = str_replace (");", ';', $sContent);
eval ($sContent); eval ($sContent);
$dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME; $dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME;
$dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/' . $DB_RBAC_NAME; $dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/' . $DB_RBAC_NAME;
@@ -293,7 +279,7 @@ if (! defined ('SYS_SYS')) {
fclose ($oFile); fclose ($oFile);
Propel::init (PATH_CORE . 'config/_databases_.php'); Propel::init (PATH_CORE . 'config/_databases_.php');
// Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection'); // Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
eprintln ("Processing workspace: " . $sObject, 'green'); eprintln ("Processing workspace: " . $sObject, 'green');
try { try {
processWorkspace (); processWorkspace ();
@@ -312,10 +298,6 @@ else {
processWorkspace (); processWorkspace ();
} }
// finally update the file
// @file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' =>
// '0', 'sLastExecution' => date('Y-m-d H:i:s'))));
function processWorkspace() function processWorkspace()
{ {
global $sLastExecution; global $sLastExecution;
@@ -323,16 +305,16 @@ function processWorkspace()
global $SkipRecords; global $SkipRecords;
global $TrunkSize; global $TrunkSize;
global $appUid; global $appUid;
try { try {
if (($solrConf = System::solrEnv (SYS_SYS)) !== false) { if (($solrConf = System::solrEnv (SYS_SYS)) !== false) {
G::LoadClass ('AppSolr'); G::LoadClass ('AppSolr');
print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n"; print "Solr Configuration file: " . PATH_DATA_SITE . "env.ini\n";
print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n"; print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";
print "solr_host: " . $solrConf ['solr_host'] . "\n"; print "solr_host: " . $solrConf ['solr_host'] . "\n";
print "solr_instance: " . $solrConf ['solr_instance'] . "\n"; print "solr_instance: " . $solrConf ['solr_instance'] . "\n";
$oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']); $oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']);
if ($ScriptAction == "reindexall") { if ($ScriptAction == "reindexall") {
$oAppSolr->reindexAllApplications ($SkipRecords, $TrunkSize); $oAppSolr->reindexAllApplications ($SkipRecords, $TrunkSize);
@@ -353,7 +335,7 @@ function processWorkspace()
else { else {
print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini"; print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini";
} }
} }
catch (Exception $oError) { catch (Exception $oError) {
saveLog ("main", "error", "Error processing workspace : " . $oError->getMessage () . "\n"); saveLog ("main", "error", "Error processing workspace : " . $oError->getMessage () . "\n");
@@ -366,7 +348,7 @@ function saveLog($sSource, $sType, $sDescription)
global $isDebug; global $isDebug;
if ($isDebug) if ($isDebug)
print date ('H:i:s') . " ($sSource) $sType $sDescription <br>\n"; print date ('H:i:s') . " ($sSource) $sType $sDescription <br>\n";
G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true); G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true);
$message = '(' . $sSource . ') ' . $sDescription . "\n"; $message = '(' . $sSource . ') ' . $sDescription . "\n";
if ($sType == 'action') { if ($sType == 'action') {
@@ -386,7 +368,7 @@ function setExecutionMessage($m)
$len = strlen ($m); $len = strlen ($m);
$linesize = 60; $linesize = 60;
$rOffset = $linesize - $len; $rOffset = $linesize - $len;
eprint ("* $m"); eprint ("* $m");
for ($i = 0; $i < $rOffset; $i++) for ($i = 0; $i < $rOffset; $i++)
eprint ('.'); eprint ('.');

View File

@@ -1,6 +1,6 @@
<?php <?php
/** /**
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
* Copyright (C) 2004 - 2012 Colosa Inc.23 * Copyright (C) 2004 - 2012 Colosa Inc.23
* *
@@ -19,7 +19,7 @@
* *
* For more information, contact Colosa Inc, 5304 Ventura Drive, * For more information, contact Colosa Inc, 5304 Ventura Drive,
* Delray Beach, FL, 33484, USA, or email info@colosa.com. * Delray Beach, FL, 33484, USA, or email info@colosa.com.
* *
*/ */
// check script parameters // check script parameters
@@ -29,13 +29,13 @@
$commandLineSyntaxMsg = "Invalid command line arguments: \n " . $commandLineSyntaxMsg = "Invalid command line arguments: \n " .
"Verify the list of cases comparing db vs solr lists by user if usr_uid is specify only verify one user otherwhise all users ". "Verify the list of cases comparing db vs solr lists by user if usr_uid is specify only verify one user otherwhise all users ".
"syntax: ". "syntax: ".
"php verify_solr.php [workspace_name] [-usruid {USR_UID}]\n" . "php verify_solr.php [workspace_name] [-usruid {USR_UID}]\n" .
" Where \n". " Where \n".
" workspace_name : is the workspace that is being verified. \n" . " workspace_name : is the workspace that is being verified. \n" .
" Optional Options: \n" . " Optional Options: \n" .
" -usruid {USR_UID}: verify only one user with the specified user uid. \n "; " -usruid {USR_UID}: verify only one user with the specified user uid. \n ";
if ( (count ($argv) < 2) || ((count ($argv) > 2) && ((count ($argv) % 2) != 0))) { if ( (count ($argv) < 2) || ((count ($argv) > 2) && ((count ($argv) % 2) != 0))) {
print $commandLineSyntaxMsg; print $commandLineSyntaxMsg;
die (); die ();
} }
@@ -43,7 +43,7 @@ $workspaceName = $argv [1];
$usrUid = ""; $usrUid = "";
if((count ($argv) > 2)){ if((count ($argv) > 2)){
$usrUid = $argv [3]; $usrUid = $argv [3];
} }
ini_set ('display_errors', 1); ini_set ('display_errors', 1);
@@ -70,13 +70,13 @@ if (! defined ('PATH_HOME')) {
array_pop ($docuroot); array_pop ($docuroot);
$pathOutTrunk = implode (PATH_SEP, $docuroot) . PATH_SEP; $pathOutTrunk = implode (PATH_SEP, $docuroot) . PATH_SEP;
// to do: check previous algorith for Windows $pathTrunk = "c:/home/"; // to do: check previous algorith for Windows $pathTrunk = "c:/home/";
define ('PATH_HOME', $pathhome); define ('PATH_HOME', $pathhome);
define ('PATH_TRUNK', $pathTrunk); define ('PATH_TRUNK', $pathTrunk);
define ('PATH_OUTTRUNK', $pathOutTrunk); define ('PATH_OUTTRUNK', $pathOutTrunk);
require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); require_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
G::LoadThirdParty ('pear/json', 'class.json'); G::LoadThirdParty ('pear/json', 'class.json');
G::LoadThirdParty ('smarty/libs', 'Smarty.class'); G::LoadThirdParty ('smarty/libs', 'Smarty.class');
G::LoadSystem ('error'); G::LoadSystem ('error');
@@ -107,20 +107,6 @@ require_once 'classes/model/AppEvent.php';
require_once 'classes/model/CaseScheduler.php'; require_once 'classes/model/CaseScheduler.php';
// G::loadClass('pmScript'); // G::loadClass('pmScript');
// //default values
// $bCronIsRunning = false;
// $sLastExecution = '';
// if ( file_exists(PATH_DATA . 'cron') ) {
// $aAux = unserialize( trim( @file_get_contents(PATH_DATA . 'cron')) );
// $bCronIsRunning = (boolean)$aAux['bCronIsRunning'];
// $sLastExecution = $aAux['sLastExecution'];
// }
// else {
// //if not exists the file, just create a new one with current date
// @file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' =>
// '1', 'sLastExecution' => date('Y-m-d H:i:s'))));
// }
print "PATH_HOME: " . PATH_HOME . "\n"; print "PATH_HOME: " . PATH_HOME . "\n";
print "PATH_DB: " . PATH_DB . "\n"; print "PATH_DB: " . PATH_DB . "\n";
print "PATH_CORE: " . PATH_CORE . "\n"; print "PATH_CORE: " . PATH_CORE . "\n";
@@ -131,19 +117,19 @@ if (! defined ('SYS_SYS')) {
$sNow = ''; // $argv[2]; $sNow = ''; // $argv[2];
/* /*
$sFilter = ''; $sFilter = '';
for ($i = 3; $i < count ($argv); $i++) { for ($i = 3; $i < count ($argv); $i++) {
$sFilter .= ' ' . $argv [$i]; $sFilter .= ' ' . $argv [$i];
}*/ }*/
$oDirectory = dir (PATH_DB); $oDirectory = dir (PATH_DB);
if (is_dir (PATH_DB . $sObject)) { if (is_dir (PATH_DB . $sObject)) {
saveLog ('main', 'action', "checking folder " . PATH_DB . $sObject); saveLog ('main', 'action', "checking folder " . PATH_DB . $sObject);
if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) { if (file_exists (PATH_DB . $sObject . PATH_SEP . 'db.php')) {
define ('SYS_SYS', $sObject); define ('SYS_SYS', $sObject);
// **************************************** // ****************************************
// read initialize file // read initialize file
require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php'; require_once PATH_HOME . 'engine' . PATH_SEP . 'classes' . PATH_SEP . 'class.system.php';
@@ -151,16 +137,16 @@ if (! defined ('SYS_SYS')) {
define ('MEMCACHED_ENABLED', $config ['memcached']); define ('MEMCACHED_ENABLED', $config ['memcached']);
define ('MEMCACHED_SERVER', $config ['memcached_server']); define ('MEMCACHED_SERVER', $config ['memcached_server']);
define ('TIME_ZONE', $config ['time_zone']); define ('TIME_ZONE', $config ['time_zone']);
date_default_timezone_set (TIME_ZONE); date_default_timezone_set (TIME_ZONE);
print "TIME_ZONE: " . TIME_ZONE . "\n"; print "TIME_ZONE: " . TIME_ZONE . "\n";
print "MEMCACHED_ENABLED: " . MEMCACHED_ENABLED . "\n"; print "MEMCACHED_ENABLED: " . MEMCACHED_ENABLED . "\n";
print "MEMCACHED_SERVER: " . MEMCACHED_SERVER . "\n"; print "MEMCACHED_SERVER: " . MEMCACHED_SERVER . "\n";
// **************************************** // ****************************************
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php'); include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths_installed.php');
include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php'); include_once (PATH_HOME . 'engine' . PATH_SEP . 'config' . PATH_SEP . 'paths.php');
// ***************** PM Paths DATA ************************** // ***************** PM Paths DATA **************************
define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/'); define ('PATH_DATA_SITE', PATH_DATA . 'sites/' . SYS_SYS . '/');
define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/'); define ('PATH_DOCUMENT', PATH_DATA_SITE . 'files/');
@@ -170,7 +156,7 @@ if (! defined ('SYS_SYS')) {
define ('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/'); define ('PATH_DYNAFORM', PATH_DATA_SITE . 'xmlForms/');
define ('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP); define ('PATH_IMAGES_ENVIRONMENT_FILES', PATH_DATA_SITE . 'usersFiles' . PATH_SEP);
define ('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP); define ('PATH_IMAGES_ENVIRONMENT_USERS', PATH_DATA_SITE . 'usersPhotographies' . PATH_SEP);
// server info file // server info file
if (is_file (PATH_DATA_SITE . PATH_SEP . '.server_info')) { if (is_file (PATH_DATA_SITE . PATH_SEP . '.server_info')) {
$SERVER_INFO = file_get_contents (PATH_DATA_SITE . PATH_SEP . '.server_info'); $SERVER_INFO = file_get_contents (PATH_DATA_SITE . PATH_SEP . '.server_info');
@@ -182,10 +168,10 @@ if (! defined ('SYS_SYS')) {
else { else {
eprintln ("WARNING! No server info found!", 'red'); eprintln ("WARNING! No server info found!", 'red');
} }
// read db configuration // read db configuration
$sContent = file_get_contents (PATH_DB . $sObject . PATH_SEP . 'db.php'); $sContent = file_get_contents (PATH_DB . $sObject . PATH_SEP . 'db.php');
$sContent = str_replace ('<?php', '', $sContent); $sContent = str_replace ('<?php', '', $sContent);
$sContent = str_replace ('<?', '', $sContent); $sContent = str_replace ('<?', '', $sContent);
$sContent = str_replace ('?>', '', $sContent); $sContent = str_replace ('?>', '', $sContent);
@@ -193,7 +179,7 @@ if (! defined ('SYS_SYS')) {
$sContent = str_replace ("('", "$", $sContent); $sContent = str_replace ("('", "$", $sContent);
$sContent = str_replace ("',", '=', $sContent); $sContent = str_replace ("',", '=', $sContent);
$sContent = str_replace (");", ';', $sContent); $sContent = str_replace (");", ';', $sContent);
eval ($sContent); eval ($sContent);
$dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME; $dsn = $DB_ADAPTER . '://' . $DB_USER . ':' . $DB_PASS . '@' . $DB_HOST . '/' . $DB_NAME;
$dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/' . $DB_RBAC_NAME; $dsnRbac = $DB_ADAPTER . '://' . $DB_RBAC_USER . ':' . $DB_RBAC_PASS . '@' . $DB_RBAC_HOST . '/' . $DB_RBAC_NAME;
@@ -225,7 +211,7 @@ if (! defined ('SYS_SYS')) {
fclose ($oFile); fclose ($oFile);
Propel::init (PATH_CORE . 'config/_databases_.php'); Propel::init (PATH_CORE . 'config/_databases_.php');
// Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection'); // Creole::registerDriver('dbarray', 'creole.contrib.DBArrayConnection');
eprintln ("Processing workspace: " . $sObject, 'green'); eprintln ("Processing workspace: " . $sObject, 'green');
try { try {
processWorkspace (); processWorkspace ();
@@ -244,10 +230,6 @@ else {
processWorkspace (); processWorkspace ();
} }
// finally update the file
// @file_put_contents(PATH_DATA . 'cron', serialize(array('bCronIsRunning' =>
// '0', 'sLastExecution' => date('Y-m-d H:i:s'))));
function processWorkspace() function processWorkspace()
{ {
global $sLastExecution; global $sLastExecution;
@@ -255,11 +237,11 @@ function processWorkspace()
//global $SkipRecords; //global $SkipRecords;
//global $TrunkSize; //global $TrunkSize;
global $usrUid; global $usrUid;
try { try {
//if $usrUid is not set get all the users //if $usrUid is not set get all the users
//verify inbox //verify inbox
verifyInboxList($usrUid); verifyInboxList($usrUid);
@@ -351,10 +333,10 @@ function displayMissingCases($aAppUidsDB, $aAppUidsSolr)
foreach($casesInDBNotSolr as $caseDB){ foreach($casesInDBNotSolr as $caseDB){
print " ". $caseDB . " \n"; print " ". $caseDB . " \n";
} }
print " Cases in Solr but not in DB: \n"; print " Cases in Solr but not in DB: \n";
foreach($casesInSolrNotDB as $caseSolr){ foreach($casesInSolrNotDB as $caseSolr){
print " ". $caseSolr . " \n"; print " ". $caseSolr . " \n";
} }
} }
function getListUids($usrUid, $action) function getListUids($usrUid, $action)
@@ -365,21 +347,21 @@ function getListUids($usrUid, $action)
print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n"; print "solr_enabled: " . $solrConf ['solr_enabled'] . "\n";
print "solr_host: " . $solrConf ['solr_host'] . "\n"; print "solr_host: " . $solrConf ['solr_host'] . "\n";
print "solr_instance: " . $solrConf ['solr_instance'] . "\n"; print "solr_instance: " . $solrConf ['solr_instance'] . "\n";
$oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']); $oAppSolr = new AppSolr ($solrConf ['solr_enabled'], $solrConf ['solr_host'], $solrConf ['solr_instance']);
G::LoadClass("applications"); G::LoadClass("applications");
$apps = new Applications(); $apps = new Applications();
} }
else { else {
print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini"; print "Incomplete Solr configuration. See configuration file: " . PATH_DATA_SITE . "env.ini";
return; return;
} }
//get the list of id's //get the list of id's
$userUid = $usrUid; $userUid = $usrUid;
$start = 0; $start = 0;
$limit = 1; $limit = 1;
$action = $action; //todo, $action = $action; //todo,
$filter = ''; $filter = '';
$search = ''; $search = '';
$process = ''; $process = '';
@@ -392,7 +374,7 @@ function getListUids($usrUid, $action)
$dir = 'DESC'; $dir = 'DESC';
$sort = 'APP_NUMBER'; $sort = 'APP_NUMBER';
$category = ''; $category = '';
$dataSolr = $oAppSolr->getAppGridData( $dataSolr = $oAppSolr->getAppGridData(
$userUid, $userUid,
$start, $start,
@@ -411,7 +393,7 @@ function getListUids($usrUid, $action)
$sort $sort
); );
$dataDB = $apps->getAll( $dataDB = $apps->getAll(
$userUid, $userUid,
$start, $start,
@@ -443,7 +425,7 @@ function getListUids($usrUid, $action)
$start = $i * $trunkSize; $start = $i * $trunkSize;
$limit = $trunkSize; $limit = $trunkSize;
//print " Loop $start to " . (String)($start + $trunkSize) . " \n"; //print " Loop $start to " . (String)($start + $trunkSize) . " \n";
$dataDB = $apps->getAll( $dataDB = $apps->getAll(
$userUid, $userUid,
$start, $start,
@@ -461,7 +443,7 @@ function getListUids($usrUid, $action)
$dir, $dir,
$sort, $sort,
$category $category
); );
foreach($dataDB["data"] as $caseDB){ foreach($dataDB["data"] as $caseDB){
$aAppUidsDB[] = $caseDB["APP_UID"]; $aAppUidsDB[] = $caseDB["APP_UID"];
} }
@@ -475,7 +457,7 @@ function getListUids($usrUid, $action)
$start = $i * $trunkSize; $start = $i * $trunkSize;
$limit = $trunkSize; $limit = $trunkSize;
//print " Loop $start to " . (String)($start + $trunkSize) . " \n"; //print " Loop $start to " . (String)($start + $trunkSize) . " \n";
$dataSolr = $oAppSolr->getAppGridData( $dataSolr = $oAppSolr->getAppGridData(
$userUid, $userUid,
$start, $start,
@@ -515,7 +497,7 @@ function saveLog($sSource, $sType, $sDescription)
global $isDebug; global $isDebug;
if ($isDebug) if ($isDebug)
print date ('H:i:s') . " ($sSource) $sType $sDescription <br>\n"; print date ('H:i:s') . " ($sSource) $sType $sDescription <br>\n";
G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true); G::verifyPath (PATH_DATA . 'log' . PATH_SEP, true);
$message = '(' . $sSource . ') ' . $sDescription . "\n"; $message = '(' . $sSource . ') ' . $sDescription . "\n";
if ($sType == 'action') { if ($sType == 'action') {
@@ -535,7 +517,7 @@ function setExecutionMessage($m)
$len = strlen ($m); $len = strlen ($m);
$linesize = 60; $linesize = 60;
$rOffset = $linesize - $len; $rOffset = $linesize - $len;
eprint ("* $m"); eprint ("* $m");
for ($i = 0; $i < $rOffset; $i++) for ($i = 0; $i < $rOffset; $i++)
eprint ('.'); eprint ('.');

View File

@@ -19,7 +19,6 @@ class pmDynaform
{ {
$this->dyn_uid = $dyn_uid; $this->dyn_uid = $dyn_uid;
$this->app_data = $app_data; $this->app_data = $app_data;
$this->getDynaform(); $this->getDynaform();
} }
@@ -87,6 +86,18 @@ class pmDynaform
public function printEdit($pm_run_outside_main_app, $application, $headData) public function printEdit($pm_run_outside_main_app, $application, $headData)
{ {
ob_clean(); ob_clean();
$a = $this->clientToken();
$clientToken = array(
"accessToken" => $a["access_token"],
"expiresIn" => $a["expires_in"],
"tokenType" => $a["token_type"],
"scope" => $a["scope"],
"refreshToken" => $a["refresh_token"],
"clientId" => $a["client_id"],
"clientSecret" => $a["client_secret"]
);
$file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html'); $file = file_get_contents(PATH_HOME . 'public_html/lib/pmdynaform/build/cases_Step_Pmdynaform.html');
$file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file); $file = str_replace("{JSON_DATA}", $this->record["DYN_CONTENT"], $file);
$file = str_replace("{CASE}", $headData["CASE"], $file); $file = str_replace("{CASE}", $headData["CASE"], $file);
@@ -97,9 +108,78 @@ class pmDynaform
$file = str_replace("{DYN_UID}", $this->dyn_uid, $file); $file = str_replace("{DYN_UID}", $this->dyn_uid, $file);
$file = str_replace("{DYNAFORMNAME}", $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"], $file); $file = str_replace("{DYNAFORMNAME}", $this->record["PRO_UID"] . "_" . $this->record["DYN_UID"], $file);
$file = str_replace("{APP_UID}", $application, $file); $file = str_replace("{APP_UID}", $application, $file);
$file = str_replace("{PRJ_UID}", $this->app_data["PROCESS"], $file);
$file = str_replace("{WORKSPACE}", $this->app_data["SYS_SYS"], $file);
$file = str_replace("{credentials}", json_encode($clientToken), $file);
echo $file; echo $file;
exit(); exit();
} }
} private function clientToken()
{
$client = $this->getClientCredentials();
$authCode = $this->getAuthorizationCode($client);
$request = array(
'grant_type' => 'authorization_code',
'code' => $authCode
);
$server = array(
'REQUEST_METHOD' => 'POST'
);
$headers = array(
"PHP_AUTH_USER" => $client['CLIENT_ID'],
"PHP_AUTH_PW" => $client['CLIENT_SECRET'],
"Content-Type" => "multipart/form-data;",
"Authorization" => "Basic " . base64_encode($client['CLIENT_ID'] . ":" . $client['CLIENT_SECRET'])
);
$request = new \OAuth2\Request(array(), $request, array(), array(), array(), $server, null, $headers);
$oauthServer = new \ProcessMaker\Services\OAuth2\Server();
$response = $oauthServer->getServer()->handleTokenRequest($request);
$clientToken = $response->getParameters();
$clientToken["client_id"] = $client['CLIENT_ID'];
$clientToken["client_secret"] = $client['CLIENT_SECRET'];
return $clientToken;
}
protected $clientId = 'x-pm-local-client';
protected function getClientCredentials()
{
$oauthQuery = new ProcessMaker\Services\OAuth2\PmPdo($this->getDsn());
return $oauthQuery->getClientDetails($this->clientId);
}
protected function getAuthorizationCode($client)
{
\ProcessMaker\Services\OAuth2\Server::setDatabaseSource($this->getDsn());
\ProcessMaker\Services\OAuth2\Server::setPmClientId($client['CLIENT_ID']);
$oauthServer = new \ProcessMaker\Services\OAuth2\Server();
$userId = $_SESSION['USER_LOGGED'];
$authorize = true;
$_GET = array_merge($_GET, array(
'response_type' => 'code',
'client_id' => $client['CLIENT_ID'],
'scope' => implode(' ', $oauthServer->getScope())
));
$response = $oauthServer->postAuthorize($authorize, $userId, true);
$code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=') + 5, 40);
return $code;
}
private function getDsn()
{
list($host, $port) = strpos(DB_HOST, ':') !== false ? explode(':', DB_HOST) : array(DB_HOST, '');
$port = empty($port) ? '' : ";port=$port";
$dsn = DB_ADAPTER . ':host=' . $host . ';dbname=' . DB_NAME . $port;
return array('dsn' => $dsn, 'username' => DB_USER, 'password' => DB_PASS);
}
}

View File

@@ -219,16 +219,16 @@ class PMScript
{ {
$sScript = ""; $sScript = "";
$iAux = 0; $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) { if ($iOcurrences) {
for ($i = 0; $i < $iOcurrences; $i ++) { for ($i = 0; $i < $iOcurrences; $i ++) {
$bEqual = false;
$sAux = substr( $this->sScript, $iAux, $aMatch[0][$i][1] - $iAux ); $sAux = substr( $this->sScript, $iAux, $aMatch[0][$i][1] - $iAux );
if (! $bEqual) { if (! $bEqual) {
if (strpos( $sAux, '==' ) !== false) { if (strpos($sAux, "==") !== false || strpos($sAux, "!=") !== false || strpos($sAux, ">") !== false || strpos($sAux, "<") !== false || strpos($sAux, ">=") !== false || strpos($sAux, "<=") !== false || strpos($sAux, "<>") !== false || strpos($sAux, "===") !== false || strpos($sAux, "!==") !== false) {
$bEqual = false; $bEqual = false;
} else { } else {
if (strpos( $sAux, '=' ) !== false) { if (strpos($sAux, "=") !== false || strpos($sAux, "+=") !== false || strpos($sAux, "-=") !== false || strpos($sAux, "*=") !== false || strpos($sAux, "/=") !== false || strpos($sAux, "%=") !== false || strpos($sAux, ".=") !== false) {
$bEqual = true; $bEqual = true;
} }
} }
@@ -246,22 +246,6 @@ class PMScript
} }
} }
$sScript .= $sAux; $sScript .= $sAux;
/** patch1: support for the expression: @@a = @@b = @@c = @@d; */
$bEqual = true;
if ($i < $iOcurrences - 1) {
$ii = $aMatch[0][$i][1] + strlen($aMatch[0][$i][0]);
$ss = trim(substr($this->sScript, $ii, $aMatch[0][$i + 1][1] - $ii));
} else {
$ii = $aMatch[0][$i][1] + strlen($aMatch[0][$i][0]);
$ss = trim(substr($this->sScript, $ii));
}
$sw0 = strpos($ss, '=') === 0 || strpos($ss, '+=') === 0 || strpos($ss, '-=') === 0;
$sw1 = strpos($ss, '==') === 0 || strpos($ss, '===') === 0 || strpos($ss, '!=') === 0 || strpos($ss, '!==') === 0 || strpos($ss, '<=') === 0 || strpos($ss, '>=') === 0;
$sw3 = substr(trim($sAux), strlen(trim($sAux)) - 6, strlen(trim($sAux))) === "empty(";
if (($sw0 && !$sw1) || $sw3) {
$bEqual = false;
}
/** patch1 end */
$iAux = $aMatch[0][$i][1] + strlen( $aMatch[0][$i][0] ); $iAux = $aMatch[0][$i][1] + strlen( $aMatch[0][$i][0] );
switch ($aMatch[1][$i][0]) { switch ($aMatch[1][$i][0]) {
case '@': case '@':

View File

@@ -43,13 +43,13 @@ class Home extends Controller
} }
public function login ($httpData) public function login ($httpData)
{ {
//start new session //start new session
@session_destroy(); @session_destroy();
session_start(); session_start();
session_regenerate_id(); session_regenerate_id();
$data = isset( $httpData->d ) ? unserialize( base64_decode( $httpData->d ) ) : ''; $data = isset( $httpData->d ) ? unserialize( base64_decode( $httpData->d ) ) : '';
$template = $this->clientBrowser['name'] == 'msie' ? 'login_ie' : 'login_standard'; $template = $this->clientBrowser['name'] == 'msie' ? 'login_ie' : 'login_standard';
$skin = $this->clientBrowser['name'] == 'msie' ? $this->lastSkin : 'simplified'; $skin = $this->clientBrowser['name'] == 'msie' ? $this->lastSkin : 'simplified';
@@ -94,9 +94,9 @@ class Home extends Controller
$start = 0; $start = 0;
$limit = ''; $limit = '';
$proData = $process->getAllProcesses( $start, $limit, null, null, false, true ); $proData = $process->getAllProcesses( $start, $limit, null, null, false, true );
$processList = $case->getStartCasesPerType( $_SESSION['USER_LOGGED'], 'category' ); $processList = $case->getStartCasesPerType( $_SESSION['USER_LOGGED'], 'category' );
unset( $processList[0] ); unset( $processList[0] );
$processesList = array (); $processesList = array ();
@@ -104,11 +104,11 @@ class Home extends Controller
foreach ($proData as $keyPro => $valuePro) { foreach ($proData as $keyPro => $valuePro) {
if ($valueProcess['pro_uid'] == $valuePro['PRO_UID']) { if ($valueProcess['pro_uid'] == $valuePro['PRO_UID']) {
$processesList[] = $valueProcess; $processesList[] = $valueProcess;
} }
} }
} }
$switchLink = $userProperty->getUserLocation( $_SESSION['USER_LOGGED'] ); $switchLink = $userProperty->getUserLocation( $_SESSION['USER_LOGGED'], SYS_LANG );
if (!isset($_COOKIE['workspaceSkin'])) { if (!isset($_COOKIE['workspaceSkin'])) {
if (substr( $sysConf['default_skin'], 0, 2 ) == 'ux') { if (substr( $sysConf['default_skin'], 0, 2 ) == 'ux') {
@@ -120,7 +120,7 @@ class Home extends Controller
$oServerConf = & serverConf::getSingleton(); $oServerConf = & serverConf::getSingleton();
if ($oServerConf->isRtl( SYS_LANG )) { if ($oServerConf->isRtl( SYS_LANG )) {
$swRtl = 1; $swRtl = 1;
} else { } else {
$swRtl = 0; $swRtl = 0;
} }
@@ -202,7 +202,7 @@ class Home extends Controller
} }
public function appList ($httpData) public function appList ($httpData)
{ {
// setting default list applications types [default: todo] // setting default list applications types [default: todo]
$httpData->t = isset( $httpData->t ) ? $httpData->t : 'todo'; $httpData->t = isset( $httpData->t ) ? $httpData->t : 'todo';
@@ -289,7 +289,7 @@ class Home extends Controller
} }
public function getApps ($httpData) public function getApps ($httpData)
{ {
$cases = $this->getAppsData( $httpData->t, $httpData->start, $httpData->limit ); $cases = $this->getAppsData( $httpData->t, $httpData->start, $httpData->limit );
$this->setView( $this->userUxBaseTemplate . PATH_SEP . 'applications' ); $this->setView( $this->userUxBaseTemplate . PATH_SEP . 'applications' );
@@ -312,7 +312,7 @@ class Home extends Controller
$dir = null, $dir = null,
$sort = "APP_CACHE_VIEW.APP_NUMBER", $sort = "APP_CACHE_VIEW.APP_NUMBER",
$category = null) $category = null)
{ {
require_once ("classes/model/AppNotes.php"); require_once ("classes/model/AppNotes.php");
G::LoadClass( 'applications' ); G::LoadClass( 'applications' );
@@ -564,7 +564,7 @@ class Home extends Controller
return $status; return $status;
} }
function getProcessArray($action, $userUid) function getProcessArray($action, $userUid)
{ {
global $oAppCache; global $oAppCache;
$processes = array(); $processes = array();
@@ -595,7 +595,7 @@ class Home extends Controller
$cProcess->addJoinMC($conds, Criteria::LEFT_JOIN); $cProcess->addJoinMC($conds, Criteria::LEFT_JOIN);
$cProcess->add(ProcessPeer::PRO_STATUS, "ACTIVE"); $cProcess->add(ProcessPeer::PRO_STATUS, "ACTIVE");
$oDataset = ProcessPeer::doSelectRS($cProcess); $oDataset = ProcessPeer::doSelectRS($cProcess);
$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
$oDataset->next(); $oDataset->next();

View File

@@ -25,6 +25,12 @@ $(window).load(function () {
var data = JSON.parse(jsondata); var data = JSON.parse(jsondata);
window.dynaform = new PMDynaform.core.Project({ window.dynaform = new PMDynaform.core.Project({
data: data, data: data,
keys: {
server: location.host,
projectId: prj_uid,
workspace: workspace
},
token: credentials,
submitRest: false submitRest: false
}); });

View File

@@ -14,23 +14,38 @@ if ($RBAC->userCanAccess("PM_SETUP") != 1) {
$bCronIsRunning = false; $bCronIsRunning = false;
$sLastExecution = null; $sLastExecution = null;
$processcTimeProcess = 0; $processcTimeProcess = 0;
$processcTimeStart = 0; $processcTimeStart = 0;
if (file_exists( PATH_DATA . "cron" )) { $osIsLinux = strtoupper(substr(PHP_OS, 0, 3)) != "WIN";
$arrayCron = unserialize( trim( @file_get_contents( PATH_DATA . "cron" ) ) );
$bCronIsRunning = (boolean) ($arrayCron["bCronIsRunning"]); if (file_exists(PATH_DATA . "cron")) {
//Windows flag
//Get data of cron file
$arrayCron = unserialize(trim(file_get_contents(PATH_DATA . "cron")));
$bCronIsRunning = (boolean)($arrayCron["bCronIsRunning"]);
$sLastExecution = $arrayCron["sLastExecution"]; $sLastExecution = $arrayCron["sLastExecution"];
$processcTimeProcess = (isset( $arrayCron["processcTimeProcess"] )) ? intval( $arrayCron["processcTimeProcess"] ) : 10; $processcTimeProcess = (isset($arrayCron["processcTimeProcess"]))? (int)($arrayCron["processcTimeProcess"]) : 10; //Minutes
$processcTimeStart = (isset( $arrayCron["processcTimeStart"] )) ? $arrayCron["processcTimeStart"] : 0; $processcTimeStart = (isset($arrayCron["processcTimeStart"]))? $arrayCron["processcTimeStart"] : 0;
} }
if ($bCronIsRunning && $processcTimeStart != 0) { if ($osIsLinux) {
if ((time() - $processcTimeStart) > ($processcTimeProcess * 60)) { //Linux flag
//Cron finished his execution for some reason //Check if cron it's running
$bCronIsRunning = false; exec("ps -fea | grep cron.php | grep -v grep", $arrayOutput);
if (count($arrayOutput) > 0) {
$bCronIsRunning = true;
} }
} }
//if ($bCronIsRunning && $processcTimeStart != 0) {
// if ((time() - $processcTimeStart) > ($processcTimeProcess * 60)) {
// //Cron finished his execution for some reason
// $bCronIsRunning = false;
// }
//}
//Data //Data
$c = new Configurations(); $c = new Configurations();
$configPage = $c->getConfiguration( "cronList", "pageSize", null, $_SESSION["USER_LOGGED"] ); $configPage = $c->getConfiguration( "cronList", "pageSize", null, $_SESSION["USER_LOGGED"] );

View File

@@ -25,6 +25,9 @@
var dyn_uid = '{DYN_UID}'; var dyn_uid = '{DYN_UID}';
var __DynaformName__ = '{DYNAFORMNAME}'; var __DynaformName__ = '{DYNAFORMNAME}';
var app_uid = '{APP_UID}'; var app_uid = '{APP_UID}';
var prj_uid = '{PRJ_UID}';
var workspace = '{WORKSPACE}';
var credentials = {credentials};
</script> </script>
<script type="text/javascript" src="/jscore/cases/core/cases_Step.js"></script> <script type="text/javascript" src="/jscore/cases/core/cases_Step.js"></script>
<script type="text/javascript" src="/jscore/cases/core/cases_Step_Pmdynaform.js"></script> <script type="text/javascript" src="/jscore/cases/core/cases_Step_Pmdynaform.js"></script>

View File

@@ -72,9 +72,15 @@
$previouspage = $_POST['previous_step']['PAGE']; $previouspage = $_POST['previous_step']['PAGE'];
$html .= '</td></tr><tr><td align="center">'; $html .= '</td></tr><tr><td align="center">';
$html .= '<input type="button" value="Back" class="module_app_button___gray" onclick="javascript:history.back()">'; if($netxpage == ""){
$html .= '<input type="button" value="Continue" class="module_app_button___gray" onclick="javascript:location.href=\''.$netxpage.'\'">'; $html .= '<a href='.$previouspage.'>';
$html .= '<input type="button" value="Back" class="module_app_button___gray" />';
$html .= '</a>';
} else{
$html .= '<input type="button" value="Back" class="module_app_button___gray" onclick="javascript:history.back()">';
$html .= '<input type="button" value="Continue" class="module_app_button___gray" onclick="javascript:location.href=\''.$netxpage.'\'">';
}
echo '<div class="grid" style="width:'.$width_content.'"> echo '<div class="grid" style="width:'.$width_content.'">
<div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div> <div class="boxTop"><div class="a"></div><div class="b"></div><div class="c"></div></div>

View File

@@ -137,6 +137,30 @@ try {
* you can change it or redirect to another page * you can change it or redirect to another page
* i.e. G::header("Location: http://www.processmaker.com"); * i.e. G::header("Location: http://www.processmaker.com");
*/ */
$_POST['__notValidateThisFields__'] = (isset( $_POST['__notValidateThisFields__'] ) && $_POST['__notValidateThisFields__'] != '') ? $_POST['__notValidateThisFields__'] : $_POST['DynaformRequiredFields'];
if ($missing_req_values = $oForm->validateRequiredFields( $_POST['form'], Bootstrap::json_decode( stripslashes( $_POST['__notValidateThisFields__'] ) ) )) {
$fieldsRequired = Bootstrap::json_decode(str_replace(array("%27", "%39"), array("\"", "'"), $_POST["DynaformRequiredFields"]));
foreach ($fieldsRequired as $key1 => $value1) {
foreach ($missing_req_values as $key2 => $value2) {
if ($value1->name == $value2) {
$missing_req_values[$key2] = $value1->label;
}
}
}
$_POST['next_step']['PAGE'] = "";
$_POST['previous_step']['PAGE'] = $_SERVER['HTTP_REFERER'];
$_POST['req_val'] = $missing_req_values;
global $G_PUBLISH;
$G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent( 'view', 'cases/missRequiredFields' );
G::RenderPage( 'publish', 'blank' );
exit( 0 );
}
$G_PUBLISH = new Publisher(); $G_PUBLISH = new Publisher();
$G_PUBLISH->AddContent("xmlform", "xmlform", "login/showInfo", "", $aMessage); $G_PUBLISH->AddContent("xmlform", "xmlform", "login/showInfo", "", $aMessage);
G::RenderPage("publish", "blank"); G::RenderPage("publish", "blank");