Code Duplication    Length = 19-19 lines in 2 locations

Sources/Subs-Db-postgresql.php 1 location

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

Sources/Subs-Db-mysql.php 1 location

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