1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/10899] Using Delete All in log viewer with keyword search

https://tracker.phpbb.com/browse/PHPBB3-10899

PHPBB3-10899
This commit is contained in:
Tristan Darricau
2014-05-10 16:58:11 +02:00
parent d4fc060bcd
commit c5a4ad3d31
3 changed files with 23 additions and 8 deletions

View File

@@ -636,11 +636,12 @@ class log implements \phpbb\log\log_interface
/**
* Generates a sql condition for the specified keywords
*
* @param string $keywords The keywords the user specified to search for
* @param string $keywords The keywords the user specified to search for
* @param string $table_alias The alias of the logs' table ('l.' by default)
*
* @return string Returns the SQL condition searching for the keywords
*/
protected function generate_sql_keyword($keywords)
public function generate_sql_keyword($keywords, $table_alias = 'l.')
{
// Use no preg_quote for $keywords because this would lead to sole
// backslashes being added. We also use an OR connection here for
@@ -688,9 +689,9 @@ class log implements \phpbb\log\log_interface
$sql_keywords = 'AND (';
if (!empty($operations))
{
$sql_keywords .= $this->db->sql_in_set('l.log_operation', $operations) . ' OR ';
$sql_keywords .= $this->db->sql_in_set($table_alias . 'log_operation', $operations) . ' OR ';
}
$sql_lower = $this->db->sql_lower_text('l.log_data');
$sql_lower = $this->db->sql_lower_text($table_alias . 'log_data');
$sql_keywords .= " $sql_lower " . implode(" OR $sql_lower ", $keywords) . ')';
}