mirror of
https://github.com/ellite/Wallos.git
synced 2025-12-23 23:18:07 -05:00
feat: make container shutdown instant & graceful (#916) feat: add pushplus notification service (#911) feat: option to delete ai recommendations fix: parsing ai recommendations from gemini (#909)
52 lines
1.6 KiB
PHP
52 lines
1.6 KiB
PHP
<?php
|
|
require_once '../../includes/connect_endpoint.php';
|
|
|
|
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
|
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
|
$input = file_get_contents('php://input');
|
|
$data = json_decode($input, true);
|
|
|
|
$recommendationId = isset($data['id']) ? (int) $data['id'] : 0;
|
|
|
|
if ($recommendationId <= 0) {
|
|
$response = [
|
|
"success" => false,
|
|
"message" => translate('error', $i18n)
|
|
];
|
|
echo json_encode($response);
|
|
exit;
|
|
}
|
|
|
|
// Delete the recommendation for the user
|
|
$stmt = $db->prepare("DELETE FROM ai_recommendations WHERE id = ? AND user_id = ?");
|
|
$stmt->bindValue(1, $recommendationId, SQLITE3_INTEGER);
|
|
$stmt->bindValue(2, $userId, SQLITE3_INTEGER);
|
|
$result = $stmt->execute();
|
|
|
|
if ($db->changes() > 0) {
|
|
$response = [
|
|
"success" => true,
|
|
"message" => translate('success', $i18n)
|
|
];
|
|
} else {
|
|
$response = [
|
|
"success" => false,
|
|
"message" => translate('error', $i18n)
|
|
];
|
|
}
|
|
|
|
echo json_encode($response);
|
|
} else {
|
|
http_response_code(405);
|
|
echo json_encode([
|
|
"success" => false,
|
|
"message" => translate('invalid_request_method', $i18n)
|
|
]);
|
|
}
|
|
} else {
|
|
$response = [
|
|
"success" => false,
|
|
"message" => translate('session_expired', $i18n)
|
|
];
|
|
echo json_encode($response);
|
|
} |