From ef03f8188cbd162a1a2cb52e51c88d51128fd25e Mon Sep 17 00:00:00 2001
From: Andrew Dolgov <noreply@fakecake.org>
Date: Mon, 8 Mar 2021 13:45:15 +0300
Subject: [PATCH] api: add support for setting score (bump api level to 16)

---
 classes/api.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/classes/api.php b/classes/api.php
index 0cac0bb90..a1ed7968c 100755
--- a/classes/api.php
+++ b/classes/api.php
@@ -1,7 +1,7 @@
 <?php
 class API extends Handler {
 
-	const API_LEVEL  = 15;
+	const API_LEVEL  = 16;
 
 	const STATUS_OK  = 0;
 	const STATUS_ERR = 1;
@@ -258,6 +258,10 @@ class API extends Handler {
 				break;
 			case 3:
 				$field = "note";
+				break;
+			case 4:
+				$field = "score";
+				break;
 		};
 
 		switch ($mode) {
@@ -273,6 +277,7 @@ class API extends Handler {
 		}
 
 		if ($field == "note") $set_to = $this->pdo->quote($data);
+		if ($field == "score") $set_to = (int) $data;
 
 		if ($field && $set_to && count($article_ids) > 0) {
 
-- 
GitLab