Guest User

Untitled

a guest
May 18th, 2012
65
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. acp_logs.php, mcp_logs.php:
  2.  
  3. FIND
  4.  
  5. $sql = 'DELETE FROM ' . LOG_TABLE . "
  6. WHERE log_type = {$this->log_type}
  7. $where_sql";
  8. $db->sql_query($sql);
  9.  
  10. REPLACE WITH
  11.  
  12. $keywords = utf8_normalize_nfc(request_var('keywords', '', true));
  13.  
  14. // Use no preg_quote for $keywords because this would lead to sole backslashes being added
  15. // We also use an OR connection here for spaces and the | string. Currently, regex is not supported for searching (but may come later).
  16. $keywords = preg_split('#[\s|]+#u', utf8_strtolower($keywords), 0, PREG_SPLIT_NO_EMPTY);
  17. $sql_keywords = '';
  18.  
  19. if ($deleteall && !empty($keywords))
  20. {
  21. $keywords_pattern = array();
  22.  
  23. // Build pattern and keywords...
  24. for ($i = 0, $num_keywords = sizeof($keywords); $i < $num_keywords; $i++)
  25. {
  26. $keywords_pattern[] = preg_quote($keywords[$i], '#');
  27. $keywords[$i] = $db->sql_like_expression($db->any_char . $keywords[$i] . $db->any_char);
  28. }
  29.  
  30. $keywords_pattern = '#' . implode('|', $keywords_pattern) . '#ui';
  31.  
  32. $operations = array();
  33. foreach ($user->lang as $key => $value)
  34. {
  35. if (substr($key, 0, 4) == 'LOG_' && preg_match($keywords_pattern, $value))
  36. {
  37. $operations[] = $key;
  38. }
  39. }
  40.  
  41. $sql_keywords = ' AND (';
  42. if (!empty($operations))
  43. {
  44. $sql_keywords .= $db->sql_in_set('log_operation', $operations) . ' OR ';
  45. }
  46. $sql_keywords .= 'LOWER(log_data) ' . implode(' OR LOWER(log_data) ', $keywords) . ')';
  47. }
  48.  
  49. $sql = 'DELETE FROM ' . LOG_TABLE . "
  50. WHERE log_type = {$this->log_type}
  51. $where_sql
  52. $sql_keywords";
  53. $db->sql_query($sql);
RAW Paste Data