File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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 ' );
You can’t perform that action at this time.
0 commit comments