mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-28 16:24:54 +02:00
Merge branch 'ent-4032-new-macro-sql-reports' into 'develop'
Ent 4032 new macro sql reports See merge request artica/pandorafms!2610
This commit is contained in:
commit
0f1baadb00
@ -5309,6 +5309,9 @@ function reporting_sql($report, $content)
|
|||||||
$sql = io_safe_output($content['external_source']);
|
$sql = io_safe_output($content['external_source']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if exist sql macro
|
||||||
|
$sql = reporting_sql_macro($report, $sql);
|
||||||
|
|
||||||
// Do a security check on SQL coming from the user.
|
// Do a security check on SQL coming from the user.
|
||||||
$sql = check_sql($sql);
|
$sql = check_sql($sql);
|
||||||
|
|
||||||
@ -12080,6 +12083,28 @@ function reporting_label_macro($item, $label)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert macro in sql string to value
|
||||||
|
*
|
||||||
|
* @param array $report
|
||||||
|
* @param string $sql
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
function reporting_sql_macro(array $report, string $sql): string
|
||||||
|
{
|
||||||
|
if (preg_match('/_timefrom_/', $sql)) {
|
||||||
|
$sql = str_replace(
|
||||||
|
'_timefrom_',
|
||||||
|
$report['datetime'],
|
||||||
|
$sql
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $sql;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Calculates the SLA compliance value given an sla array
|
* @brief Calculates the SLA compliance value given an sla array
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user