Release 2.1.0 (#158)
Jeremy D

Jeremy D commited on 2022-05-27 16:16:20
Showing 51 changed files, with 139 additions and 75 deletions.


* Release 2.1.0

* Fix buildTools
... ...
@@ -1 +1 @@
1
-Subproject commit 2d59db5bb4e7cc0b3024003181d36048bcccde63
1
+Subproject commit ec395af8128c6f0c66b2979aa7f445429832db8d
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: install.php                                      *
18 18
 **************************************************************/
19 19
 
... ...
@@ -181,7 +181,7 @@ function sd_get_install_modSettings($getAll = false)
181 181
 function sd_get_install_rows()
182 182
 {
183 183
 	global $smcFunc;
184
-	static $current_package_server_url = 'https://www.simpledesk.net/download/plugins/2.0';
184
+	static $current_package_server_url = 'https://www.simpledesk.net/download/plugins/2.1';
185 185
 
186 186
 	$rows = array();
187 187
 	$rows[] = array(
... ...
@@ -6,7 +6,7 @@ Thank you for downloading SimpleDesk :)
6 6
 
7 7
 Yes, we know, you don't want the boring formality of a license, but to protect us - and you - we have a license in the code. Clicking the install button after this constitutes acceptance of the following terms.
8 8
 
9
-[code]Copyright (c) 2010-2015, SimpleDesk Team
9
+[code]Copyright (c) 2010-2022, SimpleDesk Team
10 10
 All rights reserved.
11 11
 
12 12
 Redistribution and use in source and binary forms, with or without
... ...
@@ -3,7 +3,7 @@
3 3
 <package-info xmlns="http://www.simplemachines.org/xml/package-info" xmlns:smf="http://www.simplemachines.org/">
4 4
 	<id>SimpleDeskTeam:SimpleDesk</id>
5 5
 	<name>SimpleDesk - Integrated Helpdesk for Simple Machines Forum</name>
6
-	<version>2.1 RC2</version>
6
+	<version>2.1.0</version>
7 7
 	<type>modification</type>
8 8
 
9 9
 	<install for="2.1 RC4, 2.1.0-2.1.99">
... ...
@@ -78,6 +78,7 @@
78 78
 		<hook hook="integrate_display_buttons" function="shd_display_btn_mvtopic" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
79 79
 
80 80
 			<!-- ShowAttachments -->
81
+		<hook hook="integrate_pre_download_request" function="shd_pre_download_request" file="$sourcedir/sd_source/Subs-SimpleDeskDisplay.php" />
81 82
 		<hook hook="integrate_download_request" function="shd_download_request" file="$sourcedir/sd_source/Subs-SimpleDeskDisplay.php" />
82 83
 
83 84
 			<!-- BoardIndex -->
... ...
@@ -142,6 +143,7 @@
142 143
 		<hook reverse="true" hook="integrate_display_buttons" function="shd_display_btn_mvtopic" file="$sourcedir/sd_source/Subs-SimpleDesk.php" />
143 144
 
144 145
 			<!-- ShowAttachments -->
146
+		<hook reverse="true" hook="integrate_pre_download_request" function="shd_pre_download_request" file="$sourcedir/sd_source/Subs-SimpleDeskDisplay.php" />
145 147
 		<hook reverse="true" hook="integrate_download_request" function="shd_download_request" file="$sourcedir/sd_source/Subs-SimpleDeskDisplay.php" />
146 148
 
147 149
 			<!-- BoardIndex -->
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk.english.php                           *
18 18
 **************************************************************/
19 19
 // Version: 2.1; SimpleDesk main language file
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDeskAdmin.english.php                      *
18 18
 **************************************************************/
19 19
 // Version: 2.1; SimpleDesk administration options
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDeskLogAction.english.php                  *
18 18
 **************************************************************/
19 19
 // Version: 2.1; SimpleDesk action log
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDeskNotifications.english.php              *
18 18
 **************************************************************/
19 19
 // Version: 2.1; SimpleDesk Notifications language file
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDeskPermissions.english.php                *
18 18
 **************************************************************/
19 19
 // Version: 2.1; SimpleDesk permissions
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDeskProfile.english.php                    *
18 18
 **************************************************************/
19 19
 // Version: 2.1; SimpleDesk Profile language file
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDeskWho.english.php                        *
18 18
 **************************************************************/
19 19
 // Version: 2.1; SimpleDesk who's online
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SDPluginFrontPage.english.php                    *
18 18
 **************************************************************/
19 19
 // Version: 2.1; SimpleDesk main language file
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SDPluginStats.english.php                        *
18 18
 **************************************************************/
19 19
 // Version: 2.1; SimpleDesk main language file
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SDPluginFrontPage.php                            *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: index.php                                        *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SDPluginStats.php                                *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: index.php                                        *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-Admin.php                             *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-AdminDepartments.php                  *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-AdminCustomField.php                  *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-AdminDepartments.php                  *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-AdminMaint.php                        *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-AdminPermissions.php                  *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-AdminPlugins.php                      *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-AjaxHandler.php                       *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-Assign.php                            *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-Delete.php                            *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-Display.php                           *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-MiscActions.php                       *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-MoveDept.php                          *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-Notifications.php                     *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-Post.php                              *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-Profile.php                           *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-SSI.php                               *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-Scheduled.php                         *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-Search.php                            *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-TicketTopicMove.php                   *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk-Unread.php                            *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: SimpleDesk.php                                   *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: Subs-SimpleDesk.php                              *
18 18
 **************************************************************/
19 19
 
... ...
@@ -50,7 +50,7 @@ function shd_init()
50 50
 	$context['shd_home'] = 'action=helpdesk;sa=main';
51 51
 
52 52
 	// What SD version are we on? It's now here!
53
-	define('SHD_VERSION', 'SimpleDesk 2.1 RC1');
53
+	define('SHD_VERSION', 'SimpleDesk 2.1.0');
54 54
 
55 55
 	// This isn't the SMF way. But for something like this, it's way way more logical and readable.
56 56
 	define('TICKET_STATUS_NEW', 0);
... ...
@@ -1600,7 +1600,7 @@ function shd_init_current_action(&$current_action)
1600 1600
 	global $context, $modSettings;
1601 1601
 
1602 1602
 	// Load some extra CSS
1603
-	loadCSSFile('helpdesk_icons.css', array('minimize' => empty($context['shd_developer_mode']), 'seed' => $context['shd_css_version']), 'helpdesk_icons');
1603
+	loadCSSFile('helpdesk_icons.css', array('minimize' => empty($context['shd_developer_mode']), 'seed' => !empty($context['shd_css_version']) ? $context['shd_css_version'] : false), 'helpdesk_icons');
1604 1604
 	
1605 1605
 	// In helpdesk only mode, disable PMs if we choose to, this is repeated here due to caching.
1606 1606
 	if (!empty($modSettings['shd_helpdesk_only']) && !empty($modSettings['shd_disable_pm']))
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: Subs-SimpleDeskAdmin.php                         *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: Subs-SimpleDeskBoardIndex.php                    *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: Subs-SimpleDeskDisplay.php                       *
18 18
 **************************************************************/
19 19
 
... ...
@@ -27,24 +27,46 @@ if (!defined('SMF'))
27 27
 	die('Hacking attempt...');
28 28
 
29 29
 /**
30
- *	Looks to see if an attachment is from the helpdesk, if so we validate it and return a proper request. SMF will handle the rest.
31
- *
32
- *	@param string &$attachRequest A resource handle.
30
+ *	Prior to downloading, we check if this is an attachment of ours or not.
31
+ *	We do this here, because caching may otherwise skip these checks.
33 32
  *
34
- *	@since 2.0
33
+ *	@since 2.1
35 34
 */
36
-function shd_download_request(&$attachRequest)
35
+function shd_pre_download_request()
37 36
 {
38 37
 	global $smcFunc;
39 38
 
40
-	// Is this already a resource?  Then another hook has claimed the attachment as theirs.
41
-	if (!empty($attachRequest) && is_resource($attachRequest) && empty($_REQUEST['ticket']))
42
-		return;
43
-	// If we don't have a ticket present, it is not our attachment.
44
-	elseif (empty($_REQUEST['ticket']))
45
-		return;
39
+	// If we don't have a ticket, lets verify this is ours.
40
+	if (empty($_REQUEST['ticket']))
41
+	{
42
+		$request = shd_db_query('', '
43
+			SELECT hdt.id_ticket
44
+			FROM {db_prefix}attachments AS a
45
+				INNER JOIN {db_prefix}helpdesk_attachments AS hda ON (a.id_attach = hda.id_attach)
46
+				INNER JOIN {db_prefix}helpdesk_ticket_replies AS hdtr ON (hda.id_msg = hdtr.id_msg)
47
+				INNER JOIN {db_prefix}helpdesk_tickets AS hdt ON (hdtr.id_ticket = hdt.id_ticket)
48
+			WHERE a.id_attach = {int:attach}
49
+			LIMIT 1',
50
+			array(
51
+				'attach' => (int) $_REQUEST['attach'],
52
+			)
53
+		);
46 54
 
47
-	$_REQUEST['ticket'] = (int) $_REQUEST['ticket'];
55
+		// It is, but we are missing the ticket info, bad url.
56
+		if ($smcFunc['db_num_rows']($request) > 0)
57
+		{
58
+			$smcFunc['db_free_result']($request);
59
+			send_http_status(404, 'File Not Found SD[1]');
60
+			die('404 File Not Found SD[1]');
61
+		}
62
+
63
+		// We didn't find anything, this is somebody elses problem.
64
+		$smcFunc['db_free_result']($request);
65
+		return;
66
+	}
67
+	// We have a ticket info.  Lets see if we can see this.
68
+	else
69
+	{	
48 70
 		// First we check that we can see said ticket and figure out what department we're in.
49 71
 		$request = shd_db_query('', '
50 72
 			SELECT hdt.id_dept
... ...
@@ -52,7 +74,7 @@ function shd_download_request(&$attachRequest)
52 74
 			WHERE id_ticket = {int:ticket}
53 75
 				AND {query_see_ticket}',
54 76
 			array(
55
-			'ticket' => $_REQUEST['ticket'],
77
+				'ticket' => (int) $_REQUEST['ticket'],
56 78
 			)
57 79
 		);
58 80
 
... ...
@@ -63,11 +85,45 @@ function shd_download_request(&$attachRequest)
63 85
 			$smcFunc['db_free_result']($request);
64 86
 
65 87
 			// Now check their permission. If they don't have permission to view in this department, bye.
66
-		shd_is_allowed_to('shd_view_attachment', $dept);
88
+			if (!shd_allowed_to('shd_view_attachment', $dept))
89
+			{
90
+				send_http_status(404, 'File Not Found SD[2]');
91
+				die('404 File Not Found SD[2]');
92
+			}
93
+		}
94
+		// We couldn't find the ticket, but we have a ticket id in the url.
95
+		else
96
+		{
97
+			$smcFunc['db_free_result']($request);
98
+
99
+			send_http_status(404, 'File Not Found SD[3]');
100
+			die('404 File Not Found SD[3]');
101
+		}
102
+	}
103
+}
104
+
105
+/**
106
+ *	Looks to see if an attachment is from the helpdesk, if so we validate it and return a proper request. SMF will handle the rest.
107
+ *
108
+ *	@param string &$attachRequest A resource handle.
109
+ *
110
+ *	@since 2.0
111
+*/
112
+function shd_download_request(&$attachRequest)
113
+{
114
+	global $smcFunc;
115
+
116
+	// Is this already a resource?  Then another hook has claimed the attachment as theirs.
117
+	if ((!empty($attachRequest) && is_resource($attachRequest)) || empty($_REQUEST['ticket']))
118
+		return;
67 119
 
68 120
 	// Make sure the attachment is on this ticket, note right now we're forcing it to be "approved"
69 121
 	$attachRequest = shd_db_query('', '
70
-			SELECT a.id_folder, a.filename, a.file_hash, a.fileext, a.id_attach, a.attachment_type, a.mime_type, 1 AS approved, hdtr.id_member
122
+		SELECT
123
+			{string:source} AS source,
124
+			a.id_folder, a.filename, a.file_hash, a.fileext, a.id_attach,
125
+			a.attachment_type, a.mime_type, 1 AS approved, hdtr.id_member,
126
+			0 AS id_board
71 127
 		FROM {db_prefix}attachments AS a
72 128
 			INNER JOIN {db_prefix}helpdesk_attachments AS hda ON (a.id_attach = hda.id_attach)
73 129
 			INNER JOIN {db_prefix}helpdesk_ticket_replies AS hdtr ON (hda.id_msg = hdtr.id_msg)
... ...
@@ -76,9 +132,9 @@ function shd_download_request(&$attachRequest)
76 132
 			AND hdt.id_ticket = {int:ticket}
77 133
 		LIMIT 1',
78 134
 		array(
79
-				'attach' => $_REQUEST['attach'],
135
+			'source' => 'SimpleDesk',
136
+			'attach' => (int) $_REQUEST['attach'],
80 137
 			'ticket' => (int) $_REQUEST['ticket'],
81 138
 		)
82 139
 	);
83 140
 }
84 141
\ No newline at end of file
85
-}
86 142
\ No newline at end of file
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: Subs-SimpleDeskManageAttachments.php             *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: Subs-SimpleDeskPackages.php                      *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: Subs-SimpleDeskPermissions.php                   *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: Subs-SimpleDeskPost.php                          *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: Subs-SimpleDeskProfile.php                       *
18 18
 **************************************************************/
