Code Duplication    Length = 19-19 lines in 2 locations

Sources/Subs-Db-mysql.php 1 location

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

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.