Browse Source

! Removed duplicate code from Memberlist.php
! Removed duplicate script lines from index.template, now uses loadCSSFile and loadJavascriptFile

Spuds 12 years ago
parent
commit
9267bbffe0
2 changed files with 7 additions and 100 deletions
  1. 0 72
      Sources/Memberlist.php
  2. 7 28
      Themes/default/index.template.php

+ 0 - 72
Sources/Memberlist.php

@@ -590,76 +590,4 @@ function printMemberListRows($request)
 	}
 }
 
-/**
- * Used as a popup for searching members.
- * Uses sub template find_members of the Help template.
- * Also used to add members for PM's sent using wap2/imode protocol.
- */
-function JSMembers()
-{
-	global $context, $scripturl, $user_info, $smcFunc, $sourcedir;
-
-	checkSession('get');
-
-	if (WIRELESS)
-		$context['sub_template'] = WIRELESS_PROTOCOL . '_pm';
-	else
-	{
-		// Why is this in the Help template, you ask?  Well, erm... it helps you.  Does that work?
-		loadTemplate('Help');
-
-		$context['template_layers'] = array();
-		$context['sub_template'] = 'find_members';
-	}
-
-	if (isset($_REQUEST['search']))
-		$context['last_search'] = $smcFunc['htmlspecialchars']($_REQUEST['search'], ENT_QUOTES);
-	else
-		$_REQUEST['start'] = 0;
-
-	// Allow the user to pass the input to be added to to the box.
-	$context['input_box_name'] = isset($_REQUEST['input']) && preg_match('~^[\w-]+$~', $_REQUEST['input']) === 1 ? $_REQUEST['input'] : 'to';
-
-	// Take the delimiter over GET in case it's \n or something.
-	$context['delimiter'] = isset($_REQUEST['delim']) ? ($_REQUEST['delim'] == 'LB' ? "\n" : $_REQUEST['delim']) : ', ';
-	$context['quote_results'] = !empty($_REQUEST['quote']);
-
-	// List all the results.
-	$context['results'] = array();
-
-	// Some buddy related settings ;)
-	$context['show_buddies'] = !empty($user_info['buddies']);
-	$context['buddy_search'] = isset($_REQUEST['buddies']);
-
-	// If the user has done a search, well - search.
-	if (isset($_REQUEST['search']))
-	{
-		require_once($sourcedir . 'Subs-Members.php');
-		$_REQUEST['search'] = $smcFunc['htmlspecialchars']($_REQUEST['search'], ENT_QUOTES);
-
-		$context['results'] = findMembers(array($_REQUEST['search']), true, $context['buddy_search']);
-		$total_results = count($context['results']);
-
-		$context['page_index'] = constructPageIndex($scripturl . '?action=findmember;search=' . $context['last_search'] . ';' . $context['session_var'] . '=' . $context['session_id'] . ';input=' . $context['input_box_name'] . ($context['quote_results'] ? ';quote=1' : '') . ($context['buddy_search'] ? ';buddies' : ''), $_REQUEST['start'], $total_results, 7);
-
-		// Determine the navigation context (especially useful for the wireless template).
-		$base_url = $scripturl . '?action=findmember;search=' . urlencode($context['last_search']) . (empty($_REQUEST['u']) ? '' : ';u=' . $_REQUEST['u']) . ';' . $context['session_var'] . '=' . $context['session_id'];
-		$context['links'] = array(
-			'first' => $_REQUEST['start'] >= 7 ? $base_url . ';start=0' : '',
-			'prev' => $_REQUEST['start'] >= 7 ? $base_url . ';start=' . ($_REQUEST['start'] - 7) : '',
-			'next' => $_REQUEST['start'] + 7 < $total_results ? $base_url . ';start=' . ($_REQUEST['start'] + 7) : '',
-			'last' => $_REQUEST['start'] + 7 < $total_results ? $base_url . ';start=' . (floor(($total_results - 1) / 7) * 7) : '',
-			'up' => $scripturl . '?action=pm;sa=send' . (empty($_REQUEST['u']) ? '' : ';u=' . $_REQUEST['u']),
-		);
-		$context['page_info'] = array(
-			'current_page' => $_REQUEST['start'] / 7 + 1,
-			'num_pages' => floor(($total_results - 1) / 7) + 1
-		);
-
-		$context['results'] = array_slice($context['results'], $_REQUEST['start'], 7);
-	}
-	else
-		$context['links']['up'] = $scripturl . '?action=pm;sa=send' . (empty($_REQUEST['u']) ? '' : ';u=' . $_REQUEST['u']);
-}
-
 ?>

