-
Notifications
You must be signed in to change notification settings - Fork 41
/
delete_run.php
37 lines (29 loc) · 1012 Bytes
/
delete_run.php
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
<?php
include(__DIR__ . '/webapp/inc.php');
$properties = properties_reader::get('readonlyweb');
if (!empty($properties['readonlyweb'])) {
die('Error: You are not allowed to perform write actions from the web interface');
}
if (!$filename = $_GET['filename']) {
die('Error: No filename to delete');
}
if (!preg_match('/^\d*$/', $filename, $matches)) {
die('Error: Incorrect filename');
}
$returnurl = urldecode($_GET['returnurl']);
$run = new test_plan_run($filename);
if (!$run->delete()) {
echo '<b>Error: There was a problem deleting the file</b>';
} else {
echo '<p>Run deleted</p>';
// Remove the deleted one.
$timestamps = explode('&', $returnurl);
foreach ($timestamps as $key => $timestamp) {
if (strstr($timestamp, $filename) != false) {
unset($timestamps[$key]);
}
}
$returnurl = implode('&', $timestamps);
}
// Link to return to the index.
echo '<br/><br/><a href="index.php?' . $returnurl . '">Return to the runs page</a>';