blob: cf6c6d4b8b661507bfe45350a6b88b3dee0a6009 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<?php
function init_builds_delete() {
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() == 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() {
global $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.');
}
?>
|