Code Duplication    Length = 19-19 lines in 2 locations

Sources/Subs-Db-postgresql.php 1 location

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

Sources/Subs-Db-mysql.php 1 location

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