You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: convert remaining db_execute to prepared statements in notify_lists.php
Convert all template and thold_data association/disassociation queries
from raw string concatenation with $selected_items[$i] to
db_execute_prepared with bound parameters.
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Copy file name to clipboardExpand all lines: notify_lists.php
+17-54Lines changed: 17 additions & 54 deletions
Original file line number
Diff line number
Diff line change
@@ -394,42 +394,29 @@ function form_actions() {
394
394
// clear other settings
395
395
if (get_request_var('notification_warning_action') == 1) {
396
396
// set the notification list
397
-
db_execute('UPDATE thold_template
398
-
SET notify_warning=' . get_request_var('id') . '
399
-
WHERE id=' . $selected_items[$i]);
397
+
db_execute_prepared('UPDATE thold_template SET notify_warning=? WHERE id=?', [intval(get_request_var('id')), intval($selected_items[$i])]);
400
398
401
399
// clear other items
402
-
db_execute("UPDATE thold_template
403
-
SET notify_warning_extra=''
404
-
WHERE id=" . $selected_items[$i]);
400
+
db_execute_prepared("UPDATE thold_template SET notify_warning_extra='' WHERE id=?", [intval($selected_items[$i])]);
405
401
} else {
406
402
// set the notification list
407
-
db_execute('UPDATE thold_template
408
-
SET notify_warning=' . get_request_var('id') . '
409
-
WHERE id=' . $selected_items[$i]);
403
+
db_execute_prepared('UPDATE thold_template SET notify_warning=? WHERE id=?', [intval(get_request_var('id')), intval($selected_items[$i])]);
410
404
}
411
405
}
412
406
413
407
if (get_request_var('notification_alert_action') > 0) {
414
408
// clear other settings
415
409
if (get_request_var('notification_alert_action') == 1) {
416
410
// set the notification list
417
-
db_execute('UPDATE thold_template
418
-
SET notify_alert=' . get_request_var('id') . '
419
-
WHERE id=' . $selected_items[$i]);
411
+
db_execute_prepared('UPDATE thold_template SET notify_alert=? WHERE id=?', [intval(get_request_var('id')), intval($selected_items[$i])]);
420
412
421
413
// clear other items
422
-
db_execute("UPDATE thold_template
423
-
SET notify_extra=''
424
-
WHERE id=" . $selected_items[$i]);
414
+
db_execute_prepared("UPDATE thold_template SET notify_extra='' WHERE id=?", [intval($selected_items[$i])]);
425
415
426
-
db_execute('DELETE FROM plugin_thold_template_contact
427
-
WHERE template_id=' . $selected_items[$i]);
416
+
db_execute_prepared('DELETE FROM plugin_thold_template_contact WHERE template_id=?', [intval($selected_items[$i])]);
428
417
} else {
429
418
// set the notification list
430
-
db_execute('UPDATE thold_template
431
-
SET notify_alert=' . get_request_var('id') . '
432
-
WHERE id=' . $selected_items[$i]);
419
+
db_execute_prepared('UPDATE thold_template SET notify_alert=? WHERE id=?', [intval(get_request_var('id')), intval($selected_items[$i])]);
433
420
}
434
421
}
435
422
@@ -439,18 +426,12 @@ function form_actions() {
439
426
for ($i = 0; ($i < count($selected_items)); $i++) {
440
427
if (get_request_var('notification_warning_action') > 0) {
441
428
// set the notification list
442
-
db_execute('UPDATE thold_template
443
-
SET notify_warning=0
444
-
WHERE id=' . $selected_items[$i] . '
445
-
AND notify_warning=' . get_request_var('id'));
429
+
db_execute_prepared('UPDATE thold_template SET notify_warning=0 WHERE id=? AND notify_warning=?', [intval($selected_items[$i]), intval(get_request_var('id'))]);
446
430
}
447
431
448
432
if (get_request_var('notification_alert_action') > 0) {
449
433
// set the notification list
450
-
db_execute('UPDATE thold_template
451
-
SET notify_alert=0
452
-
WHERE id=' . $selected_items[$i] . '
453
-
AND notify_alert=' . get_request_var('id'));
434
+
db_execute_prepared('UPDATE thold_template SET notify_alert=0 WHERE id=? AND notify_alert=?', [intval($selected_items[$i]), intval(get_request_var('id'))]);
for ($i = 0; ($i < count($selected_items)); $i++) {
515
484
if (get_request_var('notification_warning_action') > 0) {
516
485
// set the notification list
517
-
db_execute('UPDATE thold_data
518
-
SET notify_warning=0
519
-
WHERE id=' . $selected_items[$i] . '
520
-
AND notify_warning=' . get_request_var('id'));
486
+
db_execute_prepared('UPDATE thold_data SET notify_warning=0 WHERE id=? AND notify_warning=?', [intval($selected_items[$i]), intval(get_request_var('id'))]);
521
487
}
522
488
523
489
if (get_request_var('notification_alert_action') > 0) {
524
490
// set the notification list
525
-
db_execute('UPDATE thold_data
526
-
SET notify_alert=0
527
-
WHERE id=' . $selected_items[$i] . '
528
-
AND notify_alert=' . get_request_var('id'));
491
+
db_execute_prepared('UPDATE thold_data SET notify_alert=0 WHERE id=? AND notify_alert=?', [intval($selected_items[$i]), intval(get_request_var('id'))]);
0 commit comments