diff --git a/includes/smarty.php b/includes/smarty.php index cbeea2d..5b8fdb4 100644 --- a/includes/smarty.php +++ b/includes/smarty.php @@ -146,8 +146,10 @@ function display_template($template, $pagetitle=false) { } } -function display_ajax_return($data) { +function display_ajax_return($data=null, $pretty=false) { global $debug_ajax; + if (is_null($data)) + $data = array(); if (isset($_SESSION['messages']) && !empty($_SESSION['messages'])) { $data['messages'] = $_SESSION['messages']; unset($_SESSION['messages']); @@ -159,7 +161,7 @@ function display_ajax_return($data) { if ($debug_ajax) logging('DEBUG',"Ajax Response : ".vardump($data)); header('Content-Type: application/json'); - echo json_encode($data); + echo json_encode($data, (($pretty||isset($_REQUEST['pretty']))?JSON_PRETTY_PRINT:0)); exit(); }