예제 #1
0
 public function saveConfigPmGmail($httpData)
 {
     G::LoadClass("pmGoogleApi");
     $pmGoogle = new PMGoogleApi();
     $result = new StdClass();
     $result->success = true;
     if (!empty($httpData->status_pmgmail)) {
         $httpData->status_pmgmail = $httpData->status_pmgmail == 1 ? true : false;
         $pmGoogle->setStatusService($httpData->status_pmgmail);
         $message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . ($httpData->status_pmgmail ? G::LoadTranslation('ID_ENABLE') : G::LoadTranslation('ID_DISABLE'));
         $pmGoogle->setTypeAuthentication($httpData->typeAuth);
         if (!empty($httpData->email_service_account)) {
             $pmGoogle->setServiceAccountEmail($httpData->email_service_account);
             $message .= ', ' . G::LoadTranslation('ID_PMG_EMAIL') . ': ' . $httpData->email_service_account;
         }
         if (!empty($_FILES)) {
             if (!empty($_FILES['file_p12']) && $_FILES['file_p12']['error'] != 1) {
                 if ($_FILES['file_p12']['tmp_name'] != '') {
                     G::uploadFile($_FILES['file_p12']['tmp_name'], PATH_DATA_SITE, $_FILES['file_p12']['name']);
                     $pmGoogle->setServiceAccountP12($_FILES['file_p12']['name']);
                     $message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['file_p12']['name'];
                 }
             } else {
                 if (!empty($_FILES['file_json']) && $_FILES['file_json']['error'] != 1) {
                     if ($_FILES['file_json']['tmp_name'] != '') {
                         G::uploadFile($_FILES['file_json']['tmp_name'], PATH_DATA_SITE, $_FILES['file_json']['name']);
                         $pmGoogle->setAccountJson($_FILES['file_json']['name']);
                         $message .= ', ' . G::LoadTranslation('ID_PMG_FILE') . ': ' . $_FILES['file_json']['name'];
                     }
                 } else {
                     $result->success = false;
                     $result->fileError = true;
                     print G::json_encode($result);
                     die;
                 }
             }
         }
     } else {
         $pmGoogle->setStatusService(false);
         $message = G::LoadTranslation('ID_ENABLE_PMGMAIL') . ': ' . G::LoadTranslation('ID_DISABLE');
     }
     G::auditLog("Update Settings Gmail", $message);
     print G::json_encode($result);
 }
예제 #2
0
 public function create($data)
 {
     try {
         parent::create($data);
     } catch (\Exception $e) {
         throw new \RuntimeException(sprintf("Can't create Bpmn Project." . PHP_EOL . $e->getMessage()));
     }
     try {
         $wpData = array();
         $wpData["PRO_UID"] = $this->getUid();
         if (array_key_exists("PRJ_NAME", $data)) {
             $wpData["PRO_TITLE"] = $data["PRJ_NAME"];
         }
         if (array_key_exists("PRJ_DESCRIPTION", $data)) {
             $wpData["PRO_DESCRIPTION"] = $data["PRJ_DESCRIPTION"];
         }
         if (array_key_exists("PRJ_AUTHOR", $data)) {
             $wpData["PRO_CREATE_USER"] = $data["PRJ_AUTHOR"];
         }
         if (array_key_exists("PRJ_TYPE", $data)) {
             $wpData["PRO_TYPE"] = $data["PRJ_TYPE"];
         }
         if (array_key_exists("PRJ_CATEGORY", $data)) {
             $wpData["PRO_CATEGORY"] = $data["PRJ_CATEGORY"];
         }
         $this->wp = new Project\Workflow();
         $this->wp->create($wpData);
         //Add Audit Log
         $ogetProcess = new \Process();
         $getprocess = $ogetProcess->load($this->getUid());
         $nameProcess = $getprocess['PRO_TITLE'];
         \G::auditLog("ImportProcess", 'PMX File Imported ' . $nameProcess . ' (' . $this->getUid() . ')');
     } catch (\Exception $e) {
         $prjUid = $this->getUid();
         //$this->remove();
         $bpmnProject = Project\Bpmn::load($prjUid);
         $bpmnProject->remove();
         throw new \RuntimeException(sprintf("Can't create Bpmn Project with prj_uid: %s, workflow creation fails." . PHP_EOL . $e->getMessage(), $prjUid));
     }
 }
예제 #3
0
 /**
  * Update register device with userUid
  *
  * @param array $request_data
  * @param string $dev_uid
  * @param string $use_uid
  * @author Ronald Quenta <*****@*****.**>
  *
  */
 public function updateDevice($dev_uid, $use_uid, $request_data)
 {
     $arrayData = array();
     $arrayData['USR_UID'] = $use_uid;
     $arrayData['DEV_UID'] = $dev_uid;
     if (isset($request_data['deviceIdToken'])) {
         $arrayData['DEV_REG_ID'] = $request_data['deviceIdToken'];
     }
     if (isset($request_data['sysLanguage'])) {
         $arrayData['SYS_LANG'] = $request_data['sysLanguage'];
     }
     if (isset($request_data['deviceType'])) {
         $arrayData['DEV_TYPE'] = $request_data['deviceType'];
     }
     $oNoti = new \NotificationDevice();
     $response = array();
     if ($oNoti->update($arrayData)) {
         $response["message"] = G::LoadTranslation("ID_RECORD_SAVED_SUCCESFULLY");
         G::auditLog("Update", "Device Save: Device ID (" . $oNoti->getDevUid() . ") ");
     }
     return $response;
 }
