Code Duplication    Length = 19-19 lines in 2 locations

Sources/Subs-Db-mysql.php 1 location

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

Sources/Subs-Db-postgresql.php 1 location

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