diff --git a/workflow/engine/methods/events/eventList.php b/workflow/engine/methods/events/eventList.php index f59820ca0..dc98cce45 100644 --- a/workflow/engine/methods/events/eventList.php +++ b/workflow/engine/methods/events/eventList.php @@ -12,84 +12,85 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . + * along with this program. If not, see . * * For more information, contact Colosa Inc, 2566 Le Jeune Rd., * Coral Gables, FL, 33134, USA, or email info@colosa.com. - * */ global $RBAC; -if ($RBAC->userCanAccess('PM_SETUP_ADVANCE') != 1) { - G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels'); - G::header('location: ../login/login'); - die; +if ($RBAC->userCanAccess( 'PM_SETUP_ADVANCE' ) != 1) { + G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' ); + G::header( 'location: ../login/login' ); + die(); } -G::LoadClass('configuration'); +G::LoadClass( 'configuration' ); $c = new Configurations(); -$configPage = $c->getConfiguration('eventList', 'pageSize','',$_SESSION['USER_LOGGED']); -$Config['pageSize'] = isset($configPage['pageSize']) ? $configPage['pageSize'] : 20; +$configPage = $c->getConfiguration( 'eventList', 'pageSize', '', $_SESSION['USER_LOGGED'] ); +$Config['pageSize'] = isset( $configPage['pageSize'] ) ? $configPage['pageSize'] : 20; -$G_MAIN_MENU = 'processmaker'; -$G_SUB_MENU = 'logs'; -$G_ID_MENU_SELECTED = 'logs'; +$G_MAIN_MENU = 'processmaker'; +$G_SUB_MENU = 'logs'; +$G_ID_MENU_SELECTED = 'logs'; $G_ID_SUB_MENU_SELECTED = 'EVENT'; //get values for the comboBoxes -$userUid = ( isset($_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '' ) ? - $_SESSION['USER_LOGGED'] : null; -$status = array( - array('', G::LoadTranslation('ID_ALL')), - array("PENDING",G::LoadTranslation('ID_OPEN')), - array("COMPLETED",G::LoadTranslation('ID_CLOSE'))); -$type = array( - array('', G::LoadTranslation('ID_ALL')), - array('SEND_MESSAGE',G::LoadTranslation('ID_EVENT_MESSAGE')), - array('EXECUTE_TRIGGER',G::LoadTranslation('ID_EVENT_TIMER')), - array('EXECUTE_CONDITIONAL_TRIGGER',G::LoadTranslation('ID_EVENT_CONDITIONAL'))); -$processes = getProcessArray($userUid ); +$userUid = (isset( $_SESSION['USER_LOGGED'] ) && $_SESSION['USER_LOGGED'] != '') ? $_SESSION['USER_LOGGED'] : null; +$status = array (array ('',G::LoadTranslation( 'ID_ALL' ) +),array ("PENDING",G::LoadTranslation( 'ID_OPEN' ) +),array ("COMPLETED",G::LoadTranslation( 'ID_CLOSE' ) +) +); +$type = array (array ('',G::LoadTranslation( 'ID_ALL' ) +),array ('SEND_MESSAGE',G::LoadTranslation( 'ID_EVENT_MESSAGE' ) +),array ('EXECUTE_TRIGGER',G::LoadTranslation( 'ID_EVENT_TIMER' ) +),array ('EXECUTE_CONDITIONAL_TRIGGER',G::LoadTranslation( 'ID_EVENT_CONDITIONAL' ) +) +); +$processes = getProcessArray( $userUid ); -$G_PUBLISH = new Publisher; +$G_PUBLISH = new Publisher(); -$oHeadPublisher =& headPublisher::getSingleton(); -$oHeadPublisher->addExtJsScript('events/eventList', false); //adding a javascript file .js -$oHeadPublisher->addContent('events/eventList'); //adding a html file .html. +$oHeadPublisher = & headPublisher::getSingleton(); +$oHeadPublisher->addExtJsScript( 'events/eventList', false ); //adding a javascript file .js +$oHeadPublisher->addContent( 'events/eventList' ); //adding a html file .html. //sending the columns to display in grid -$oHeadPublisher->assign( 'typeValues', $type ); -$oHeadPublisher->assign( 'statusValues', $status ); -$oHeadPublisher->assign( 'processValues', $processes); +$oHeadPublisher->assign( 'typeValues', $type ); +$oHeadPublisher->assign( 'statusValues', $status ); +$oHeadPublisher->assign( 'processValues', $processes ); -function getProcessArray ( $userUid ) { +function getProcessArray ($userUid) +{ global $oAppCache; - require_once ( "classes/model/AppCacheView.php" ); + require_once ("classes/model/AppCacheView.php"); - $processes = Array(); - $processes[] = array ( '', G::LoadTranslation('ID_ALL_PROCESS') ); + $processes = Array (); + $processes[] = array ('',G::LoadTranslation( 'ID_ALL_PROCESS' )); - $cProcess = new Criteria('workflow'); + $cProcess = new Criteria( 'workflow' ); $cProcess->clearSelectColumns(); - $cProcess->addSelectColumn(AppCacheViewPeer::PRO_UID); - $cProcess->addSelectColumn(AppCacheViewPeer::APP_PRO_TITLE); - $cProcess->setDistinct(AppCacheViewPeer::PRO_UID); - - $cProcess->addAscendingOrderByColumn(AppCacheViewPeer::APP_PRO_TITLE); + $cProcess->addSelectColumn( AppCacheViewPeer::PRO_UID ); + $cProcess->addSelectColumn( AppCacheViewPeer::APP_PRO_TITLE ); + $cProcess->setDistinct( AppCacheViewPeer::PRO_UID ); - $oDataset = AppCacheViewPeer::doSelectRS($cProcess); - $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC); + $cProcess->addAscendingOrderByColumn( AppCacheViewPeer::APP_PRO_TITLE ); + + $oDataset = AppCacheViewPeer::doSelectRS( $cProcess ); + $oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC ); $oDataset->next(); - while($aRow = $oDataset->getRow()){ - $processes[] = array ( $aRow['PRO_UID'], $aRow['APP_PRO_TITLE'] ); - $oDataset->next(); + while ($aRow = $oDataset->getRow()) { + $processes[] = array ($aRow['PRO_UID'],$aRow['APP_PRO_TITLE']); + $oDataset->next(); } return $processes; } -G::RenderPage('publish', 'extJs'); +G::RenderPage( 'publish', 'extJs' ); diff --git a/workflow/engine/methods/events/eventsAjax.php b/workflow/engine/methods/events/eventsAjax.php index 852204690..c301f030e 100755 --- a/workflow/engine/methods/events/eventsAjax.php +++ b/workflow/engine/methods/events/eventsAjax.php @@ -6,7 +6,6 @@ require_once 'classes/model/Content.php'; switch($req){ case 'showUsers': - /* $sql = "SELECT USR_UID, USR_EMAIL, CONCAT(USR_FIRSTNAME, ' ' , USR_LASTNAME) AS USR_FULLNAME FROM USERS WHERE USR_STATUS = 'ACTIVE' AND USR_EMAIL <> ''"; */ @@ -29,7 +28,7 @@ switch($req){ $rs = $stmt->executeQuery(); $aRows[] = array('USR_UID'=>'char', 'USR_EMAIL'=>'char', 'USR_FULLNAME'=>'char'); - while($rs->next()){ + while ($rs->next()) { $aRows[] = array('USR_UID'=>$rs->getString('USR_UID'), 'USR_EMAIL'=>$rs->getString('USR_EMAIL'), 'USR_FULLNAME'=>$rs->getString('USR_FULLNAME')); } //echo '
';     print_r($aRows);
@@ -40,11 +39,10 @@ switch($req){
         G::LoadClass('ArrayPeer');
         $oCriteria = new Criteria('dbarray');
         $oCriteria->setDBArrayTable('virtualtable');
-
         $G_PUBLISH = new Publisher();
         $G_PUBLISH->AddContent('propeltable', 'paged-table', 'events/usermailList', $oCriteria);
         G::RenderPage('publish', 'raw');
-    break;
+        break;
     case 'showGroups':
         G::LoadClass('groups');
         $groups = new Groups();
@@ -56,41 +54,35 @@ switch($req){
             $GROUP_TITLE = strip_tags($group->getGrpTitle());
             $aRows[] = array('GRP_UID'=>$UID, 'GROUP_TITLE'=>$GROUP_TITLE);
         }
-
         global $_DBArray;
         $_DBArray['virtualtable']   = $aRows;
         $_SESSION['_DBArray'] = $_DBArray;
         G::LoadClass('ArrayPeer');
         $oCriteria = new Criteria('dbarray');
         $oCriteria->setDBArrayTable('virtualtable');
-
         $G_PUBLISH = new Publisher();
         $G_PUBLISH->AddContent('propeltable', 'paged-table', 'events/groupmailList', $oCriteria);
         G::RenderPage('publish', 'raw');
-    break;
+        break;
     case 'showDynavars':
         G::LoadClass('xmlfield_InputPM');
         $dynaformFields = getDynaformsVars($_SESSION['PROCESS'], false, false);
         $fields = array(array('id' => 'char', 'dynaform' => 'char', 'name' => 'char'));
-
         foreach ($dynaformFields as $dynaformField) {
             $fields[] = array('id' => $dynaformField['sName'],
                               'name' => '@#' . $dynaformField['sName'] . '', 'label' => $dynaformField['sLabel']);
         }
-
         global $_DBArray;
         $_DBArray['virtualtable'] = $fields;
         $_SESSION['_DBArray'] = $_DBArray;
         G::LoadClass('ArrayPeer');
         $oCriteria = new Criteria('dbarray');
         $oCriteria->setDBArrayTable('virtualtable');
-
         $G_PUBLISH = new Publisher();
         $G_PUBLISH->AddContent('propeltable', 'paged-table', 'events/dynavarsList', $oCriteria);
         G::RenderPage('publish', 'raw');
-    break;
+        break;
     case 'eventList':
-
         $start      = (isset($_REQUEST['start']))?      $_REQUEST['start']      : '0';
         $limit      = (isset($_REQUEST['limit']))?      $_REQUEST['limit']      : '25';
         $proUid     = (isset($_REQUEST['process']))?    $_REQUEST['process']    : '';
@@ -110,7 +102,7 @@ switch($req){
         $result = AppEventPeer::doSelectRS($criteria);
         $result->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         $data = Array();
-        while( $result->next() ) {
+        while ( $result->next() ) {
             $data[] = $result->getRow();
         }
         $totalCount = count($data);
@@ -120,8 +112,7 @@ switch($req){
         if ($sort != '') {
             if ($dir == 'ASC') {
                 $criteria->addAscendingOrderByColumn($sort);
-            }
-            else {
+            } else {
                 $criteria->addDescendingOrderByColumn($sort);
             }
         } else {
@@ -136,12 +127,13 @@ switch($req){
         $data = Array();
         $dataPro = array();
         $index = 0;
-        while( $result->next() ) {
+        while ( $result->next() ) {
             $data[] = $result->getRow();
         }
         $response = array();
         $response['totalCount'] = $totalCount;
         $response['data']       = $data;
         die(G::json_encode($response));
-    break;
+        break;
 }
+
diff --git a/workflow/engine/methods/events/eventsCompleted.php b/workflow/engine/methods/events/eventsCompleted.php
index baaf787d3..5eab54b07 100755
--- a/workflow/engine/methods/events/eventsCompleted.php
+++ b/workflow/engine/methods/events/eventsCompleted.php
@@ -12,27 +12,27 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU Affero General Public License for more details.
  *
  * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
+ * along with this program. If not, see .
  *
  * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
  * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- *
  */
 global $RBAC;
-if ($RBAC->userCanAccess('PM_SETUP') != 1) {
-  G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
-  G::header('location: ../login/login');
-  die;
+if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
+    G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
+    G::header( 'location: ../login/login' );
+    die();
 }
 
 require_once 'classes/model/AppEvent.php';
 $oAppEvent = new AppEvent();
 
 global $G_PUBLISH;
-$G_PUBLISH = new Publisher;
-$G_PUBLISH->AddContent('propeltable', 'paged-table', 'events/appEventsListCompleted', $oAppEvent->getAppEventsCriteria($_GET['PRO_UID'], 'COMPLETED', $_GET['EVN_TYPE']));
-G::RenderPage('publish', 'raw');
+$G_PUBLISH = new Publisher();
+$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'events/appEventsListCompleted', $oAppEvent->getAppEventsCriteria( $_GET['PRO_UID'], 'COMPLETED', $_GET['EVN_TYPE'] ) );
+G::RenderPage( 'publish', 'raw' );
+
diff --git a/workflow/engine/methods/events/eventsDelete.php b/workflow/engine/methods/events/eventsDelete.php
index dd77c3bc9..2c5933c3d 100755
--- a/workflow/engine/methods/events/eventsDelete.php
+++ b/workflow/engine/methods/events/eventsDelete.php
@@ -12,24 +12,24 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU Affero General Public License for more details.
  *
  * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
+ * along with this program. If not, see .
  *
  * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
  * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- *
  */
 global $RBAC;
-if ($RBAC->userCanAccess('PM_SETUP') != 1) {
-  G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
-	G::header('location: ../login/login');
-	die;
+if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
+    G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
+    G::header( 'location: ../login/login' );
+    die();
 }
 
 $evnUid = $_POST['EVN_UID'];
 require_once 'classes/model/Event.php';
 $oEvent = new Event();
-$oEvent->remove( $evnUid );
\ No newline at end of file
+$oEvent->remove( $evnUid );
+
diff --git a/workflow/engine/methods/events/eventsEdit.php b/workflow/engine/methods/events/eventsEdit.php
index c6186521d..46cf4d764 100755
--- a/workflow/engine/methods/events/eventsEdit.php
+++ b/workflow/engine/methods/events/eventsEdit.php
@@ -12,74 +12,68 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU Affero General Public License for more details.
  *
  * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
+ * along with this program. If not, see .
  *
  * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
  * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- *
  */
 global $RBAC;
-if ($RBAC->userCanAccess('PM_SETUP') != 1) {
-  G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
-	G::header('location: ../login/login');
-	die;
+if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
+    G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
+    G::header( 'location: ../login/login' );
+    die();
 }
 
-G::LoadClass('tasks');
-G::LoadClass('processMap');
+G::LoadClass( 'tasks' );
+G::LoadClass( 'processMap' );
 global $_DBArray;
 
-if (isset($_GET['EVN_UID'])) {
-  require_once 'classes/model/Event.php';
-  $oEvent = new Event();
-  $aFields = $oEvent->load($_GET['EVN_UID']);
-}
-else {
-  $aFields = array('PRO_UID' => $_GET['PRO_UID']);
+if (isset( $_GET['EVN_UID'] )) {
+    require_once 'classes/model/Event.php';
+    $oEvent = new Event();
+    $aFields = $oEvent->load( $_GET['EVN_UID'] );
+} else {
+    $aFields = array ('PRO_UID' => $_GET['PRO_UID'] );
 }
 
-
-if (!isset($_SESSION['PROCESS'])){
-  if (isset($aFields['PRO_UID'])){
-    $_SESSION['PROCESS'] = $aFields['PRO_UID'];
-  }
+if (! isset( $_SESSION['PROCESS'] )) {
+    if (isset( $aFields['PRO_UID'] )) {
+        $_SESSION['PROCESS'] = $aFields['PRO_UID'];
+    }
 }
 
-$oTasks   = new Tasks();
-$aAux1    = $oTasks->getAllTasks($aFields['PRO_UID']);
-$aTasks   = array();
-$aTasks[] = array('TAS_UID'   => 'char',
-      	          'TAS_TITLE' => 'char');
+$oTasks = new Tasks();
+$aAux1 = $oTasks->getAllTasks( $aFields['PRO_UID'] );
+$aTasks = array ();
+$aTasks[] = array ('TAS_UID' => 'char','TAS_TITLE' => 'char');
 foreach ($aAux1 as $aAux2) {
-  if ($aAux2['TAS_TYPE'] != 'SUBPROCESS') {
-    $aTasks[] = array('TAS_UID'   => $aAux2['TAS_UID'], 'TAS_TITLE' => $aAux2['TAS_TITLE']);
-  }
+    if ($aAux2['TAS_TYPE'] != 'SUBPROCESS') {
+        $aTasks[] = array ('TAS_UID' => $aAux2['TAS_UID'],'TAS_TITLE' => $aAux2['TAS_TITLE'] );
+    }
 }
 
+$oProcessMap = new processMap( new DBConnection() );
+$aTriggersList = $oProcessMap->getTriggers( $_SESSION['PROCESS'] );
+$aTriggersFileds = Array ('TRI_UID' => 'char','TRI_TITLE' => 'char');
 
-$oProcessMap = new processMap(new DBConnection);
-$aTriggersList = $oProcessMap->getTriggers($_SESSION['PROCESS']);
-$aTriggersFileds = Array('TRI_UID'=>'char', 'TRI_TITLE'=>'char');
-
-foreach($aTriggersList as $i=>$v){
-  unset($aTriggersList[$i]['PRO_UID']);
-  unset($aTriggersList[$i]['TRI_DESCRIPTION']);
-  $aTriggersList[$i]['TRI_TITLE'] = (strlen($aTriggersList[$i]['TRI_TITLE'])>32)? substr($aTriggersList[$i]['TRI_TITLE'], 0, 32).'...': $aTriggersList[$i]['TRI_TITLE'];
+foreach ($aTriggersList as $i => $v) {
+    unset( $aTriggersList[$i]['PRO_UID'] );
+    unset( $aTriggersList[$i]['TRI_DESCRIPTION'] );
+    $aTriggersList[$i]['TRI_TITLE'] = (strlen( $aTriggersList[$i]['TRI_TITLE'] ) > 32) ? substr( $aTriggersList[$i]['TRI_TITLE'], 0, 32 ) . '...' : $aTriggersList[$i]['TRI_TITLE'];
 }
 
-$aTriggersList = array_merge(Array($aTriggersFileds), $aTriggersList);
+$aTriggersList = array_merge( Array ($aTriggersFileds, $aTriggersList ));
 
 $_DBArray['tasks'] = $aTasks;
 $_DBArray['TMP_TRIGGERS'] = $aTriggersList;
 
-
 $_SESSION['_DBArray'] = $_DBArray;
 
 $G_PUBLISH = new Publisher();
-$G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/eventsEdit', '', $aFields, '../events/eventsSave');
-G::RenderPage('publish', 'raw');
-?>
+$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'events/eventsEdit', '', $aFields, '../events/eventsSave' );
+G::RenderPage( 'publish', 'raw' );
+
diff --git a/workflow/engine/methods/events/eventsEditAction.php b/workflow/engine/methods/events/eventsEditAction.php
index 23589f4a4..72e939d66 100755
--- a/workflow/engine/methods/events/eventsEditAction.php
+++ b/workflow/engine/methods/events/eventsEditAction.php
@@ -12,238 +12,224 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU Affero General Public License for more details.
  *
  * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
+ * along with this program. If not, see .
  *
  * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
  * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- *
  */
 global $RBAC;
 global $_DBArray;
 
-if ($RBAC->userCanAccess('PM_SETUP') != 1) {
-  G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
-	G::header('location: ../login/login');
-	die;
+if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
+    G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
+    G::header( 'location: ../login/login' );
+    die();
 }
-if ( isset ($_SESSION['EVN_UID']) )  {
-  $evnUid = $_SESSION['EVN_UID'];
-  unset ( $_SESSION['EVN_UID'] );
+if (isset( $_SESSION['EVN_UID'] )) {
+    $evnUid = $_SESSION['EVN_UID'];
+    unset( $_SESSION['EVN_UID'] );
+} else {
+    $evnUid = $_GET['EVN_UID'];
 }
-else
-  $evnUid = $_GET['EVN_UID'];
 
 require_once 'classes/model/Event.php';
 require_once 'classes/model/Triggers.php';
-$oEvent   = new Event();
+$oEvent = new Event();
 $oTrigger = new Triggers();
 $aFields = $oEvent->load( $evnUid );
-$parameters = unserialize ( $oEvent->getEvnActionParameters() );
+$parameters = unserialize( $oEvent->getEvnActionParameters() );
 //g::pr($parameters); die;
-$aTrigger = $oTrigger->load($aFields['TRI_UID']);
+$aTrigger = $oTrigger->load( $aFields['TRI_UID'] );
 
-$hash = md5 ( $oTrigger->getTriWebbot() );
+$hash = md5( $oTrigger->getTriWebbot() );
 //var_dump($hash,$parameters->hash);die;
 //if the hash is different, the script was edited , so we will show the trigger editor.
-if ( ( isset($parameters->hash) && $hash <> $parameters->hash ) || $aFields['EVN_ACTION'] == 'EXECUTE_TRIGGER' || $aFields['EVN_ACTION'] == 'EXECUTE_CONDITIONAL_TRIGGER' ) {
-  $oTriggerParams = unserialize($aTrigger['TRI_PARAM']);
-  // check again a hash, this time to check the trigger itself integrity
-  if ($oTriggerParams['hash']!=$hash){
-    // if has changed edit manually
-    G::LoadClass('xmlfield_InputPM');
-    $G_PUBLISH = new Publisher();
-    $G_PUBLISH->AddContent('xmlform', 'xmlform', 'triggers/triggersNarrowEdit', '', $aTrigger, '../events/triggersSave');
-    G::RenderPage('publish', 'raw');
-    die;
-  } else {
-    // if not launch the wizard view.
-    $triUid = $aFields['TRI_UID'];
-    $_GET = $oTriggerParams['params'];
-    $_GET['TRI_UID'] = $triUid;
-    require_once(PATH_METHODS.'triggers/triggers_EditWizard.php');
-    die;
-  }
+if ((isset( $parameters->hash ) && $hash != $parameters->hash) || $aFields['EVN_ACTION'] == 'EXECUTE_TRIGGER' || $aFields['EVN_ACTION'] == 'EXECUTE_CONDITIONAL_TRIGGER') {
+    $oTriggerParams = unserialize( $aTrigger['TRI_PARAM'] );
+    // check again a hash, this time to check the trigger itself integrity
+    if ($oTriggerParams['hash'] != $hash) {
+        // if has changed edit manually
+        G::LoadClass( 'xmlfield_InputPM' );
+        $G_PUBLISH = new Publisher();
+        $G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'triggers/triggersNarrowEdit', '', $aTrigger, '../events/triggersSave' );
+        G::RenderPage( 'publish', 'raw' );
+        die();
+    } else {
+        // if not launch the wizard view.
+        $triUid = $aFields['TRI_UID'];
+        $_GET = $oTriggerParams['params'];
+        $_GET['TRI_UID'] = $triUid;
+        require_once (PATH_METHODS . 'triggers/triggers_EditWizard.php');
+        die();
+    }
 }
 
-$aFields['EVN_MESSAGE_SUBJECT']  = (isset($parameters->SUBJECT) ? $parameters->SUBJECT : '');
+$aFields['EVN_MESSAGE_SUBJECT'] = (isset( $parameters->SUBJECT ) ? $parameters->SUBJECT : '');
 
-if(isset($parameters->TO)){
-	$paramTO[] = Array('id'=>'char', 'name'=>'char');
-	
-	//echo '
';print_r($parameters->TO);
-	foreach($parameters->TO as $item){
-		$row = explode('|', $item);
-		switch($row[0]){
-			case 'usr':
-				require_once('classes/model/Users.php');
-				$user = new Users();
-				
-				if($row[1] == '-1'){
-					$value = '(Current Task User)'; 
-				} else {
-					$rec = $user->load($row[1]);
-					$value = $rec['USR_FIRSTNAME'].' '.$rec['USR_LASTNAME'];
-				}
-			break;
-			
-			case 'grp':
-				G::LoadClass('groups');
-				$group = new Groups();
-				$rec = $group->load($row[1]);
-				
-				$value = strip_tags($rec->getGrpTitle());
-			break;
-			
-			case 'ext':
-				$value = htmlentities($row[1]); 
-			break;
-			
-			case 'dyn':
-				$value = htmlentities('@#'.$row[1]); 
-			break;
-			
-			default:
-					echo '->'.$row[0];
-		}
-		$paramTO[] = Array('id'=>replaceQuotes($item), 'name'=>$value);
-	}
+if (isset( $parameters->TO )) {
+    $paramTO[] = Array ('id' => 'char','name' => 'char' );
+
+    //echo '
';print_r($parameters->TO);
+    foreach ($parameters->TO as $item) {
+        $row = explode( '|', $item );
+        switch ($row[0]) {
+            case 'usr':
+                require_once ('classes/model/Users.php');
+                $user = new Users();
+                if ($row[1] == '-1') {
+                    $value = '(Current Task User)';
+                } else {
+                    $rec = $user->load( $row[1] );
+                    $value = $rec['USR_FIRSTNAME'] . ' ' . $rec['USR_LASTNAME'];
+                }
+                break;
+            case 'grp':
+                G::LoadClass( 'groups' );
+                $group = new Groups();
+                $rec = $group->load( $row[1] );
+                $value = strip_tags( $rec->getGrpTitle() );
+                break;
+            case 'ext':
+                $value = htmlentities( $row[1] );
+                break;
+            case 'dyn':
+                $value = htmlentities( '@#' . $row[1] );
+                break;
+            default:
+                echo '->' . $row[0];
+        }
+        $paramTO[] = Array ('id' => replaceQuotes( $item ),'name' => $value
+        );
+    }
 } else {
-	$paramTO[] = Array('id'=>'char', 'name'=>'char');
-	$paramTO[] = Array('id'=>'usr|-1', 'name'=>'(Current Task User)');
+    $paramTO[] = Array ('id' => 'char','name' => 'char'
+    );
+    $paramTO[] = Array ('id' => 'usr|-1','name' => '(Current Task User)'
+    );
 }
 $_DBArray['eventomsgto'] = $paramTO;
 
-if(isset($parameters->CC)){
-	$paramCC[] = Array('id'=>'char', 'name'=>'char');
-	foreach($parameters->CC as $item){
-		$row = explode('|', $item);
-		switch($row[0]){
-			case 'usr':
-				require_once('classes/model/Users.php');
-				$user = new Users();
-				
-				if($row[1] == '-1'){
-					$value = '(Current Task User)'; 
-				} else {
-					$rec = $user->load($row[1]);
-					$value = $rec['USR_FIRSTNAME'].' '.$rec['USR_LASTNAME'];
-				}
-			break;
-			
-			case 'grp':
-				G::LoadClass('groups');
-				$group = new Groups();
-				$rec = $group->load($row[1]);
-				
-				$value = strip_tags($rec->getGrpTitle());
-			break;
-			
-			case 'ext':
-				$value = htmlentities($row[1]); 
-			break;
-			
-			case 'dyn':
-				$value = htmlentities('@#'.$row[1]); 
-			break;
-		}
-		$paramCC[] = Array('id'=>replaceQuotes($item), 'name'=>$value);
-	}
-	
-	$_DBArray['eventomsgcc'] = $paramCC;
-	
+if (isset( $parameters->CC )) {
+    $paramCC[] = Array ('id' => 'char','name' => 'char' );
+    foreach ($parameters->CC as $item) {
+        $row = explode( '|', $item );
+        switch ($row[0]) {
+            case 'usr':
+                require_once ('classes/model/Users.php');
+                $user = new Users();
+
+                if ($row[1] == '-1') {
+                    $value = '(Current Task User)';
+                } else {
+                    $rec = $user->load( $row[1] );
+                    $value = $rec['USR_FIRSTNAME'] . ' ' . $rec['USR_LASTNAME'];
+                }
+                break;
+            case 'grp':
+                G::LoadClass( 'groups' );
+                $group = new Groups();
+                $rec = $group->load( $row[1] );
+                $value = strip_tags( $rec->getGrpTitle() );
+                break;
+            case 'ext':
+                $value = htmlentities( $row[1] );
+                break;
+            case 'dyn':
+                $value = htmlentities( '@#' . $row[1] );
+                break;
+        }
+        $paramCC[] = Array ('id' => replaceQuotes( $item ),'name' => $value
+        );
+    }
+
+    $_DBArray['eventomsgcc'] = $paramCC;
+
 } else {
-	$_DBArray['eventomsgcc'] = Array();
+    $_DBArray['eventomsgcc'] = Array ();
 }
 
-if(isset($parameters->BCC)){
-	$paramBCC[] = Array('id'=>'char', 'name'=>'char');
-	foreach($parameters->BCC as $item){
-		$row = explode('|', $item);
-		switch($row[0]){
-			case 'usr':
-				require_once('classes/model/Users.php');
-				$user = new Users();
-				
-				if($row[1] == '-1'){
-					$value = '(Current Task User)'; 
-				} else {
-					$rec = $user->load($row[1]);
-					$value = $rec['USR_FIRSTNAME'].' '.$rec['USR_LASTNAME'];
-				}
-			break;
-			
-			case 'grp':
-				G::LoadClass('groups');
-				$group = new Groups();
-				$rec = $group->load($row[1]);
-				
-				$value = strip_tags($rec->getGrpTitle());
-			break;
-			
-			case 'ext':
-				$value = htmlentities($row[1]); 
-			break;
-			
-			case 'dyn':
-				$value = htmlentities('@#'.$row[1]); 
-			break;
-		}
-		$paramBCC[] = Array('id'=>replaceQuotes($item), 'name'=>$value);
-	}
-	
-	$_DBArray['eventomsgbcc'] = $paramBCC;
-	
+if (isset( $parameters->BCC )) {
+    $paramBCC[] = Array ('id' => 'char','name' => 'char' );
+    foreach ($parameters->BCC as $item) {
+        $row = explode( '|', $item );
+        switch ($row[0]) {
+            case 'usr':
+                require_once ('classes/model/Users.php');
+                $user = new Users();
+
+                if ($row[1] == '-1') {
+                    $value = '(Current Task User)';
+                } else {
+                    $rec = $user->load( $row[1] );
+                    $value = $rec['USR_FIRSTNAME'] . ' ' . $rec['USR_LASTNAME'];
+                }
+                break;
+            case 'grp':
+                G::LoadClass( 'groups' );
+                $group = new Groups();
+                $rec = $group->load( $row[1] );
+                $value = strip_tags( $rec->getGrpTitle() );
+                break;
+            case 'ext':
+                $value = htmlentities( $row[1] );
+                break;
+            case 'dyn':
+                $value = htmlentities( '@#' . $row[1] );
+                break;
+        }
+        $paramBCC[] = Array ('id' => replaceQuotes( $item ),'name' => $value);
+    }
+
+    $_DBArray['eventomsgbcc'] = $paramBCC;
+
 } else {
-	$_DBArray['eventomsgbcc'] = Array();
+    $_DBArray['eventomsgbcc'] = Array ();
 }
-$aFields['EVN_MESSAGE_TO_TO']    = $paramTO;
-$aFields['EVN_MESSAGE_TO_CC']    = (isset($parameters->CC) ? $paramCC : '');
-$aFields['EVN_MESSAGE_TO_BCC']   = (isset($parameters->BCC) ? $paramBCC : '');
-$aFields['EVN_MESSAGE_TEMPLATE'] = (isset($parameters->TEMPLATE) ? $parameters->TEMPLATE : '');
+$aFields['EVN_MESSAGE_TO_TO'] = $paramTO;
+$aFields['EVN_MESSAGE_TO_CC'] = (isset( $parameters->CC ) ? $paramCC : '');
+$aFields['EVN_MESSAGE_TO_BCC'] = (isset( $parameters->BCC ) ? $paramBCC : '');
+$aFields['EVN_MESSAGE_TEMPLATE'] = (isset( $parameters->TEMPLATE ) ? $parameters->TEMPLATE : '');
 
-
-$aTemplates   = array();
-$aTemplates[] = array('TEMPLATE1' => 'char',
-      	              'TEMPLATE2' => 'char');
+$aTemplates = array ();
+$aTemplates[] = array ('TEMPLATE1' => 'char','TEMPLATE2' => 'char');
 $sDirectory = PATH_DATA_MAILTEMPLATES . $aFields['PRO_UID'] . PATH_SEP;
-G::verifyPath($sDirectory, true);
-if (!file_exists($sDirectory . 'alert_message.html')) {
-  @copy(PATH_TPL . 'mails' . PATH_SEP . 'alert_message.html', $sDirectory . 'alert_message.html');
+G::verifyPath( $sDirectory, true );
+if (! file_exists( $sDirectory . 'alert_message.html' )) {
+    @copy( PATH_TPL . 'mails' . PATH_SEP . 'alert_message.html', $sDirectory . 'alert_message.html' );
 }
-$oDirectory   = dir($sDirectory);
+$oDirectory = dir( $sDirectory );
 while ($sObject = $oDirectory->read()) {
-  if (($sObject !== '.') && ($sObject !== '..') && ($sObject !== 'alert_message.html')) {
-    $aTemplates[] = array('TEMPLATE1' => $sObject,
-      	                  'TEMPLATE2' => $sObject);
-  }
+    if (($sObject !== '.') && ($sObject !== '..') && ($sObject !== 'alert_message.html')) {
+        $aTemplates[] = array ('TEMPLATE1' => $sObject,'TEMPLATE2' => $sObject);
+    }
 }
 $_DBArray['templates'] = $aTemplates;
 
-$aTriggers[] = array('TRI_UID'   => 'char',
-      	             'TRI_TITLE' => 'char');
-G::LoadClass('processMap');
+$aTriggers[] = array ('TRI_UID' => 'char','TRI_TITLE' => 'char');
+G::LoadClass( 'processMap' );
 $oProcessMap = new ProcessMap();
-$oDataset = TriggersPeer::doSelectRS($oProcessMap->getTriggersCriteria($aFields['PRO_UID']));
-$oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
+$oDataset = TriggersPeer::doSelectRS( $oProcessMap->getTriggersCriteria( $aFields['PRO_UID'] ) );
+$oDataset->setFetchmode( ResultSet::FETCHMODE_ASSOC );
 $oDataset->next();
 while ($aRow = $oDataset->getRow()) {
-  $aTriggers[] = array('TRI_UID'   => $aRow['TRI_UID'],
-      	               'TRI_TITLE' => $aRow['TRI_TITLE']);
-  $oDataset->next();
+    $aTriggers[] = array ('TRI_UID' => $aRow['TRI_UID'],'TRI_TITLE' => $aRow['TRI_TITLE'] );
+    $oDataset->next();
 }
 $_DBArray['triggers'] = $aTriggers;
 
 $_SESSION['_DBArray'] = $_DBArray;
 
 $G_PUBLISH = new Publisher();
-$G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/eventsEditAction', '', $aFields, '../events/eventsSave');
+$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'events/eventsEditAction', '', $aFields, '../events/eventsSave' );
 //$G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/eventsEditAction', '', $aFields, '../events/eventsSave');
-G::RenderPage('publish', 'raw');
+G::RenderPage( 'publish', 'raw' );
 
-function replaceQuotes($aData){
-	return str_replace('"', '"e;', $aData);
+function replaceQuotes ($aData)
+{
+    return str_replace( '"', '"e;', $aData );
 }
+
diff --git a/workflow/engine/methods/events/eventsNew.php b/workflow/engine/methods/events/eventsNew.php
index 0f49f3e9a..6dda40be7 100755
--- a/workflow/engine/methods/events/eventsNew.php
+++ b/workflow/engine/methods/events/eventsNew.php
@@ -12,50 +12,49 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU Affero General Public License for more details.
  *
  * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
+ * along with this program. If not, see .
  *
  * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
  * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- *
  */
 global $RBAC;
-if ($RBAC->userCanAccess('PM_SETUP') != 1) {
-  G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
-  G::header('location: ../login/login');
-  die;
+if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
+    G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
+    G::header( 'location: ../login/login' );
+    die();
 }
 
 global $_DBArray;
-G::LoadClass('tasks');
-G::LoadClass('processMap');
+G::LoadClass( 'tasks' );
+G::LoadClass( 'processMap' );
 
-$oTasks   = new Tasks();
-$aAux1    = $oTasks->getAllTasks($_GET['PRO_UID']);
-$aTasks   = array();
-$aTasks[] = array('TAS_UID'   => 'char', 'TAS_TITLE' => 'char');
+$oTasks = new Tasks();
+$aAux1 = $oTasks->getAllTasks( $_GET['PRO_UID'] );
+$aTasks = array ();
+$aTasks[] = array ('TAS_UID' => 'char','TAS_TITLE' => 'char');
 
 //g::pr($aAux1);die;
 foreach ($aAux1 as $aAux2) {
-  if ($aAux2['TAS_TYPE'] != 'SUBPROCESS') {
-    $aTasks[] = array('TAS_UID'   => $aAux2['TAS_UID'], 'TAS_TITLE' => $aAux2['TAS_TITLE']);
-  }
+    if ($aAux2['TAS_TYPE'] != 'SUBPROCESS') {
+        $aTasks[] = array ('TAS_UID' => $aAux2['TAS_UID'],'TAS_TITLE' => $aAux2['TAS_TITLE']);
+    }
 }
 
-$oProcessMap = new processMap(new DBConnection);
-$aTriggersList = $oProcessMap->getTriggers($_SESSION['PROCESS']);
-$aTriggersFileds = Array('TRI_UID'=>'char', 'TRI_TITLE'=>'char');
+$oProcessMap = new processMap( new DBConnection() );
+$aTriggersList = $oProcessMap->getTriggers( $_SESSION['PROCESS'] );
+$aTriggersFileds = Array ('TRI_UID' => 'char','TRI_TITLE' => 'char');
 
-foreach($aTriggersList as $i=>$v){
-  unset($aTriggersList[$i]['PRO_UID']);
-  unset($aTriggersList[$i]['TRI_DESCRIPTION']);
-  $aTriggersList[$i]['TRI_TITLE'] = (strlen($aTriggersList[$i]['TRI_TITLE'])>32)? substr($aTriggersList[$i]['TRI_TITLE'], 0, 32).'...': $aTriggersList[$i]['TRI_TITLE'];
+foreach ($aTriggersList as $i => $v) {
+    unset( $aTriggersList[$i]['PRO_UID'] );
+    unset( $aTriggersList[$i]['TRI_DESCRIPTION'] );
+    $aTriggersList[$i]['TRI_TITLE'] = (strlen( $aTriggersList[$i]['TRI_TITLE'] ) > 32) ? substr( $aTriggersList[$i]['TRI_TITLE'], 0, 32 ) . '...' : $aTriggersList[$i]['TRI_TITLE'];
 }
 
-$aTriggersList = array_merge(Array($aTriggersFileds), $aTriggersList);
+$aTriggersList = array_merge( Array ($aTriggersFileds), $aTriggersList );
 
 $_DBArray['tasks'] = $aTasks;
 $_DBArray['TMP_TRIGGERS'] = $aTriggersList;
@@ -63,6 +62,6 @@ $_DBArray['TMP_TRIGGERS'] = $aTriggersList;
 $_SESSION['_DBArray'] = $_DBArray;
 
 $G_PUBLISH = new Publisher();
-$G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/eventsNew',  '', array('PRO_UID' => $_GET['PRO_UID'], 'EVN_ACTION' => $_GET['EVN_TYPE']), '');
-G::RenderPage('publish', 'raw');
+$G_PUBLISH->AddContent( 'xmlform', 'xmlform', 'events/eventsNew', '', array ('PRO_UID' => $_GET['PRO_UID'],'EVN_ACTION' => $_GET['EVN_TYPE']), '' );
+G::RenderPage( 'publish', 'raw' );
 
diff --git a/workflow/engine/methods/events/eventsNewAction.php b/workflow/engine/methods/events/eventsNewAction.php
index c63fd3bc1..efd80aff3 100755
--- a/workflow/engine/methods/events/eventsNewAction.php
+++ b/workflow/engine/methods/events/eventsNewAction.php
@@ -12,37 +12,36 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU Affero General Public License for more details.
  *
  * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
+ * along with this program. If not, see .
  *
  * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
  * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- *
  */
 global $RBAC;
-if ($RBAC->userCanAccess('PM_SETUP') != 1) {
-  G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
-	G::header('location: ../login/login');
-	die;
+if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
+    G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
+    G::header( 'location: ../login/login' );
+    die();
 }
 
 global $_DBArray;
 
-//get the posted fields of new Event and create a new record of that 
+//get the posted fields of new Event and create a new record of that
 require_once 'classes/model/Event.php';
 
 $oEvent = new Event();
-$envUId = $oEvent->create($_POST);
+$envUId = $oEvent->create( $_POST );
 
 $_SESSION['EVN_UID'] = $envUId;
-require_once ( 'eventsEditAction.php' );
-die;
+require_once ('eventsEditAction.php');
+die();
 
 /*
-//this page is showing the parameters for setup email messages and triggers, 
+//this page is showing the parameters for setup email messages and triggers,
 //probably this will be changed soon.
 
 $aTemplates   = array();
@@ -80,4 +79,5 @@ $G_PUBLISH = new Publisher();
 $G_PUBLISH->AddContent('xmlform', 'xmlform', 'events/events_EditAction', '', $_POST, '../events/eventsSave');
 G::RenderPage('publish', 'raw');
 
-*/
\ No newline at end of file
+*/
+
diff --git a/workflow/engine/methods/events/eventsPending.php b/workflow/engine/methods/events/eventsPending.php
index 253c1c49a..6723f58b7 100755
--- a/workflow/engine/methods/events/eventsPending.php
+++ b/workflow/engine/methods/events/eventsPending.php
@@ -12,27 +12,27 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU Affero General Public License for more details.
  *
  * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
+ * along with this program. If not, see .
  *
  * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
  * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- *
  */
 global $RBAC;
-if ($RBAC->userCanAccess('PM_SETUP') != 1) {
-  G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
-  G::header('location: ../login/login');
-  die;
+if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
+    G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
+    G::header( 'location: ../login/login' );
+    die();
 }
 
 require_once 'classes/model/AppEvent.php';
 $oAppEvent = new AppEvent();
 
 global $G_PUBLISH;
-$G_PUBLISH = new Publisher;
-$G_PUBLISH->AddContent('propeltable', 'paged-table', 'events/appEventsList', $oAppEvent->getAppEventsCriteria($_GET['PRO_UID'], 'PENDING', $_GET['EVN_TYPE']));
-G::RenderPage('publish', 'raw');
+$G_PUBLISH = new Publisher();
+$G_PUBLISH->AddContent( 'propeltable', 'paged-table', 'events/appEventsList', $oAppEvent->getAppEventsCriteria( $_GET['PRO_UID'], 'PENDING', $_GET['EVN_TYPE'] ) );
+G::RenderPage( 'publish', 'raw' );
+
diff --git a/workflow/engine/methods/events/eventsSave.php b/workflow/engine/methods/events/eventsSave.php
index 2b4105353..bd38f717a 100755
--- a/workflow/engine/methods/events/eventsSave.php
+++ b/workflow/engine/methods/events/eventsSave.php
@@ -12,66 +12,59 @@
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  * GNU Affero General Public License for more details.
  *
  * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see .
+ * along with this program. If not, see .
  *
  * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
  * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- *
  */
 global $RBAC;
-if ($RBAC->userCanAccess('PM_SETUP') != 1) {
-  G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
-	G::header('location: ../login/login');
-	die;
+if ($RBAC->userCanAccess( 'PM_SETUP' ) != 1) {
+    G::SendTemporalMessage( 'ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels' );
+    G::header( 'location: ../login/login' );
+    die();
 }
-$EVN_MESSAGE_TO_TO  = isset($_POST['form']['EVN_MESSAGE_TO_TO'])?  replaceQuotes($_POST['form']['EVN_MESSAGE_TO_TO']): Array();
-$EVN_MESSAGE_TO_CC  = isset($_POST['form']['EVN_MESSAGE_TO_CC'])?  replaceQuotes($_POST['form']['EVN_MESSAGE_TO_CC']): Array();
-$EVN_MESSAGE_TO_BCC = isset($_POST['form']['EVN_MESSAGE_TO_BCC'])? replaceQuotes($_POST['form']['EVN_MESSAGE_TO_BCC']): Array();
+$EVN_MESSAGE_TO_TO = isset( $_POST['form']['EVN_MESSAGE_TO_TO'] ) ? replaceQuotes( $_POST['form']['EVN_MESSAGE_TO_TO'] ) : Array ();
+$EVN_MESSAGE_TO_CC = isset( $_POST['form']['EVN_MESSAGE_TO_CC'] ) ? replaceQuotes( $_POST['form']['EVN_MESSAGE_TO_CC'] ) : Array ();
+$EVN_MESSAGE_TO_BCC = isset( $_POST['form']['EVN_MESSAGE_TO_BCC'] ) ? replaceQuotes( $_POST['form']['EVN_MESSAGE_TO_BCC'] ) : Array ();
 
-if (isset($_POST['form']['EVN_MESSAGE_SUBJECT'])) {
-  $_POST['form']['EVN_ACTION_PARAMETERS'] = array(
-  	'SUBJECT'  => $_POST['form']['EVN_MESSAGE_SUBJECT'],
-	  'TO'       => $EVN_MESSAGE_TO_TO,
-	  'CC'       => $EVN_MESSAGE_TO_CC,
-	  'BCC'      => $EVN_MESSAGE_TO_BCC,
-	  'TEMPLATE' => $_POST['form']['EVN_MESSAGE_TEMPLATE']
-  );
-  
-  unset($_POST['form']['EVN_MESSAGE_SUBJECT']);
-  unset($_POST['form']['EVN_MESSAGE_TO_TO']);
-  unset($_POST['form']['EVN_MESSAGE_TO_CC']);
-  unset($_POST['form']['EVN_MESSAGE_TO_BCC']);
-  unset($_POST['form']['EVN_MESSAGE_TEMPLATE']);
+if (isset( $_POST['form']['EVN_MESSAGE_SUBJECT'] )) {
+    $_POST['form']['EVN_ACTION_PARAMETERS'] = array ('SUBJECT' => $_POST['form']['EVN_MESSAGE_SUBJECT'],'TO' => $EVN_MESSAGE_TO_TO,'CC' => $EVN_MESSAGE_TO_CC,'BCC' => $EVN_MESSAGE_TO_BCC,'TEMPLATE' => $_POST['form']['EVN_MESSAGE_TEMPLATE']);
+
+    unset( $_POST['form']['EVN_MESSAGE_SUBJECT'] );
+    unset( $_POST['form']['EVN_MESSAGE_TO_TO'] );
+    unset( $_POST['form']['EVN_MESSAGE_TO_CC'] );
+    unset( $_POST['form']['EVN_MESSAGE_TO_BCC'] );
+    unset( $_POST['form']['EVN_MESSAGE_TEMPLATE'] );
 }
-unset($_POST['form']['SAVE']);
+unset( $_POST['form']['SAVE'] );
 
 require_once 'classes/model/Event.php';
 $oEvent = new Event();
 if ($_POST['form']['EVN_UID'] == '') {
-  //this is probably not used, because the creation of one Event is done directly in EventsNewAction
-  $oEvent->create($_POST['form']);
-}
-else {
-  /*
-   *if($_POST['form']['EVN_ACTION'] == 'SEND_MESSAGE' && $ev->getTriUid() != trim($_POST['form']['TRI_UID']) ){
+    //this is probably not used, because the creation of one Event is done directly in EventsNewAction
+    $oEvent->create( $_POST['form'] );
+} else {
+    /*
+    *if($_POST['form']['EVN_ACTION'] == 'SEND_MESSAGE' && $ev->getTriUid() != trim($_POST['form']['TRI_UID']) ){
     $oEvnActionParameters = unserialize($ev->getEvnActionParameters());
     prit_r($oEvnActionParameters);
     if( isset($oEvnActionParameters->TRI_UID) ){
       $_POST['form']['TRI_UID'] = $oEvnActionParameters->TRI_UID;
     }
-
-  }
-   */
-  $oEvent->update($_POST['form']);
+    }
+    */
+    $oEvent->update( $_POST['form'] );
+}
+
+function replaceQuotes ($aData)
+{
+    for ($i = 0; $i < sizeof( $aData ); $i ++) {
+        $aData[$i] = str_replace( ""e;", '"', $aData[$i] );
+    }
+    return $aData;
 }
 
-function replaceQuotes($aData){
-	for($i=0; $i abs($estimated) ) { //this event is before the start of the task, so will never occurs
-      $xTimer = 30;
-      $sWhen = abs($when) - abs($estimated);
-      imagestring ($im, 2, $xTimer -8 , $h -16, $sWhen, $black);
-      $s = 'i';
+//when is negative and the event occurs after, then this event will occurs
+if ($when < 0 && $o == 'a') {
+    if (abs( $when ) > abs( $estimated )) {
+        //this event is before the start of the task, so will never occurs
+        $xTimer = 30;
+        $sWhen = abs( $when ) - abs( $estimated );
+        imagestring( $im, 2, $xTimer - 8, $h - 16, $sWhen, $black );
+        $s = 'i';
     }
-  	if ( abs($when) < abs($estimated) ) { //this event is after the start of the task, drawing
-      $xTimer = 170;
-      $sWhen = $estimated + $when;
-      imagestring ($im, 2, $xTimer -4 , $h -16, $sWhen, $black);
+    if (abs( $when ) < abs( $estimated )) {
+        //this event is after the start of the task, drawing
+        $xTimer = 170;
+        $sWhen = $estimated + $when;
+        imagestring( $im, 2, $xTimer - 4, $h - 16, $sWhen, $black );
     }
-  	if ( abs($when) == abs($estimated) ) { //this event is exactly at starting 
-      $xTimer = 80;
-      $sWhen = $estimated + $when;
-      imagestring ($im, 2, $xTimer -4 , $h -16, $sWhen, $black);
+    if (abs( $when ) == abs( $estimated )) {
+        //this event is exactly at starting
+        $xTimer = 80;
+        $sWhen = $estimated + $when;
+        imagestring( $im, 2, $xTimer - 4, $h - 16, $sWhen, $black );
     }
-  }
+}
 
-  //when is positive and the event occurs after, then this event will occurs
-  if ( $when > 0 && $o == 'a' ) {
-      $xTimer = 270;
-      $sWhen = $estimated + $when;
-      imagestring ($im, 2, $xTimer -4 , $h -16, $sWhen, $black);
-  }
+//when is positive and the event occurs after, then this event will occurs
+if ($when > 0 && $o == 'a') {
+    $xTimer = 270;
+    $sWhen = $estimated + $when;
+    imagestring( $im, 2, $xTimer - 4, $h - 16, $sWhen, $black );
+}
 
-  //when is positive and the event occurs starting, then this event will occurs
-  if ( $when > 0 && $o == 's' ) {
-  	if ( abs($when) <  abs($estimated) ) $xTimer = 140;
-  	if ( abs($when) >  abs($estimated) ) $xTimer = 270;
-  	if ( abs($when) == abs($estimated) ) $xTimer = 220;
-  	
-    imagestring ($im, 2, $xTimer -4 , $h -16, $when, $black);
-  }
+//when is positive and the event occurs starting, then this event will occurs
+if ($when > 0 && $o == 's') {
+    if (abs( $when ) < abs( $estimated )) {
+        $xTimer = 140;
+    }
+    if (abs( $when ) > abs( $estimated )) {
+        $xTimer = 270;
+    }
+    if (abs( $when ) == abs( $estimated )) {
+        $xTimer = 220;
+    }
+    imagestring( $im, 2, $xTimer - 4, $h - 16, $when, $black );
+}
 
-  if ( $when == 0 ) {
-    $xTimer = ( $o == 's' ) ? 80: 220 ;  
-  }
+if ($when == 0) {
+    $xTimer = ($o == 's') ? 80 : 220;
+}
 
-  if ( $s == 'a' ) {    
-    drawTimerEvent ( $im, $xTimer, $h -70 , $h -15);
-  }
+if ($s == 'a') {
+    drawTimerEvent( $im, $xTimer, $h - 70, $h - 15 );
+}
+
+header( "Content-Type: image/png" );
+imagepng( $im );
+die();
 
-  header("Content-Type: image/png");
-  imagepng($im);
-die;
diff --git a/workflow/engine/methods/events/triggersSave.php b/workflow/engine/methods/events/triggersSave.php
index fc98ebf57..b9402984a 100755
--- a/workflow/engine/methods/events/triggersSave.php
+++ b/workflow/engine/methods/events/triggersSave.php
@@ -1,10 +1,10 @@
 .
- * 
- * For more information, contact Colosa Inc, 2566 Le Jeune Rd., 
+ * along with this program. If not, see .
+ *
+ * For more information, contact Colosa Inc, 2566 Le Jeune Rd.,
  * Coral Gables, FL, 33134, USA, or email info@colosa.com.
- * 
  */
- 
-if (($RBAC_Response=$RBAC->userCanAccess("PM_FACTORY"))!=1) return $RBAC_Response;
-require_once('classes/model/Triggers.php');
-$oTrigger = new Triggers();
-if ($_POST['form']['TRI_UID'] != '')
-{
-	$oTrigger->load($_POST['form']['TRI_UID']);
+
+if (($RBAC_Response = $RBAC->userCanAccess( "PM_FACTORY" )) != 1) {
+    return $RBAC_Response;
 }
-else
-{
-	$oTrigger->create($_POST['form']);
-	$_POST['form']['TRI_UID']=$oTrigger->getTriUid();
+require_once ('classes/model/Triggers.php');
+$oTrigger = new Triggers();
+if ($_POST['form']['TRI_UID'] != '') {
+    $oTrigger->load( $_POST['form']['TRI_UID'] );
+} else {
+    $oTrigger->create( $_POST['form'] );
+    $_POST['form']['TRI_UID'] = $oTrigger->getTriUid();
 }
 
-$oTrigger->update($_POST['form']);
-?>
\ No newline at end of file
+$oTrigger->update( $_POST['form'] );
+