diff --git a/README.md b/README.md index 0afbaee..9cef2b2 100644 --- a/README.md +++ b/README.md @@ -9,4 +9,6 @@ The newest generation imageboard. - `sudo rm -r /usr/share/nginx/html/testing/E949 && sudo cp -R . /usr/share/nginx/html/testing/E949/ && sudo chown -R http:http /usr/share/nginx/html/testing` +- `mysql -u e949 -p` + - `#049e59` -> `#094e59` \ No newline at end of file diff --git a/TODO.md b/TODO.md index 742785b..ca0f828 100644 --- a/TODO.md +++ b/TODO.md @@ -39,6 +39,7 @@ - Может банить кого угодно - Может удалять чьи угодно аккаунты - Может редактировать чужие посты + - Может управлять одобренными тегами - Аватарки - Бан - Полное удаление diff --git a/api/post/create.php b/api/post/create.php new file mode 100644 index 0000000..dfbb1b9 --- /dev/null +++ b/api/post/create.php @@ -0,0 +1,36 @@ +prepare("INSERT ..."); + // $s->bind_param("s", $author); + // $s->execute(); + // $d = $s->get_result()->fetch_assoc(); + // + // if (!(bool)$d) { + // return null; + // } + + return $result; +} + + + +if (ThisFileIsRequested(__FILE__)) { + require_once("../_json.php"); + + // Check if there are necessary input + if (!(isset($_POST["tags"]) && isset($_FILES["pic"]))) + ReturnJSONError($Err_RDP_InvalidArgs, "not enough arguments"); + + // TODO +} + +?> \ No newline at end of file diff --git a/api/post/index.php b/api/post/index.php index e882142..22cfde8 100644 --- a/api/post/index.php +++ b/api/post/index.php @@ -5,6 +5,21 @@ require_once("../_utils.php"); +// Increment number of views for post +function Post_AddView ($id) { + global $db; + + $s = $db->prepare("UPDATE posts SET views = views + 1 WHERE id = ?"); + $s->bind_param("s", $id); + $s->execute(); + $d = $s->get_result()->fetch_assoc(); + + if (!(bool)$d) { + require_once("../_json.php"); + ReturnJSONError($Err_Int_Unexpected, "failed to increment number of views"); + } +} + // Get single publication by ID function Post_GetByID ($id) { global $db; @@ -34,7 +49,7 @@ function Post_GetByID ($id) { $result["preview_path"] = $d["preview_path"]; $result["edit_lock"] = $d["edit_lock"]; - // TODO: increment views of post + Post_AddView($id); return $result; } diff --git a/api/user/delete.php b/api/user/delete.php index 105dd61..d57d84c 100644 --- a/api/user/delete.php +++ b/api/user/delete.php @@ -1,4 +1,5 @@