@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | // Return path of sandbox directory for the given user. |
33 | 33 | // Create dir if not present. |
34 | 34 | // |
35 | -if (!function_exists("sandbox_dir")){ |
|
35 | +if (!function_exists("sandbox_dir")) { |
|
36 | 36 | function sandbox_dir($user) { |
37 | 37 | $dir = parse_config(get_config(), "<sandbox_dir>"); |
38 | 38 | if (!$dir) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | foreach ($files as $file) { |
64 | 64 | $path = "$dir/$file"; |
65 | 65 | [$err, $file_size, $file_md5] = sandbox_parse_link_file($path); |
66 | - if (!$err){ |
|
66 | + if (!$err) { |
|
67 | 67 | if (strcmp($md5, $file_md5) == 0) { |
68 | 68 | $exist = true; |
69 | 69 | $elf = $file; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | $files = sandbox_file_names($user); |
132 | 132 | foreach ($files as $f) { |
133 | - if ($regexp && !preg_match("/$regexp/",$f)) continue; |
|
133 | + if ($regexp && !preg_match("/$regexp/", $f)) continue; |
|
134 | 134 | $x .= "<option value=\"$f\">$f</option>\n"; |
135 | 135 | } |
136 | 136 | $x .= "</select>\n"; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // TODO: this is a kludge. |
153 | 153 | // Should we use the job_file and batch_file_assoc tables instead? |
154 | 154 | // |
155 | -function sandbox_file_in_use($user, $file){ |
|
155 | +function sandbox_file_in_use($user, $file) { |
|
156 | 156 | $ufiles = array(); |
157 | 157 | |
158 | 158 | $pbatches = BoincBatch::enum( |
@@ -162,16 +162,16 @@ discard block |
||
162 | 162 | ); |
163 | 163 | if (!$pbatches) return false; |
164 | 164 | |
165 | - foreach ($pbatches as $batch){ |
|
166 | - $wus = BoincWorkUnit::enum("batch = $batch->id limit 1" ); |
|
167 | - if ($wus == null){ |
|
165 | + foreach ($pbatches as $batch) { |
|
166 | + $wus = BoincWorkUnit::enum("batch = $batch->id limit 1"); |
|
167 | + if ($wus == null) { |
|
168 | 168 | continue; |
169 | 169 | } |
170 | - foreach($wus as $wu){ |
|
170 | + foreach ($wus as $wu) { |
|
171 | 171 | $x = "<in>".$wu->xml_doc."</in>"; |
172 | 172 | $x = simplexml_load_string($x); |
173 | 173 | global $fanout; |
174 | - foreach($x->workunit->file_ref as $fr){ |
|
174 | + foreach ($x->workunit->file_ref as $fr) { |
|
175 | 175 | $pname = (string)$fr->file_name; |
176 | 176 | $ufiles[] = $pname; |
177 | 177 | } |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | $dir = sandbox_dir($user); |
181 | 181 | $path = $dir."/".$file; |
182 | 182 | list($err, $size, $md5) = sandbox_parse_link_file($path); |
183 | - if (!$err){ |
|
183 | + if (!$err) { |
|
184 | 184 | $f = sandbox_file_name($user, $md5); |
185 | - foreach($ufiles as $uf) { |
|
186 | - if (strcmp($f,$uf) == 0){ |
|
185 | + foreach ($ufiles as $uf) { |
|
186 | + if (strcmp($f, $uf) == 0) { |
|
187 | 187 | return true; |
188 | 188 | } |
189 | 189 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | // Return path of sandbox directory for the given user. |
33 | 33 | // Create dir if not present. |
34 | 34 | // |
35 | -if (!function_exists("sandbox_dir")){ |
|
35 | +if (!function_exists("sandbox_dir")) { |
|
36 | 36 | function sandbox_dir($user) { |
37 | 37 | $dir = parse_config(get_config(), "<sandbox_dir>"); |
38 | 38 | if (!$dir) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | foreach ($files as $file) { |
64 | 64 | $path = "$dir/$file"; |
65 | 65 | [$err, $file_size, $file_md5] = sandbox_parse_link_file($path); |
66 | - if (!$err){ |
|
66 | + if (!$err) { |
|
67 | 67 | if (strcmp($md5, $file_md5) == 0) { |
68 | 68 | $exist = true; |
69 | 69 | $elf = $file; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // TODO: this is a kludge. |
153 | 153 | // Should we use the job_file and batch_file_assoc tables instead? |
154 | 154 | // |
155 | -function sandbox_file_in_use($user, $file){ |
|
155 | +function sandbox_file_in_use($user, $file) { |
|
156 | 156 | $ufiles = array(); |
157 | 157 | |
158 | 158 | $pbatches = BoincBatch::enum( |
@@ -162,16 +162,16 @@ discard block |
||
162 | 162 | ); |
163 | 163 | if (!$pbatches) return false; |
164 | 164 | |
165 | - foreach ($pbatches as $batch){ |
|
165 | + foreach ($pbatches as $batch) { |
|
166 | 166 | $wus = BoincWorkUnit::enum("batch = $batch->id limit 1" ); |
167 | - if ($wus == null){ |
|
167 | + if ($wus == null) { |
|
168 | 168 | continue; |
169 | 169 | } |
170 | - foreach($wus as $wu){ |
|
170 | + foreach($wus as $wu) { |
|
171 | 171 | $x = "<in>".$wu->xml_doc."</in>"; |
172 | 172 | $x = simplexml_load_string($x); |
173 | 173 | global $fanout; |
174 | - foreach($x->workunit->file_ref as $fr){ |
|
174 | + foreach($x->workunit->file_ref as $fr) { |
|
175 | 175 | $pname = (string)$fr->file_name; |
176 | 176 | $ufiles[] = $pname; |
177 | 177 | } |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | $dir = sandbox_dir($user); |
181 | 181 | $path = $dir."/".$file; |
182 | 182 | list($err, $size, $md5) = sandbox_parse_link_file($path); |
183 | - if (!$err){ |
|
183 | + if (!$err) { |
|
184 | 184 | $f = sandbox_file_name($user, $md5); |
185 | 185 | foreach($ufiles as $uf) { |
186 | - if (strcmp($f,$uf) == 0){ |
|
186 | + if (strcmp($f,$uf) == 0) { |
|
187 | 187 | return true; |
188 | 188 | } |
189 | 189 |