Example #1
0
    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']);
} else {
    $evnUid = $_GET['EVN_UID'];
}
require_once 'classes/model/Event.php';
require_once 'classes/model/Triggers.php';
$oEvent = new Event();
$oTrigger = new Triggers();
$aFields = $oEvent->load($evnUid);
$parameters = unserialize($oEvent->getEvnActionParameters());
//g::pr($parameters); die;
$aTrigger = $oTrigger->load($aFields['TRI_UID']);
$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;