pass array to setScore

master
Andrew Dolgov 4 years ago
parent 155e4f6125
commit 8b09e653e0

@ -169,7 +169,7 @@ class Article extends Handler_Protected {
} }
function setScore() { function setScore() {
$ids = explode(",", clean($_REQUEST['id'])); $ids = array_map("intval", clean($_REQUEST['ids'] ?? []));
$score = (int)clean($_REQUEST['score']); $score = (int)clean($_REQUEST['score']);
$ids_qmarks = arr_qmarks($ids); $ids_qmarks = arr_qmarks($ids);

@ -169,7 +169,7 @@ const Headlines = {
if (scores.length != 0) { if (scores.length != 0) {
scores.forEach((score) => { scores.forEach((score) => {
promises.push(xhr.post("backend.php", 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}));
}); });
} }

Loading…
Cancel
Save