Passed
Push — dpa_docker_wrapper12 ( e18bd7 )
by David
08:59
created
html/user/buda.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 // show list of BUDA apps and variants,
55 55
 // w/ buttons for adding and deleting
56 56
 //
57
-function app_list($notice=null) {
57
+function app_list($notice = null) {
58 58
     global $buda_root;
59 59
     if (!is_dir($buda_root)) {
60 60
         mkdir($buda_root);
@@ -256,7 +256,7 @@  discard block
 block discarded – undo
256 256
     //
257 257
     $x = "<input_template>\n";
258 258
     $ninfiles = 1 + count($variant_desc->input_file_names) + count($variant_desc->app_files);
259
-    for ($i=0; $i<$ninfiles; $i++) {
259
+    for ($i = 0; $i < $ninfiles; $i++) {
260 260
         $x .= "   <file_info>\n      <sticky/>\n      <no_delete/>\n      <executable/>\n   </file_info>\n";
261 261
     }
262 262
     $x .= "   <workunit>\n";
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
     );
287 287
 
288 288
     $x .= sprintf("      <max_delay>%f</max_delay>\n",
289
-        $variant_desc->max_delay_days * 86400.
289
+        $variant_desc->max_delay_days*86400.
290 290
     );
291 291
 
292 292
     $x .= "   </workunit>\n<input_template>\n";
@@ -476,8 +476,8 @@  discard block
 block discarded – undo
476 476
     }
477 477
 }
478 478
 
479
-function app_form($desc=null) {
480
-    page_head_select2($desc?"Edit BUDA app $desc->name":'Create BUDA app');
479
+function app_form($desc = null) {
480
+    page_head_select2($desc ? "Edit BUDA app $desc->name" : 'Create BUDA app');
481 481
     form_start('buda.php');
482 482
     form_input_hidden('action', 'app_action');
483 483
     if ($desc) {
@@ -488,22 +488,22 @@  discard block
 block discarded – undo
488 488
         form_input_text('Internal name<br><small>No spaces</small>', 'name');
489 489
     }
490 490
     form_input_text('User-visible name', 'long_name',
491
-        $desc?$desc->long_name:null
491
+        $desc ? $desc->long_name : null
492 492
     );
493 493
     form_input_textarea(
494 494
         'Description<br><small>... of what the app does and of the research goals</small>',
495 495
         'description',
496
-        $desc?$desc->description:null
496
+        $desc ? $desc->description : null
497 497
     );
498 498
     form_select2_multi('Science keywords',
499 499
         'sci_kw',
500 500
         keyword_select_options(KW_CATEGORY_SCIENCE),
501
-        $desc?$desc->sci_kw:null
501
+        $desc ? $desc->sci_kw : null
502 502
     );
503 503
     form_input_text(
504 504
         'URL of web page describing app',
505 505
         'url',
506
-        !empty($desc->url)?$desc->url:''
506
+        !empty($desc->url) ? $desc->url : ''
507 507
     );
508 508
     // don't include location keywords;
509 509
     // various people may submit jobs to this app
Please login to merge, or discard this patch.
Upper-Lower-Casing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     } else {
226 226
         form_input_text("Plan class$pc", 'variant', $variant);
227 227
     }
228
-    form_select("Dockerfile$sb", 'dockerfile', $sbitems, $variant_desc->dockerfile);
228
+    form_select("dockerfile$sb", 'dockerfile', $sbitems, $variant_desc->dockerfile);
229 229
     form_select2_multi("Application files$sb", 'app_files', $sbitems, $variant_desc->app_files);
230 230
     form_input_text(
231 231
         'Input file names<br><small>Space-separated</small>',
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
     // Note: we don't currently allow indirect file access.
435 435
     // If we did, we'd need to create job.toml to mount project dir
436 436
 
437
-    app_list("Variant $variant added for app $app.");
437
+    app_list("variant $variant added for app $app.");
438 438
 }
439 439
 
440 440
 function variant_delete() {
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
         if ($ret) {
462 462
             error_page("delete failed");
463 463
         }
464
-        $notice = "Variant $variant of app $app removed.";
464
+        $notice = "variant $variant of app $app removed.";
465 465
         app_list($notice);
466 466
     } else {
467 467
         page_head("Confirm");
@@ -491,7 +491,7 @@  discard block
 block discarded – undo
491 491
         if ($ret) {
492 492
             error_page('delete failed');
493 493
         }
494
-        $notice = "App $app removed.";
494
+        $notice = "app $app removed.";
495 495
         app_list($notice);
496 496
     } else {
497 497
         page_head('Confirm');
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
         }
557 557
         $dir = "$buda_root/$name";
558 558
         if (file_exists($dir)) {
559
-            error_page("App $name already exists.");
559
+            error_page("app $name already exists.");
560 560
         }
561 561
         mkdir($dir);
562 562
         $desc->user_id = $user->id;
Please login to merge, or discard this patch.
html/inc/submit_util.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     foreach ($res_in_prog as $res) {
180 180
         $wus_in_prog[$res->workunitid] = true;
181 181
     }
182
-    unset($res_in_progress);    // does this do anything?
182
+    unset($res_in_progress); // does this do anything?
183 183
 
184 184
     $fp_total = 0;
185 185
     $fp_done = 0;
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 // get the total size of output files of a batch
353 353
 //
354 354
 function batch_output_file_size($batchid) {
355
-    $batch_td_size=0;
355
+    $batch_td_size = 0;
356 356
     $wus = BoincWorkunit::enum_fields(
357 357
         'canonical_resultid',
358 358
         "batch=$batchid"
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 }
386 386
 
387 387
 function boinc_get_wu_output_files_url($user, $wu_id) {
388
-    $auth_str =  md5($user->authenticator.$wu_id);
388
+    $auth_str = md5($user->authenticator.$wu_id);
389 389
     return "get_output.php?cmd=workunit_files&wu_id=$wu_id&auth_str=$auth_str";
390 390
 }
391 391
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
     if (!file_exists($path)) return null;
420 420
     $x = file_get_contents($path);
421 421
     $n = sscanf($x, "%s %d", $md5, $size);
422
-    if ($n != 2 || strlen($md5)!=32) {
422
+    if ($n != 2 || strlen($md5) != 32) {
423 423
         return null;
424 424
     }
425 425
     return [$md5, $size];
Please login to merge, or discard this patch.
html/user/buda_submit.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 //
86 86
 function unzip_batch_file($user, $batch_file) {
87 87
     @mkdir("../../buda_batches");
88
-    for ($i=0; $i<1000; $i++) {
88
+    for ($i = 0; $i < 1000; $i++) {
89 89
         $batch_dir = "../../buda_batches/$i";
90 90
         $batch_dir_name = $i;
91 91
         $ret = @mkdir($batch_dir);
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         }
137 137
         $job_files = [];
138 138
         $cmdline = '';
139
-        foreach(scandir("$batch_dir/$fname") as $f2) {
139
+        foreach (scandir("$batch_dir/$fname") as $f2) {
140 140
             if ($f2[0] == '.') continue;
141 141
             if ($f2 == 'cmdline') {
142 142
                 $cmdline = trim(file_get_contents("$batch_dir/$fname/cmdline"));
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 function stage_input_files($batch_dir, $batch_desc, $batch_id) {
187 187
     $n = count($batch_desc->shared_files);
188 188
     $batch_desc->shared_files_phys_names = [];
189
-    for ($i=0; $i<$n; $i++) {
189
+    for ($i = 0; $i < $n; $i++) {
190 190
         $path = sprintf('%s/%s', $batch_dir, $batch_desc->shared_files[$i]);
191 191
         [$md5, $size] = $batch_desc->shared_file_infos[$i];
192 192
         $phys_name = sprintf('batch_%d_%s', $batch_id, $md5);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     foreach ($batch_desc->jobs as $job) {
197 197
         $n = count($batch_desc->unshared_files);
198 198
         $job->phys_names = [];
199
-        for ($i=0; $i<$n; $i++) {
199
+        for ($i = 0; $i < $n; $i++) {
200 200
             $path = sprintf('%s/%s/%s',
201 201
                 $batch_dir, $job->dir, $batch_desc->unshared_files[$i]
202 202
             );
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     }
246 246
     $wrapper_cmdline = sprintf('"--dockerfile %s %s %s"',
247 247
         $variant_desc->dockerfile,
248
-        $wrapper_verbose?'--verbose':'',
248
+        $wrapper_verbose ? '--verbose' : '',
249 249
         $cmdline
250 250
     );
251 251
     $cmd = sprintf(
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     $max_runtime_days = (double)$max_runtime_days;
295 295
     if ($max_runtime_days <= 0) error_page('bad runtime limit');
296 296
     if ($max_runtime_days > 100) error_page('bad runtime limit');
297
-    $max_fpops = $max_runtime_days * 4.3e9 * 86400;
297
+    $max_fpops = $max_runtime_days*4.3e9*86400;
298 298
 
299 299
     $exp_runtime_days = get_str('exp_runtime_days');
300 300
     if (!is_numeric($exp_runtime_days)) error_page('bad expected runtime');
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     if ($exp_runtime_days > $max_runtime_days) {
305 305
         error_page('exp must be < max runtime');
306 306
     }
307
-    $exp_fpops = $exp_runtime_days * 4.3e9 * 86400;
307
+    $exp_fpops = $exp_runtime_days*4.3e9*86400;
308 308
 
309 309
     $app_desc = get_buda_desc($app);
310 310
 
Please login to merge, or discard this patch.
html/user/json_form.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
5 5
 require_once('../inc/util.inc');
6 6
 require_once('../inc/sandbox.inc');
7 7
 
8
-function sb_file_select($user, $suffix=null) {
8
+function sb_file_select($user, $suffix = null) {
9 9
     $sbfiles = sandbox_file_names($user);
10 10
     $sbitems = [];
11 11
     $exp = null;
Please login to merge, or discard this patch.
html/user/weak_auth.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -30,14 +30,14 @@  discard block
 block discarded – undo
30 30
 $master_url = master_url();
31 31
 $idx = strpos($master_url, '://');
32 32
 if ($idx) {
33
-    $url = substr($master_url, $idx+strlen('://'));
33
+    $url = substr($master_url, $idx + strlen('://'));
34 34
 } else {
35 35
     $url = $master_url;
36 36
 }
37 37
 
38 38
 // convert invalid characters into underscores
39 39
 //
40
-for ($i=0; $i<strlen($url); $i++) {
40
+for ($i = 0; $i < strlen($url); $i++) {
41 41
     $c = $url[$i];
42 42
     if (!ctype_alnum($c) && $c != '.' && $c != '-' && $c != '_') {
43 43
         $url[$i] = '_';
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 
47 47
 //remove trailing underscore(s)
48 48
 //
49
-$account_file = "account_" . rtrim($url, '_') . ".xml";
49
+$account_file = "account_".rtrim($url, '_').".xml";
50 50
 
51 51
 page_head(tra("Account keys"));
52 52
 text_start();
@@ -58,12 +58,12 @@  discard block
 block discarded – undo
58 58
     <p>",
59 59
     tra("This key can be used to:"),
60 60
     "<ul>
61
-    <li><a href=get_passwd.php>",tra("log in to your account on the web"),"</a>;
61
+    <li><a href=get_passwd.php>",tra("log in to your account on the web"), "</a>;
62 62
     <li>",
63 63
         tra("attach a computer to your account without using the BOINC Manager.
64 64
        To do so, install BOINC,
65 65
        create a file named %1 in the BOINC
66
-       data directory, and set its contents to:","<b>$account_file</b>"),"
66
+       data directory, and set its contents to:","<b>$account_file</b>"), "
67 67
     <p><pre>",
68 68
     htmlspecialchars(
69 69
 "<account>
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
     as described above, but cannot be used to log in to your account or change it in any way.
78 78
     If you want to attach untrusted or insecure computers to your account,
79 79
     do so using your weak account key.
80
-    Your weak account key is:"),"
80
+    Your weak account key is:"), "
81 81
     <p><pre>$weak_auth</pre><p>
82 82
     ",
83
-    tra("The key depends on your account's email address and password.  If you change either of these, the weak account key will change."),"
83
+    tra("The key depends on your account's email address and password.  If you change either of these, the weak account key will change."), "
84 84
     </td></tr></table>"
85 85
 ;
86 86
 text_end();
Please login to merge, or discard this patch.
html/user/submit_stats.php 2 patches
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -199,25 +199,25 @@  discard block
 block discarded – undo
199 199
     $min = 1e99;
200 200
     $max = 0;
201 201
     foreach ($results as $r) {
202
-        $f = $r->flops / (4.3e9 *3600);
202
+        $f = $r->flops/(4.3e9*3600);
203 203
         if ($f > $max) $max = $f;
204 204
         if ($f < $min) $min = $f;
205 205
         $x[] = $f;
206 206
     }
207 207
     $n = 800;
208 208
     $count = [];
209
-    for ($i=0; $i<$n; $i++) {
209
+    for ($i = 0; $i < $n; $i++) {
210 210
         $count[$i] = 0;
211 211
     }
212 212
     $range = $max - $min;
213 213
     foreach ($x as $f) {
214
-        $d = intval($n*($f-$min)/$range);
215
-        if ($d >= $n) $d = $n-1;
214
+        $d = intval($n*($f - $min)/$range);
215
+        if ($d >= $n) $d = $n - 1;
216 216
         $count[$d] += 1;
217 217
     }
218 218
     $data = [];
219
-    for ($i=0; $i<$n; $i++) {
220
-        $data[] = [$min+($i*$range)/$n, $count[$i]];
219
+    for ($i = 0; $i < $n; $i++) {
220
+        $data[] = [$min + ($i*$range)/$n, $count[$i]];
221 221
     }
222 222
     graph($data, 'hours', 'count');
223 223
     page_tail();
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 
226 226
 $batch = BoincBatch::lookup_id(get_int('batch_id'));
227 227
 if (!$batch) error_page('no batch');
228
-switch(get_str('action')) {
228
+switch (get_str('action')) {
229 229
 case 'err_host':
230 230
     err_host($batch);
231 231
     break;
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@
 block discarded – undo
183 183
 }
184 184
 
185 185
 function flops_graph($batch) {
186
-    page_head("Batch $batch->id job runtimes");
186
+    page_head("batch $batch->id job runtimes");
187 187
     echo "
188 188
     <p>
189 189
     Runtimes of completed jobs, normalized to an average (4.3 GFLOPS) computer.
Please login to merge, or discard this patch.