19 19
 
... ...
@@ -213,15 +213,21 @@ function shd_profile_trackip($ip_string, $ip_var)
213 213
 		'get_items' => array(
214 214
 			'function' => 'shd_list_get_ip_messages',
215 215
 			'params' => array(
216
-				'hdtr.poster_ip ' . $ip_string,
217
-				array('ip_address' => $ip_var),
216
+				'hdtr.poster_ip = {string:ip_address_low} OR hdtr.poster_ip = {string:ip_address_high}',
217
+				array(
218
+					'ip_address_low' => inet_dtop($ip_var['low']),
219
+					'ip_address_high' => inet_dtop($ip_var['high'])
220
+				),
218 221
 			),
219 222
 		),
220 223
 		'get_count' => array(
221 224
 			'function' => 'shd_list_get_ip_message_count',
222 225
 			'params' => array(
223
-				'hdtr.poster_ip ' . $ip_string,
224
-				array('ip_address' => $ip_var),
226
+				'hdtr.poster_ip = {string:ip_address_low} OR hdtr.poster_ip = {string:ip_address_high}',
227
+				array(
228
+					'ip_address_low' => inet_dtop($ip_var['low']),
229
+					'ip_address_high' => inet_dtop($ip_var['high'])
230
+				),
225 231
 			),
226 232
 		),
227 233
 		'columns' => array(
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: Subs-SimpleDeskSearch.php                        *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: uninstall-optional.php                           *
18 18
 **************************************************************/
19 19
 
... ...
@@ -13,7 +13,7 @@
13 13
 *   Any questions, please contact SimpleDesk.net              *
14 14
 *                                                             *
15 15
 ***************************************************************
16
-* SimpleDesk Version: 2.1 RC1                                 *
16
+* SimpleDesk Version: 2.1.0                                   *
17 17
 * File Info: uninstall-required.php                           *
18 18
 **************************************************************/
19 19
 
20 20