[]]); } exit; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_GET['action']) && $_GET['action'] === 'save') { ensureDirectory($jsonFile); $input = file_get_contents('php://input'); $data = json_decode($input, true); if (json_last_error() === JSON_ERROR_NONE) { file_put_contents($jsonFile, json_encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); echo json_encode(['success' => true]); } else { http_response_code(400); echo json_encode(['success' => false, 'error' => 'Hibás JSON formátum']); } exit; } if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_GET['action']) && $_GET['action'] === 'complete') { $input = file_get_contents('php://input'); $data = json_decode($input, true); if (json_last_error() !== JSON_ERROR_NONE || !isset($data['index'])) { http_response_code(400); echo json_encode(['success' => false, 'error' => 'Hibás JSON formátum']); exit; } $index = (int)$data['index']; // Devplan betöltése ensureDirectory($jsonFile); $devplanData = ['plans' => []]; if (file_exists($jsonFile)) { $content = file_get_contents($jsonFile); $devplanData = json_decode($content, true); if (!is_array($devplanData) || !isset($devplanData['plans'])) { $devplanData = ['plans' => []]; } } if (!isset($devplanData['plans'][$index])) { http_response_code(400); echo json_encode(['success' => false, 'error' => 'Érvénytelen index']); exit; } $planName = $devplanData['plans'][$index]; // Version.json betöltése $versionFile = __DIR__ . '/../managers/version.json'; $versionData = ['updates' => []]; if (file_exists($versionFile)) { $versionContent = file_get_contents($versionFile); $versionData = json_decode($versionContent, true); if (!is_array($versionData) || !isset($versionData['updates'])) { $versionData = ['updates' => []]; } } // Legutóbbi build szám használata if (empty($versionData['updates'])) { http_response_code(400); echo json_encode(['success' => false, 'error' => 'Nincs meglévő build szám']); exit; } $build = $versionData['updates'][0]['build']; // Changelog bejegyzés hozzáadása a legutóbbi buildhez if (!in_array($planName, $versionData['updates'][0]['changes'], true)) { array_unshift($versionData['updates'][0]['changes'], $planName); } // Version.json mentése file_put_contents($versionFile, json_encode($versionData, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT)); // Terv törlése a devplan.json-ból array_splice($devplanData['plans'], $index, 1); file_put_contents($jsonFile, json_encode($devplanData, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE)); echo json_encode(['success' => true, 'build' => $build]); exit; } http_response_code(400); echo json_encode(['success' => false, 'error' => 'Hibás kérés']); exit; } else { $CanEdit = false; $localIP = trim(shell_exec('hostname -I | cut -d" " -f1')); if (UserHasPerm("god_profile") && $userID == 1 && $localIP == '192.168.15.10') { $CanEdit = true; } } ?> Fejlesztési Tervek

Fejlesztési Tervek