Code Duplication    Length = 6-11 lines in 5 locations

Sources/Display.php 1 location

@@ 44-49 (lines=6) @@
41
	loadTemplate('Display');
42
43
	// Not only does a prefetch make things slower for the server, but it makes it impossible to know if they read it.
44
	if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
45
	{
46
		ob_end_clean();
47
		header('HTTP/1.1 403 Prefetch Forbidden');
48
		die;
49
	}
50
51
	// How much are we sticking on each page?
52
	$context['messages_per_page'] = empty($modSettings['disableCustomPerPage']) && !empty($options['messages_per_page']) ? $options['messages_per_page'] : $modSettings['defaultMaxMessages'];

Sources/MessageIndex.php 1 location

@@ 45-55 (lines=11) @@
42
43
	loadTemplate('MessageIndex');
44
45
	if (!$user_info['is_guest'])
46
	{
47
		// We can't know they read it if we allow prefetches.
48
		// But we'll actually mark it read later after we've done everything else.
49
		if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
50
		{
51
			ob_end_clean();
52
			header('HTTP/1.1 403 Prefetch Forbidden');
53
			die;
54
		}
55
	}
56
57
	$context['name'] = $board_info['name'];
58
	$context['description'] = $board_info['description'];

Sources/Recent.php 1 location

@@ 471-476 (lines=6) @@
468
	is_not_guest();
469
470
	// Prefetching + lots of MySQL work = bad mojo.
471
	if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
472
	{
473
		ob_end_clean();
474
		header('HTTP/1.1 403 Forbidden');
475
		die;
476
	}
477
478
	$context['showCheckboxes'] = !empty($options['display_quick_mod']) && $options['display_quick_mod'] == 1;
479

Sources/Search.php 1 location

@@ 266-271 (lines=6) @@
263
		fatal_lang_error('loadavg_search_disabled', false);
264
265
	// No, no, no... this is a bit hard on the server, so don't you go prefetching it!
266
	if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
267
	{
268
		ob_end_clean();
269
		header('HTTP/1.1 403 Forbidden');
270
		die;
271
	}
272
273
	$weight_factors = array(
274
		'frequency' => array(

Sources/Security.php 1 location

@@ 639-644 (lines=6) @@
636
		$error = 'session_verify_fail';
637
638
	// Make sure a page with session check requirement is not being prefetched.
639
	if (isset($_SERVER['HTTP_X_MOZ']) && $_SERVER['HTTP_X_MOZ'] == 'prefetch')
640
	{
641
		ob_end_clean();
642
		header('HTTP/1.1 403 Forbidden');
643
		die;
644
	}
645
646
	// Check the referring site - it should be the same server at least!
647
	if (isset($_SESSION['request_referer']))