This commit is contained in:
Andrea Adamczyk
2019-02-28 15:33:18 -04:00
parent ce63bc91e8
commit fc485657ca

View File

@@ -1,65 +1,57 @@
<?php
if (isset( $_SESSION['TRIGGER_DEBUG']['info'] )) {
$aTriggers = $_SESSION['TRIGGER_DEBUG']['info'];
if (isset($_SESSION['TRIGGER_DEBUG']['info'])) {
$triggers = $_SESSION['TRIGGER_DEBUG']['info'];
} else {
$aTriggers[0] = $_SESSION['TRIGGER_DEBUG'];
$triggers[0] = $_SESSION['TRIGGER_DEBUG'];
}
//print_r($aTriggers);die;
$triggersList = Array ();
$triggersList = [];
$i = 0;
foreach ($aTriggers as $aTrigger) {
foreach ($triggers as $trigger) {
if ($aTrigger['NUM_TRIGGERS'] != 0) {
if ($trigger['NUM_TRIGGERS'] != 0) {
foreach ($aTrigger['TRIGGERS_NAMES'] as $index => $name) {
foreach ($trigger['TRIGGERS_NAMES'] as $index => $name) {
$triggersList[$i]['name'] = $name;
$triggersList[$i]['execution_time'] = strtolower( $aTrigger['TIME'] );
//$t_code = $aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT'];
//$t_code = str_replace('"', '\'',$t_code);
//$t_code = addslashes($t_code);
//$t_code = Only1br($t_code);
//highlighting the trigger code using the geshi third party library
$triggersList[$i]['execution_time'] = strtolower($trigger['TIME']);
$geshi = new GeSHi( $aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT'], 'php' );
$geshi->enable_line_numbers( GESHI_FANCY_LINE_NUMBERS, 2 );
$geshi->set_line_style( 'background: #f0f0f0;' );
$geshi = new GeSHi($trigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT'], 'php');
$geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS, 2);
$geshi->set_line_style('background: #f0f0f0;');
$triggersList[$i]['code'] = $geshi->parse_code(); //$aTrigger['TRIGGERS_VALUES'][$index]['TRI_WEBBOT'];
$triggersList[$i]['code'] = $geshi->parse_code();
$triggerUid = $aTrigger['TRIGGERS_VALUES'][$index]['TRI_UID'];
$triggersList[$i]['script_execution_time'] = isset($aTrigger['TRIGGERS_EXECUTION_TIME'][$triggerUid]) ? $aTrigger['TRIGGERS_EXECUTION_TIME'][$triggerUid] : '';
$triggerUid = $trigger['TRIGGERS_VALUES'][$index]['TRI_UID'];
$triggersList[$i]['script_execution_time'] = isset($trigger['TRIGGERS_EXECUTION_TIME'][$triggerUid]) ? $trigger['TRIGGERS_EXECUTION_TIME'][$triggerUid] : '';
$i ++;
$i++;
}
} else {
}
}
//print_r($_SESSION['TRIGGER_DEBUG']['ERRORS']); die;
$DEBUG_ERRORS = array_unique( $_SESSION['TRIGGER_DEBUG']['ERRORS'] );
$debugErrors = array_unique($_SESSION['TRIGGER_DEBUG']['ERRORS'], SORT_REGULAR);
foreach ($DEBUG_ERRORS as $error) {
if (isset( $error['ERROR'] ) and $error['ERROR'] != '') {
foreach ($debugErrors as $error) {
if (isset($error['ERROR']) and $error['ERROR'] != '') {
$triggersList[$i]['name'] = 'Error';
$triggersList[$i]['execution_time'] = 'error';
$triggersList[$i]['code'] = $error['ERROR'];
$i ++;
$i++;
}
if (isset( $error['FATAL'] ) and $error['FATAL'] != '') {
$error['FATAL'] = str_replace( "<br />", "\n", $error['FATAL'] );
$tmp = explode( "\n", $error['FATAL'] );
$triggersList[$i]['name'] = isset( $tmp[0] ) ? $tmp[0] : 'Fatal Error in trigger';
if (isset($error['FATAL']) and $error['FATAL'] != '') {
$error['FATAL'] = str_replace("<br />", "\n", $error['FATAL']);
$tmp = explode("\n", $error['FATAL']);
$triggersList[$i]['name'] = isset($tmp[0]) ? $tmp[0] : 'Fatal Error in trigger';
$triggersList[$i]['execution_time'] = 'Fatal error';
$triggersList[$i]['code'] = $error['FATAL'];
$i ++;
$i++;
}
}
$triggersRet = new StdClass();
$triggersRet->total = count( $triggersList );
$triggersRet->total = count($triggersList);
$triggersRet->data = $triggersList;
echo G::json_encode( $triggersRet );
echo G::json_encode($triggersRet);