Code Duplication    Length = 17-19 lines in 3 locations

Sources/Calendar.php 1 location

@@ 65-83 (lines=19) @@
62
	if (isset($_GET['event']))
63
	{
64
		$evid = (int) $_GET['event'];
65
		if ($evid > 0)
66
		{
67
			$request = $smcFunc['db_query']('', '
68
				SELECT start_date
69
				FROM {db_prefix}calendar
70
				WHERE id_event = {int:event_id}',
71
				array(
72
					'event_id' => $evid,
73
				)
74
			);
75
			if ($row = $smcFunc['db_fetch_assoc']($request))
76
			{
77
				$_REQUEST['start_date'] = $row['start_date'];
78
79
				// We might use this later.
80
				$context['selected_event'] = $evid;
81
			}
82
			$smcFunc['db_free_result']($request);
83
		}
84
		unset ($_GET['event']);
85
	}
86

Sources/Subs-Post.php 1 location

@@ 2393-2409 (lines=17) @@
2390
	);
2391
2392
	// If we were unapproving find the last msg in the topics...
2393
	if (!$approve)
2394
	{
2395
		$request = $smcFunc['db_query']('', '
2396
			SELECT id_topic, MAX(id_msg) AS id_last_msg
2397
			FROM {db_prefix}messages
2398
			WHERE id_topic IN ({array_int:topic_list})
2399
				AND approved = {int:approved}
2400
			GROUP BY id_topic',
2401
			array(
2402
				'topic_list' => $topics,
2403
				'approved' => 1,
2404
			)
2405
		);
2406
		while ($row = $smcFunc['db_fetch_assoc']($request))
2407
			$topic_changes[$row['id_topic']]['id_last_msg'] = $row['id_last_msg'];
2408
		$smcFunc['db_free_result']($request);
2409
	}
2410
2411
	// ... next the topics...
2412
	foreach ($topic_changes as $id => $changes)

Sources/Stats.php 1 location

@@ 345-363 (lines=19) @@
342
	}
343
344
	// Large forums may need a bit more prodding...
345
	if ($modSettings['totalMessages'] > 100000)
346
	{
347
		$request = $smcFunc['db_query']('', '
348
			SELECT id_topic
349
			FROM {db_prefix}topics
350
			WHERE num_views != {int:no_views}
351
			ORDER BY num_views DESC
352
			LIMIT 100',
353
			array(
354
				'no_views' => 0,
355
			)
356
		);
357
		$topic_ids = array();
358
		while ($row = $smcFunc['db_fetch_assoc']($request))
359
			$topic_ids[] = $row['id_topic'];
360
		$smcFunc['db_free_result']($request);
361
	}
362
	else
363
		$topic_ids = array();
364
365
	// Topic views top 10.
366
	$topic_view_result = $smcFunc['db_query']('', '