Actualiser api.php
This commit is contained in:
@@ -579,7 +579,21 @@ case 'get_config_keys':
|
||||
]);
|
||||
$imported++;
|
||||
}
|
||||
} else {
|
||||
} else {
|
||||
// CORRECTION : Initialisation des variables manquantes
|
||||
$stmtCritiques = $pdo->prepare("INSERT INTO critiques (id, title, year, director, poster, rating, review, streaming)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
ON DUPLICATE KEY UPDATE title=VALUES(title), year=VALUES(year), director=VALUES(director),
|
||||
poster=VALUES(poster), rating=VALUES(rating), review=VALUES(review), streaming=VALUES(streaming)");
|
||||
$tmdbApiKey = getTmdbApiKey($pdo);
|
||||
|
||||
foreach ($items as $rowData) {
|
||||
$title = $rowData['Title'] ?? $rowData['title'] ?? '';
|
||||
if (empty($title)) continue;
|
||||
|
||||
$year = $rowData['Year'] ?? $rowData['year'] ?? '';
|
||||
$id = makeStableId('critique', $title, $year);
|
||||
|
||||
$ratingRaw = $rowData['Rating'] ?? $rowData['rating'] ?? '';
|
||||
$rating = ($ratingRaw !== '' && $ratingRaw !== null) ? (float)$ratingRaw : null;
|
||||
$review = $rowData['Review'] ?? $rowData['review'] ?? '';
|
||||
@@ -598,8 +612,9 @@ case 'get_config_keys':
|
||||
if (empty($streaming)) $streaming = 'Support physique / Cinéma';
|
||||
|
||||
$stmtCritiques->execute([$id, $title, $year, $director, $poster, $rating, $review, $streaming]);
|
||||
}
|
||||
$imported++;
|
||||
}
|
||||
}
|
||||
$pdo->commit();
|
||||
echo json_encode(["success" => true, "imported" => $imported]);
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user