@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | if ($user->authenticator != $auth) die('bad auth'); |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -function do_result_aux($result, $batch, $file_num=null) { |
|
| 54 | +function do_result_aux($result, $batch, $file_num = null) { |
|
| 55 | 55 | $phys_names = get_outfile_phys_names($result); |
| 56 | 56 | $log_names = get_outfile_log_names($result); |
| 57 | 57 | if ($file_num !== null) { |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $dir_path = "submit/$batch->id/$result->name"; |
| 72 | 72 | system("rm -r $dir_path"); |
| 73 | 73 | mkdir($dir_path); |
| 74 | - for ($i=0; $i<count($phys_names); $i++) { |
|
| 74 | + for ($i = 0; $i < count($phys_names); $i++) { |
|
| 75 | 75 | $cmd = sprintf('ln -s %s %s/%s', |
| 76 | 76 | upload_path($phys_names[$i]), |
| 77 | 77 | $dir_path, |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | -function do_result($result_id, $auth, $file_num=null) { |
|
| 91 | +function do_result($result_id, $auth, $file_num = null) { |
|
| 92 | 92 | $result = BoincResult::lookup_id($result_id); |
| 93 | 93 | if (!$result) die("no result $result_id"); |
| 94 | 94 | $workunit = BoincWorkunit::lookup_id($result->workunitid); |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | system($cmd); |
| 136 | 136 | } else { |
| 137 | 137 | mkdir(sprintf('%s/%s', $dir_path, $result->name)); |
| 138 | - for ($i=0; $i<count($phys_names); $i++) { |
|
| 138 | + for ($i = 0; $i < count($phys_names); $i++) { |
|
| 139 | 139 | $cmd = sprintf('ln -s %s %s/%s/%s', |
| 140 | 140 | upload_path($phys_names[$i]), |
| 141 | 141 | $dir_path, |
@@ -461,7 +461,7 @@ discard block |
||
| 461 | 461 | if ($owner) { |
| 462 | 462 | row2('submitter', $owner->name); |
| 463 | 463 | } |
| 464 | - row2("application", $app?$app->name:'---'); |
|
| 464 | + row2("application", $app ? $app->name : '---'); |
|
| 465 | 465 | row2("state", batch_state_string($batch->state)); |
| 466 | 466 | //row2("# jobs", $batch->njobs); |
| 467 | 467 | //row2("# error jobs", $batch->nerror_jobs); |
@@ -523,7 +523,7 @@ discard block |
||
| 523 | 523 | $x[] = "Download Results"; |
| 524 | 524 | } |
| 525 | 525 | row_heading_array($x); |
| 526 | - foreach($wus as $wu) { |
|
| 526 | + foreach ($wus as $wu) { |
|
| 527 | 527 | $resultid = $wu->canonical_resultid; |
| 528 | 528 | if ($resultid) { |
| 529 | 529 | $y = '<font color="green">completed</font>'; |
@@ -532,7 +532,7 @@ discard block |
||
| 532 | 532 | $text = "---"; |
| 533 | 533 | if ($batch->state == BATCH_STATE_COMPLETE) { |
| 534 | 534 | $y = '<font color="red">failed</font>'; |
| 535 | - } else { |
|
| 535 | + } else { |
|
| 536 | 536 | $y = "in progress"; |
| 537 | 537 | } |
| 538 | 538 | } |
@@ -595,7 +595,7 @@ discard block |
||
| 595 | 595 | $results = BoincResult::enum("workunitid=$wuid"); |
| 596 | 596 | $upload_dir = parse_config(get_config(), "<upload_dir>"); |
| 597 | 597 | $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); |
| 598 | - foreach($results as $result) { |
|
| 598 | + foreach ($results as $result) { |
|
| 599 | 599 | $x = [ |
| 600 | 600 | "<a href=result.php?resultid=$result->id>$result->id</a>", |
| 601 | 601 | state_string($result) |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | if ($result->server_state == RESULT_SERVER_STATE_OVER) { |
| 605 | 605 | $phys_names = get_outfile_phys_names($result); |
| 606 | 606 | $log_names = get_outfile_log_names($result); |
| 607 | - for ($i=0; $i<count($phys_names); $i++) { |
|
| 607 | + for ($i = 0; $i < count($phys_names); $i++) { |
|
| 608 | 608 | if ($web_app->assim_move) { |
| 609 | 609 | // file is in |
| 610 | 610 | // project/results/<batchid>/<wu_name>__file_<log_name> |
@@ -451,7 +451,7 @@ |
||
| 451 | 451 | |
| 452 | 452 | $web_app = get_web_app($app); |
| 453 | 453 | |
| 454 | - page_head("Batch $batch_id"); |
|
| 454 | + page_head("batch $batch_id"); |
|
| 455 | 455 | text_start(800); |
| 456 | 456 | start_table(); |
| 457 | 457 | row2("name", $batch->name); |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | // |
| 61 | 61 | function unzip_batch_file($user, $batch_file) { |
| 62 | 62 | @mkdir("../../buda_batches"); |
| 63 | - for ($i=0; $i<1000; $i++) { |
|
| 63 | + for ($i = 0; $i < 1000; $i++) { |
|
| 64 | 64 | $batch_dir = "../../buda_batches/$i"; |
| 65 | 65 | $batch_dir_name = $i; |
| 66 | 66 | $ret = @mkdir($batch_dir); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | } |
| 112 | 112 | $job_files = []; |
| 113 | 113 | $cmdline = ''; |
| 114 | - foreach(scandir("$batch_dir/$fname") as $f2) { |
|
| 114 | + foreach (scandir("$batch_dir/$fname") as $f2) { |
|
| 115 | 115 | if ($f2[0] == '.') continue; |
| 116 | 116 | if ($f2 == 'cmdline') { |
| 117 | 117 | $cmdline = file_get_contents("$batch_dir/$f2"); |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | function stage_input_files($batch_dir, $batch_desc, $batch_id) { |
| 161 | 161 | $n = count($batch_desc->shared_files); |
| 162 | 162 | $batch_desc->shared_files_phys_names = []; |
| 163 | - for ($i=0; $i<$n; $i++) { |
|
| 163 | + for ($i = 0; $i < $n; $i++) { |
|
| 164 | 164 | $path = sprintf('%s/%s', $batch_dir, $batch_desc->shared_files[$i]); |
| 165 | 165 | [$md5, $size] = $batch_desc->shared_file_infos[$i]; |
| 166 | 166 | $phys_name = sprintf('batch_%d_%s', $batch_id, $md5); |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | foreach ($batch_desc->jobs as $job) { |
| 171 | 171 | $n = count($batch_desc->unshared_files); |
| 172 | 172 | $job->phys_names = []; |
| 173 | - for ($i=0; $i<$n; $i++) { |
|
| 173 | + for ($i = 0; $i < $n; $i++) { |
|
| 174 | 174 | $path = sprintf('%s/%s/%s', |
| 175 | 175 | $batch_dir, $job->dir, $batch_desc->unshared_files[$i] |
| 176 | 176 | ); |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | 'cd ../..; bin/create_work --appname %s --batch %d --stdin --command_line "--dockerfile %s %s" --wu_template %s --result_template %s', |
| 213 | 213 | $buda_app->name, $batch_id, |
| 214 | 214 | $variant_desc->dockerfile, |
| 215 | - $wrapper_verbose?'--verbose':'', |
|
| 215 | + $wrapper_verbose ? '--verbose' : '', |
|
| 216 | 216 | "buda_batches/$batch_dir_name/template_in", |
| 217 | 217 | "buda_batches/$batch_dir_name/template_out" |
| 218 | 218 | ); |
@@ -276,7 +276,7 @@ discard block |
||
| 276 | 276 | // |
| 277 | 277 | $x = "<input_template>\n"; |
| 278 | 278 | $ninfiles = 1 + count($variant_desc->input_file_names) + count($variant_desc->app_files); |
| 279 | - for ($i=0; $i<$ninfiles; $i++) { |
|
| 279 | + for ($i = 0; $i < $ninfiles; $i++) { |
|
| 280 | 280 | $x .= " <file_info>\n <no_delete/>\n </file_info>\n"; |
| 281 | 281 | } |
| 282 | 282 | $x .= " <workunit>\n"; |
@@ -300,7 +300,7 @@ discard block |
||
| 300 | 300 | // get the total size of output files of a batch |
| 301 | 301 | // |
| 302 | 302 | function batch_output_file_size($batchid) { |
| 303 | - $batch_td_size=0; |
|
| 303 | + $batch_td_size = 0; |
|
| 304 | 304 | $wus = BoincWorkunit::enum("batch=$batchid"); |
| 305 | 305 | $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); |
| 306 | 306 | $upload_dir = parse_config(get_config(), "<upload_dir>"); |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | function boinc_get_wu_output_files_url($user, $wu_id) { |
| 333 | - $auth_str = md5($user->authenticator.$wu_id); |
|
| 333 | + $auth_str = md5($user->authenticator.$wu_id); |
|
| 334 | 334 | return "get_output.php?cmd=workunit_files&wu_id=$wu_id&auth_str=$auth_str"; |
| 335 | 335 | } |
| 336 | 336 | |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | if (!file_exists($path)) return null; |
| 365 | 365 | $x = file_get_contents($path); |
| 366 | 366 | $n = sscanf($x, "%s %d", $md5, $size); |
| 367 | - if ($n != 2 || strlen($md5)!=32) { |
|
| 367 | + if ($n != 2 || strlen($md5) != 32) { |
|
| 368 | 368 | return null; |
| 369 | 369 | } |
| 370 | 370 | return [$md5, $size]; |
@@ -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; |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | // output a panel. |
| 216 | 216 | // $content_func is a function that generates the panel contents |
| 217 | 217 | // |
| 218 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { |
|
| 218 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { |
|
| 219 | 219 | echo sprintf('<div class="panel %s"> |
| 220 | 220 | ', $class |
| 221 | 221 | ); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | // $left_width is the width of left column in 1/12 units. |
| 243 | 243 | // $arg is passed to the functions. |
| 244 | 244 | // |
| 245 | -function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) { |
|
| 245 | +function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) { |
|
| 246 | 246 | echo ' |
| 247 | 247 | <div class="container-fluid"> |
| 248 | 248 | '; |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | </div> |
| 258 | 258 | '; |
| 259 | 259 | } |
| 260 | - $right_width = 12-$left_width; |
|
| 260 | + $right_width = 12 - $left_width; |
|
| 261 | 261 | echo ' |
| 262 | 262 | <div class="row"> |
| 263 | 263 | <div class="col-sm-'.$left_width.'"> |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | // use extra = "name=x" |
| 282 | 282 | // call forum_focus(x, foo) after defining the field |
| 283 | 283 | // |
| 284 | -function form_start($action, $method='get', $extra='') { |
|
| 284 | +function form_start($action, $method = 'get', $extra = '') { |
|
| 285 | 285 | echo sprintf( |
| 286 | 286 | '<div class="container-fluid"> |
| 287 | 287 | <form class="form-horizontal" method="%s" action="%s" %s>' |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | // just the input field |
| 314 | 314 | // |
| 315 | 315 | function form_input_text_field( |
| 316 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
| 316 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
| 317 | 317 | ) { |
| 318 | 318 | return sprintf( |
| 319 | 319 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | // the whole row |
| 325 | 325 | // |
| 326 | 326 | function form_input_text( |
| 327 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
| 327 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
| 328 | 328 | ) { |
| 329 | 329 | echo sprintf(' |
| 330 | 330 | <div class="form-group"> |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
| 355 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
| 356 | 356 | echo sprintf(' |
| 357 | 357 | <div class="form-group"> |
| 358 | 358 | <label align=right class="%s" for="%s">%s</label> |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | // $items is either a string of <option> elements, or an array |
| 370 | 370 | // |
| 371 | -function form_select($label, $name, $items, $selected=null) { |
|
| 371 | +function form_select($label, $name, $items, $selected = null) { |
|
| 372 | 372 | echo sprintf(' |
| 373 | 373 | <div class="form-group"> |
| 374 | 374 | <label align=right class="%s" for="%s">%s</label> |
@@ -381,7 +381,7 @@ discard block |
||
| 381 | 381 | foreach ($items as $i) { |
| 382 | 382 | echo sprintf( |
| 383 | 383 | '<option %s value=%s>%s</option>', |
| 384 | - ($i[0]==$selected)?'selected':'', |
|
| 384 | + ($i[0] == $selected) ? 'selected' : '', |
|
| 385 | 385 | $i[0], $i[1] |
| 386 | 386 | ); |
| 387 | 387 | } |
@@ -394,7 +394,7 @@ discard block |
||
| 394 | 394 | // same, for multiple select. |
| 395 | 395 | // $selected, if non-null, is a list of selected values |
| 396 | 396 | // |
| 397 | -function form_select_multiple($label, $name, $items, $selected=null) { |
|
| 397 | +function form_select_multiple($label, $name, $items, $selected = null) { |
|
| 398 | 398 | echo sprintf(' |
| 399 | 399 | <div class="form-group"> |
| 400 | 400 | <label align=right class="%s" for="%s">%s</label> |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | foreach ($items as $i) { |
| 407 | 407 | echo sprintf( |
| 408 | 408 | '<option %s value=%s>%s</option>', |
| 409 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
| 409 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
| 410 | 410 | $i[0], $i[1] |
| 411 | 411 | ); |
| 412 | 412 | } |
@@ -415,12 +415,12 @@ discard block |
||
| 415 | 415 | |
| 416 | 416 | // return a list of string for checkbox items |
| 417 | 417 | // |
| 418 | -function checkbox_item_strings($items, $attrs='') { |
|
| 418 | +function checkbox_item_strings($items, $attrs = '') { |
|
| 419 | 419 | $x = []; |
| 420 | 420 | foreach ($items as $i) { |
| 421 | 421 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
| 422 | 422 | ', |
| 423 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
| 423 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
| 424 | 424 | ); |
| 425 | 425 | } |
| 426 | 426 | return $x; |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | |
| 429 | 429 | // $items is list of (name, label, checked) |
| 430 | 430 | // |
| 431 | -function form_checkboxes($label, $items, $attrs='') { |
|
| 431 | +function form_checkboxes($label, $items, $attrs = '') { |
|
| 432 | 432 | echo sprintf(' |
| 433 | 433 | <div class="form-group"> |
| 434 | 434 | <label align=right class="%s">%s</label> |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
| 455 | 455 | ); |
| 456 | 456 | foreach ($items as $i) { |
| 457 | - $checked = ($selected == $i[0])?"checked":""; |
|
| 457 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
| 458 | 458 | echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br> |
| 459 | 459 | ', |
| 460 | 460 | $name, $i[0], $checked, $i[1] |
@@ -487,7 +487,7 @@ discard block |
||
| 487 | 487 | '; |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | -function form_submit($text, $attrs='') { |
|
| 490 | +function form_submit($text, $attrs = '') { |
|
| 491 | 491 | form_general( |
| 492 | 492 | "", |
| 493 | 493 | sprintf( |
@@ -497,7 +497,7 @@ discard block |
||
| 497 | 497 | ); |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | -function form_checkbox($label, $name, $checked=false) { |
|
| 500 | +function form_checkbox($label, $name, $checked = false) { |
|
| 501 | 501 | echo sprintf(' |
| 502 | 502 | <div class="form-group"> |
| 503 | 503 | <label align=right class="%s">%s</label> |
@@ -508,6 +508,6 @@ discard block |
||
| 508 | 508 | echo sprintf(' |
| 509 | 509 | <input type="checkbox" name="%s" %s> |
| 510 | 510 | </div> |
| 511 | - ', $name, $checked?"checked":"" |
|
| 511 | + ', $name, $checked ? "checked" : "" |
|
| 512 | 512 | ); |
| 513 | 513 | } |