Code Duplication    Length = 19-19 lines in 2 locations

Sources/Subs-Db-postgresql.php 1 location

@@ 268-286 (lines=19) @@
265
 * @param resource $connection = null The connection to use (null to use $db_connection)
266
 * @return string The string with the values inserted
267
 */
268
function smf_db_quote($db_string, $db_values, $connection = null)
269
{
270
	global $db_callback, $db_connection;
271
272
	// Only bother if there's something to replace.
273
	if (strpos($db_string, '{') !== false)
274
	{
275
		// This is needed by the callback function.
276
		$db_callback = array($db_values, $connection === null ? $db_connection : $connection);
277
278
		// Do the quoting and escaping
279
		$db_string = preg_replace_callback('~{([a-z_]+)(?::([a-zA-Z0-9_-]+))?}~', 'smf_db_replacement__callback', $db_string);
280
281
		// Clear this global variable.
282
		$db_callback = array();
283
	}
284
285
	return $db_string;
286
}
287
288
/**
289
 * Do a query.  Takes care of errors too.

Sources/Subs-Db-mysql.php 1 location

@@ 314-332 (lines=19) @@
311
 * @param resource $connection = null The connection to use (null to use $db_connection)
312
 * @return string The string with the values inserted
313
 */
314
function smf_db_quote($db_string, $db_values, $connection = null)
315
{
316
	global $db_callback, $db_connection;
317
318
	// Only bother if there's something to replace.
319
	if (strpos($db_string, '{') !== false)
320
	{
321
		// This is needed by the callback function.
322
		$db_callback = array($db_values, $connection === null ? $db_connection : $connection);
323
324
		// Do the quoting and escaping
325
		$db_string = preg_replace_callback('~{([a-z_]+)(?::([a-zA-Z0-9_-]+))?}~', 'smf_db_replacement__callback', $db_string);
326
327
		// Clear this global variable.
328
		$db_callback = array();
329
	}
330
331
	return $db_string;
332
}
333
334
/**
335
 * Do a query.  Takes care of errors too.