+ 7 - 28
Themes/default/index.template.php

@@ -75,6 +75,7 @@ function template_init()
 	$settings['require_theme_strings'] = false;
 
 	// Load the CSS
+	// The ?fin20 part of this link is just here to make sure browsers don't cache it wrongly.
 	loadCSSFile($settings['theme_url'] . '/css/index' . $context['theme_variant'] . '.css?fin20');
 
 	// Some browsers need an extra stylesheet due to bugs/compatibility issues.
@@ -87,6 +88,8 @@ function template_init()
 		loadCSSFile($settings['theme_url'] . '/css/rtl.css');
 
 	// Now load the JS
+	// Note that the Superfish function seems to like being called by the full syntax.
+	// It doesn't appear to like being called by short syntax. Please test if contemplating changes.
 	loadJavascriptFile($settings['theme_url'] . '/scripts/jquery-1.6.4.min.js');
 	loadJavascriptFile($settings['theme_url'] . '/scripts/hoverIntent.js');
 	loadJavascriptFile($settings['theme_url'] . '/scripts/superfish.js');
@@ -106,39 +109,15 @@ function template_html_above()
 <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
 <head>';
 
-	// The ?fin20 part of this link is just here to make sure browsers don't cache it wrongly.
-	echo '
-	<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/index', $context['theme_variant'], '.css?fin20" />';
-
-	// Some browsers need an extra stylesheet due to bugs/compatibility issues.
-	foreach (array('ie7', 'ie6', 'webkit') as $cssfix)
-		if (isBrowser('is_' . $cssfix))
-			echo '
-	<link rel="stylesheet" type="text/css" href="', $settings['default_theme_url'], '/css/', $cssfix, '.css" />';
-
-	// RTL languages require an additional stylesheet.
-	if ($context['right_to_left'])
-		echo '
-	<link rel="stylesheet" type="text/css" href="', $settings['theme_url'], '/css/rtl.css" />';
-
 	template_css();
 
 	// Here comes the JavaScript bits!
-	// Note that the Superfish function seems to like being called by the full syntax.
-	// It doesn't appear to like being called by short syntax. Please test if contemplating changes.
 	echo '
-	<script type="text/javascript" src="', $settings['theme_url'], '/scripts/jquery-1.6.4.min.js"></script>
-	<script type="text/javascript" src="', $settings['theme_url'], '/scripts/hoverIntent.js"></script>
-	<script type="text/javascript" src="', $settings['theme_url'], '/scripts/superfish.js"></script>
-	<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/script.js?fin20"></script>
-	<script type="text/javascript" src="', $settings['theme_url'], '/scripts/theme.js?fin20"></script>
-	<script type="text/javascript">
-
+	<script type="text/javascript"><!-- // --><![CDATA[
 			$(document).ready(function() { 
 				$("ul.dropmenu").superfish(); 
 			});
-
-	</script>
+	// ]]></script>
 	<script type="text/javascript"><!-- // --><![CDATA[
 		var smf_theme_url = "', $settings['theme_url'], '";
 		var smf_default_theme_url = "', $settings['default_theme_url'], '";
@@ -597,7 +576,7 @@ function template_javascript_vars()
 }
 
 /**
- * Output the Javascript files
+ * Output the CSS files
  */
 function template_css()
 {
@@ -611,4 +590,4 @@ function template_css()
 	<link rel="stylesheet" type="text/css" href="', $filename, '" />';
 }
 
-?>
+?>