Code Duplication    Length = 21-26 lines in 4 locations

Sources/Poll.php 1 location

@@ 835-855 (lines=21) @@
832
	}
833
834
	// I'm sorry, but... well, no one was choosing you.  Poor options, I'll put you out of your misery.
835
	if (!empty($delete_options))
836
	{
837
		$smcFunc['db_query']('', '
838
			DELETE FROM {db_prefix}log_polls
839
			WHERE id_poll = {int:id_poll}
840
				AND id_choice IN ({array_int:delete_options})',
841
			array(
842
				'delete_options' => $delete_options,
843
				'id_poll' => $bcinfo['id_poll'],
844
			)
845
		);
846
		$smcFunc['db_query']('', '
847
			DELETE FROM {db_prefix}poll_choices
848
			WHERE id_poll = {int:id_poll}
849
				AND id_choice IN ({array_int:delete_options})',
850
			array(
851
				'delete_options' => $delete_options,
852
				'id_poll' => $bcinfo['id_poll'],
853
			)
854
		);
855
	}
856
857
	// Shall I reset the vote count, sir?
858
	if (isset($_POST['resetVoteCount']))

Sources/RemoveTopic.php 1 location

@@ 445-468 (lines=24) @@
442
		$polls[] = $row['id_poll'];
443
	$smcFunc['db_free_result']($request);
444
445
	if (!empty($polls))
446
	{
447
		$smcFunc['db_query']('', '
448
			DELETE FROM {db_prefix}polls
449
			WHERE id_poll IN ({array_int:polls})',
450
			array(
451
				'polls' => $polls,
452
			)
453
		);
454
		$smcFunc['db_query']('', '
455
			DELETE FROM {db_prefix}poll_choices
456
			WHERE id_poll IN ({array_int:polls})',
457
			array(
458
				'polls' => $polls,
459
			)
460
		);
461
		$smcFunc['db_query']('', '
462
			DELETE FROM {db_prefix}log_polls
463
			WHERE id_poll IN ({array_int:polls})',
464
			array(
465
				'polls' => $polls,
466
			)
467
		);
468
	}
469
470
	// Get rid of the attachment, if it exists.
471
	require_once($sourcedir . '/ManageAttachments.php');

Sources/SplitTopics.php 1 location

@@ 1557-1580 (lines=24) @@
1554
	}
1555
1556
	// Get rid of the redundant polls.
1557
	if (!empty($deleted_polls))
1558
	{
1559
		$smcFunc['db_query']('', '
1560
			DELETE FROM {db_prefix}polls
1561
			WHERE id_poll IN ({array_int:deleted_polls})',
1562
			array(
1563
				'deleted_polls' => $deleted_polls,
1564
			)
1565
		);
1566
		$smcFunc['db_query']('', '
1567
			DELETE FROM {db_prefix}poll_choices
1568
			WHERE id_poll IN ({array_int:deleted_polls})',
1569
			array(
1570
				'deleted_polls' => $deleted_polls,
1571
			)
1572
		);
1573
		$smcFunc['db_query']('', '
1574
			DELETE FROM {db_prefix}log_polls
1575
			WHERE id_poll IN ({array_int:deleted_polls})',
1576
			array(
1577
				'deleted_polls' => $deleted_polls,
1578
			)
1579
		);
1580
	}
1581
1582
	// Cycle through each board...
1583
	foreach ($boardTotals as $id_board => $stats)

Sources/PersonalMessage.php 1 location

@@ 3019-3044 (lines=26) @@
3016
		$remove_pms[] = $row['sender'];
3017
	$smcFunc['db_free_result']($request);
3018
3019
	if (!empty($remove_pms))
3020
	{
3021
		$smcFunc['db_query']('', '
3022
			DELETE FROM {db_prefix}personal_messages
3023
			WHERE id_pm IN ({array_int:pm_list})',
3024
			array(
3025
				'pm_list' => $remove_pms,
3026
			)
3027
		);
3028
3029
		$smcFunc['db_query']('', '
3030
			DELETE FROM {db_prefix}pm_recipients
3031
			WHERE id_pm IN ({array_int:pm_list})',
3032
			array(
3033
				'pm_list' => $remove_pms,
3034
			)
3035
		);
3036
3037
		$smcFunc['db_query']('', '
3038
			DELETE FROM {db_prefix}pm_labeled_messages
3039
			WHERE id_pm IN ({array_int:pm_list})',
3040
			array(
3041
				'pm_list' => $remove_pms,
3042
			)
3043
		);
3044
	}
3045
3046
	// Any cached numbers may be wrong now.
3047
	cache_put_data('labelCounts:' . $user_info['id'], null, 720);