diff options
Diffstat (limited to 'frontend/pages/builds/download.php')
-rw-r--r-- | frontend/pages/builds/download.php | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/frontend/pages/builds/download.php b/frontend/pages/builds/download.php index c40606d..411efbf 100644 --- a/frontend/pages/builds/download.php +++ b/frontend/pages/builds/download.php @@ -1,14 +1,13 @@ <?php -function init_builds_download() { - global $S, $request; +function init_builds_download(&$S) { if (!isset($S['user'])) { return 'login'; } - if (!(isset($request['build']) && strlen($request['build']) == 6 && ctype_alnum($request['build']))) { + if (!(isset($_REQUEST['build']) && strlen($_REQUEST['build']) == 6 && ctype_alnum($_REQUEST['build']))) { debug('builds_download', 'No build or badly formatted build requested'); return '404'; } - $r=$S['pdo']->query('SELECT * FROM `builds` WHERE `id`="'.$request['build'].'"'); + $r=query('SELECT * FROM `builds` WHERE `id`="'.$_REQUEST['build'].'"'); if ($r->rowCount() == 0) { debug('builds_download', 'build not found or not owned by user'); return '404'; @@ -41,8 +40,7 @@ function init_builds_download() { header('Content-Transfer-Encoding: binary'); header('Content-Disposition: attachment; filename="'.(isset($build->name) && strlen($build->name)?str_replace('"', '\"', $build->name):'ingenue-'.$build->id).$ext); } -function body_builds_download() { - global $S; +function body_builds_download(&$S) { readfile($S['builds_download']['file']); // Log the download to db after sending data so hopefully HEAD requests won't artificially inflate the # of dls $S['builds_download']['dl']->write(); |