diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index bdd3f98f..af3c8346 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -1500,6 +1500,15 @@ function hesk_getAdminButtonsInTicket($reply = 0, $white = 1) $options = $reply ? '' : '
'; + // Resend email notification + if ($reply) { + $options .= ' + + '; + } + /* Edit post */ if ($can_edit) { $tmp = $reply ? '&reply=' . $reply['id'] : ''; diff --git a/api/BusinessLogic/Exceptions/InternalUseOnlyException.php b/api/BusinessLogic/Exceptions/InternalUseOnlyException.php index 99bbee4d..89f2d0f9 100644 --- a/api/BusinessLogic/Exceptions/InternalUseOnlyException.php +++ b/api/BusinessLogic/Exceptions/InternalUseOnlyException.php @@ -5,6 +5,6 @@ namespace BusinessLogic\Exceptions; class InternalUseOnlyException extends ApiFriendlyException { function __construct() { - parent::__construct("This endpoint can only be used internally", "Internal Use Only", 400); + parent::__construct("This endpoint can only be used internally", "Internal Use Only", 401); } } \ No newline at end of file diff --git a/api/BusinessLogic/Security/UserContext.php b/api/BusinessLogic/Security/UserContext.php index 27318d14..45132395 100644 --- a/api/BusinessLogic/Security/UserContext.php +++ b/api/BusinessLogic/Security/UserContext.php @@ -61,44 +61,45 @@ class UserContext { * @return UserContext the built user context */ static function fromDataRow($dataRow) { + var_dump($dataRow); $userContext = new UserContext(); - $userContext->id = $dataRow['id']; + $userContext->id = intval($dataRow['id']); $userContext->username = $dataRow['user']; - $userContext->admin = $dataRow['isadmin'] === '1'; + $userContext->admin = boolval($dataRow['isadmin']); $userContext->name = $dataRow['name']; $userContext->email = $dataRow['email']; $userContext->signature = $dataRow['signature']; $userContext->language = $dataRow['language']; $userContext->categories = explode(',', $dataRow['categories']); $userContext->permissions = explode(',', $dataRow['heskprivileges']); - $userContext->autoAssign = $dataRow['autoassign']; - $userContext->ratingNegative = $dataRow['ratingneg']; - $userContext->ratingPositive = $dataRow['ratingpos']; - $userContext->rating = $dataRow['rating']; - $userContext->totalNumberOfReplies = $dataRow['replies']; - $userContext->active = $dataRow['active']; + $userContext->autoAssign = boolval($dataRow['autoassign']); + $userContext->ratingNegative = intval($dataRow['ratingneg']); + $userContext->ratingPositive = intval($dataRow['ratingpos']); + $userContext->rating = floatval($dataRow['rating']); + $userContext->totalNumberOfReplies = intval($dataRow['replies']); + $userContext->active = boolval($dataRow['active']); $preferences = new UserContextPreferences(); - $preferences->afterReply = $dataRow['afterreply']; - $preferences->autoStartTimeWorked = $dataRow['autostart']; - $preferences->autoreload = $dataRow['autoreload']; - $preferences->defaultNotifyCustomerNewTicket = $dataRow['notify_customer_new']; - $preferences->defaultNotifyCustomerReply = $dataRow['notify_customer_reply']; - $preferences->showSuggestedKnowledgebaseArticles = $dataRow['show_suggested']; - $preferences->defaultCalendarView = $dataRow['default_calendar_view']; + $preferences->afterReply = intval($dataRow['afterreply']); + $preferences->autoStartTimeWorked = boolval($dataRow['autostart']); + $preferences->autoreload = intval($dataRow['autoreload']); + $preferences->defaultNotifyCustomerNewTicket = boolval($dataRow['notify_customer_new']); + $preferences->defaultNotifyCustomerReply = boolval($dataRow['notify_customer_reply']); + $preferences->showSuggestedKnowledgebaseArticles = boolval($dataRow['show_suggested']); + $preferences->defaultCalendarView = intval($dataRow['default_calendar_view']); $preferences->defaultTicketView = $dataRow['default_list']; $userContext->preferences = $preferences; $notifications = new UserContextNotifications(); - $notifications->newUnassigned = $dataRow['notify_new_unassigned']; - $notifications->newAssignedToMe = $dataRow['notify_new_my']; - $notifications->replyUnassigned = $dataRow['notify_reply_unassigned']; - $notifications->replyToMe = $dataRow['notify_reply_my']; - $notifications->ticketAssignedToMe = $dataRow['notify_assigned']; - $notifications->privateMessage = $dataRow['notify_pm']; - $notifications->noteOnTicketAssignedToMe = $dataRow['notify_note']; - $notifications->noteOnTicketNotAssignedToMe = $dataRow['notify_note_unassigned']; - $notifications->overdueTicketUnassigned = $dataRow['notify_overdue_unassigned']; + $notifications->newUnassigned = boolval($dataRow['notify_new_unassigned']); + $notifications->newAssignedToMe = boolval($dataRow['notify_new_my']); + $notifications->replyUnassigned = boolval($dataRow['notify_reply_unassigned']); + $notifications->replyToMe = boolval($dataRow['notify_reply_my']); + $notifications->ticketAssignedToMe = boolval($dataRow['notify_assigned']); + $notifications->privateMessage = boolval($dataRow['notify_pm']); + $notifications->noteOnTicketAssignedToMe = boolval($dataRow['notify_note']); + $notifications->noteOnTicketNotAssignedToMe = boolval($dataRow['notify_note_unassigned']); + $notifications->overdueTicketUnassigned = boolval($dataRow['notify_overdue_unassigned']); $userContext->notificationSettings = $notifications; return $userContext; diff --git a/api/Controllers/InternalApiController.php b/api/Controllers/InternalApiController.php index 38188528..29d82642 100644 --- a/api/Controllers/InternalApiController.php +++ b/api/Controllers/InternalApiController.php @@ -9,7 +9,7 @@ use BusinessLogic\Helpers; abstract class InternalApiController { function checkForInternalUseOnly() { $tokenHeader = Helpers::getHeader('X-AUTH-TOKEN'); - if ($tokenHeader === null || trim($tokenHeader) === '') { + if ($tokenHeader !== null && trim($tokenHeader) !== '') { throw new InternalUseOnlyException(); } } diff --git a/api/autoload.php b/api/autoload.php index c12b9647..b9c2292e 100644 --- a/api/autoload.php +++ b/api/autoload.php @@ -11,6 +11,7 @@ require_once(__DIR__ . '/../inc/common.inc.php'); require_once(__DIR__ . '/Core/output.php'); require_once(__DIR__ . '/../hesk_settings.inc.php'); require_once(__DIR__ . '/http_response_code.php'); +require_once(__DIR__ . '/../inc/admin_functions.inc.php'); hesk_load_api_database_functions(); diff --git a/api/index.php b/api/index.php index 52a815ee..92e87d99 100644 --- a/api/index.php +++ b/api/index.php @@ -47,7 +47,7 @@ function buildUserContextFromSession() { hesk_session_start(); - if (!hesk_isLoggedIn(false)) { + if (empty($_SESSION['id'])) { throw new \BusinessLogic\Exceptions\SessionNotActiveException(); } diff --git a/css/colors.css b/css/colors.css index afe383f8..1062549e 100644 --- a/css/colors.css +++ b/css/colors.css @@ -33,6 +33,10 @@ color: blue; } +.navy-blue { + color: #3c8dbc; +} + .med-low-priority { background-color: #8BB467; } diff --git a/inc/headerAdmin.inc.php b/inc/headerAdmin.inc.php index 8a6bd43e..67371291 100644 --- a/inc/headerAdmin.inc.php +++ b/inc/headerAdmin.inc.php @@ -247,6 +247,7 @@ if (defined('MFH_PAGE_LAYOUT') && MFH_PAGE_LAYOUT == 'TOP_ONLY') { ?> +