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
	}
@@ 734-742 (lines=9) @@
731
		foreach ($_POST['default_options'] as $opt => $val)
732
			$inserts[] = array(0, 1, $opt, is_array($val) ? implode(',', $val) : $val);
733
		// If we're actually inserting something..
734
		if (!empty($inserts))
735
		{
736
			$smcFunc['db_insert']('replace',
737
				'{db_prefix}themes',
738
				array('id_member' => 'int', 'id_theme' => 'int', 'variable' => 'string-255', 'value' => 'string-65534'),
739
				$inserts,
740
				array('id_member', 'id_theme', 'variable')
741
			);
742
		}
743
744
		cache_put_data('theme_settings-' . $_GET['th'], null, 90);
745
		cache_put_data('theme_settings-1', null, 90);

other/upgrade.php 1 location

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