summaryrefslogtreecommitdiff
blob: 51aa9cf3fcefc7625c480a396fb9b7df52e39b87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?php
function init_builds_delete(&$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() == 0) return '404';
	$S['build']=new sql_build($r->fetch(PDO::FETCH_ASSOC));
	if (!owner_or_admin($S['build']->id)) return '404';
	return array('title' => 'Delete Build');
}
function body_builds_delete(&$S) {
	if ($S['build']->status >= 0 || $S['build']->status == -128) {
		$S['build']->delete();
		echo print_success('Build deleted.');
	} else
		echo print_error('Cannot delete build while it is being built.');
}
?>