$tracks = $dl->get_tracks($album); $app->render('redeem.twig', array('album' => $album, 'code' => $code, 'artist' => $albumInfo['artist'], 'album_title' => $albumInfo['title'], 'image_name' => $albumInfo['thumbnail'], 'tracks' => $tracks, 'email' => $app->getCookie('email'), 'remaining_dl' => $dl->remaining_downloads($code, $album))); } })->name('redeem'); /** * LEGACY REDIRECT **/ $app->get('/redeem/redeem.php?c=:code&p=:album', function ($album, $code) use($app) { $app->redirect('./redeem/' . $album . '/' . $code); }); /** * Album Download page **/ $app->get('/download/:album/:code', function ($album, $code) use($app, $dl) { $download = $dl->file_download($album, $code); $dl->use_code($code, $album); })->name('download'); // Custom 404 Page $app->notFound(function () use($app) { $app->render('notfound.twig'); }); // Temporary Admin Page $app->get('/webhook/', function () use($app) { $app->response->setStatus(200); }); // Temporary Admin Page $app->post('/webhook/', function () use($app, $dl) { $app->response->setStatus(200); $wh = json_decode($app->request->post('mandrill_events'), true); foreach ($wh as $event) { $sent_time = date("Y-m-d H:i:s", $event['msg']['ts']);