|
24 | 24 |
|
25 | 25 | chdir('../../'); |
26 | 26 | include_once('./include/auth.php'); |
| 27 | +require_once(__DIR__ . '/audit_helpers.php'); |
27 | 28 |
|
28 | 29 | set_default_action(); |
29 | 30 |
|
|
98 | 99 | } |
99 | 100 |
|
100 | 101 | if (is_array($content)) { |
101 | | - $output .= '<td style="font-weight:bold;white-space:nowrap;">' . $field . '</td><td">' . implode(',', $content) . '</td>'; |
| 102 | + $output .= '<td style="font-weight:bold;white-space:nowrap;">' . audit_html_escape($field) . '</td><td>' . audit_html_escape(implode(',', $content)) . '</td>'; |
102 | 103 | } else { |
103 | | - $output .= '<td style="font-weight:bold;white-space:nowrap;">' . $field . '</td><td>' . $content . '</td>'; |
| 104 | + $output .= '<td style="font-weight:bold;white-space:nowrap;">' . audit_html_escape($field) . '</td><td>' . audit_html_escape($content) . '</td>'; |
104 | 105 | } |
105 | 106 |
|
106 | 107 | $i++; |
|
119 | 120 | $output .= '<tr><td colspan="' . ($columns * 2) . '"><b>' . __('Record Data:', 'audit') . '</b></td></tr>'; |
120 | 121 |
|
121 | 122 | foreach ($recordData as $record) { |
122 | | - $output .= '<tr><td colspan="' . ($columns * 2) . '"><pre>' . json_encode($record, JSON_PRETTY_PRINT) . '</pre></td></tr>'; |
| 123 | + $output .= '<tr><td colspan="' . ($columns * 2) . '"><pre>' . audit_html_escape(json_encode($record, JSON_PRETTY_PRINT)) . '</pre></td></tr>'; |
123 | 124 | } |
124 | 125 | } else { |
125 | 126 | $output .= '</table>'; |
@@ -163,8 +164,9 @@ function audit_export_rows() { |
163 | 164 | $sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . ' page = ' . db_qstr(get_request_var('event_page')); |
164 | 165 | } |
165 | 166 |
|
166 | | - if (!isempty_request_var('user_id') && get_request_var('user_id') > '-1') { |
167 | | - $sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . ' user_id = ' . get_request_var('user_id'); |
| 167 | + $user_id = audit_normalize_int(get_request_var('user_id'), -1); |
| 168 | + if ($user_id > -1) { |
| 169 | + $sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . ' user_id = ' . $user_id; |
168 | 170 | } |
169 | 171 |
|
170 | 172 | $events = db_fetch_assoc("SELECT audit_log.*, user_auth.username |
@@ -357,8 +359,9 @@ function audit_log() { |
357 | 359 | $sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . ' page = ' . db_qstr(get_request_var('event_page')); |
358 | 360 | } |
359 | 361 |
|
360 | | - if (!isempty_request_var('user_id') && get_request_var('user_id') > '-1') { |
361 | | - $sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . ' user_id = ' . get_request_var('user_id'); |
| 362 | + $user_id = audit_normalize_int(get_request_var('user_id'), -1); |
| 363 | + if ($user_id > -1) { |
| 364 | + $sql_where .= ($sql_where != '' ? ' AND ':'WHERE ') . ' user_id = ' . $user_id; |
362 | 365 | } |
363 | 366 |
|
364 | 367 | $total_rows = db_fetch_cell("SELECT |
@@ -463,4 +466,3 @@ function audit_log() { |
463 | 466 | <script type='text/javascript' src='plugins/audit/js/functions.js'></script> |
464 | 467 | <?php |
465 | 468 | } |
466 | | - |
|
0 commit comments