diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index b06c561978..bb46d57171 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -2062,11 +2062,17 @@ function delete_dir($dir) { return rmdir($dir); } +/** + * Returns 1 if the data contains a codified image (base64) + */ +function is_image_data ($data) { + return (substr($data,0,10) == "data:image"); +} + /** * Returns 1 if this is Snapshot data, 0 otherwise * Looks for two or more carriage returns. */ - function is_snapshot_data ($data) { // TODO IDEA: In the future, we can set a variable in setup @@ -2076,7 +2082,7 @@ function is_snapshot_data ($data) { $temp = array(); $count = preg_match_all ("/\n/", $data, $temp); - if ($count > 2) + if ( ($count > 2) || (is_image_data($data) ) return 1; else return 0; diff --git a/pandora_console/operation/agentes/snapshot_view.php b/pandora_console/operation/agentes/snapshot_view.php index b8b50857c2..3425464c21 100644 --- a/pandora_console/operation/agentes/snapshot_view.php +++ b/pandora_console/operation/agentes/snapshot_view.php @@ -1,102 +1,109 @@ -load_tables(); -} - -$id = get_parameter('id'); -$label = get_parameter ("label"); - -// TODO - Put ACL here -?> - - - 0) { - $query = ui_get_url_refresh (false); - echo ''; - } - ?> - - Pandora FMS Snapshot data view for module (<?php echo $label; ?>) - - - - "; - echo __("Current data at"); - echo " "; - echo $row["timestamp"]; - echo ""; - $datos = io_safe_output($row["datos"]); - $datos = preg_replace ('/\n/i','
',$datos); - $datos = preg_replace ('/\s/i',' ',$datos); - echo "
"; - echo $datos; - echo "
"; - ?> - - - \ No newline at end of file +load_tables(); +} + +$id = get_parameter('id'); +$label = get_parameter ("label"); + +// TODO - Put ACL here +?> + + + 0) { + $query = ui_get_url_refresh (false); + echo ''; + } + ?> + + Pandora FMS Snapshot data view for module (<?php echo $label; ?>) + + + + "; + echo __("Current data at"); + echo " "; + echo $row["timestamp"]; + echo ""; + $datos = io_safe_output($row["datos"]); + if (is_image_data($datos)) { + echo 'image'; + } + else { + $datos = preg_replace ('/\n/i','
',$datos); + $datos = preg_replace ('/\s/i',' ',$datos); + echo "
"; + echo $datos; + echo "
"; + ?> + + + +