Add ticket templates, make some tweaks to canned endpoint
This commit is contained in:
parent
8985413901
commit
99193274df
@ -11,8 +11,12 @@ hesk_dbConnect();
|
|||||||
if (isset($_GET['id'])) {
|
if (isset($_GET['id'])) {
|
||||||
$response = hesk_dbQuery("SELECT `id`, `message`, `title`, `reply_order` FROM `"
|
$response = hesk_dbQuery("SELECT `id`, `message`, `title`, `reply_order` FROM `"
|
||||||
. hesk_dbEscape($hesk_settings['db_pfix']) . "std_replies` WHERE `id` = ".intval($_GET['id']));
|
. hesk_dbEscape($hesk_settings['db_pfix']) . "std_replies` WHERE `id` = ".intval($_GET['id']));
|
||||||
|
if (hesk_dbNumRows($response) == 0) {
|
||||||
|
return http_response_code(404);
|
||||||
|
}
|
||||||
$result = hesk_dbFetchAssoc($response);
|
$result = hesk_dbFetchAssoc($response);
|
||||||
$result['message'] = html_entity_decode($result['message']);
|
$result['title'] = hesk_html_entity_decode($result['title']);
|
||||||
|
$result['message'] = hesk_html_entity_decode($result['message']);
|
||||||
|
|
||||||
header('Content-Type: application/json');
|
header('Content-Type: application/json');
|
||||||
print json_encode($result);
|
print json_encode($result);
|
||||||
|
24
api/ticket-templates/index.php
Normal file
24
api/ticket-templates/index.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
define('IN_SCRIPT', 1);
|
||||||
|
define('HESK_PATH', '../../');
|
||||||
|
require(HESK_PATH . 'hesk_settings.inc.php');
|
||||||
|
require(HESK_PATH . 'inc/common.inc.php');
|
||||||
|
|
||||||
|
hesk_load_api_database_functions();
|
||||||
|
hesk_dbConnect();
|
||||||
|
|
||||||
|
// Routing
|
||||||
|
if (isset($_GET['id'])) {
|
||||||
|
$response = hesk_dbQuery("SELECT `id`, `message`, `title`, `tpl_order` FROM `"
|
||||||
|
. hesk_dbEscape($hesk_settings['db_pfix']) . "ticket_templates` WHERE `id` = ".intval($_GET['id']));
|
||||||
|
if (hesk_dbNumRows($response) == 0) {
|
||||||
|
return http_response_code(404);
|
||||||
|
}
|
||||||
|
$result = hesk_dbFetchAssoc($response);
|
||||||
|
$result['title'] = hesk_html_entity_decode($result['title']);
|
||||||
|
$result['message'] = hesk_html_entity_decode($result['message']);
|
||||||
|
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
print json_encode($result);
|
||||||
|
return http_response_code(200);
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user