Refactor API and database interactions: enhance token management, improve entry handling, and add application name retrieval
This commit is contained in:
1 parent
9316818753
commit
1a2ee0c176
10 files changed
+79
-19
No files matched your search
+30
-1
@@ -20,4 +20,33 @@ if (!isset($input["name"]) || !isset($input["text"])) {
|
||||
]);
|
||||
}
|
||||
|
||||
$api->getSetting("");
|
||||
$html_allowed = $api->getSetting("allow_html");
|
||||
|
||||
if ($html_allowed == "true") {
|
||||
$name = $input["name"];
|
||||
$text = $input["text"];
|
||||
}else{
|
||||
$name = htmlspecialchars($input["name"]);
|
||||
$text = htmlspecialchars($input["text"]);
|
||||
}
|
||||
|
||||
$date = date("d.m.Y");
|
||||
$approve = $api->getSetting("approve_entrys") == "true" ? true : false;
|
||||
|
||||
if ($approve) {
|
||||
$status = 0;
|
||||
}else{
|
||||
$status = 1;
|
||||
}
|
||||
|
||||
|
||||
// Insert Into Database
|
||||
$command = "INSERT INTO entrys (name, text, date, status) VALUES (:name, :text, :date, :status)";
|
||||
$api->dbCommand($command, false, true, [
|
||||
":name" => $name,
|
||||
":text" => $text,
|
||||
":date" => $date,
|
||||
":status" => $status
|
||||
]);
|
||||
|
||||
$api->answer(200);
|
||||
Reference in new issue
Block a user