Skip to content

Commit

Permalink
Update Subs-Db-postgresql.php
Browse files Browse the repository at this point in the history
- any modification or future SMF update that includes additions/changes for where clauses contained within the $user_info array (using the query_ prefix) will be included using this method.

Signed-off-by: Underdog-01 <[email protected]>
  • Loading branch information
Underdog-01 authored May 25, 2017
1 parent 1b527f1 commit 2242125
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions Sources/Subs-Db-postgresql.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ function db_fix_prefix(&$db_prefix, $db_name)

/**
* Callback for preg_replace_callback on the query.
* It allows to replace on the fly a few pre-defined strings, for convenience ('query_see_board', 'query_wanna_see_board'), with
* It allows to replace on the fly a few pre-defined strings, for convenience ('query_see_board', 'query_wanna_see_board', etc), with
* their current values from $user_info.
* In addition, it performs checks and sanitization on the values sent to the database.
*
Expand All @@ -128,11 +128,9 @@ function smf_db_replacement__callback($matches)
if ($matches[1] === 'db_prefix')
return $db_prefix;

if ($matches[1] === 'query_see_board')
return $user_info['query_see_board'];

if ($matches[1] === 'query_wanna_see_board')
return $user_info['query_wanna_see_board'];
foreach (array_keys($user_info) as $key)
if (strpos($key, 'query_') !== false && $key === $matches[1])
return $user_info[$matches[1]];

if ($matches[1] === 'empty')
return '\'\'';
Expand Down Expand Up @@ -930,4 +928,4 @@ function smf_db_escape_wildcard_string($string, $translate_human_wildcards = fal
return strtr($string, $replacements);
}

?>
?>

0 comments on commit 2242125

Please sign in to comment.