summaryrefslogtreecommitdiff
blob: cd8e5811a263e03ecf520fbef01d8a3b9552f18f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
function init_builds_history() {
	global $S, $request;
	if (!isset($S['user'])) return 'login';
	if (!(isset($request['build']) && strlen($request['build']) == 6 && ctype_alnum($request['build']))) {
		return '404';
	}
	$r=$S['pdo']->query('SELECT * FROM `builds` WHERE `id`="'.$request['build'].'"');
	if (!$r->rowCount()) return '404';
	$S['builds_history']['build']=new sql_build($r->fetch(PDO::FETCH_ASSOC));
	if ($S['builds_history']['build']->visibility == 'private' && !owner_or_admin($S['builds_history']['build']->id)) {
		return '404';
	}
	return array('title' => 'Download History');
}
function body_builds_history() {
	global $S;
	$build=&$S['builds_history']['build'];
	echo $build->display();
	$r=$S['pdo']->query('SELECT * FROM `downloads` WHERE `build`="'.$build->id.'" ORDER BY `time` DESC');
	while ($download=$r->fetch(PDO::FETCH_ASSOC)) {
		$download=new sql_download($download);
		$user=$download->get_user();
		echo '<p>Downloaded <code>'.date('D j M Y G:i:s T', $download->time).'</code> by <b>'.$user->name.'</b></p>'."\n";
	}
}
?>