Skip to content

Commit 9cd217f

Browse files
AI fixes
1 parent 5d16612 commit 9cd217f

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

html/user/get_output3.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
// user is allowed to download output files from batch only if
3939
// they own batch or have manage-all permissions
4040
//
41-
function check_auth($batch_id){
41+
function check_auth($batch_id) {
4242
$user = get_logged_in_user();
4343
if (has_manage_access($user, 0)) {
4444
return;
@@ -86,7 +86,7 @@ function get_batch_zip() {
8686
check_auth($batch_id);
8787
$dir = "../../results/$batch_id";
8888
if (!is_dir($dir)) {
89-
die('no batch dir');
89+
error_page('no batch dir');
9090
}
9191
$name = "batch_$batch_id.zip";
9292
$cmd = "cd $dir; rm -f $name; zip -q $name *";
@@ -103,10 +103,13 @@ function get_batch_tar() {
103103
check_auth($batch_id);
104104
$dir = "../../results/$batch_id";
105105
if (!is_dir($dir)) {
106-
die('no batch dir');
106+
error_page('no batch dir');
107107
}
108108

109109
$d = fopen($dir, 'r');
110+
if (!$d) {
111+
error_page('fopen() failed');
112+
}
110113
if (!flock($d, LOCK_EX|LOCK_NB)) {
111114
error_page(
112115
"A download of this batch is already in progress."
@@ -153,7 +156,7 @@ function get_batch_tar() {
153156
flush();
154157
}
155158
pclose($f);
156-
pclose($d);
159+
fclose($d);
157160
}
158161

159162
$action = get_str('action');

0 commit comments

Comments
 (0)