function getModel($tracking, $modelId) { $db = new AutotuneDb(); if (!$db->validTracking($tracking)) { // return error for invalid tracking return outputError("1005"); } // check if model id is valid if ($db->validModelId($modelId)) { return singleModelOutput($tracking, $modelId); } else { // return error for invalid model id return outputError("1010"); } }
Contents = all models named as "tuned_[modelId].idf" If modelId and models are both included, models will be used by default and modelId will be ignored. If models contains an invalid model, all models for the tracking will be provided instead. */ require 'dbAccess.php'; $db = new AutotuneDb(); if (isset($_REQUEST['tracking'])) { $tracking = $_REQUEST['tracking']; //check if tracking is valid if ($db->validTracking($tracking)) { // download a single model if (isset($_REQUEST['modelId']) && !isset($_REQUEST['models'])) { $modelId = $_REQUEST['modelId']; //check if model id is valid if ($db->validModelId($modelId)) { $fileName = "tuned_{$modelId}.idf"; $dir = "filesFolder"; file_put_contents("{$dir}/{$fileName}", $db->getFile($modelId)); $db->downloadFile("{$dir}/{$fileName}"); unlink("{$dir}/{$fileName}"); } } else { $zipName = $tracking . ".zip"; $zip = new zipArchive(); if ($zip->open($zipName, ZIPARCHIVE::CREATE)) { $validModels = true; if (isset($_REQUEST['models'])) { $modelIds = $_REQUEST['models']; //validate foreach ($modelIds as $modelId) {