예제 #4
0
 public function create($data)
 {
     try {
         parent::create($data);
     } catch (\Exception $e) {
         throw new \RuntimeException(sprintf("Can't create Workflow Project." . PHP_EOL . $e->getMessage()));
     }
     try {
         $bpData = array();
         $bpData["PRJ_UID"] = $this->getUid();
         if (array_key_exists("PRO_TITLE", $data)) {
             $bpData["PRJ_NAME"] = $data["PRO_TITLE"];
         }
         if (array_key_exists("PRO_DESCRIPTION", $data)) {
             $bpData["PRJ_DESCRIPTION"] = $data["PRO_DESCRIPTION"];
         }
         if (array_key_exists("PRO_CREATE_USER", $data)) {
             $bpData["PRJ_AUTHOR"] = $data["PRO_CREATE_USER"];
         } elseif (array_key_exists("USR_UID", $data)) {
             $bpData["PRJ_AUTHOR"] = $data["USR_UID"];
         }
         $this->bp = new Project\Bpmn();
         $this->bp->create($bpData);
         // At this time we will add a default diagram and process
         $this->bp->addDiagram();
         $this->bp->addProcess();
         //Add Audit Log
         $ogetProcess = new \Process();
         $getprocess = $ogetProcess->load($this->getUid());
         $nameProcess = $getprocess['PRO_TITLE'];
         \G::auditLog("ImportProcess", 'BPMN Imported ' . $nameProcess . ' (' . $this->getUid() . ')');
     } catch (\Exception $e) {
         $prjUid = $this->getUid();
         $this->remove();
         throw new \RuntimeException(sprintf("Can't create Project with prj_uid: %s, workflow creation fails." . PHP_EOL . $e->getMessage(), $prjUid));
     }
 }
}
try {
    global $RBAC;
    switch ($RBAC->userCanAccess('PM_FACTORY')) {
        case -2:
            G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
            G::header('location: ../login/login');
            die;
            break;
        case -1:
            G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
            G::header('location: ../login/login');
            die;
            break;
    }
    require_once 'classes/model/CaseTrackerObject.php';
    $oCaseTrackerObject = new CaseTrackerObject();
    if (isset($_POST['form'])) {
        $value = $_POST['form'];
    } else {
        $value = $_POST;
    }
    $aFields = $oCaseTrackerObject->load($value['CTO_UID']);
    $aFields['CTO_CONDITION'] = $value['CTO_CONDITION'];
    $oCaseTrackerObject->update($aFields);
    $infoProcess = new Process();
    $resultProcess = $infoProcess->load($value['PRO_UID']);
    G::auditLog('CaseTrackers', 'Save Condition Case Tracker Object (' . $value['CTO_UID'] . ', condition: ' . $value['CTO_CONDITION'] . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
} catch (Exception $oException) {
    die($oException->getMessage());
}
예제 #6
0
    public function remove ($SchUid)
    {
        $con = Propel::getConnection( CaseSchedulerPeer::DATABASE_NAME );
        try {
            $oCaseScheduler = CaseSchedulerPeer::retrieveByPK( $SchUid );
            if (! is_null( $oCaseScheduler )) {
                $fields = $this->Load( $SchUid );
                $iResult = $oCaseScheduler->delete();
                $con->commit();
                //Add Audit Log
                G::auditLog("DeleteCaseScheduler", "Scheduler Name: ".$fields['SCH_NAME'].", Task: ".$fields['TAS_UID']);

                return $iResult;
            } else {
                throw (new Exception( 'This row doesn\'t exist!' ));
            }
        } catch (Exception $e) {
            $con->rollback();
            throw ($e);
        }
    }
        require_once 'classes/model/Step.php';
        $oStep = new Step();
        $sUidGrids = $oStep->lookingforUidGrids($sPRO_UID, $sDYNAFORM);
        $template->assign("URL_MABORAK_JS", G::browserCacheFilesUrl("/js/maborak/core/maborak.js"));
        $template->assign("URL_TRANSLATION_ENV_JS", G::browserCacheFilesUrl("/jscore/labels/" . SYS_LANG . ".js"));
        $template->assign("siteUrl", $http . $_SERVER["HTTP_HOST"]);
        $template->assign("sysSys", SYS_SYS);
        $template->assign("sysLang", SYS_LANG);
        $template->assign("sysSkin", SYS_SKIN);
        $template->assign("processUid", $sPRO_UID);
        $template->assign("dynaformUid", $sDYNAFORM);
        $template->assign("taskUid", $sTASKS);
        $template->assign("dynFileName", $sPRO_UID . "/" . $sDYNAFORM);
        $template->assign("formId", $G_FORM->id);
        $template->assign("scriptCode", $scriptCode);
        if (sizeof($sUidGrids) > 0) {
            foreach ($sUidGrids as $k => $v) {
                $template->newBlock('grid_uids');
                $template->assign('siteUrl', $http . $_SERVER['HTTP_HOST']);
                $template->assign('gridFileName', $sPRO_UID . '/' . $v);
            }
        }
        print_r('<textarea cols="77" rows="26" style="width:100%; height:99%">' . htmlentities(str_replace('</body>', '</form></body>', str_replace('</form>', '', $template->getOutputContent()))) . '</textarea>');
        G::auditLog('WebEntry', 'Generate web entry with single HTML (dynaform uid: ' . $sDYNAFORM . ') in process "' . $resultProcess['PRO_TITLE'] . '"');
    }
} catch (Exception $e) {
    $G_PUBLISH = new Publisher();
    $aMessage['MESSAGE'] = $e->getMessage();
    $G_PUBLISH->AddContent('xmlform', 'xmlform', 'login/showMessage', '', $aMessage);
    G::RenderPage('publish', 'raw');
}
예제 #8
0
                    die;
                }

                $sDir = "";
                if (isset($_REQUEST['MAIN_DIRECTORY'])) {
                    $_REQUEST['MAIN_DIRECTORY'] = $filter->xssFilterHard($_REQUEST['MAIN_DIRECTORY']);
                    $sDir = $_REQUEST['MAIN_DIRECTORY'];
                }
                switch ($sDir) {
                    case 'mailTemplates':
                        $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
                        G::auditLog('ProcessFileManager','Save template ('.$_REQUEST['filename'].') in process "'.$resultProcess['PRO_TITLE'].'"');
                        break;
                    case 'public':
                        $sDirectory = PATH_DATA_PUBLIC . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
                        G::auditLog('ProcessFileManager','Save public template ('.$_REQUEST['filename'].') in process "'.$resultProcess['PRO_TITLE'].'"');
                        break;
                    default:
                        $sDirectory = PATH_DATA_MAILTEMPLATES . $_REQUEST['pro_uid'] . PATH_SEP . $_REQUEST['filename'];
                        break;
                }
                $fp = fopen($sDirectory, 'w');
                $content = stripslashes($_REQUEST['fcontent']);
                $content = str_replace("@amp@", "&", $content);
                $content = base64_decode($content);
                fwrite($fp, $content);
                fclose($fp);
                $sDirectory = $filter->xssFilterHard($sDirectory);
                echo 'saved: ' . $sDirectory;
            }
            break;
