Additional CI cleanups
jdarwood007

jdarwood007 commited on 2019-02-23 15:39:51
Showing 3 changed files, with 11 additions and 7 deletions.

... ...
@@ -369,6 +369,7 @@ function shd_save_ticket()
369 369
 		$context['ticket_form'] = array(
370 370
 			'first_msg' => 0,
371 371
 			'last_msg' => 0,
372
+			'link' => '',
372 373
 		);
373 374
 	}
374 375
 	else
... ...
@@ -398,6 +399,7 @@ function shd_save_ticket()
398 399
 		$context['ticket_form'] = array(
399 400
 			'first_msg' => $ticketinfo['id_first_msg'],
400 401
 			'last_msg' => $ticketinfo['id_last_msg'],
402
+			'link' => '<a href="' . $scripturl . '?action=helpdesk;sa=ticket;ticket=' . $context['ticket_id'] . '">' . $ticketinfo['subject'] . '</a>',
401 403
 		);
402 404
 	}
403 405
 
... ...
@@ -410,7 +412,6 @@ function shd_save_ticket()
410 412
 		'message' => $_POST['shd_message'],
411 413
 		'subject' => $_POST['subject'],
412 414
 		'ticket' => $context['ticket_id'],
413
-		'link' => !$new_ticket ? '<a href="' . $scripturl . '?action=helpdesk;sa=ticket;ticket=' . $context['ticket_id'] . '">' . $ticketinfo['subject'] . '</a>' : '',
414 415
 		'msg' => $msg,
415 416
 		'display_id' => empty($context['ticket_id']) ? '' : str_pad($context['ticket_id'], $modSettings['shd_zerofill'], '0', STR_PAD_LEFT),
416 417
 		'status' => $new_status,
... ...
@@ -517,7 +517,7 @@ function shd_admin_smf_perms(&$permissionGroups, &$permissionList, &$leftPermiss
517 517
 {
518 518
 	global $modSettings;
519 519
 
520
-	if (!$modSettings['helpdesk_active'] || empty($modSettings['shd_helpdesk_only']))
520
+	if (!$modSettings['helpdesk_active'] || empty($modSettings['shd_helpdesk_only']) || empty($permissionGroups) || empty($permissionList) || empty($leftPermissionGroups) || empty($relabelPermissions))
521 521
 		return;
522 522
 
523 523
 	$perms_disable = array(
... ...
@@ -590,8 +590,11 @@ function shd_admin_smf_perms(&$permissionGroups, &$permissionList, &$leftPermiss
590 590
 function shd_admin_search(&$language_files, &$include_files, &$settings_search)
591 591
 {
592 592
 	// Add in language files.
593
-	shd_load_language('sd_language/SimpleDeskAdmin');
593
+	$language_files = array_merge($language_files, array(
594
+		'sd_language/SimpleDeskAdmin',
595
+	));
594 596
 
597
+	// Extra files.
595 598
 	$include_files = array_merge($include_files, array(
596 599
 		'sd_source/SimpleDesk-Admin',
597 600
 	));
... ...
@@ -635,9 +638,9 @@ function shd_remove_attachments($attach)
635 638
  *	Converts helpdesk body length to match SMF's.
636 639
  *
637 640
  *	@since 2.1
638
- *	@param array &$body_type Either text or other.
641
+ *	@param array $body_type Either text or other.
639 642
 */
640
-function shd_convert_msgbody($body_type)
643
+function shd_convert_msgbody($body_type = 'null')
641 644
 {
642 645
 	global $smcFunc;
643 646
 
... ...
@@ -765,7 +768,7 @@ function shd_admin_log($action, $extra)
765 768
  *	@see shd_count_action_log_entries()
766 769
  *	@since 1.0
767 770
 */
768
-function shd_load_admin_log_entries($start = 0, $items_per_page = 10, $sort = 'la.log_time', $order = 'DESC', $clause = '')
771
+function shd_load_admin_log_entries($start = 0, $items_per_page = 10, $sort = 'la.log_time', $order = 'DESC')
769 772
 {
770 773
 	global $smcFunc, $txt, $scripturl, $context, $user_info, $user_profile;
771 774
 
... ...
@@ -38,7 +38,7 @@ function shd_download_request(&$attachRequest)
38 38
 	global $smcFunc;
39 39
 
40 40
 	// Is this already a resource?  Then another hook has claimed the attachment as theirs.
41
-	if (is_resource($attachRequest))
41
+	if (is_resource($attachRequest) && empty($_REQUEST['ticket']))
42 42
 		return;
43 43
 	// If we don't have a ticket present, it is not our attachment.
44 44
 	elseif (empty($_REQUEST['ticket']))
45 45