From 5851c4d7f29b4b268b56de1b51d43cdb1794dc9a Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 1 Nov 2015 14:20:19 -0500 Subject: [PATCH] Allow retrieval of all canned responses / ticket tpls --- api/canned/index.php | 14 +++++++++++++- api/ticket-templates/index.php | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/api/canned/index.php b/api/canned/index.php index cd0b5387..b8fc9fb6 100644 --- a/api/canned/index.php +++ b/api/canned/index.php @@ -21,4 +21,16 @@ if (isset($_GET['id'])) { header('Content-Type: application/json'); print json_encode($result); return http_response_code(200); -} \ No newline at end of file +} + +$response = hesk_dbQuery("SELECT `id`, `message`, `title`, `reply_order` FROM `" + . hesk_dbEscape($hesk_settings['db_pfix']) . "std_replies`"); +$results = []; +while ($row = hesk_dbFetchAssoc($response)) { + $row['title'] = hesk_html_entity_decode($row['title']); + $row['message'] = hesk_html_entity_decode($row['message']); + $results[] = $row; +} +header('Content-Type: application/json'); +print json_encode($results); +return http_response_code(200); \ No newline at end of file diff --git a/api/ticket-templates/index.php b/api/ticket-templates/index.php index c2e02b79..5b718598 100644 --- a/api/ticket-templates/index.php +++ b/api/ticket-templates/index.php @@ -21,4 +21,16 @@ if (isset($_GET['id'])) { header('Content-Type: application/json'); print json_encode($result); return http_response_code(200); -} \ No newline at end of file +} + +$response = hesk_dbQuery("SELECT `id`, `message`, `title`, `tpl_order` FROM `" + . hesk_dbEscape($hesk_settings['db_pfix']) . "ticket_templates`"); +$results = []; +while ($row = hesk_dbFetchAssoc($response)) { + $row['title'] = hesk_html_entity_decode($row['title']); + $row['message'] = hesk_html_entity_decode($row['message']); + $results[] = $row; +} +header('Content-Type: application/json'); +print json_encode($results); +return http_response_code(200); \ No newline at end of file