Code Duplication    Length = 19-19 lines in 2 locations

Sources/Subs-Db-postgresql.php 1 location

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

Sources/Subs-Db-mysql.php 1 location

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