From 694d93ded98280bb0d13ef20f8bf1e9786cb7f0f Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 29 Jan 2020 22:31:13 -0500 Subject: [PATCH] Replace json_encode + exit by System::jsonExit in mod/item --- mod/item.php | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/mod/item.php b/mod/item.php index 8b795d28cb..cfbe8f225f 100644 --- a/mod/item.php +++ b/mod/item.php @@ -54,8 +54,7 @@ function item_post(App $a) { $arr_drop = explode(',', $_REQUEST['dropitems']); drop_items($arr_drop); $json = ['success' => 1]; - echo json_encode($json); - exit(); + System::jsonExit($json); } Hook::callAll('post_local_start', $_REQUEST); @@ -319,7 +318,7 @@ function item_post(App $a) { if (!strlen($body)) { if ($preview) { - exit(); + System::jsonExit(['preview' => '']); } info(DI::l10n()->t('Empty post discarded.') . EOL); if (!empty($_REQUEST['return'])) { @@ -665,8 +664,8 @@ function item_post(App $a) { $o = conversation($a, [array_merge($contact_record, $datarray)], new Pager(DI::args()->getQueryString()), 'search', false, true); Logger::log('preview: ' . $o); - echo json_encode(['preview' => $o]); - exit(); + + System::jsonExit(['preview' => $o]); } Hook::callAll('post_local',$datarray); @@ -682,8 +681,7 @@ function item_post(App $a) { $json['reload'] = DI::baseUrl() . '/' . $_REQUEST['jsreload']; } - echo json_encode($json); - exit(); + System::jsonExit($json); } if ($orig_post) { @@ -841,8 +839,7 @@ function item_post_return($baseurl, $api_source, $return_path) Logger::log('post_json: ' . print_r($json, true), Logger::DEBUG); - echo json_encode($json); - exit(); + System::jsonExit($json); } function item_content(App $a) @@ -867,8 +864,7 @@ function item_content(App $a) if (DI::mode()->isAjax()) { // ajax return: [, 0 (no perm) | ] - echo json_encode([intval($a->argv[2]), intval($o)]); - exit(); + System::jsonExit([intval($a->argv[2]), intval($o)]); } } -- 2.39.5