[FIX] [BUG] Impossible d'ajouter un morceau #4
This commit is contained in:
@@ -289,16 +289,17 @@ if ($path === 'admin/scores' && $method === 'POST') {
|
||||
if (empty($id)) {
|
||||
$scores = $scanner->listScores();
|
||||
$maxId = 0;
|
||||
foreach ($scores as $s) {
|
||||
$num = intval($s['id']);
|
||||
if ($num > $maxId) $maxId = $maxId;
|
||||
}
|
||||
// Find highest numeric ID
|
||||
foreach ($scores as $s) {
|
||||
$num = intval($s['id']);
|
||||
if ($num > $maxId) $maxId = $num;
|
||||
}
|
||||
|
||||
// Skip existing IDs
|
||||
$scoresPath = getenv('SCORES_PATH') ?: __DIR__ . '/../legacy/Scores/';
|
||||
$id = strval($maxId + 1);
|
||||
while (is_dir($scoresPath . $id)) {
|
||||
$id = strval(intval($id) + 1);
|
||||
}
|
||||
// Pad with zeros to 3 digits if needed
|
||||
if (strlen($id) < 3) {
|
||||
$id = str_pad($id, 3, '0', STR_PAD_LEFT);
|
||||
|
||||
Reference in New Issue
Block a user