add todos

This commit is contained in:
Bruno Rybársky 2023-08-07 20:33:24 +02:00
parent 0e4ad244f4
commit c3cab73502
No known key found for this signature in database
GPG Key ID: DFE2C061EF985CD4

51
api.php

@ -1,4 +1,5 @@
<?php <?php
session_start(); session_start();
$mysqllogin = json_decode(file_get_contents("secrets/MysqlLogin.json"), false); $mysqllogin = json_decode(file_get_contents("secrets/MysqlLogin.json"), false);
@ -84,6 +85,10 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
} }
if($actionin == "getcurrentuser"){
//TODO Create this query
}
if($actionin == "getallusers"){ if($actionin == "getallusers"){
$stmt6 = $mysqliconn->prepare("SELECT ID, Username, Nickname, FullName, IsAdmin FROM Users;"); $stmt6 = $mysqliconn->prepare("SELECT ID, Username, Nickname, FullName, IsAdmin FROM Users;");
$stmt6->execute(); $stmt6->execute();
@ -133,32 +138,44 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
function processCitationRelated($actionin, mysqli $mysqliconn){ function processCitationRelated($actionin, mysqli $mysqliconn){
if($actionin == "getcitations"){ if($actionin == "getallcitations"){
//TODO Create this query
} }
if($actionin == "getrandomcitation"){ if($actionin == "getrandomcitation"){
//TODO Create this query
} }
if($actionin == "getcitationfulltextsearch"){ if($actionin == "getcitationsfulltextsearch"){
//TODO Create this query
} }
if($actionin == "getcitationsbyuser"){ if($actionin == "getcitationsbyuser"){
//TODO Create this query
}
if($actionin == "getcitationthreadbyid"){
//TODO Create this query
}
if($actionin == "getcitationversionbyid"){
//TODO Create this query
} }
if($actionin == "getcitationsbysource"){ if($actionin == "getcitationsbysource"){
//TODO Create this query
} }
if($actionin == "getcitationsbytags"){ if($actionin == "getcitationsbytags"){
//TODO Create this query
} }
if($actionin == "getcitationbyverse"){ if($actionin == "getcitationsbyverse"){
//TODO Create this query
}
if($actionin == "getcitationsuggestionsbyverse"){
//TODO Create this query
} }
return 0; return 0;
@ -230,6 +247,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
if($actionin == "getallsources"){ if($actionin == "getallsources"){
//TODO Use JOIN to embed the publication info
$stmt17 = $mysqliconn->prepare("SELECT ID, PublicationID, Place, CreatorID FROM Sources;"); $stmt17 = $mysqliconn->prepare("SELECT ID, PublicationID, Place, CreatorID FROM Sources;");
$stmt17->execute(); $stmt17->execute();
$stmt17->bind_result($id, $publicationid, $place, $creatorid); $stmt17->bind_result($id, $publicationid, $place, $creatorid);
@ -248,6 +266,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
if($actionin == "getallsourcesbycreator"){ if($actionin == "getallsourcesbycreator"){
//TODO Use JOIN to embed the publication info
$stmt13 = $mysqliconn->prepare("SELECT ID, PublicationID, Place, CreatorID FROM Sources WHERE CreatorID = ?;"); $stmt13 = $mysqliconn->prepare("SELECT ID, PublicationID, Place, CreatorID FROM Sources WHERE CreatorID = ?;");
$cruid = intval($_POST['creatorid']); $cruid = intval($_POST['creatorid']);
$stmt13->bind_param("i", $cruid); $stmt13->bind_param("i", $cruid);
@ -284,6 +303,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
if($actionin == "getallcommentsbycreator"){ if($actionin == "getallcommentsbycreator"){
//TODO Use JOIN to embed the citation info
$stmt15 = $mysqliconn->prepare("SELECT ID, CreatorID, CitationID, CitationThreadID, Content FROM Comments WHERE CreatorID = ?;"); $stmt15 = $mysqliconn->prepare("SELECT ID, CreatorID, CitationID, CitationThreadID, Content FROM Comments WHERE CreatorID = ?;");
$cruid = intval($_POST['creatorid']); $cruid = intval($_POST['creatorid']);
$stmt15->bind_param("i", $cruid); $stmt15->bind_param("i", $cruid);
@ -303,17 +323,20 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
} }
return json_encode($outarr); return json_encode($outarr);
} }
//TODO Also send user info with ID
if($actionin == "getcommentsbycitationlatestversion"){ if($actionin == "getcommentsbycitationlatestversion"){
//TODO Create this query
//TODO Use JOIN to embed the citation info
} }
if($actionin == "getcommentsbycitationbyversion"){ if($actionin == "getcommentsbycitationbyversion"){
//TODO Create this query
//TODO Use JOIN to embed the citation info
} }
if($actionin == "getcommentsbycitationallversions"){ if($actionin == "getcommentsbycitationallversions"){
//TODO Create this query
//TODO Use JOIN to embed the citation info
} }
return 0; return 0;