Code Duplication    Length = 19-19 lines in 2 locations

Sources/Subs-Db-mysql.php 1 location

@@ 326-344 (lines=19) @@
323
 * @param resource $connection = null The connection to use (null to use $db_connection)
324
 * @return string The string with the values inserted
325
 */
326
function smf_db_quote($db_string, $db_values, $connection = null)
327
{
328
	global $db_callback, $db_connection;
329
330
	// Only bother if there's something to replace.
331
	if (strpos($db_string, '{') !== false)
332
	{
333
		// This is needed by the callback function.
334
		$db_callback = array($db_values, $connection === null ? $db_connection : $connection);
335
336
		// Do the quoting and escaping
337
		$db_string = preg_replace_callback('~{([a-z_]+)(?::([a-zA-Z0-9_-]+))?}~', 'smf_db_replacement__callback', $db_string);
338
339
		// Clear this global variable.
340
		$db_callback = array();
341
	}
342
343
	return $db_string;
344
}
345
346
/**
347
 * Do a query.  Takes care of errors too.

Sources/Subs-Db-postgresql.php 1 location

@@ 280-298 (lines=19) @@
277
 * @param resource $connection = null The connection to use (null to use $db_connection)
278
 * @return string The string with the values inserted
279
 */
280
function smf_db_quote($db_string, $db_values, $connection = null)
281
{
282
	global $db_callback, $db_connection;
283
284
	// Only bother if there's something to replace.
285
	if (strpos($db_string, '{') !== false)
286
	{
287
		// This is needed by the callback function.
288
		$db_callback = array($db_values, $connection === null ? $db_connection : $connection);
289
290
		// Do the quoting and escaping
291
		$db_string = preg_replace_callback('~{([a-z_]+)(?::([a-zA-Z0-9_-]+))?}~', 'smf_db_replacement__callback', $db_string);
292
293
		// Clear this global variable.
294
		$db_callback = array();
295
	}
296
297
	return $db_string;
298
}
299
300
/**
301
 * Do a query.  Takes care of errors too.