23 lines
665 B
PHP
23 lines
665 B
PHP
|
<?php
|
||
|
|
||
|
function get_ticket_template($hesk_settings, $id = NULL) {
|
||
|
$sql = "SELECT `id`, `message`, `title`, `tpl_order` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "ticket_templates` ";
|
||
|
if ($id != NULL) {
|
||
|
$sql .= "WHERE `id` = ".intval($id);
|
||
|
}
|
||
|
|
||
|
$response = hesk_dbQuery($sql);
|
||
|
|
||
|
if (hesk_dbNumRows($response) == 0) {
|
||
|
return NULL;
|
||
|
}
|
||
|
|
||
|
$results = [];
|
||
|
while ($row = hesk_dbFetchAssoc($response)) {
|
||
|
$row['title'] = hesk_html_entity_decode($row['title']);
|
||
|
$row['message'] = hesk_html_entity_decode($row['message']);
|
||
|
$results[] = $row;
|
||
|
}
|
||
|
|
||
|
return $id == NULL ? $results : $results[0];
|
||
|
}
|