@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | // show list of BUDA apps and variants, |
59 | 59 | // w/ buttons for adding and deleting |
60 | 60 | // |
61 | -function app_list($notice=null) { |
|
61 | +function app_list($notice = null) { |
|
62 | 62 | global $buda_root; |
63 | 63 | if (!is_dir($buda_root)) { |
64 | 64 | mkdir($buda_root); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | // |
255 | 255 | $x = "<input_template>\n"; |
256 | 256 | $ninfiles = 1 + count($variant_desc->input_file_names) + count($variant_desc->app_files); |
257 | - for ($i=0; $i<$ninfiles; $i++) { |
|
257 | + for ($i = 0; $i < $ninfiles; $i++) { |
|
258 | 258 | $x .= " <file_info>\n <sticky/>\n <no_delete/>\n <executable/>\n </file_info>\n"; |
259 | 259 | } |
260 | 260 | $x .= " <workunit>\n"; |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | // prefix for links; needed for pages not in top dir |
142 | 142 | $user, |
143 | 143 | // logged-in user, if any |
144 | - $fixed=false, |
|
144 | + $fixed = false, |
|
145 | 145 | // if true, navbar is fixed at top of page. |
146 | 146 | // NOTE: if you do this, you must set a global var $fixed_navbar |
147 | 147 | // to true at compile time |
148 | 148 | // (it needs to be set when page_head() is called). |
149 | - $inverse=false |
|
149 | + $inverse = false |
|
150 | 150 | // white on black? |
151 | 151 | ) { |
152 | 152 | global $master_url; |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | // output a panel. |
237 | 237 | // $content_func is a function that generates the panel contents |
238 | 238 | // |
239 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { |
|
239 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { |
|
240 | 240 | echo sprintf('<div class="panel %s"> |
241 | 241 | ', $class |
242 | 242 | ); |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | // $left_width is the width of left column in 1/12 units. |
264 | 264 | // $arg is passed to the functions. |
265 | 265 | // |
266 | -function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) { |
|
266 | +function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) { |
|
267 | 267 | echo ' |
268 | 268 | <div class="container-fluid"> |
269 | 269 | '; |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | </div> |
279 | 279 | '; |
280 | 280 | } |
281 | - $right_width = 12-$left_width; |
|
281 | + $right_width = 12 - $left_width; |
|
282 | 282 | echo ' |
283 | 283 | <div class="row"> |
284 | 284 | <div class="col-sm-'.$left_width.'"> |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | // use extra = "name=x" |
303 | 303 | // call forum_focus(x, foo) after defining the field |
304 | 304 | // |
305 | -function form_start($action, $method='get', $extra='') { |
|
305 | +function form_start($action, $method = 'get', $extra = '') { |
|
306 | 306 | echo sprintf( |
307 | 307 | '<div class="container-fluid"> |
308 | 308 | <form class="form-horizontal" method="%s" action="%s" %s>' |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | // just the input field |
335 | 335 | // |
336 | 336 | function form_input_text_field( |
337 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
337 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
338 | 338 | ) { |
339 | 339 | return sprintf( |
340 | 340 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | // the whole row |
346 | 346 | // |
347 | 347 | function form_input_text( |
348 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
348 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
349 | 349 | ) { |
350 | 350 | echo sprintf(' |
351 | 351 | <div class="form-group"> |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | ); |
374 | 374 | } |
375 | 375 | |
376 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
376 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
377 | 377 | echo sprintf(' |
378 | 378 | <div class="form-group"> |
379 | 379 | <label align=right class="%s" for="%s">%s</label> |
@@ -389,7 +389,7 @@ discard block |
||
389 | 389 | |
390 | 390 | // $items is either a string of <option> elements, or an array |
391 | 391 | // |
392 | -function form_select($label, $name, $items, $selected=null) { |
|
392 | +function form_select($label, $name, $items, $selected = null) { |
|
393 | 393 | echo sprintf(' |
394 | 394 | <div class="form-group"> |
395 | 395 | <label align=right class="%s" for="%s">%s</label> |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | foreach ($items as $i) { |
403 | 403 | echo sprintf( |
404 | 404 | '<option %s value=%s>%s</option>', |
405 | - ($i[0]==$selected)?'selected':'', |
|
405 | + ($i[0] == $selected) ? 'selected' : '', |
|
406 | 406 | $i[0], $i[1] |
407 | 407 | ); |
408 | 408 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | // same, for multiple select. |
416 | 416 | // $selected, if non-null, is a list of selected values |
417 | 417 | // |
418 | -function form_select_multiple($label, $name, $items, $selected=null, $size=0) { |
|
418 | +function form_select_multiple($label, $name, $items, $selected = null, $size = 0) { |
|
419 | 419 | echo sprintf(' |
420 | 420 | <div class="form-group"> |
421 | 421 | <label align=right class="%s" for="%s">%s</label> |
@@ -427,7 +427,7 @@ discard block |
||
427 | 427 | foreach ($items as $i) { |
428 | 428 | echo sprintf( |
429 | 429 | '<option %s value=%s>%s</option>', |
430 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
430 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
431 | 431 | $i[0], $i[1] |
432 | 432 | ); |
433 | 433 | } |
@@ -436,12 +436,12 @@ discard block |
||
436 | 436 | |
437 | 437 | // return a list of strings for checkbox items |
438 | 438 | // |
439 | -function checkbox_item_strings($items, $attrs='') { |
|
439 | +function checkbox_item_strings($items, $attrs = '') { |
|
440 | 440 | $x = []; |
441 | 441 | foreach ($items as $i) { |
442 | 442 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
443 | 443 | ', |
444 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
444 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
445 | 445 | ); |
446 | 446 | } |
447 | 447 | return $x; |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | |
450 | 450 | // $items is list of (name, label, checked) |
451 | 451 | // |
452 | -function form_checkboxes($label, $items, $attrs='') { |
|
452 | +function form_checkboxes($label, $items, $attrs = '') { |
|
453 | 453 | echo sprintf(' |
454 | 454 | <div class="form-group"> |
455 | 455 | <label align=right class="%s">%s</label> |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | // |
469 | 469 | function form_radio_buttons( |
470 | 470 | $label, $name, $items, $selected, |
471 | - $assign_ids=false // assign IDs to buttons based on names |
|
471 | + $assign_ids = false // assign IDs to buttons based on names |
|
472 | 472 | ) { |
473 | 473 | echo sprintf(' |
474 | 474 | <div class="form-group"> |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
479 | 479 | ); |
480 | 480 | foreach ($items as $i) { |
481 | - $checked = ($selected == $i[0])?"checked":""; |
|
481 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
482 | 482 | if ($assign_ids) { |
483 | 483 | $id = sprintf('id="%s_%s"', $name, $i[0]); |
484 | 484 | } else { |
@@ -516,7 +516,7 @@ discard block |
||
516 | 516 | '; |
517 | 517 | } |
518 | 518 | |
519 | -function form_submit($text, $attrs='') { |
|
519 | +function form_submit($text, $attrs = '') { |
|
520 | 520 | form_general( |
521 | 521 | "", |
522 | 522 | sprintf( |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | ); |
527 | 527 | } |
528 | 528 | |
529 | -function form_checkbox($label, $name, $checked=false) { |
|
529 | +function form_checkbox($label, $name, $checked = false) { |
|
530 | 530 | echo sprintf(' |
531 | 531 | <div class="form-group"> |
532 | 532 | <label align=right class="%s">%s</label> |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | <input type="checkbox" name="%s" %s> |
539 | 539 | </div> |
540 | 540 | </div> |
541 | - ', $name, $checked?"checked":"" |
|
541 | + ', $name, $checked ? "checked" : "" |
|
542 | 542 | ); |
543 | 543 | } |
544 | 544 | |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | // $selected is the list of selected values. |
567 | 567 | // $extra is e.g. id=foo |
568 | 568 | // |
569 | -function form_select2_multi($label, $name, $items, $selected=null, $extra='') { |
|
569 | +function form_select2_multi($label, $name, $items, $selected = null, $extra = '') { |
|
570 | 570 | echo sprintf(' |
571 | 571 | <div class="form-group"> |
572 | 572 | <label align=right class="%s" for="%s">%s</label> |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | foreach ($items as $i) { |
579 | 579 | echo sprintf( |
580 | 580 | '<option %s value=%s>%s</option>', |
581 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
581 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
582 | 582 | $i[0], $i[1] |
583 | 583 | ); |
584 | 584 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | if ($owner) { |
478 | 478 | row2('submitter', $owner->name); |
479 | 479 | } |
480 | - row2("application", $app?$app->name:'---'); |
|
480 | + row2("application", $app ? $app->name : '---'); |
|
481 | 481 | row2("state", batch_state_string($batch->state)); |
482 | 482 | //row2("# jobs", $batch->njobs); |
483 | 483 | //row2("# error jobs", $batch->nerror_jobs); |
@@ -536,9 +536,9 @@ discard block |
||
536 | 536 | "status" |
537 | 537 | ]; |
538 | 538 | row_heading_array($x); |
539 | - foreach($wus as $wu) { |
|
539 | + foreach ($wus as $wu) { |
|
540 | 540 | $y = ''; |
541 | - switch($wu->status) { |
|
541 | + switch ($wu->status) { |
|
542 | 542 | case WU_SUCCESS: |
543 | 543 | $resultid = $wu->canonical_resultid; |
544 | 544 | $y = '<font color="green">completed</font>'; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | $results = BoincResult::enum("workunitid=$wuid"); |
612 | 612 | $upload_dir = parse_config(get_config(), "<upload_dir>"); |
613 | 613 | $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); |
614 | - foreach($results as $result) { |
|
614 | + foreach ($results as $result) { |
|
615 | 615 | $x = [ |
616 | 616 | "<a href=result.php?resultid=$result->id>$result->id</a>", |
617 | 617 | state_string($result) |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | if ($result->server_state == RESULT_SERVER_STATE_OVER) { |
621 | 621 | $phys_names = get_outfile_phys_names($result); |
622 | 622 | $log_names = get_outfile_log_names($result); |
623 | - for ($i=0; $i<count($phys_names); $i++) { |
|
623 | + for ($i = 0; $i < count($phys_names); $i++) { |
|
624 | 624 | if ($is_assim_move) { |
625 | 625 | // file is in |
626 | 626 | // project/results/<batchid>/<wu_name>__file_<log_name> |