summaryrefslogtreecommitdiff
blob: c9789e37125ba6e0968971ccfe0a8fc2f86e0863 (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
<?php
function init_builds_history(&$S) {
	if (!isset($S['user'])) return 'login';
	if (!(isset($_REQUEST['build']) && strlen($_REQUEST['build']) == 6 && ctype_alnum($_REQUEST['build']))) {
		return '404';
	}
	$r=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(&$S) {
	$build=&$S['builds_history']['build'];
	echo $build->display();
	$r=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";
	}
}
?>