From 8b09e653e0ae242f4c6590accc311da40b690c32 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 24 Feb 2021 12:10:09 +0300 Subject: [PATCH] pass array to setScore --- classes/article.php | 2 +- js/Headlines.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/article.php b/classes/article.php index 4bf563c4b..f77275122 100755 --- a/classes/article.php +++ b/classes/article.php @@ -169,7 +169,7 @@ class Article extends Handler_Protected { } function setScore() { - $ids = explode(",", clean($_REQUEST['id'])); + $ids = array_map("intval", clean($_REQUEST['ids'] ?? [])); $score = (int)clean($_REQUEST['score']); $ids_qmarks = arr_qmarks($ids); diff --git a/js/Headlines.js b/js/Headlines.js index 8baf93671..d44866d94 100755 --- a/js/Headlines.js +++ b/js/Headlines.js @@ -169,7 +169,7 @@ const Headlines = { if (scores.length != 0) { scores.forEach((score) => { promises.push(xhr.post("backend.php", - {op: "article", method: "setScore", id: ops.rescore[score].toString(), score: score})); + {op: "article", method: "setScore", "ids[]": ops.rescore[score].toString(), score: score})); }); }