Refactor entry handling: update date format, enhance entry retrieval, and improve HTML structure
This commit is contained in:
1 parent
ff2afb4441
commit
fd1b8d9a0b
7 files changed
+15
-7
No files matched your search
+1
-1
@@ -114,7 +114,7 @@ class gbAPI {
|
||||
$stmt->execute($stmtArgs);
|
||||
|
||||
if ($expectResult) {
|
||||
$result = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
$result = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ if ($html_allowed == "true") {
|
||||
$text = htmlspecialchars($input["text"]);
|
||||
}
|
||||
|
||||
$date = date("d.m.Y");
|
||||
$date = date("Y-m-d H:i:s");
|
||||
$approve = $api->getSetting("approve_entrys") == "true" ? true : false;
|
||||
|
||||
if ($approve) {
|
||||
|
||||
+5
-2
@@ -5,7 +5,7 @@ require "../api.php";
|
||||
$api = new gbAPI(false);
|
||||
|
||||
// Get Entrys
|
||||
$command = "SELECT * FROM entrys WHERE status = :status";
|
||||
$command = "SELECT * FROM entrys WHERE status = :status ORDER BY date DESC";
|
||||
$result = $api->dbCommand($command, true, true, [":status" => 1]);
|
||||
|
||||
$entrys = [];
|
||||
@@ -20,10 +20,13 @@ if (!$result) {
|
||||
foreach($result as $row) {
|
||||
$entry_name = $row["name"];
|
||||
$entry_text = $row["text"];
|
||||
$date = new DateTime($row["date"]);
|
||||
$entry_date = $date->format("d.m.Y H:i:s");
|
||||
|
||||
$entry = [
|
||||
"name" => $entry_name,
|
||||
"text" => $entry_text
|
||||
"text" => $entry_text,
|
||||
"date" => $entry_date
|
||||
];
|
||||
|
||||
$entrys[] = $entry;
|
||||
|
||||
@@ -9,5 +9,5 @@ $command = "SELECT name, value FROM settings WHERE name = :name";
|
||||
$result = $api->dbCommand($command, true, true, [":name" => "application_name"]);
|
||||
|
||||
$api->answer(200, [
|
||||
"application_name" => $result["value"]
|
||||
"application_name" => $result[0]["value"]
|
||||
]);
|
||||
Reference in new issue
Block a user