예제 #9
0
 /**
  * Remove the application document registry
  *
  * @param string $sGrpUid
  * @param string $sUserUid
  * @return string
  */
 public function remove($sGrpUid, $sUserUid)
 {
     $oConnection = Propel::getConnection(GroupUserPeer::DATABASE_NAME);
     try {
         $oGroupUser = GroupUserPeer::retrieveByPK($sGrpUid, $sUserUid);
         if (!is_null($oGroupUser)) {
             $oConnection->begin();
             $iResult = $oGroupUser->delete();
             $oConnection->commit();
             $oGrpwf = new Groupwf();
             $grpName = $oGrpwf->loadByGroupUid($sGrpUid);
             $oUsr = new Users();
             $usrName = $oUsr->load($sUserUid);
             G::auditLog("AssignUserToGroup", "Remove user: "******" (" . $sUserUid . ") from group " . $grpName['CON_VALUE'] . " (" . $sGrpUid . ") ");
             return $iResult;
         } else {
             throw new Exception('This row doesn\'t exist!');
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw $oError;
     }
 }
예제 #10
0
    /**
     * Export PM tables
     *
     * @author : Erik Amaru Ortiz <*****@*****.**>
     */
    public function export ($httpData)
    {
        require_once 'classes/model/AdditionalTables.php';
        $at = new AdditionalTables();
        $tablesToExport = G::json_decode( stripslashes( $httpData->rows ) );

        try {
            $result = new stdClass();
            G::LoadCLass( 'net' );
            $net = new NET( G::getIpAddress() );

            G::LoadClass( "system" );

            $META = " \n-----== ProcessMaker Open Source Private Tables ==-----\n" . " @Ver: 1.0 Oct-2009\n" . " @Processmaker version: " . System::getVersion() . "\n" . " -------------------------------------------------------\n" . " @Export Date: " . date( "l jS \of F Y h:i:s A" ) . "\n" . " @Server address: " . getenv( 'SERVER_NAME' ) . " (" . getenv( 'SERVER_ADDR' ) . ")\n" . " @Client address: " . $net->hostname . "\n" . " @Workspace: " . SYS_SYS . "\n" . " @Export trace back:\n\n";

            $EXPORT_TRACEBACK = Array ();
            $c = 0;
            foreach ($tablesToExport as $table) {
                $tableRecord = $at->load( $table->ADD_TAB_UID );
                $tableData = $at->getAllData( $table->ADD_TAB_UID, null, null, false );
                $table->ADD_TAB_NAME = $tableRecord['ADD_TAB_NAME'];
                $rows = $tableData['rows'];
                $count = $tableData['count'];

                array_push( $EXPORT_TRACEBACK, Array ('uid' => $table->ADD_TAB_UID,'name' => $table->ADD_TAB_NAME,'num_regs' => $tableData['count'],'schema' => $table->_SCHEMA ? 'yes' : 'no','data' => $table->_DATA ? 'yes' : 'no'
                ) );
            }

            $sTrace = "TABLE UID                        TABLE NAME\tREGS\tSCHEMA\tDATA\n";

            foreach ($EXPORT_TRACEBACK as $row) {
                $sTrace .= "{$row['uid']}\t{$row['name']}\t\t{$row['num_regs']}\t{$row['schema']}\t{$row['data']}\n";
            }

            $META .= $sTrace;

            ///////////////EXPORT PROCESS
            $PUBLIC_ROOT_PATH = PATH_DATA . 'sites' . PATH_SEP . SYS_SYS . PATH_SEP . 'public' . PATH_SEP;

            $filenameOnly = strtolower( 'SYS-' . SYS_SYS . "_" . date( "Y-m-d" ) . '_' . date( "Hi" ) . ".pmt" );

            $filename = $PUBLIC_ROOT_PATH . $filenameOnly;
            $fp = fopen( $filename, "wb" );

            $bytesSaved = 0;
            $bufferType = '@META';
            $fsData = sprintf( "%09d", strlen( $META ) );
            $fsbufferType = sprintf( "%09d", strlen( $bufferType ) );
            $bytesSaved += fwrite( $fp, $fsbufferType ); //writing the size of $oData
            $bytesSaved += fwrite( $fp, $bufferType ); //writing the $oData
            $bytesSaved += fwrite( $fp, $fsData ); //writing the size of $oData
            $bytesSaved += fwrite( $fp, $META ); //writing the $oData


            foreach ($tablesToExport as $table) {

                if ($table->_SCHEMA) {
                    $oAdditionalTables = new AdditionalTables();
                    $aData = $oAdditionalTables->load( $table->ADD_TAB_UID, true );

                    $bufferType = '@SCHEMA';
                    $SDATA = serialize( $aData );
                    $fsUid = sprintf( "%09d", strlen( $table->ADD_TAB_UID ) );
                    $fsData = sprintf( "%09d", strlen( $SDATA ) );
                    $fsbufferType = sprintf( "%09d", strlen( $bufferType ) );

                    $bytesSaved += fwrite( $fp, $fsbufferType ); //writing the size of $oData
                    $bytesSaved += fwrite( $fp, $bufferType ); //writing the $oData
                    $bytesSaved += fwrite( $fp, $fsUid ); //writing the size of xml file
                    $bytesSaved += fwrite( $fp, $table->ADD_TAB_UID ); //writing the xmlfile
                    $bytesSaved += fwrite( $fp, $fsData ); //writing the size of xml file
                    $bytesSaved += fwrite( $fp, $SDATA ); //writing the xmlfile
                }

                if ($table->_DATA) {
                    //export data
                    $oAdditionalTables = new additionalTables();
                    $tableData = $oAdditionalTables->getAllData( $table->ADD_TAB_UID, null, null, false );

                    $SDATA = serialize( $tableData['rows'] );
                    $bufferType = '@DATA';

                    $fsbufferType = sprintf( "%09d", strlen( $bufferType ) );
                    $fsTableName = sprintf( "%09d", strlen( $table->ADD_TAB_NAME ) );
                    $fsData = sprintf( "%09d", strlen( $SDATA ) );

                    $bytesSaved += fwrite( $fp, $fsbufferType ); //writing type size
                    $bytesSaved += fwrite( $fp, $bufferType ); //writing type
                    $bytesSaved += fwrite( $fp, $fsTableName ); //writing the size of xml file
                    $bytesSaved += fwrite( $fp, $table->ADD_TAB_NAME ); //writing the xmlfile
                    $bytesSaved += fwrite( $fp, $fsData ); //writing the size of xml file
                    $bytesSaved += fwrite( $fp, $SDATA ); //writing the xmlfile
                }
                G::auditLog("ExportTable", $table->ADD_TAB_NAME." (".$table->ADD_TAB_UID.") ");
            }

            fclose( $fp );

            $filenameLink = "pmTables/streamExported?f=$filenameOnly";
            $size = round( ($bytesSaved / 1024), 2 ) . " Kb";
            $meta = "<pre>" . $META . "</pre>";
            $filename = $filenameOnly;
            $link = $filenameLink;

            $result->success = true;
            $result->filename = $filenameOnly;
            $result->link = $link;
            $result->message = "Generated file: $filenameOnly, size: $size";
        } catch (Exception $e) {
            $result = new stdClass();
            $result->success = false;
            $result->message = $e->getMessage();
        }

        return $result;
    }
예제 #11
0
         //SUB_APPLICATION INSERT
         $res = $appCache->triggerSubApplicationInsert($lang, false);
         //CONTENT UPDATE
         $res = $appCache->triggerContentUpdate($lang, true);
         //$result->info[] = array("name" => "Trigger CONTENT UPDATE", "value" => $res);
         //build using the method in AppCacheView Class
         $res = $appCache->fillAppCacheView($lang);
         //$result->info[] = array ('name' => 'build APP_CACHE_VIEW',              'value'=> $res);
         //set status in config table
         $confParams = array('LANG' => $lang, 'STATUS' => 'active');
         $conf->aConfig = $confParams;
         $conf->saveConfig('APP_CACHE_VIEW_ENGINE', '', '', '');
         $result = new StdClass();
         $result->success = true;
         $result->msg = G::LoadTranslation('ID_TITLE_COMPLETED');
         G::auditLog("BuildCache");
         echo G::json_encode($result);
     } catch (Exception $e) {
         $confParams = array('lang' => $lang, 'status' => 'failed');
         $appCacheViewEngine = $oServerConf->setProperty('APP_CACHE_VIEW_ENGINE', $confParams);
         echo '{success: false, msg:"' . $e->getMessage() . '"}';
     }
     break;
 case 'recreate-root':
     $user = $_POST['user'];
     $passwd = $_POST['password'];
     $server = $_POST['host'];
     $aServer = split(":", $server);
     $serverName = $aServer[0];
     $port = count($aServer) > 1 ? $aServer[1] : "none";
     list($sucess, $msgErr) = testConnection(DB_ADAPTER, $serverName, $user, $passwd, $port);
예제 #12
0
<?php

