Fix up some more code issues WIRELESS isn't in SMF 2.1 Make template_button_strip compatibility code compliant with 2.1 templates.
jdarwood007

jdarwood007 commited on 2016-12-28 16:50:24
Showing 12 changed files, with 14 additions and 41 deletions.


Signed-off-by: jdarwood007 <unmonitored+github@sleepycode.com>
... ...
@@ -253,7 +253,7 @@ shd_attach_select.prototype.checkActive = function()
253 253
 {
254 254
 	var elements = document.getElementsByTagName('input');
255 255
 	var session_attach = 0;
256
-	for (i in elements)
256
+	for (var i in elements)
257 257
 	{
258 258
 		if (elements[i] && elements[i].type == 'checkbox' && elements[i].name == 'attach_del[]' && elements[i].checked == true)
259 259
 			session_attach++;
... ...
@@ -1857,7 +1857,7 @@ function shd_handle_attachments()
1857 1857
 	// ...or attach a new file...
1858 1858
 	if (!empty($_FILES) || !empty($_SESSION['temp_attachments']))
1859 1859
 	{
1860
-		if (!empty($FILES))
1860
+		if (!empty($_FILES))
1861 1861
 			$_FILES = array_reverse($_FILES);
1862 1862
 
1863 1863
 		shd_is_allowed_to('shd_post_attachment');
... ...
@@ -446,7 +446,6 @@ function shd_profile_show_tickets($memID)
446 446
 	list ($item_count) = $smcFunc['db_fetch_row']($request);
447 447
 	$smcFunc['db_free_result']($request);
448 448
 
449
-	$reverse = false;
450 449
 	$max_index = (int) $modSettings['defaultMaxMessages'];
451 450
 
452 451
 	// A little page index to help us along the way!
... ...
@@ -39,7 +39,7 @@ function shd_unread_posts()
39 39
 	global $smcFunc, $context, $user_info, $sourcedir, $txt, $scripturl, $user_profile, $modSettings;
40 40
 
41 41
 	// Are we using Dragooon's very swish mobile theme, or other wireless? If so, disable this.
42
-	if (WIRELESS || (isset($_REQUEST['thememode']) && $_REQUEST['thememode'] == 'mobile') || (isset($_COOKIE['smf4m_cookie']) && $_COOKIE['smf4m_cookie'] == 'mobile'))
42
+	if ((isset($_REQUEST['thememode']) && $_REQUEST['thememode'] == 'mobile') || (isset($_COOKIE['smf4m_cookie']) && $_COOKIE['smf4m_cookie'] == 'mobile'))
43 43
 		$modSettings['shd_disable_unread'] = true;
44 44
 
45 45
 	// We're only displaying this to staff. We didn't do this check on bootstrapping, no sense doing it every page load.
... ...
@@ -1096,7 +1096,6 @@ function shd_helpdesk_listing()
1096 1096
 	{
1097 1097
 		foreach ($context['ticket_blocks'] as $block_id => $block)
1098 1098
 		{
1099
-			$num_per_page = !empty($context['shd_preferences']['blocks_' . $block_key . '_count']) ? $context['shd_preferences']['blocks_' . $block_key . '_count'] : $context['items_per_page'];
1100 1099
 			$url_fragment = $base_url;
1101 1100
 
1102 1101
 			foreach ($block_list as $block_item)
... ...
@@ -1067,8 +1067,6 @@ function shd_determine_status($action, $starter_id = 0, $replier_id = 0, $replie
1067 1067
 */
1068 1068
 function shd_no_expand_pageindex($base_url, &$start, $max_value, $num_per_page, $flexible_start = false)
1069 1069
 {
1070
-	
1071
-//	return constructPageIndex($base_url, $start, $max_value, $num_per_page, $flexible_start);
1072 1070
 	return preg_replace('~<span class="expand_pages"([^<]+)~i', '<span style="font-weight: bold;"> ... ', constructPageIndex($base_url, $start, $max_value, $num_per_page, $flexible_start));
1073 1071
 }
1074 1072
 
... ...
@@ -73,8 +73,6 @@ function shd_load_action_log_entries($start = 0, $items_per_page = 10, $sort = '
73 73
 	shd_load_language('sd_language/SimpleDeskLogAction');
74 74
 	shd_load_language('sd_language/SimpleDeskNotifications');
75 75
 
76
-	$loaded_users = array();
77
-
78 76
 	// We may have to exclude some items from this depending on who the user is or is not. Forum/HD admins can always see everything.
79 77
 	$exclude = shd_action_log_exclusions();
80 78
 
... ...
@@ -714,13 +712,13 @@ function shd_admin_log_configvar($save_vars)
714 712
  *	@since 2.1
715 713
  *	@param string $section The area this was from.
716 714
  *	@param array $extra An array of extra elements, in the following format.
717
- *		@param (required) string $action The action performed.
718
- *		@param (optional) string $setting During a setting update, this is the variable we changed.
719
- *		@param (optional) string $type The subaction peformed or during a setting update, int/string/etc.
720
- *		@param (optional) int $id The ID of the item we performed the action on.
721
- *		@param (optional) string $direction During a reorder up/down operation which way we moved.
722
- *		@param (optional) int $to The ID of the destination item used during copy/move operation.
723
- *		@param (optional) int $from The ID of the source item used during the copy/move operation
715
+ *		(required) string $action The action performed.
716
+ *		(optional) string $setting During a setting update, this is the variable we changed.
717
+ *		(optional) string $type The subaction peformed or during a setting update, int/string/etc.
718
+ *		(optional) int $id The ID of the item we performed the action on.
719
+ *		(optional) string $direction During a reorder up/down operation which way we moved.
720
+ *		(optional) int $to The ID of the destination item used during copy/move operation.
721
+ *		(optional) int $from The ID of the source item used during the copy/move operation
724 722
 */
725 723
 function shd_admin_log($action, $extra)
726 724
 {
... ...
@@ -779,8 +777,6 @@ function shd_load_admin_log_entries($start = 0, $items_per_page = 10, $sort = 'l
779 777
 	shd_load_language('sd_language/SimpleDeskLogAction');
780 778
 	shd_load_language('sd_language/SimpleDeskNotifications');
781 779
 
782
-	$loaded_users = array();
783
-
784 780
 	$request = shd_db_query('','
785 781
 		SELECT la.id_action, la.log_time, la.ip, la.action, la.extra,
786 782
 		IFNULL(mem.id_member, 0) AS id_member, IFNULL(mem.real_name, {string:blank}) AS real_name, IFNULL(mg.group_name, {string:na}) AS group_name
... ...
@@ -135,7 +135,6 @@ function shd_create_ticket_post(&$msgOptions, &$ticketOptions, &$posterOptions)
135 135
 		$msgOptions['modified']['id'] = empty($msgOptions['modified']['id']) ? 0 : (int) $msgOptions['modified']['id'];
136 136
 		$msgOptions['modified']['name'] = empty($msgOptions['modified']['name']) ? '' : $msgOptions['modified']['name'];
137 137
 
138
-		$cancel = false;
139 138
 		if (empty($msgOptions['modified']['time']) || (empty($msgOptions['modified']['name']) && empty($msgOptions['modified']['id'])))
140 139
 			$modified = false;
141 140
 
... ...
@@ -130,15 +130,6 @@ function template_shd_admin()
130 130
 					echo '
131 131
 								<strong>', $group['title'], '</strong>', !empty($group['desc']) ? ' - <em class="smalltext">' . $group['desc'] . '</em>' : '', '<hr>';
132 132
 
133
-					/*// Try to make this read nicely.
134
-					if (count($group['members']) <= 2)
135
-						echo implode(' ' . $txt['shd_credits_and'] . ' ', $group['members']);
136
-					else
137
-					{
138
-						$last_peep = array_pop($group['members']);
139
-						echo implode(', ', $group['members']), ', ', $txt['shd_credits_and'], ' ', $last_peep;
140
-					}*/
141
-
142 133
 					$cur_member = 1;
143 134
 					foreach ($group['members'] AS $member)
144 135
 					{
... ...
@@ -709,7 +700,7 @@ function template_shd_admin_log()
709 700
 	if (empty($context['actions']))
710 701
 		echo '
711 702
 			<tr class="windowbg">
712
-				<td ', $action['can_remove'] && $context['can_delete'] ? 'colspan="6"' : 'colspan="5"',' class="shd_noticket">', $txt['shd_admin_actionlog_none'], '</td>
703
+				<td ', $context['can_delete'] ? 'colspan="6"' : 'colspan="5"',' class="shd_noticket">', $txt['shd_admin_actionlog_none'], '</td>
713 704
 			</tr>';
714 705
 	else
715 706
 	{
... ...
@@ -729,7 +720,7 @@ function template_shd_admin_log()
729 720
 
730 721
 	echo '
731 722
 			<tr class="windowbg">
732
-				<td ', $action['can_remove'] && $context['can_delete'] ? 'colspan="6"' : 'colspan="5"','>
723
+				<td ', $context['can_delete'] ? 'colspan="6"' : 'colspan="5"','>
733 724
 					<span class="floatright smalltext">', $context['page_index'], '</span>
734 725
 					<span class="smalltext shd_empty_log"><img src="', $settings['default_images_url'], '/simpledesk/delete.png" alt="X" /> <a href="', $scripturl, '?action=admin;area=helpdesk_info;sa=adminlog', $context['url_sort'], $context['url_order'], ';removeall" onclick="return confirm(', JavaScriptEscape(sprintf($txt['shd_admin_actionlog_removeall_confirm'], $context['daysdisable'])), ');">', $txt['shd_admin_actionlog_removeall'], '</a></span>
735 726
 				</td>
... ...
@@ -238,7 +238,6 @@ function template_shd_custom_field_edit()
238 238
 	foreach ($context['field_icons'] as $icon)
239 239
 	{
240 240
 		list($file, $desc) = $icon;
241
-		$path = $settings['default_theme_dir'] . '/images/simpledesk/' . $file;
242 241
 		echo '
243 242
 									<option value="', $file, '"', $context['field_icon_value'] == $file ? ' selected="selected"' : '','>', $desc, '</option>';
244 243
 	}
... ...
@@ -293,7 +292,7 @@ function template_shd_custom_field_edit()
293 292
 
294 293
 	foreach ($context['field_types'] as $field => $details)
295 294
 	{
296
-		list($field_desc, $class) = $details;
295
+		list($field_desc,) = $details;
297 296
 		echo '
298 297
 									<option value="', $field, '"', ($context['field_type_value'] == $field ? ' selected="selected"' : ''), '>', $field_desc, '</option>';
299 298
 	}
... ...
@@ -695,10 +695,6 @@ function template_inline_attachments($msg)
695 695
 	{
696 696
 		echo '
697 697
 							<table width="90%">';
698
-		/*echo '
699
-							<div class="smalltext">
700
-								<strong>', $txt['shd_ticket_attachments'], '</strong><br>
701
-								<ul class="shd_replyattachments">';*/
702 698
 
703 699
 		$count = 0;
704 700
 		$firstrow = true;
... ...
@@ -745,9 +741,6 @@ function template_inline_attachments($msg)
745 741
 			$firstrow = false;
746 742
 		}
747 743
 
748
-		/*echo '
749
-								</ul>
750
-							</div>';*/
751 744
 		echo '
752 745
 							</table>';
753 746
 	}
... ...
@@ -519,7 +519,6 @@ function template_shd_menu_header($header, $string)
519 519
 		if (isset($_REQUEST['st_' . $block_key]))
520 520
 			$link .= ';st_' . $block_key . '=' . $block['start'];
521 521
 
522
-	$direction = 'down';
523 522
 	// Now for sorting direction per block
524 523
 	foreach ($context['ticket_blocks'] as $block_key => $block)
525 524
 	{
... ...
@@ -568,7 +567,7 @@ function template_shd_maintenance_below()
568 567
 // Provide a placeholder in the event template_button_strip isn't defined (like in the mobile templates)
569 568
 if (!function_exists('template_button_strip'))
570 569
 {
571
-	function template_button_strip($navigation, $direction)
570
+	function template_button_strip($navigation, $direction = '', $strip_options = array())
572 571
 	{
573 572
 	}
574 573
 }
575 574