Skip to content

Commit

Permalink
s9y#844 Simplify code removing If statement because we escape term se…
Browse files Browse the repository at this point in the history
…arch anyway + change alias to mysqli_real_escape_string
  • Loading branch information
GuillaumeValadas committed Jul 17, 2024
1 parent 1c60209 commit f625eaf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion include/db/mysqli.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function serendipity_db_matched_rows() {
*/
function serendipity_db_escape_string($string) {
global $serendipity;
return mysqli_escape_string($serendipity['dbConn'], $string);
return mysqli_real_escape_string($serendipity['dbConn'], $string);
}

/**
Expand Down
8 changes: 2 additions & 6 deletions include/functions_entries.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -882,12 +882,8 @@ function &serendipity_searchEntries($term, $limit = '', $searchresults = '') {
$cond['distinct'] = '';
$term = str_replace('"', '"', $term);
$relevance_enabled = true;
if (preg_match('@["\+\-\*~<>\(\)]+@', $term)) {
$term = serendipity_db_escape_string($term);
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('\"$term\"' IN BOOLEAN MODE)";
} else {
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('$term')";
}
$term = serendipity_db_escape_string($term);
$cond['find_part'] = "MATCH(title,body,extended) AGAINST('\"$term\"' IN BOOLEAN MODE)";
}

switch($serendipity['searchsort']) {
Expand Down

0 comments on commit f625eaf

Please sign in to comment.