summaryrefslogtreecommitdiff
blob: ee652f3b55ab2d62f3ad5f1529cae844151f5c61 (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
<?php
function init_builds_log() {
	global $S, $request;
	$S['title']='Log Viewer';
	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()) {
		$S['builds_log']=new sql_build($r->fetch(PDO::FETCH_ASSOC));
		if (!owner_or_admin($S['builds_log']->owner)) return '404'; // TODO permission denied
	} else
		return '404';
	if (isset($request['task']) && is_numeric($request['task']))
		return 'builds/task';
}
function body_builds_log() {
	global $S;
	$build=&$S['builds_log'];
	echo $build->display();
	$r=$S['pdo']->query('SELECT * FROM `tasks` WHERE `build`="'.$build->id.'" ORDER BY `order` ASC');
	if ($r->rowCount() == 0) {
		echo '<b>No tasks found.</b>';
	}
	while ($task=$r->fetch(PDO::FETCH_ASSOC)) {
		$task=new sql_task($task);
		echo $task->display();
	}
}
?>