Code Duplication    Length = 7-9 lines in 5 locations

Sources/Profile-Modify.php 2 locations

@@ 1032-1040 (lines=9) @@
1029
	// If themeSetArray isn't still empty, send it to the database.
1030
	if (empty($context['password_auth_failed']))
1031
	{
1032
		if (!empty($themeSetArray))
1033
		{
1034
			$smcFunc['db_insert']('replace',
1035
				'{db_prefix}themes',
1036
				array('id_member' => 'int', 'id_theme' => 'int', 'variable' => 'string-255', 'value' => 'string-65534'),
1037
				$themeSetArray,
1038
				array('id_member', 'id_theme', 'variable')
1039
			);
1040
		}
1041
1042
		if (!empty($erase_options))
1043
		{
@@ 1279-1285 (lines=7) @@
1276
	// Make those changes!
1277
	if ((!empty($changes) || !empty($deletes)) && empty($context['password_auth_failed']) && empty($errors))
1278
	{
1279
		if (!empty($changes))
1280
			$smcFunc['db_insert']('replace',
1281
				'{db_prefix}themes',
1282
				array('id_theme' => 'int', 'variable' => 'string-255', 'value' => 'string-65534', 'id_member' => 'int'),
1283
				$changes,
1284
				array('id_theme', 'variable', 'id_member')
1285
			);
1286
		if (!empty($deletes))
1287
			$smcFunc['db_query']('','
1288
				DELETE FROM {db_prefix}themes

Sources/Themes.php 2 locations

@@ 223-231 (lines=9) @@
220
			cache_put_data('theme_settings-' . $id, null, 90);
221
		}
222
223
		if (!empty($setValues))
224
		{
225
			$smcFunc['db_insert']('replace',
226
				'{db_prefix}themes',
227
				array('id_theme' => 'int', 'id_member' => 'int', 'variable' => 'string-255', 'value' => 'string-65534'),
228
				$setValues,
229
				array('id_theme', 'variable', 'id_member')
230
			);
231
		}
232
233
		redirectexit('action=admin;area=theme;sa=list;' . $context['session_var'] . '=' . $context['session_id']);
234
	}
@@ 739-747 (lines=9) @@
736
		foreach ($_POST['default_options'] as $opt => $val)
737
			$inserts[] = array(0, 1, $opt, is_array($val) ? implode(',', $val) : $val);
738
		// If we're actually inserting something..
739
		if (!empty($inserts))
740
		{
741
			$smcFunc['db_insert']('replace',
742
				'{db_prefix}themes',
743
				array('id_member' => 'int', 'id_theme' => 'int', 'variable' => 'string-255', 'value' => 'string-65534'),
744
				$inserts,
745
				array('id_member', 'id_theme', 'variable')
746
			);
747
		}
748
749
		cache_put_data('theme_settings-' . $_GET['th'], null, 90);
750
		cache_put_data('theme_settings-1', null, 90);

other/upgrade.php 1 location

@@ 1670-1678 (lines=9) @@
1667
1668
		$themeData[] = array(0, 1, $variable, $value);
1669
	}
1670
	if (!empty($themeData))
1671
	{
1672
		$smcFunc['db_insert']('ignore',
1673
			$db_prefix . 'themes',
1674
			array('id_member' => 'int', 'id_theme' => 'int', 'variable' => 'string', 'value' => 'string'),
1675
			$themeData,
1676
			array('id_member', 'id_theme', 'variable')
1677
		);
1678
	}
1679
}
1680
1681
// This function only works with MySQL but that's fine as it is only used for v1.0.