Removes need for old sql functions in log api
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
require_once "api.php";
|
||||
if (array_key_exists("data", $_GET)){ // Gets the log
|
||||
if ($PRIVILEGE["viewLog"]) {
|
||||
echo json_encode(dbRequest("*", "log", "", "", 2));
|
||||
echo json_encode(dbRequest2("SELECT * FROM log"));
|
||||
} else {
|
||||
missingPrivilege($USERNAME);
|
||||
}
|
||||
@@ -26,13 +26,8 @@ if (array_key_exists("data", $_GET)){ // Gets the log
|
||||
}
|
||||
} elseif (array_key_exists("remove", $_POST) and array_key_exists("time", $_POST) and array_key_exists("message", $_POST)) { // To delete an entry in log
|
||||
if ($PRIVILEGE["deleteLog"]) {
|
||||
$possibleDelete = dbRequest("message", "log", "time", $_POST["time"], 0);
|
||||
if (array_search($OGPOST["message"], $possibleDelete) !== NULL and array_search($OGPOST["message"], $possibleDelete) !== false) {
|
||||
dbRemove("log", ["message", "time"], [$OGPOST["message"], $_POST["time"]], 0);
|
||||
} else {
|
||||
http_response_code(404);
|
||||
echo "Log entry does not exist";
|
||||
}
|
||||
$time = $_POST["time"];
|
||||
dbCommand("DELETE FROM log WHERE time = $time and message=?", [$OGPOST["message"]]);
|
||||
} else {
|
||||
missingPrivilege($USERNAME);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user