if (isset($_POST['form'])) {
    $sValue = $_POST['form'];
} else {
    $sValue = $_POST;
}
unset($sValue['SAVE']);
if (!isset($sValue['CT_DERIVATION_HISTORY'])) {
    $sValue['CT_DERIVATION_HISTORY'] = 0;
}
if (!isset($sValue['CT_MESSAGE_HISTORY'])) {
    $sValue['CT_MESSAGE_HISTORY'] = 0;
}
require_once 'classes/model/CaseTracker.php';
$oCaseTracker = new CaseTracker();
$oCaseTracker->update($sValue);
$infoProcess = new Process();
$resultProcess = $infoProcess->load($sValue['PRO_UID']);
if ($sValue['CT_DERIVATION_HISTORY'] == 1) {
    $type[] = "Routing History";
}
if ($sValue['CT_MESSAGE_HISTORY'] == 1) {
    $type[] = "Messages History";
}
G::auditLog('CaseTrackers', 'Save Case Tracker Properties (' . $sValue['CT_MAP_TYPE'] . ' - ' . implode(', ', $type) . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
예제 #13
0
        unset($oClass);
        if ($fVersionOld > $fVersionNew) {
            throw new Exception(G::loadTranslation('ID_RECENT_VERSION_PLUGIN'));
        }
        $res = $tar->extract(PATH_PLUGINS);
    } else {
        throw new Exception(G::loadTranslation('ID_FILE_CONTAIN_CLASS_PLUGIN', SYS_LANG, array("filename" => $filename, "className" => $sClassName)));
    }
    if (!file_exists(PATH_PLUGINS . $sClassName . '.php')) {
        throw new Exception(G::loadTranslation('ID_FILE_PLUGIN_NOT_EXISTS', SYS_LANG, array("pluginFile" => $pluginFile)));
    }
    require_once PATH_PLUGINS . $pluginFile;
    $oPluginRegistry->registerPlugin($sClassName, PATH_PLUGINS . $sClassName . ".php");
    $size = file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance());
    $details = $oPluginRegistry->getPluginDetails($pluginFile);
    $oPluginRegistry->installPlugin($details->sNamespace);
    $oPluginRegistry->setupPlugins();
    //get and setup enabled plugins
    $size = file_put_contents(PATH_DATA_SITE . "plugin.singleton", $oPluginRegistry->serializeInstance());
    $response = $oPluginRegistry->verifyTranslation($details->sNamespace);
    G::auditLog("InstallPlugin", "Plugin Name: " . $details->sNamespace);
    //if ($response->recordsCountSuccess <= 0) {
    //throw (new Exception( 'The plugin ' . $details->sNamespace . ' couldn\'t verify any translation item. Verified Records:' . $response->recordsCountSuccess));
    //}
    G::header("Location: pluginsMain");
    die;
} catch (Exception $e) {
    $_SESSION['__PLUGIN_ERROR__'] = $e->getMessage();
    G::header('Location: pluginsMain');
    die;
}
예제 #14
0
            G::LoadClass('processMap');
            $oProcessMap = new ProcessMap();
            $oProcessMap->upCaseTrackerObject($_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION']);
            $oProcessMap->getCaseTrackerObjectsCriteria($_POST['PRO_UID']);
            $infoProcess = new Process();
            $resultProcess = $infoProcess->load($_POST['PRO_UID']);
            G::auditLog('CaseTrackers', 'Move Up Case Tracker Object (' . $_POST['CTO_UID'] . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
            break;
        case 'downCaseTrackerObject':
            G::LoadClass('processMap');
            $oProcessMap = new ProcessMap();
            $oProcessMap->downCaseTrackerObject($_POST['CTO_UID'], $_POST['PRO_UID'], $_POST['STEP_POSITION']);
            $oProcessMap->getCaseTrackerObjectsCriteria($_POST['PRO_UID']);
            $infoProcess = new Process();
            $resultProcess = $infoProcess->load($_POST['PRO_UID']);
            G::auditLog('CaseTrackers', 'Move Down Case Tracker Object (' . $_POST['CTO_UID'] . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
            break;
        case 'editStagesMap':
            $oTemplatePower = new TemplatePower(PATH_TPL . 'tracker/stages_Map.html');
            $oTemplatePower->prepare();
            $G_PUBLISH = new Publisher();
            $G_PUBLISH->AddContent('template', '', '', '', $oTemplatePower);
            $oHeadPublisher =& headPublisher::getSingleton();
            $oHeadPublisher->addScriptCode('
			  var pb=leimnud.dom.capture("tag.body 0");
			  Sm=new stagesmap();
			  Sm.options = {
			  	target    : "sm_target",
			  	dataServer: "../tracker/tracker_Ajax",
			  	uid       : "' . $_POST['PRO_UID'] . '",
			  	lang      : "' . SYS_LANG . '",
예제 #15
0
    public function removeTranslationEnvironment ($locale)
    {
        $filePath = $this->envFilePath;
        if (strpos( $locale, self::$localeSeparator ) !== false) {
            list ($LAN_ID, $IC_UID) = explode( '-', strtoupper( $locale ) );
        } else {
            $LAN_ID = $locale;
            $IC_UID = '__INTERNATIONAL__';
        }

        if (file_exists( $filePath )) {
            $environments = unserialize( file_get_contents( $filePath ) );
            if (! isset( $environments[$LAN_ID][$IC_UID] )) {
                return null;
            }

            unset( $environments[$LAN_ID][$IC_UID] );
            file_put_contents( $filePath, serialize( $environments ) );

            if (file_exists( PATH_CORE . "META-INF" . PATH_SEP . "translation." . $locale )) {
                G::rm_dir( PATH_DATA . "META-INF" . PATH_SEP . "translation." . $locale );
            }
            if (file_exists( PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po' )) {
                G::rm_dir( PATH_CORE . PATH_SEP . 'content' . PATH_SEP . 'translations' . PATH_SEP . 'processmaker' . $locale . '.po' );
            }
            G::auditLog("DeleteLanguage", "Language: ".$locale);
        }
    }
예제 #16
0
        if ($value['TRI_UID'] != '') {
            $oTrigger->load($value['TRI_UID']);
        } else {
            $oTrigger->create($value);
            $value['TRI_UID'] = $oTrigger->getTriUid();
            $swCreate = false;
        }
        $oTrigger->update($value);
        if ($swCreate) {
            //Add Audit Log
            $fields = $oTrigger->load($value['TRI_UID']);
            $description = "Trigger Name: " . $fields['TRI_TITLE'] . ", Trigger Uid: " . $value['TRI_UID'];
            if (isset($fields['TRI_DESCRIPTION'])) {
                $description .= ", Description: " . $fields['TRI_DESCRIPTION'];
            }
            if (isset($value["TRI_WEBBOT"])) {
                $description .= ", [EDIT CODE]";
            }
            G::auditLog("UpdateTrigger", $description);
        }
        //if (! isset( $_POST['mode'] )) {
        //    $oProcessMap->triggersList( $value['PRO_UID'] );
        //}
        $response["success"] = true;
        $response["msg"] = G::LoadTranslation("ID_TRIGGERS_SAVED");
    } catch (Exception $e) {
        $response["success"] = false;
        $response["msg"] = $e->getMessage();
    }
    echo G::json_encode($response);
}
예제 #17
0
 /**
  * Remove the Prolication document registry
  *
  * @param array $aData or string $ProUid
  * @return string
  *
  */
 public function remove($ProUid)
 {
     if (is_array($ProUid)) {
         $ProUid = isset($ProUid['DYN_UID']) ? $ProUid['DYN_UID'] : '';
     }
     try {
         $oPro = DynaformPeer::retrieveByPK($ProUid);
         if (!is_null($oPro)) {
             $title = $oPro->getDynTitle();
             $type = $oPro->getDynType();
             $description = $oPro->getDynDescription();
             Content::removeContent('DYN_TITLE', '', $oPro->getDynUid());
             Content::removeContent('DYN_DESCRIPTION', '', $oPro->getDynUid());
             $iResult = $oPro->delete();
             //Add Audit Log
             G::auditLog("DeleteDynaform", "Dynaform Title: " . $title . ", Type: " . $type . ", Description: " . $description);
             if (file_exists(PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '.xml')) {
                 unlink(PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '.xml');
             }
             if (file_exists(PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '_tmp0.xml')) {
                 unlink(PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '_tmp0.xml');
             }
             if (file_exists(PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '.html')) {
                 unlink(PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '.html');
             }
             if (file_exists(PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '_tmp0.html')) {
                 unlink(PATH_DYNAFORM . $oPro->getProUid() . PATH_SEP . $oPro->getDynUid() . '_tmp0.html');
             }
             return $iResult;
         } else {
             throw new Exception("The row '{$ProUid}' in table Dynaform doesn't exist!");
         }
     } catch (Exception $oError) {
         throw $oError;
     }
 }
예제 #18
0
 * License, or (at your option) any later version.
 *
 * 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
 * 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 <http://www.gnu.org/licenses/>.
 *
 * 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']);
} else {
    $oTrigger->create($_POST['form']);
    $_POST['form']['TRI_UID'] = $oTrigger->getTriUid();
}
$oTrigger->update($_POST['form']);
$triggerFields = $oTrigger->load($_POST['form']['TRI_UID']);
$proUid = $triggerFields['PRO_UID'];
$infoProcess = new Process();
$resultProcess = $infoProcess->load($proUid);
G::auditLog('EditEvent', 'Save trigger from event (' . $_POST['form']['TRI_UID'] . ') in process "' . $resultProcess['PRO_TITLE'] . '"');
예제 #19
0
         fclose($file);
         fclose($fileData);
         ///////
         $path = PATH_TRUNK;
         //$path = PATH_OUTTRUNK;
         if (EnterpriseUtils::checkFolderPermissions($path, true) == false) {
             $str = $path . " " . "directory, its sub-directories or file is not writable. Read the wiki for <a href=\"http://wiki.processmaker.com/index.php/Upgrading_ProcessMaker\" onclick=\"window.open(this.href, \\'_blank\\'); return (false);\">Upgrading ProcessMaker</a>.<br /> The file is downloaded in " . $fileName . "<br />";
             throw new Exception($str);
         }
         ///////
         $result = install($fileName);
         if ($result["status"] == "OK") {
             $response["status"] = $result["status"];
             //OK
             $response["message"] = $result["message"];
             G::auditLog("InstallPlugin", "Plugin Name: " . $file);
         } else {
             throw new Exception($result["message"]);
         }
     } catch (Exception $e) {
         $response["message"] = $e->getMessage();
         $status = 0;
     }
     if ($status == 0) {
         $response["status"] = "ERROR";
     }
     echo G::json_encode($response);
     break;
 case "list":
     $status = 1;
     $response = new stdclass();
                echo '{success: true}';
            } catch (Exception $ex) {
                echo '{success: false, error: ' . $ex->getMessage() . '}';
            }
            break;
        case 'canDeleteCategory':
            require_once 'classes/model/Process.php';
            $proc = new Process();
            $aProcess = $proc->getAllProcessesByCategory();
            $catUID = $_REQUEST['CAT_UID'];
            $response = isset($aProcess[$catUID]) ? 'false' : 'true';
            echo $response;
            break;
        case 'deleteCategory':
            try {
                require_once 'classes/model/ProcessCategory.php';
                $catUID = $_REQUEST['cat_uid'];
                $cat = new ProcessCategory();
                $cat->setCategoryUid($catUID);
                $catName = $cat->loadByCategoryId($catUID);
                $cat->delete();
                G::auditLog("DeleteCategory", "Category Name: " . $catName . " Category ID: (" . $catUID . ") ");
                echo '{success: true}';
            } catch (Exception $ex) {
                echo '{success: false, error: ' . $ex->getMessage() . '}';
            }
            break;
        default:
            echo 'default';
    }
}
예제 #21
0
 case "finish":
     if ($addon === null) {
         throw new Exception("No addon specified to {$action}");
     }
     $addon->setState();
     break;
 case "disable":
 case "enable":
     if ($addon === null) {
         throw new Exception("No addon specified to {$action}");
     }
     $result["success"] = $addon->setEnabled($action == "enable");
     if ($action == "enable") {
         G::auditLog("EnablePlugin", "Plugin Name: " . $_REQUEST['addon']);
     } else {
         G::auditLog("DisablePlugin", "Plugin Name: " . $_REQUEST['addon']);
     }
     break;
 case "install":
     $status = 1;
     try {
         if (EnterpriseUtils::getInternetConnection() == 0) {
             throw new Exception("Enterprise Plugins Manager no connected to internet.");
         }
         ///////
         $aux = explode("?", $addon->getAddonDownloadUrl());
         $url = $aux[0];
         if (EnterpriseUtils::checkConnectivity($url) == false) {
             throw new Exception("Server {$url} not available.");
         }
         if ($addon === null) {
$sObjectUID = '';
switch ($sValue['OP_OBJ_TYPE']) {
    case 'ANY':
        /*case 'ANY_DYNAFORM':
          case 'ANY_INPUT':
          case 'ANY_OUTPUT':*/
        $sObjectUID = '';
        break;
    case 'DYNAFORM':
        $sObjectUID = $sValue['DYNAFORMS'];
        break;
    case 'INPUT':
        $sObjectUID = $sValue['INPUTS'];
        break;
    case 'OUTPUT':
        $sObjectUID = $sValue['OUTPUTS'];
        break;
}
require_once 'classes/model/ObjectPermission.php';
$oOP = new ObjectPermission();
$aData = array('OP_UID' => G::generateUniqueID(), 'PRO_UID' => $sValue['PRO_UID'], 'TAS_UID' => $sValue['TAS_UID'], 'USR_UID' => (string) $sUserGroup, 'OP_USER_RELATION' => $iRelation, 'OP_TASK_SOURCE' => $sValue['OP_TASK_SOURCE'], 'OP_PARTICIPATE' => $sValue['OP_PARTICIPATE'], 'OP_OBJ_TYPE' => $sValue['OP_OBJ_TYPE'], 'OP_OBJ_UID' => $sObjectUID, 'OP_ACTION' => $sValue['OP_ACTION'], 'OP_CASE_STATUS' => $sValue['OP_CASE_STATUS']);
$oOP->fromArray($aData, BasePeer::TYPE_FIELDNAME);
$oOP->save();
G::LoadClass('processMap');
$oProcessMap = new ProcessMap();
$oProcessMap->getObjectsPermissionsCriteria($sValue['PRO_UID']);
$infoProcess = new Processes();
$resultProcess = $infoProcess->getProcessRow($sValue['PRO_UID']);
$participation = $sValue['OP_PARTICIPATE'] == 1 ? "YES" : "NO";
G::auditLog('ProcessPermissions', 'Add Permission (group or user: '******'|', $sValue['GROUP_USER'])) . ', permission: ' . $sValue['OP_ACTION'] . ', status case: ' . $sValue['OP_CASE_STATUS'] . ', type: ' . $sValue['OP_OBJ_TYPE'] . ', participation required: ' . $participation . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
예제 #23
0
 public function update($aData, $aFields = array())
 {
     $oConnection = Propel::getConnection(AdditionalTablesPeer::DATABASE_NAME);
     try {
         $oAdditionalTables = AdditionalTablesPeer::retrieveByPK($aData['ADD_TAB_UID']);
         if (!is_null($oAdditionalTables)) {
             $oAdditionalTables->fromArray($aData, BasePeer::TYPE_FIELDNAME);
             if ($oAdditionalTables->validate()) {
                 $oConnection->begin();
                 $iResult = $oAdditionalTables->save();
                 $oConnection->commit();
                 $addTabDescription = ($aData["ADD_TAB_DESCRIPTION"] != "")? ", Description: " . $aData["ADD_TAB_DESCRIPTION"] : ".";
                 G::auditLog("UpdatePmtable", "PM Table Name: ".$aData['ADD_TAB_NAME'] . $addTabDescription . ", PM Table ID: (".$aData['ADD_TAB_UID'].") ");
             } else {
                 $sMessage = '';
                 $aValidationFailures = $oAdditionalTables->getValidationFailures();
                 foreach ($aValidationFailures as $oValidationFailure) {
                     $sMessage .= $oValidationFailure->getMessage() . '<br />';
                 }
                 throw(new Exception('The registry cannot be updated!<br />' . $sMessage));
             }
         } else {
             throw(new Exception('This row doesn\'t exist!'));
         }
     } catch (Exception $oError) {
         $oConnection->rollback();
         throw($oError);
     }
 }
예제 #24
0
 public function removeUserFromDepartment($DepUid, $UsrUid)
 {
     $aFields = array('USR_UID' => $UsrUid, 'DEP_UID' => '', 'USR_REPORTS_TO' => '');
     try {
         $oUser = UsersPeer::retrieveByPk($UsrUid);
         $user = $oUser->loadDetailed($UsrUid);
         $dptoTitle = $this->Load($DepUid);
         if (is_object($oUser) && get_class($oUser) == 'Users') {
             //$oDepto = new Users();
             $oUser->setDepUid('');
             $oUser->setUsrReportsTo('');
             $oUser->save();
             G::auditLog("RemoveUsersFromDepartament", "Remove user " . $user['USR_USERNAME'] . "( " . $UsrUid . ") from departament " . $dptoTitle['DEPO_TITLE'] . " (" . $DepUid . ") ");
         }
     } catch (exception $oError) {
         throw $oError;
     }
 }
예제 #25
0
function deleteSkin()
{
    G::LoadSystem('inputfilter');
    $filter = new InputFilter();
    try {
        $_REQUEST['SKIN_FOLDER_ID'] = $filter->xssFilterHard($_REQUEST['SKIN_FOLDER_ID']);
        if (!isset($_REQUEST['SKIN_FOLDER_ID'])) {
            throw new Exception(G::LoadTranslation('ID_SKIN_FOLDER_REQUIRED'));
        }
        if ($_REQUEST['SKIN_FOLDER_ID'] == "classic") {
            throw new Exception(G::LoadTranslation('ID_SKIN_FOLDER_NOT_DELETEABLE'));
        }
        $folderId = $_REQUEST['SKIN_FOLDER_ID'];
        if (!is_dir(PATH_CUSTOM_SKINS . $folderId)) {
            throw new Exception(G::LoadTranslation('ID_SKIN_NOT_EXISTS'));
        }
        //Delete
        G::rm_dir(PATH_CUSTOM_SKINS . $folderId);
        $response['success'] = true;
        $response['message'] = "{$folderId} deleted";
        G::auditLog("DeleteSkin", "Skin Name: " . $folderId);
    } catch (Exception $e) {
        $response['success'] = false;
        $response['error'] = $response['message'] = $e->getMessage();
        $response = $filter->xssFilterHard($response);
        print_r(G::json_encode($response));
    }
}
예제 #26
0
 public function export()
 {
     G::LoadSystem('i18n_po');
     G::LoadClass("system");
     //get labels MichelangeloFE
     try {
         $oTranslation = new Translation();
         $MichelangeloFE = PATH_HOME . "../workflow/public_html/lib/js";
         if (file_exists($MichelangeloFE)) {
             $labels = self::readLabelsDirectory($MichelangeloFE, true);
             foreach ($labels as $label) {
                 $oTranslation->addTranslation('LABEL', 'ID_MAFE_' . G::encryptOld($label), 'en', $label);
             }
         }
     } catch (Exception $e) {
         error_log($e->getMessage());
     }
     //creating the .po file
     $sPOFile = PATH_CORE . 'content' . PATH_SEP . 'translations' . PATH_SEP . MAIN_POFILE . '.' . $_GET['LOCALE'] . '.po';
     $poFile = new i18n_PO($sPOFile);
     $poFile->buildInit();
     $language = new Language();
     $locale = $_GET['LOCALE'];
     $_TARGET_LANG = $_GET['LOCALE'];
     $_BASE_LANG = 'en';
     if (strpos($locale, Translation::$localeSeparator) !== false) {
         list($LAN_ID, $IC_UID) = explode(Translation::$localeSeparator, $_GET['LOCALE']);
         $iCountry = new IsoCountry();
         $iCountryRecord = $iCountry->findById($IC_UID);
         if (!isset($iCountryRecord['IC_UID'])) {
             throw new Exception("Country Target ID '{$_GET['LAN_ID']}' doesn't exist!");
         }
         $sCountry = $iCountryRecord['IC_NAME'];
     } else {
         $LAN_ID = $locale;
         $sCountry = $IC_UID = '';
     }
     $langRecord = $language->findById($LAN_ID);
     if (!isset($langRecord['LAN_NAME'])) {
         throw new Exception("Language Target ID \"{$LAN_ID}\" doesn't exist!");
     }
     $sLanguage = $langRecord['LAN_NAME'];
     //setting headers
     $poFile->addHeader('Project-Id-Version', 'ProcessMaker ' . System::getVersion());
     $poFile->addHeader('POT-Creation-Date', '');
     $poFile->addHeader('PO-Revision-Date', date('Y-m-d H:i:s'));
     $poFile->addHeader('Last-Translator', '');
     $poFile->addHeader('Language-Team', 'Colosa Developers Team <*****@*****.**>');
     $poFile->addHeader('MIME-Version', '1.0');
     $poFile->addHeader('Content-Type', 'text/plain; charset=utf-8');
     $poFile->addHeader('Content-Transfer_Encoding', '8bit');
     $poFile->addHeader('X-Poedit-Language', ucwords($sLanguage));
     $poFile->addHeader('X-Poedit-Country', ucwords($sCountry));
     $poFile->addHeader('X-Poedit-SourceCharset', 'utf-8');
     $poFile->addHeader('Content-Transfer-Encoding', '8bit');
     $aLabels = array();
     $aMsgids = array('' => true);
     // selecting all translations records of base language 'en' on TRANSLATIONS table
     $oCriteria = new Criteria('workflow');
     $oCriteria->addSelectColumn(TranslationPeer::TRN_CATEGORY);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_ID);
     $oCriteria->addSelectColumn(TranslationPeer::TRN_VALUE);
     $oCriteria->add(TranslationPeer::TRN_LANG, 'en');
     $oDataset = TranslationPeer::doSelectRS($oCriteria);
     $oDataset->setFetchmode(ResultSet::FETCHMODE_ASSOC);
     $targetLangRecords = array();
     // retrieve the translation for the target language
     if ($LAN_ID != 'en') {
         // only if it is different language than base language 'en'
         $c = new Criteria('workflow');
         $c->addSelectColumn(TranslationPeer::TRN_CATEGORY);
         $c->addSelectColumn(TranslationPeer::TRN_ID);
         $c->addSelectColumn(TranslationPeer::TRN_VALUE);
         $c->add(TranslationPeer::TRN_LANG, $_GET['LOCALE']);
         $ds = TranslationPeer::doSelectRS($c);
         $ds->setFetchmode(ResultSet::FETCHMODE_ASSOC);
         while ($ds->next()) {
             $row = $ds->getRow();
             $targetLangRecords[$row['TRN_CATEGORY'] . '/' . $row['TRN_ID']] = $row['TRN_VALUE'];
         }
     }
     // get the respective translation for each english label
     while ($oDataset->next()) {
         $aRow1 = $oDataset->getRow();
         $trnCategory = trim($aRow1['TRN_CATEGORY']);
         # Validation, validate that the TRN_CATEGORY contains valid characteres
         preg_match("/^[0-9a-zA-Z_-]+/", $trnCategory, $sTestResult);
         // IF the translations id "TRN_ID" has invalid characteres or has not accepted categories
         if ($sTestResult[0] !== $trnCategory || $trnCategory != 'LABEL' && $trnCategory != 'JAVASCRIPT') {
             $oTranslation = new Translation();
             $oTranslation->remove($aRow1['TRN_CATEGORY'], $aRow1['TRN_ID'], 'en');
             //remove not accepted translations
             continue;
             //jump to next iteration
         }
         // retrieve the translation for the target language
         if ($LAN_ID != 'en') {
             // only if it is different language than base language 'en'
             if (isset($targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']])) {
                 $msgstr = $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] != '' ? $targetLangRecords[$aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']] : $aRow1['TRN_VALUE'];
             } else {
                 $msgstr = $aRow1['TRN_VALUE'];
             }
         } else {
             //if not just copy the same
             $msgstr = $aRow1['TRN_VALUE'];
         }
         $msgid = trim($aRow1['TRN_VALUE']);
         $msgstr = trim($msgstr);
         if (isset($aMsgids[$msgid])) {
             $msgid = '[' . $aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID'] . '] ' . $msgid;
         }
         $poFile->addTranslatorComment('TRANSLATION');
         $poFile->addTranslatorComment($aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']);
         $poFile->addReference($aRow1['TRN_CATEGORY'] . '/' . $aRow1['TRN_ID']);
         $poFile->addTranslation(stripcslashes($msgid), stripcslashes($msgstr));
         $aMsgids[$msgid] = true;
     }
     //$timer->setMarker('end making 1th .po from db');
     //find all xml files into PATH_XMLFORM
     $aXMLForms = glob(PATH_XMLFORM . '*/*.xml');
     //from a sublevel to
     $aXMLForms2 = glob(PATH_XMLFORM . '*/*/*.xml');
     $aXMLForms = array_merge($aXMLForms, $aXMLForms2);
     $aEnglishLabel = array();
     $aOptions = array();
     $nodesNames = array();
     G::loadSystem('dynaformhandler');
     foreach ($aXMLForms as $xmlFormPath) {
         $xmlFormFile = str_replace(chr(92), '/', $xmlFormPath);
         $xmlFormFile = str_replace(PATH_XMLFORM, '', $xmlFormPath);
         $dynaForm = new dynaFormHandler($xmlFormPath);
         $dynaNodes = $dynaForm->getFields();
         //get all fields of each xmlform
         foreach ($dynaNodes as $oNode) {
             $sNodeName = $oNode->nodeName;
             //$arrayNode = $dynaForm->getArray($oNode, Array('type', $_BASE_LANG, $_BASE_LANG));
             $arrayNode = $dynaForm->getArray($oNode);
             //if has not native language translation
             if (!isset($arrayNode[$_BASE_LANG]) || !isset($arrayNode['type']) || isset($arrayNode['type']) && in_array($arrayNode['type'], $this->exceptionFields)) {
                 continue;
                 //just continue with the next node
             }
             // Getting the Base Origin Text
             if (!is_array($arrayNode[$_BASE_LANG])) {
                 $originNodeText = trim($arrayNode[$_BASE_LANG]);
             } else {
                 $langNode = $arrayNode[$_BASE_LANG][0];
                 $originNodeText = $langNode['__nodeText__'];
             }
             // Getting the Base Target Text
             if (isset($arrayNode[$_TARGET_LANG])) {
                 if (!is_array($arrayNode[$_TARGET_LANG])) {
                     $targetNodeText = trim($arrayNode[$_TARGET_LANG]);
                 } else {
                     $langNode = $arrayNode[$_TARGET_LANG][0];
                     $targetNodeText = $langNode['__nodeText__'];
                 }
             } else {
                 $targetNodeText = $originNodeText;
             }
             $nodeName = $arrayNode['__nodeName__'];
             $nodeType = $arrayNode['type'];
             $msgid = $originNodeText;
             // if the nodeName already exists in the po file, we need to create other msgid
             if (isset($aMsgids[$msgid])) {
                 $msgid = '[' . $xmlFormFile . '?' . $nodeName . '] ' . $originNodeText;
             }
             $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName);
             $poFile->addTranslatorComment($xmlFormFile);
             $poFile->addReference($nodeType . ' - ' . $nodeName);
             $poFile->addTranslation(stripslashes($msgid), stripslashes($targetNodeText));
             $aMsgids[$msgid] = true;
             //if this node has options child nodes
             if (isset($arrayNode[$_BASE_LANG]) && isset($arrayNode[$_BASE_LANG][0]) && isset($arrayNode[$_BASE_LANG][0]['option'])) {
                 $originOptionNode = $arrayNode[$_BASE_LANG][0]['option'];
                 //get the options
                 $targetOptionExists = false;
                 if (isset($arrayNode[$_TARGET_LANG]) && isset($arrayNode[$_TARGET_LANG][0]) && isset($arrayNode[$_TARGET_LANG][0]['option'])) {
                     $targetOptionNode = $arrayNode[$_TARGET_LANG][0]['option'];
                     $targetOptionExists = true;
                 }
                 if (!is_array($originOptionNode)) {
                     if (is_string($originOptionNode)) {
                         $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName . '-' . $originOptionNode);
                         $poFile->addTranslatorComment($xmlFormFile);
                         $poFile->addReference($nodeType . ' - ' . $nodeName . ' - ' . $originOptionNode);
                         $poFile->addTranslation(stripslashes($msgid), stripslashes($originOptionNode));
                     }
                 } else {
                     foreach ($originOptionNode as $optionNode) {
                         $optionName = $optionNode['name'];
                         $originOptionValue = $optionNode['__nodeText__'];
                         if ($targetOptionExists) {
                             $targetOptionValue = getMatchDropdownOptionValue($optionName, $targetOptionNode);
                             if ($targetOptionValue === false) {
                                 $targetOptionValue = $originOptionValue;
                             }
                         } else {
                             $targetOptionValue = $originOptionValue;
                         }
                         $msgid = '[' . $xmlFormFile . '?' . $nodeName . '-' . $optionName . ']';
                         $poFile->addTranslatorComment($xmlFormFile . '?' . $nodeName . '-' . $optionName);
                         $poFile->addTranslatorComment($xmlFormFile);
                         $poFile->addReference($nodeType . ' - ' . $nodeName . ' - ' . $optionName);
                         $poFile->addTranslation($msgid, stripslashes($targetOptionValue));
                     }
                 }
             }
         }
         //end foreach
     }
     G::auditLog("ExportLanguage", "Language: " . $_GET['LOCALE']);
     G::streamFile($sPOFile, true);
 }
            G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_SYSTEM', 'error', 'labels');
            G::header('location: ../login/login');
            die;
            break;
        default:
            G::SendTemporalMessage('ID_USER_HAVENT_RIGHTS_PAGE', 'error', 'labels');
            G::header('location: ../login/login');
            die;
            break;
    }
}
try {
    require_once 'classes/model/ObjectPermission.php';
    $oOP = new ObjectPermission();
    $oOP = ObjectPermissionPeer::retrieveByPK($_GET['OP_UID']);
    $sProcessUID = $oOP->getProUid();
    $oOP->delete();
    $result->success = true;
    $result->msg = G::LoadTranslation('ID_REPORTTABLE_REMOVED');
    G::LoadClass('processMap');
    $oProcessMap = new ProcessMap();
    $oProcessMap->getObjectsPermissionsCriteria($sProcessUID);
} catch (Exception $e) {
    $result->success = false;
    $result->msg = $e->getMessage();
}
print G::json_encode($result);
$infoProcess = new Processes();
$resultProcess = $infoProcess->getProcessRow($sProcessUID);
G::auditLog('DeletePermissions', 'Delete Permissions (' . $_GET['OP_UID'] . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
예제 #28
0
 function deletePermissionRole($ROL_UID, $PER_UID)
 {
     $crit = new Criteria();
     $crit->add(RolesPermissionsPeer::ROL_UID, $ROL_UID);
     $crit->add(RolesPermissionsPeer::PER_UID, $PER_UID);
     RolesPermissionsPeer::doDelete($crit);
     $o = new RolesPermissions();
     $o->setPerUid($PER_UID);
     $permission = $o->getPermissionName($PER_UID);
     $role = $this->load($ROL_UID);
     G::auditLog("DeletePermissionToRole", "Delete Permission " . $permission . " (" . $PER_UID . ") from Role " . $role['ROL_NAME'] . " (" . $ROL_UID . ") ");
 }
예제 #29
0
         } else {
             $oTaskSaveNextPattern = new Task();
             $taskNextInfo = $oTaskSaveNextPattern->load($aRow['ROU_NEXT_TASK']);
             $titleNextTask = $taskNextInfo['TAS_TITLE'];
             if ($aRow['ROU_CONDITION'] == '') {
                 $tasksAffected .= 'From -> ' . $titleTask . ' : ' . $aData['TASK'] . ' To -> ' . $titleNextTask . ' : ' . $aRow['ROU_NEXT_TASK'] . ' Condition -> Empty ; ';
             } else {
                 $tasksAffected .= 'From -> ' . $titleTask . ' : ' . $aData['TASK'] . ' To -> ' . $titleNextTask . ' : ' . $aRow['ROU_NEXT_TASK'] . ' Condition -> ' . $aFields['ROU_CONDITION'] . ' ; ';
             }
         }
         unset($aFields);
     }
     $oProcessNewPattern = new Process();
     $processInfo = $oProcessNewPattern->load($aData['PROCESS']);
     $titleProcess = $processInfo['PRO_TITLE'];
     G::auditLog("DerivationRule", 'PROCESS NAME : ' . $titleProcess . ' : ' . $aData['PROCESS'] . ' Change Routing Rule From : ' . $aData['ROU_TYPE'] . ' Details : ROU_TYPE_OLD -> ' . $aData['ROU_TYPE_OLD'] . ' ROU_TYPE ->' . $aData['ROU_TYPE'] . ' ' . $tasksAffected);
     break;
 case 'DISCRIMINATOR':
     //Girish ->Added to save changes, while editing the route
     foreach ($aData['GRID_DISCRIMINATOR_TYPE'] as $iKey => $aRow) {
         $aFields['PRO_UID'] = $aData['PROCESS'];
         $aFields['TAS_UID'] = $aData['TASK'];
         $aFields['ROU_NEXT_TASK'] = $aRow['ROU_NEXT_TASK'];
         $aFields['ROU_CASE'] = $iKey;
         $aFields['ROU_TYPE'] = $aData['ROU_TYPE'];
         $aFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
         $aFields['ROU_OPTIONAL'] = $aRow['ROU_OPTIONAL'];
         $routeData = $oTasks->getRouteByType($aData['PROCESS'], $aRow['ROU_NEXT_TASK'], $aData['ROU_TYPE']);
         foreach ($routeData as $route) {
             $sFields['ROU_UID'] = $route['ROU_UID'];
             $sFields['ROU_CONDITION'] = $aRow['ROU_CONDITION'];
    G::LoadClass('processMap');
    $oProcessMap = new ProcessMap();
    $infoProcess = new Processes();
    $resultProcess = $infoProcess->getProcessRow($_POST['PRO_UID']);
    switch ($_POST['action']) {
        case 'availableSupervisorDynaforms':
            $oProcessMap->availableSupervisorDynaforms($_POST['PRO_UID']);
            break;
        case 'assignSupervisorDynaform':
            $oProcessMap->assignSupervisorStep($_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID']);
            G::auditLog('AssignSupervisorDynaform', 'Assign Supervisor Dynaform (' . $_POST['DYN_UID'] . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
            break;
        case 'removeSupervisorDynaform':
            $oProcessMap->removeSupervisorStep($_POST['STEP_UID'], $_POST['PRO_UID'], 'DYNAFORM', $_POST['DYN_UID'], $_POST['STEP_POSITION']);
            G::auditLog('RemoveSupervisorDynaform', 'Remove Supervisor Dynaform (' . $_POST['DYN_UID'] . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
            break;
        case 'availableSupervisorInputs':
            $oProcessMap->availableSupervisorInputs($_POST['PRO_UID']);
            break;
        case 'assignSupervisorInput':
            $oProcessMap->assignSupervisorStep($_POST['PRO_UID'], 'INPUT_DOCUMENT', $_POST['INP_DOC_UID']);
            G::auditLog('AssignSupervisorInput', 'Assign Supervisor Input (' . $_POST['INP_DOC_UID'] . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
            break;
        case 'removeSupervisorInput':
            $oProcessMap->removeSupervisorStep($_POST['STEP_UID'], $_POST['PRO_UID'], 'INPUT_DOCUMENT', $_POST['INP_DOC_UID'], $_POST['STEP_POSITION']);
            G::auditLog('RemoveSupervisorInput', 'Remove Supervisor Input (' . $_POST['INP_DOC_UID'] . ') in Process "' . $resultProcess['PRO_TITLE'] . '"');
            break;
    }
} catch (Exception $oException) {
    die($oException->getMessage());
}