jdarwood007 commited on 2019-02-23 14:50:14
Showing 8 changed files, with 80 additions and 13 deletions.
... | ... |
@@ -714,7 +714,7 @@ function shd_admin_cf_icons() |
714 | 714 |
$dir = dir($settings['default_theme_dir'] . '/images/simpledesk/cf/'); |
715 | 715 |
$files = array(); |
716 | 716 |
|
717 |
- if (!is_resource($dir)) |
|
717 |
+ if (!is_object($dir) || is_null($dir)) |
|
718 | 718 |
return $iconlist; |
719 | 719 |
|
720 | 720 |
while ($line = $dir->read()) |
... | ... |
@@ -351,7 +351,7 @@ function shd_admin_save_dept() |
351 | 351 |
if ($smcFunc['db_num_rows']($query) == 0) |
352 | 352 |
{ |
353 | 353 |
$smcFunc['db_free_result']($query); |
354 |
- shd_fatal_lang_error(shd_unknown_dept, false); |
|
354 |
+ shd_fatal_lang_error('shd_unknown_dept', false); |
|
355 | 355 |
} |
356 | 356 |
list($dept_order) = $smcFunc['db_fetch_row']($query); |
357 | 357 |
$smcFunc['db_free_result']($query); |
... | ... |
@@ -101,12 +101,13 @@ function shd_admin_maint_home() |
101 | 101 |
{ |
102 | 102 |
global $context, $txt, $smcFunc; |
103 | 103 |
|
104 |
- $depts = shd_allowed_to('access_helpdesk', false); |
|
105 |
- if (count($depts) > 1) |
|
106 |
- { |
|
107 | 104 |
$context['dept_list'] = array( |
108 | 105 |
0 => $txt['shd_admin_maint_massdeptmove_select'], |
109 | 106 |
); |
107 |
+ |
|
108 |
+ $depts = shd_allowed_to('access_helpdesk', false); |
|
109 |
+ if (!is_bool($depts) && count($depts) > 1) |
|
110 |
+ { |
|
110 | 111 |
$query = $smcFunc['db_query']('', ' |
111 | 112 |
SELECT id_dept, dept_name |
112 | 113 |
FROM {db_prefix}helpdesk_depts |
... | ... |
@@ -671,7 +671,12 @@ function shd_ajax_notify() |
671 | 671 |
'ticket' => $context['ticket_id'], |
672 | 672 |
) |
673 | 673 |
); |
674 |
- if ($smcFunc['db_num_rows']($query) != 0) |
|
674 |
+ if (empty($smcFunc['db_num_rows']($query))) |
|
675 |
+ { |
|
676 |
+ $smcFunc['db_free_result']($query); |
|
677 |
+ return array('success' => false, 'error' => $txt['shd_no_ticket']); |
|
678 |
+ } |
|
679 |
+ |
|
675 | 680 |
$ticket = $smcFunc['db_fetch_assoc']($query); |
676 | 681 |
$smcFunc['db_free_result']($query); |
677 | 682 |
|
... | ... |
@@ -381,6 +381,7 @@ function shd_view_ticket() |
381 | 381 |
continue; |
382 | 382 |
|
383 | 383 |
// If this is going to be displayed for the individual ticket, we need to figure out where it should go. |
384 |
+ $pos = CFIELD_PLACE_DETAILS; |
|
384 | 385 |
if ($row['field_loc'] & CFIELD_TICKET) |
385 | 386 |
$pos = $placements[$row['placement']]; |
386 | 387 |
|
... | ... |
@@ -833,7 +834,7 @@ function shd_prepare_ticket_context() |
833 | 834 |
$memberContext[$message['id_member']]['group'] = $txt['guest_title']; |
834 | 835 |
$memberContext[$message['id_member']]['link'] = $message['poster_name']; |
835 | 836 |
$memberContext[$message['id_member']]['email'] = $message['poster_email']; |
836 |
- $memberContext[$message['id_member']]['show_email'] = showEmailAddress(true, 0); |
|
837 |
+ $memberContext[$message['id_member']]['show_email'] = false; |
|
837 | 838 |
$memberContext[$message['id_member']]['is_guest'] = true; |
838 | 839 |
$memberContext[$message['id_member']]['group_icons'] = ''; |
839 | 840 |
} |
... | ... |
@@ -365,6 +365,11 @@ function shd_save_ticket() |
365 | 365 |
'link' => '<span class="error">' . $txt['shd_unassigned'] . '</span>', |
366 | 366 |
); |
367 | 367 |
$num_replies = 0; |
368 |
+ |
|
369 |
+ $context['ticket_form'] = array( |
|
370 |
+ 'first_msg' => 0, |
|
371 |
+ 'last_msg' => 0, |
|
372 |
+ ); |
|
368 | 373 |
} |
369 | 374 |
else |
370 | 375 |
{ |
... | ... |
@@ -389,16 +394,19 @@ function shd_save_ticket() |
389 | 394 |
'link' => !empty($ticketinfo['assigned_id']) ? shd_profile_link($ticketinfo['assigned_name'], $ticketinfo['assigned_id']) : '<span class="error">' . $txt['shd_unassigned'] . '</span>', |
390 | 395 |
); |
391 | 396 |
$num_replies = $ticketinfo['num_replies']; |
392 |
- } |
|
393 | 397 |
|
394 | 398 |
$context['ticket_form'] = array( |
399 |
+ 'first_msg' => $ticketinfo['id_first_msg'], |
|
400 |
+ 'last_msg' => $ticketinfo['id_last_msg'], |
|
401 |
+ ); |
|
402 |
+ } |
|
403 |
+ |
|
404 |
+ $context['ticket_form'] += array( |
|
395 | 405 |
'is_new' => $new_ticket, |
396 | 406 |
'is_reply' => false, |
397 | 407 |
'dept' => isset($newdept) ? $newdept : $dept, |
398 | 408 |
'form_title' => !$new_ticket ? $txt['shd_edit_ticket'] : $txt['shd_create_ticket'], |
399 | 409 |
'form_action' => $scripturl . '?action=helpdesk;sa=saveticket', |
400 |
- 'first_msg' => !$new_ticket ? $ticketinfo['id_first_msg'] : 0, |
|
401 |
- 'last_msg' => !$new_ticket ? $ticketinfo['id_last_msg'] : 0, |
|
402 | 410 |
'message' => $_POST['shd_message'], |
403 | 411 |
'subject' => $_POST['subject'], |
404 | 412 |
'ticket' => $context['ticket_id'], |
... | ... |
@@ -940,7 +948,6 @@ function shd_post_reply() |
940 | 948 |
{ |
941 | 949 |
require_once($sourcedir . '/Subs-Editor.php'); |
942 | 950 |
$row['body'] = strtr($row['body'], array('<' => '#smlt#', '>' => '#smgt#', '&' => '#smamp#')); |
943 |
- $row['body'] = bbc_to_html($row['body']); |
|
944 | 951 |
$lb = '<br>'; |
945 | 952 |
} |
946 | 953 |
else |
... | ... |
@@ -1787,7 +1794,7 @@ function shd_check_attachments() |
1787 | 1794 |
if (!in_array(strtolower(substr(strrchr($uplfile['name'], '.'), 1)), explode(',', strtolower($modSettings['attachmentExtensions'])))) |
1788 | 1795 |
{ |
1789 | 1796 |
checkSubmitOnce('free'); |
1790 |
- fatal_error($uplfile['name'] . '.<br>' . $txt['cant_upload_type'] . ' ' . $modSettings['attachmentExtensions'] . '.', false); |
|
1797 |
+ shd_fatal_error($uplfile['name'] . '.<br>' . $txt['cant_upload_type'] . ' ' . $modSettings['attachmentExtensions'] . '.', false); |
|
1791 | 1798 |
} |
1792 | 1799 |
} |
1793 | 1800 |
|
... | ... |
@@ -1801,7 +1808,7 @@ function shd_check_attachments() |
1801 | 1808 |
|
1802 | 1809 |
$dir = opendir($current_attach_dir); |
1803 | 1810 |
if (!is_resource($dir)) |
1804 |
- fatal_lang_error('cant_access_upload_path', 'critical'); |
|
1811 |
+ shd_fatal_lang_error('cant_access_upload_path', 'critical'); |
|
1805 | 1812 |
|
1806 | 1813 |
while ($file = readdir($dir)) |
1807 | 1814 |
{ |
... | ... |
@@ -28,6 +28,12 @@ |
28 | 28 |
if (!defined('SMF')) |
29 | 29 |
die('If only you could draw like a drunken monkey...'); |
30 | 30 |
|
31 |
+/** |
|
32 |
+ * Sets up the main profile data |
|
33 |
+ * |
|
34 |
+ * @since 1.0 |
|
35 |
+ * @param int $memID The member ID |
|
36 |
+*/ |
|
31 | 37 |
function shd_profile_main($memID) |
32 | 38 |
{ |
33 | 39 |
global $context, $txt, $scripturl, $sourcedir, $user_info, $settings, $user_profile, $modSettings; |
... | ... |
@@ -125,6 +131,12 @@ function shd_profile_main($memID) |
125 | 131 |
$context['template_layers'][] = 'shd_profile_navigation'; |
126 | 132 |
} |
127 | 133 |
|
134 |
+/** |
|
135 |
+ * The frontpage profile |
|
136 |
+ * |
|
137 |
+ * @since 1.0 |
|
138 |
+ * @param int $memID The member ID |
|
139 |
+*/ |
|
128 | 140 |
function shd_profile_frontpage($memID) |
129 | 141 |
{ |
130 | 142 |
global $context, $memberContext, $txt, $modSettings, $user_info, $user_profile, $sourcedir, $scripturl, $smcFunc; |
... | ... |
@@ -263,6 +275,12 @@ function shd_profile_frontpage($memID) |
263 | 275 |
} |
264 | 276 |
} |
265 | 277 |
|
278 |
+/** |
|
279 |
+ * Prefernces for a helpdesk member |
|
280 |
+ * |
|
281 |
+ * @since 1.0 |
|
282 |
+ * @param int $memID The member ID |
|
283 |
+*/ |
|
266 | 284 |
function shd_profile_preferences($memID) |
267 | 285 |
{ |
268 | 286 |
global $context, $txt, $scripturl, $sourcedir, $user_info, $smcFunc; |
... | ... |
@@ -355,6 +373,12 @@ function shd_profile_preferences($memID) |
355 | 373 |
} |
356 | 374 |
} |
357 | 375 |
|
376 |
+/** |
|
377 |
+ * Show all the ticket information. |
|
378 |
+ * |
|
379 |
+ * @since 1.0 |
|
380 |
+ * @param int $memID The member ID |
|
381 |
+*/ |
|
358 | 382 |
function shd_profile_show_tickets($memID) |
359 | 383 |
{ |
360 | 384 |
global $txt, $user_info, $scripturl, $modSettings, $smcFunc, $board, $user_profile, $context; |
... | ... |
@@ -501,6 +525,12 @@ function shd_profile_show_tickets($memID) |
501 | 525 |
$context['items'] = array_reverse($context['items'], true); |
502 | 526 |
} |
503 | 527 |
|
528 |
+/** |
|
529 |
+ * Show the notifications for a helpdesk member |
|
530 |
+ * |
|
531 |
+ * @since 1.0 |
|
532 |
+ * @param int $memID The member ID |
|
533 |
+*/ |
|
504 | 534 |
function shd_profile_show_notify_override($memID) |
505 | 535 |
{ |
506 | 536 |
global $txt, $user_info, $scripturl, $modSettings, $smcFunc, $board, $user_profile, $context; |
... | ... |
@@ -541,8 +571,16 @@ function shd_profile_show_notify_override($memID) |
541 | 571 |
); |
542 | 572 |
$context['tickets'][] = $row; |
543 | 573 |
} |
574 |
+ |
|
575 |
+ return true; |
|
544 | 576 |
} |
545 | 577 |
|
578 |
+/** |
|
579 |
+ * Profile Permissions for a member |
|
580 |
+ * |
|
581 |
+ * @since 1.0 |
|
582 |
+ * @param int $memID The member ID |
|
583 |
+*/ |
|
546 | 584 |
function shd_profile_permissions($memID) |
547 | 585 |
{ |
548 | 586 |
global $context, $txt, $scripturl, $sourcedir, $user_info, $smcFunc, $user_profile, $settings; |
... | ... |
@@ -682,6 +720,12 @@ function shd_profile_permissions($memID) |
682 | 720 |
$context['member_permissions']['denied'][$permission][] = $role_id; |
683 | 721 |
} |
684 | 722 |
|
723 |
+/** |
|
724 |
+ * This members action log information. |
|
725 |
+ * |
|
726 |
+ * @since 1.0 |
|
727 |
+ * @param int $memID The member ID |
|
728 |
+*/ |
|
685 | 729 |
function shd_profile_actionlog($memID) |
686 | 730 |
{ |
687 | 731 |
global $context, $txt, $scripturl, $sourcedir, $user_info, $settings; |
... | ... |
@@ -699,6 +743,12 @@ function shd_profile_actionlog($memID) |
699 | 743 |
|
700 | 744 |
} |
701 | 745 |
|
746 |
+/** |
|
747 |
+ * Shows the theme options for SimpleDesk. |
|
748 |
+ * |
|
749 |
+ * @since 1.0 |
|
750 |
+ * @param int $memID The member ID |
|
751 |
+*/ |
|
702 | 752 |
function shd_profile_theme_wrapper($memID) |
703 | 753 |
{ |
704 | 754 |
global $txt, $context, $user_profile, $modSettings, $settings, $user_info, $smcFunc, $sourcedir, $profile_fields; |
... | ... |
@@ -404,6 +404,9 @@ function shd_load_user_perms() |
404 | 404 |
$tickets_private_any_dept = shd_allowed_to('shd_view_ticket_private_any', false); |
405 | 405 |
$tickets_private_own_dept = shd_allowed_to('shd_view_ticket_private_own', false); |
406 | 406 |
|
407 |
+ if (is_bool($tickets_private_any_dept) || is_bool($tickets_private_own_dept)) |
|
408 |
+ return shd_fatal_error('Tickets have no bools'); |
|
409 |
+ |
|
407 | 410 |
$clauses = array(); |
408 | 411 |
$privacy_clauses = array(); |
409 | 412 |
|
410 | 413 |