summaryrefslogtreecommitdiff
blob: 4b727e3040230be3a1d093a941319b6a7d41b5ec (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
function init_welcome() {
	global $S;
	$S['title']='Welcome';
}
function body_welcome() {
	global $S;
	echo '<h2>Welcome</h2>';
	echo '<div class="box"><h3>Most Popular Downloads</h3>';
	$r=$S['pdo']->query('SELECT `build` FROM `downloads` GROUP BY `build` ORDER BY COUNT(*) DESC LIMIT 3');
	if ($r->rowCount()) {
		while ($build=$r->fetch(PDO::FETCH_COLUMN)) {
			$build=new sql_build($build);
			echo $build->display();
		}
	} else {
		echo print_warning('No downloads');
	}
	echo '</div>';
	echo '<div class="box"><h3>Recently Downloaded</h3>';
	$r=$S['pdo']->query('SELECT * FROM `downloads` ORDER BY `time` DESC LIMIT 3');
	if ($r->rowCount()) {
		while ($download=$r->fetch(PDO::FETCH_ASSOC)) {
			$download=new sql_download($download);
			echo $download->get_build()->display();
		}
	} else {
		echo print_warning('No downloads');
	}
	echo '</div>';
	echo '<div class="box"><h3>Recently Built</h3>';
	$r=$S['pdo']->query('SELECT * FROM `builds` WHERE `status`="finished/success" ORDER BY `finish` DESC LIMIT 3');
	if ($r->rowCount()) {
		while ($build=$r->fetch(PDO::FETCH_ASSOC)) {
			$build=new sql_build($build);
			echo $build->display();
		}
	} else {
		echo print_warning('No finished builds');
	}
	echo '</div>';
}
?>