@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | form_input_hidden('app', $app); |
199 | 199 | form_input_hidden('action', 'variant_action'); |
200 | 200 | form_input_text("Plan class$pc", 'variant'); |
201 | - form_select("Dockerfile$sb", 'dockerfile', $sbitems); |
|
201 | + form_select("dockerfile$sb", 'dockerfile', $sbitems); |
|
202 | 202 | form_select2_multi("Application files$sb", 'app_files', $sbitems, null); |
203 | 203 | form_input_text( |
204 | 204 | 'Input file names<br><small>Space-separated</small>', |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | // Note: we don't currently allow indirect file access. |
384 | 384 | // If we did, we'd need to create job.toml to mount project dir |
385 | 385 | |
386 | - app_list("Variant $variant added for app $app."); |
|
386 | + app_list("variant $variant added for app $app."); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | function variant_delete() { |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | if ($ret) { |
411 | 411 | error_page("delete failed"); |
412 | 412 | } |
413 | - $notice = "Variant $variant of app $app removed."; |
|
413 | + $notice = "variant $variant of app $app removed."; |
|
414 | 414 | app_list($notice); |
415 | 415 | } else { |
416 | 416 | page_head("Confirm"); |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | if ($ret) { |
441 | 441 | error_page('delete failed'); |
442 | 442 | } |
443 | - $notice = "App $app removed."; |
|
443 | + $notice = "app $app removed."; |
|
444 | 444 | app_list($notice); |
445 | 445 | } else { |
446 | 446 | page_head('Confirm'); |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | } |
506 | 506 | $dir = "$buda_root/$name"; |
507 | 507 | if (file_exists($dir)) { |
508 | - error_page("App $name already exists."); |
|
508 | + error_page("app $name already exists."); |
|
509 | 509 | } |
510 | 510 | mkdir($dir); |
511 | 511 | $desc->user_id = $user->id; |
@@ -54,7 +54,7 @@ discard block |
||
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 |
||
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 |
||
286 | 286 | ); |
287 | 287 | |
288 | 288 | $x .= sprintf(" <max_delay>%f</max_delay>\n", |
289 | - $variant_desc->max_delay * 86400. |
|
289 | + $variant_desc->max_delay*86400. |
|
290 | 290 | ); |
291 | 291 | |
292 | 292 | $x .= " </workunit>\n<input_template>\n"; |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | } |
468 | 468 | } |
469 | 469 | |
470 | -function app_form($desc=null) { |
|
471 | - page_head_select2($desc?"Edit BUDA app $desc->name":'Create BUDA app'); |
|
470 | +function app_form($desc = null) { |
|
471 | + page_head_select2($desc ? "Edit BUDA app $desc->name" : 'Create BUDA app'); |
|
472 | 472 | form_start('buda.php'); |
473 | 473 | form_input_hidden('action', 'app_action'); |
474 | 474 | if ($desc) { |
@@ -479,22 +479,22 @@ discard block |
||
479 | 479 | form_input_text('Internal name<br><small>No spaces</small>', 'name'); |
480 | 480 | } |
481 | 481 | form_input_text('User-visible name', 'long_name', |
482 | - $desc?$desc->long_name:null |
|
482 | + $desc ? $desc->long_name : null |
|
483 | 483 | ); |
484 | 484 | form_input_textarea( |
485 | 485 | 'Description<br><small>... of what the app does and of the research goals</small>', |
486 | 486 | 'description', |
487 | - $desc?$desc->description:null |
|
487 | + $desc ? $desc->description : null |
|
488 | 488 | ); |
489 | 489 | form_select2_multi('Science keywords', |
490 | 490 | 'sci_kw', |
491 | 491 | keyword_select_options(KW_CATEGORY_SCIENCE), |
492 | - $desc?$desc->sci_kw:null |
|
492 | + $desc ? $desc->sci_kw : null |
|
493 | 493 | ); |
494 | 494 | form_input_text( |
495 | 495 | 'URL of web page describing app', |
496 | 496 | 'url', |
497 | - $desc?$desc->url:'' |
|
497 | + $desc ? $desc->url : '' |
|
498 | 498 | ); |
499 | 499 | // don't include location keywords; |
500 | 500 | // various people may submit jobs to this app |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $desc->long_name, |
38 | 38 | $desc->description, |
39 | 39 | kw_array_to_str($desc->sci_kw), |
40 | - empty($desc->url)?'':"<a href=$desc->url>View</a>", |
|
40 | + empty($desc->url) ? '' : "<a href=$desc->url>View</a>", |
|
41 | 41 | 'Yes' |
42 | 42 | ); |
43 | 43 | } |
@@ -24,72 +24,72 @@ discard block |
||
24 | 24 | define('KW_CATEGORY_SCIENCE', 0); |
25 | 25 | define('KW_CATEGORY_LOC', 1); |
26 | 26 | |
27 | -define('KW_ASTRONOMY', 1); |
|
28 | -define('KW_SETI', 2); |
|
29 | -define('KW_PULSARS', 3); |
|
30 | -define('KW_GW', 4); |
|
31 | -define('KW_COSMOLOGY', 5); |
|
32 | -define('KW_PHYSICS', 6); |
|
27 | +define('KW_ASTRONOMY', 1); |
|
28 | +define('KW_SETI', 2); |
|
29 | +define('KW_PULSARS', 3); |
|
30 | +define('KW_GW', 4); |
|
31 | +define('KW_COSMOLOGY', 5); |
|
32 | +define('KW_PHYSICS', 6); |
|
33 | 33 | define('KW_PARTICLE_PHYSICS', 7); |
34 | -define('KW_NANOSCIENCE', 8); |
|
35 | -define('KW_BIOMED', 9); |
|
34 | +define('KW_NANOSCIENCE', 8); |
|
35 | +define('KW_BIOMED', 9); |
|
36 | 36 | define('KW_DRUG_DISCOVERY', 10); |
37 | -define('KW_PROTEINS', 11); |
|
38 | -define('KW_GENETICS', 12); |
|
39 | -define('KW_DISEASE', 13); |
|
40 | -define('KW_CANCER', 14); |
|
41 | -define('KW_MATH_CS', 15); |
|
42 | -define('KW_AI', 16); |
|
43 | -define('KW_OCEANIA', 17); |
|
44 | -define('KW_AUSTRALIA', 18); |
|
37 | +define('KW_PROTEINS', 11); |
|
38 | +define('KW_GENETICS', 12); |
|
39 | +define('KW_DISEASE', 13); |
|
40 | +define('KW_CANCER', 14); |
|
41 | +define('KW_MATH_CS', 15); |
|
42 | +define('KW_AI', 16); |
|
43 | +define('KW_OCEANIA', 17); |
|
44 | +define('KW_AUSTRALIA', 18); |
|
45 | 45 | |
46 | -define('KW_EUROPE', 20); |
|
47 | -define('KW_GERMANY', 21); |
|
48 | -define('KW_ASIA', 22); |
|
49 | -define('KW_AMERICAS', 23); |
|
50 | -define('KW_US', 24); |
|
51 | -define('KW_UCB', 25); |
|
52 | -define('KW_AEI', 26); |
|
53 | -define('KW_CERN', 27); |
|
54 | -define('KW_UW', 28); |
|
55 | -define('KW_EARTH_SCI', 29); |
|
56 | -define('KW_SPAIN', 30); |
|
57 | -define('KW_SAN_JORGE', 31); |
|
58 | -define('KW_NUMBER_THEORY', 32); |
|
59 | -define('KW_CRYPTO', 33); |
|
60 | -define('KW_ENV_RESEARCH', 34); |
|
61 | -define('KW_CLIMATE', 35); |
|
62 | -define('KW_CZECH', 36); |
|
46 | +define('KW_EUROPE', 20); |
|
47 | +define('KW_GERMANY', 21); |
|
48 | +define('KW_ASIA', 22); |
|
49 | +define('KW_AMERICAS', 23); |
|
50 | +define('KW_US', 24); |
|
51 | +define('KW_UCB', 25); |
|
52 | +define('KW_AEI', 26); |
|
53 | +define('KW_CERN', 27); |
|
54 | +define('KW_UW', 28); |
|
55 | +define('KW_EARTH_SCI', 29); |
|
56 | +define('KW_SPAIN', 30); |
|
57 | +define('KW_SAN_JORGE', 31); |
|
58 | +define('KW_NUMBER_THEORY', 32); |
|
59 | +define('KW_CRYPTO', 33); |
|
60 | +define('KW_ENV_RESEARCH', 34); |
|
61 | +define('KW_CLIMATE', 35); |
|
62 | +define('KW_CZECH', 36); |
|
63 | 63 | define('KW_CHARLES_PRAGUE', 37); |
64 | -define('KW_RECHENKRAFT', 38); |
|
65 | -define('KW_RHEINMAIN', 39); |
|
66 | -define('KW_HUNGARY', 40); |
|
67 | -define('KW_IRELAND', 41); |
|
68 | -define('KW_UC_DUBLIN', 42); |
|
69 | -define('KW_POLAND', 43); |
|
70 | -define('KW_RUSSIA', 44); |
|
64 | +define('KW_RECHENKRAFT', 38); |
|
65 | +define('KW_RHEINMAIN', 39); |
|
66 | +define('KW_HUNGARY', 40); |
|
67 | +define('KW_IRELAND', 41); |
|
68 | +define('KW_UC_DUBLIN', 42); |
|
69 | +define('KW_POLAND', 43); |
|
70 | +define('KW_RUSSIA', 44); |
|
71 | 71 | define('KW_SW_STATE_RUSSIA', 45); |
72 | -define('KW_RAS', 46); |
|
73 | -define('KW_PRBB', 47); |
|
74 | -define('KW_UK', 48); |
|
75 | -define('KW_OXFORD', 49); |
|
76 | -define('KW_CHINA', 50); |
|
77 | -define('KW_U_DAYTON', 51); |
|
78 | -define('KW_WRIGHT_STATE', 52); |
|
79 | -define('KW_USC', 53); |
|
80 | -define('KW_FULLERTON', 54); |
|
81 | -define('KW_ARIZONA_STATE', 55); |
|
82 | -define('KW_U_ILLINOIS', 56); |
|
83 | -define('KW_U_WARSAW', 57); |
|
84 | -define('KW_RPI', 58); |
|
85 | -define('KW_INTERNATIONAL', 59); |
|
86 | -define('KW_UND', 60); |
|
87 | -define('KW_HOLLAND', 61); |
|
88 | -define('KW_CHEMISTRY', 62); |
|
89 | -define('KW_GAMES', 63); |
|
90 | -define('KW_VIRUS', 64); |
|
91 | -define('KW_FRANCE', 65); |
|
92 | -define('KW_CANADA', 66); |
|
72 | +define('KW_RAS', 46); |
|
73 | +define('KW_PRBB', 47); |
|
74 | +define('KW_UK', 48); |
|
75 | +define('KW_OXFORD', 49); |
|
76 | +define('KW_CHINA', 50); |
|
77 | +define('KW_U_DAYTON', 51); |
|
78 | +define('KW_WRIGHT_STATE', 52); |
|
79 | +define('KW_USC', 53); |
|
80 | +define('KW_FULLERTON', 54); |
|
81 | +define('KW_ARIZONA_STATE', 55); |
|
82 | +define('KW_U_ILLINOIS', 56); |
|
83 | +define('KW_U_WARSAW', 57); |
|
84 | +define('KW_RPI', 58); |
|
85 | +define('KW_INTERNATIONAL', 59); |
|
86 | +define('KW_UND', 60); |
|
87 | +define('KW_HOLLAND', 61); |
|
88 | +define('KW_CHEMISTRY', 62); |
|
89 | +define('KW_GAMES', 63); |
|
90 | +define('KW_VIRUS', 64); |
|
91 | +define('KW_FRANCE', 65); |
|
92 | +define('KW_CANADA', 66); |
|
93 | 93 | |
94 | 94 | $job_keywords = array(); |
95 | 95 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | } |
332 | 332 | |
333 | -function kw_options($id, $indent='') { |
|
333 | +function kw_options($id, $indent = '') { |
|
334 | 334 | global $job_keywords; |
335 | 335 | $kw = $job_keywords[$id]; |
336 | 336 | $opts = [[$id, "$indent$kw->name"]]; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | return $kw->name; |
348 | 348 | } |
349 | 349 | |
350 | -function kw_array_to_str($kws, $sep='<br>') { |
|
350 | +function kw_array_to_str($kws, $sep = '<br>') { |
|
351 | 351 | $x = array_map('strval', $kws); |
352 | 352 | $x = array_map('kw_id_to_name', $x); |
353 | 353 | return implode($sep, $x); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $app = BoincApp::lookup_id($ua->app_id); |
37 | 37 | $names[] = $app->name; |
38 | 38 | } |
39 | - $sub = $names?implode(', ', $names):'---'; |
|
39 | + $sub = $names ?implode(', ', $names) : '---'; |
|
40 | 40 | } |
41 | 41 | if ($u->manage_all) { |
42 | 42 | $admin = 'All applications'; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $app = BoincApp::lookup_id($ua->app_id); |
48 | 48 | $names[] = $app->name; |
49 | 49 | } |
50 | - $admin = $names?implode(', ', $names):'---'; |
|
50 | + $admin = $names ?implode(', ', $names) : '---'; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | table_row( |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $admin, |
60 | 60 | $u->quota, |
61 | 61 | $u->max_jobs_in_progress, |
62 | - ($u->logical_start_time > time())?local_time_str($u->logical_start_time):'---' |
|
62 | + ($u->logical_start_time > time()) ?local_time_str($u->logical_start_time) : '---' |
|
63 | 63 | ); |
64 | 64 | } |
65 | 65 | |
@@ -184,18 +184,18 @@ discard block |
||
184 | 184 | $manage_apps = array_map('intval', $manage_apps); |
185 | 185 | foreach ($apps as $app) { |
186 | 186 | $s = in_array($app->id, $submit_apps); |
187 | - $m = in_array($app->id, $manage_apps)?1:0; |
|
187 | + $m = in_array($app->id, $manage_apps) ? 1 : 0; |
|
188 | 188 | if ($s || $m) { |
189 | 189 | BoincUserSubmitApp::insert( |
190 | 190 | "(user_id, app_id, manage) values ($user_id, $app->id, $m)" |
191 | 191 | ); |
192 | 192 | } |
193 | 193 | } |
194 | - $quota = (double) get_str('quota'); |
|
194 | + $quota = (double)get_str('quota'); |
|
195 | 195 | if ($quota != $us->quota) { |
196 | 196 | $us->update("quota=$quota"); |
197 | 197 | } |
198 | - $mj = (int) get_str('max_jobs_in_progress'); |
|
198 | + $mj = (int)get_str('max_jobs_in_progress'); |
|
199 | 199 | if ($mj != $us->max_jobs_in_progress) { |
200 | 200 | $us->update("max_jobs_in_progress=$mj"); |
201 | 201 | } |
@@ -210,7 +210,7 @@ |
||
210 | 210 | ]; |
211 | 211 | } else { |
212 | 212 | $x[] = [ |
213 | - "Manage $app->name", |
|
213 | + "manage $app->name", |
|
214 | 214 | "manage_project.php" |
215 | 215 | ]; |
216 | 216 | } |
@@ -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 | $master_url = master_url(); |
@@ -246,7 +246,7 @@ discard block |
||
246 | 246 | // output a panel. |
247 | 247 | // $content_func is a function that generates the panel contents |
248 | 248 | // |
249 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { |
|
249 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { |
|
250 | 250 | echo sprintf('<div class="panel %s"> |
251 | 251 | ', $class |
252 | 252 | ); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | // $left_width is the width of left column in 1/12 units. |
274 | 274 | // $arg is passed to the functions. |
275 | 275 | // |
276 | -function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) { |
|
276 | +function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) { |
|
277 | 277 | echo ' |
278 | 278 | <div class="container-fluid"> |
279 | 279 | '; |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | </div> |
289 | 289 | '; |
290 | 290 | } |
291 | - $right_width = 12-$left_width; |
|
291 | + $right_width = 12 - $left_width; |
|
292 | 292 | echo ' |
293 | 293 | <div class="row"> |
294 | 294 | <div class="col-sm-'.$left_width.'"> |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | // use extra = "name=x" |
313 | 313 | // call forum_focus(x, foo) after defining the field |
314 | 314 | // |
315 | -function form_start($action, $method='get', $extra='') { |
|
315 | +function form_start($action, $method = 'get', $extra = '') { |
|
316 | 316 | echo sprintf( |
317 | 317 | '<div class="container-fluid"> |
318 | 318 | <form class="form-horizontal" method="%s" action="%s" %s>' |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | // just the input field |
345 | 345 | // |
346 | 346 | function form_input_text_field( |
347 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
347 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
348 | 348 | ) { |
349 | 349 | return sprintf( |
350 | 350 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -355,7 +355,7 @@ discard block |
||
355 | 355 | // the whole row |
356 | 356 | // |
357 | 357 | function form_input_text( |
358 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
358 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
359 | 359 | ) { |
360 | 360 | echo sprintf(' |
361 | 361 | <div class="form-group"> |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | ); |
384 | 384 | } |
385 | 385 | |
386 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
386 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
387 | 387 | echo sprintf(' |
388 | 388 | <div class="form-group"> |
389 | 389 | <label align=right class="%s" for="%s">%s</label> |
@@ -400,7 +400,7 @@ discard block |
||
400 | 400 | // $items is either a string of <option> elements, |
401 | 401 | // or an array of [value, name] pairs |
402 | 402 | // |
403 | -function form_select($label, $name, $items, $selected=null) { |
|
403 | +function form_select($label, $name, $items, $selected = null) { |
|
404 | 404 | echo sprintf(' |
405 | 405 | <div class="form-group"> |
406 | 406 | <label align=right class="%s" for="%s">%s</label> |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | foreach ($items as $i) { |
414 | 414 | echo sprintf( |
415 | 415 | '<option %s value=%s>%s</option>', |
416 | - ($i[0]==$selected)?'selected':'', |
|
416 | + ($i[0] == $selected) ? 'selected' : '', |
|
417 | 417 | $i[0], $i[1] |
418 | 418 | ); |
419 | 419 | } |
@@ -426,7 +426,7 @@ discard block |
||
426 | 426 | // same, for multiple select. |
427 | 427 | // $selected, if non-null, is a list of selected values |
428 | 428 | // |
429 | -function form_select_multiple($label, $name, $items, $selected=null, $size=0) { |
|
429 | +function form_select_multiple($label, $name, $items, $selected = null, $size = 0) { |
|
430 | 430 | echo sprintf(' |
431 | 431 | <div class="form-group"> |
432 | 432 | <label align=right class="%s" for="%s">%s</label> |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | foreach ($items as $i) { |
439 | 439 | echo sprintf( |
440 | 440 | '<option %s value=%s>%s</option>', |
441 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
441 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
442 | 442 | $i[0], $i[1] |
443 | 443 | ); |
444 | 444 | } |
@@ -447,12 +447,12 @@ discard block |
||
447 | 447 | |
448 | 448 | // return a list of strings for checkbox items |
449 | 449 | // |
450 | -function checkbox_item_strings($items, $attrs='') { |
|
450 | +function checkbox_item_strings($items, $attrs = '') { |
|
451 | 451 | $x = []; |
452 | 452 | foreach ($items as $i) { |
453 | 453 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
454 | 454 | ', |
455 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
455 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
456 | 456 | ); |
457 | 457 | } |
458 | 458 | return $x; |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | |
461 | 461 | // $items is list of (name, label, checked) |
462 | 462 | // |
463 | -function form_checkboxes($label, $items, $attrs='') { |
|
463 | +function form_checkboxes($label, $items, $attrs = '') { |
|
464 | 464 | echo sprintf(' |
465 | 465 | <div class="form-group"> |
466 | 466 | <label align=right class="%s">%s</label> |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | // |
480 | 480 | function form_radio_buttons( |
481 | 481 | $label, $name, $items, $selected, |
482 | - $assign_ids=false // assign IDs to buttons based on names |
|
482 | + $assign_ids = false // assign IDs to buttons based on names |
|
483 | 483 | ) { |
484 | 484 | echo sprintf(' |
485 | 485 | <div class="form-group"> |
@@ -489,7 +489,7 @@ discard block |
||
489 | 489 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
490 | 490 | ); |
491 | 491 | foreach ($items as $i) { |
492 | - $checked = ($selected == $i[0])?"checked":""; |
|
492 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
493 | 493 | if ($assign_ids) { |
494 | 494 | $id = sprintf('id="%s_%s"', $name, $i[0]); |
495 | 495 | } else { |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | '; |
528 | 528 | } |
529 | 529 | |
530 | -function form_submit($text, $attrs='') { |
|
530 | +function form_submit($text, $attrs = '') { |
|
531 | 531 | form_general( |
532 | 532 | "", |
533 | 533 | sprintf( |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | ); |
538 | 538 | } |
539 | 539 | |
540 | -function form_checkbox($label, $name, $checked=false) { |
|
540 | +function form_checkbox($label, $name, $checked = false) { |
|
541 | 541 | echo sprintf(' |
542 | 542 | <div class="form-group"> |
543 | 543 | <label align=right class="%s">%s</label> |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | <input type="checkbox" name="%s" %s> |
550 | 550 | </div> |
551 | 551 | </div> |
552 | - ', $name, $checked?"checked":"" |
|
552 | + ', $name, $checked ? "checked" : "" |
|
553 | 553 | ); |
554 | 554 | } |
555 | 555 | |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | // $selected is the list of selected values. |
578 | 578 | // $extra is e.g. id=foo |
579 | 579 | // |
580 | -function form_select2_multi($label, $name, $items, $selected=null, $extra='') { |
|
580 | +function form_select2_multi($label, $name, $items, $selected = null, $extra = '') { |
|
581 | 581 | echo sprintf(' |
582 | 582 | <div class="form-group"> |
583 | 583 | <label align=right class="%s" for="%s">%s</label> |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | foreach ($items as $i) { |
590 | 590 | echo sprintf( |
591 | 591 | '<option %s value=%s>%s</option>', |
592 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
592 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
593 | 593 | $i[0], $i[1] |
594 | 594 | ); |
595 | 595 | } |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | foreach ($res_in_prog as $res) { |
179 | 179 | $wus_in_prog[$res->workunitid] = true; |
180 | 180 | } |
181 | - unset($res_in_progress); // does this do anything? |
|
181 | + unset($res_in_progress); // does this do anything? |
|
182 | 182 | |
183 | 183 | $fp_total = 0; |
184 | 184 | $fp_done = 0; |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | // get the total size of output files of a batch |
321 | 321 | // |
322 | 322 | function batch_output_file_size($batchid) { |
323 | - $batch_td_size=0; |
|
323 | + $batch_td_size = 0; |
|
324 | 324 | $wus = BoincWorkunit::enum("batch=$batchid"); |
325 | 325 | $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); |
326 | 326 | $upload_dir = parse_config(get_config(), "<upload_dir>"); |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | } |
351 | 351 | |
352 | 352 | function boinc_get_wu_output_files_url($user, $wu_id) { |
353 | - $auth_str = md5($user->authenticator.$wu_id); |
|
353 | + $auth_str = md5($user->authenticator.$wu_id); |
|
354 | 354 | return "get_output.php?cmd=workunit_files&wu_id=$wu_id&auth_str=$auth_str"; |
355 | 355 | } |
356 | 356 | |
@@ -384,7 +384,7 @@ discard block |
||
384 | 384 | if (!file_exists($path)) return null; |
385 | 385 | $x = file_get_contents($path); |
386 | 386 | $n = sscanf($x, "%s %d", $md5, $size); |
387 | - if ($n != 2 || strlen($md5)!=32) { |
|
387 | + if ($n != 2 || strlen($md5) != 32) { |
|
388 | 388 | return null; |
389 | 389 | } |
390 | 390 | return [$md5, $size]; |
@@ -362,12 +362,12 @@ |
||
362 | 362 | $db = BoincDb::get(); |
363 | 363 | return $db->enum('result', 'BoincResult', $where_clause); |
364 | 364 | } |
365 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
365 | + static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
366 | 366 | $db = BoincDb::get(); |
367 | - return $db->enum_fields( |
|
367 | + return $db->enum_fields( |
|
368 | 368 | 'result', 'BoincResult', $fields, $where_clause, $order_clause |
369 | 369 | ); |
370 | - } |
|
370 | + } |
|
371 | 371 | function update($clause) { |
372 | 372 | $db = BoincDb::get(); |
373 | 373 | return $db->update($this, 'result', $clause); |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | // close() closes the connection. |
45 | 45 | |
46 | 46 | class BoincDb { |
47 | - static $instance; // a DbConn object, or null |
|
48 | - static $dbnum; // which replica we're connected to |
|
47 | + static $instance; // a DbConn object, or null |
|
48 | + static $dbnum; // which replica we're connected to |
|
49 | 49 | |
50 | 50 | // connect to DB $dbnum (0, 1, ...) |
51 | 51 | // If the requested DB doesn't exist or connection fails, connect to DB 0. |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | self::$instance = null; |
57 | 57 | $config = get_config(); |
58 | 58 | if ($dbnum) { |
59 | - $r = $dbnum==1?'':strval($dbnum); |
|
59 | + $r = $dbnum == 1 ? '' : strval($dbnum); |
|
60 | 60 | $host = parse_config($config, sprintf('<replica%s_db_host>', $r)); |
61 | 61 | $name = parse_config($config, sprintf('<replica%s_db_name>', $r)); |
62 | 62 | $user = parse_config($config, sprintf('<replica%s_db_user>', $r)); |
@@ -204,11 +204,11 @@ discard block |
||
204 | 204 | $db = BoincDb::get(); |
205 | 205 | return $db->update($this, 'user', $clause); |
206 | 206 | } |
207 | - static function enum($where_clause, $order_clause=null) { |
|
207 | + static function enum($where_clause, $order_clause = null) { |
|
208 | 208 | $db = BoincDb::get(); |
209 | 209 | return $db->enum('user', 'BoincUser', $where_clause, $order_clause); |
210 | 210 | } |
211 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
211 | + static function enum_fields($fields, $where_clause, $order_clause = null) { |
|
212 | 212 | $db = BoincDb::get(); |
213 | 213 | return $db->enum_fields( |
214 | 214 | 'user', 'BoincUser', $fields, $where_clause, $order_clause |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | $db = BoincDb::get(); |
259 | 259 | return $db->update($this, 'team', $clause); |
260 | 260 | } |
261 | - static function enum($where_clause, $order_clause=null) { |
|
261 | + static function enum($where_clause, $order_clause = null) { |
|
262 | 262 | $db = BoincDb::get(); |
263 | 263 | return $db->enum('team', 'BoincTeam', $where_clause, $order_clause); |
264 | 264 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $db = BoincDb::get(); |
284 | 284 | return $db->max('team', $field); |
285 | 285 | } |
286 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
286 | + static function enum_fields($fields, $where_clause, $order_clause = null) { |
|
287 | 287 | $db = BoincDb::get(); |
288 | 288 | return $db->enum_fields( |
289 | 289 | 'team', 'BoincTeam', $fields, $where_clause, $order_clause |
@@ -321,11 +321,11 @@ discard block |
||
321 | 321 | $db = BoincDb::get(); |
322 | 322 | return $db->delete($this, 'host'); |
323 | 323 | } |
324 | - static function enum($where_clause, $order_clause=null) { |
|
324 | + static function enum($where_clause, $order_clause = null) { |
|
325 | 325 | $db = BoincDb::get(); |
326 | 326 | return $db->enum('host', 'BoincHost', $where_clause, $order_clause); |
327 | 327 | } |
328 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
328 | + static function enum_fields($fields, $where_clause, $order_clause = null) { |
|
329 | 329 | $db = BoincDb::get(); |
330 | 330 | return $db->enum_fields( |
331 | 331 | 'host', 'BoincHost', $fields, $where_clause, $order_clause |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | $db = BoincDb::get(); |
363 | 363 | return $db->enum('result', 'BoincResult', $where_clause); |
364 | 364 | } |
365 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
365 | + static function enum_fields($fields, $where_clause, $order_clause = null) { |
|
366 | 366 | $db = BoincDb::get(); |
367 | 367 | return $db->enum_fields( |
368 | 368 | 'result', 'BoincResult', $fields, $where_clause, $order_clause |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | $db = BoincDb::get(); |
412 | 412 | return $db->enum('workunit', 'BoincWorkunit', $where_clause); |
413 | 413 | } |
414 | - static function enum_fields($fields, $where_clause, $order_clause=null) { |
|
414 | + static function enum_fields($fields, $where_clause, $order_clause = null) { |
|
415 | 415 | $db = BoincDb::get(); |
416 | 416 | return $db->enum_fields('workunit', 'BoincWorkunit', $fields, $where_clause, $order_clause); |
417 | 417 | } |
@@ -453,7 +453,7 @@ discard block |
||
453 | 453 | $db = BoincDb::get(); |
454 | 454 | return $db->update($this, 'app', $clause); |
455 | 455 | } |
456 | - static function sum($field, $clause=null) { |
|
456 | + static function sum($field, $clause = null) { |
|
457 | 457 | $db = BoincDb::get(); |
458 | 458 | return $db->sum('app', $field, $clause); |
459 | 459 | } |
@@ -511,11 +511,11 @@ discard block |
||
511 | 511 | $db = BoincDb::get(); |
512 | 512 | return $db->insert('profile', $clause); |
513 | 513 | } |
514 | - static function enum($where_clause=null, $order_clause=null) { |
|
514 | + static function enum($where_clause = null, $order_clause = null) { |
|
515 | 515 | $db = BoincDb::get(); |
516 | 516 | return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause); |
517 | 517 | } |
518 | - static function enum_fields($fields, $where_clause=null, $order_clause=null) { |
|
518 | + static function enum_fields($fields, $where_clause = null, $order_clause = null) { |
|
519 | 519 | $db = BoincDb::get(); |
520 | 520 | return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause); |
521 | 521 | } |
@@ -910,12 +910,12 @@ discard block |
||
910 | 910 | return $db->enum('consent', 'BoincConsent', $where_clause); |
911 | 911 | } |
912 | 912 | |
913 | - static function insert ($clause) { |
|
913 | + static function insert($clause) { |
|
914 | 914 | $db = BoincDb::get(); |
915 | 915 | return $db->insert('consent', $clause); |
916 | 916 | } |
917 | 917 | |
918 | - static function update ($clause) { |
|
918 | + static function update($clause) { |
|
919 | 919 | $db = BoincDb::get(); |
920 | 920 | return $db->update_aux('consent', $clause); |
921 | 921 | } |
@@ -940,17 +940,17 @@ discard block |
||
940 | 940 | return $db->lookup('consent_type', 'BoincConsentType', $clause); |
941 | 941 | } |
942 | 942 | |
943 | - static function enum($where_clause, $order_clause=null) { |
|
943 | + static function enum($where_clause, $order_clause = null) { |
|
944 | 944 | $db = BoincDb::get(); |
945 | 945 | return $db->enum('consent_type', 'BoincConsentType', $where_clause, $order_clause); |
946 | 946 | } |
947 | 947 | |
948 | - static function insert ($clause) { |
|
948 | + static function insert($clause) { |
|
949 | 949 | $db = BoincDb::get(); |
950 | 950 | return $db->insert('consent_type', $clause); |
951 | 951 | } |
952 | 952 | |
953 | - static function update ($clause) { |
|
953 | + static function update($clause) { |
|
954 | 954 | $db = BoincDb::get(); |
955 | 955 | return $db->update_aux('consent_type', $clause); |
956 | 956 | } |
@@ -976,7 +976,7 @@ discard block |
||
976 | 976 | return $db->lookup('latest_consent', 'BoincLatestConsent', $clause); |
977 | 977 | } |
978 | 978 | |
979 | - static function enum($where_clause, $order_clause=null) { |
|
979 | + static function enum($where_clause, $order_clause = null) { |
|
980 | 980 | $db = BoincDb::get(); |
981 | 981 | return $db->enum('latest_consent', 'BoincLatestConsent', $where_clause, $order_clause); |
982 | 982 | } |
@@ -987,7 +987,7 @@ discard block |
||
987 | 987 | // apply this to any user-supplied strings used in queries |
988 | 988 | // |
989 | 989 | function boinc_real_escape_string($x) { |
990 | - if (version_compare(phpversion(),"4.3.0")>=0) { |
|
990 | + if (version_compare(phpversion(), "4.3.0") >= 0) { |
|
991 | 991 | return BoincDb::escape_string($x); |
992 | 992 | } else { |
993 | 993 | $x = str_replace("'", "\'", $x); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $host = BoincHost::lookup_id($res->hostid); |
36 | 36 | $hosts[$res->hostid] = $host; |
37 | 37 | } |
38 | - $fpops = $res->cpu_time * $host->p_fpops; |
|
38 | + $fpops = $res->cpu_time*$host->p_fpops; |
|
39 | 39 | $samples[] = $res->cpu_time; |
40 | 40 | //$fpops /= 1e9; |
41 | 41 | //echo "$res->cpu_time $fpops\n"; |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | } |
46 | 46 | |
47 | 47 | function show($samples) { |
48 | - $x = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]; |
|
48 | + $x = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; |
|
49 | 49 | foreach ($samples as $s) { |
50 | 50 | $x[(int)log10($s)] += 1; |
51 | 51 | } |
52 | - for ($i=0; $i<16; $i++) { |
|
52 | + for ($i = 0; $i < 16; $i++) { |
|
53 | 53 | echo sprintf("%d: %d\n", $i, $x[$i]); |
54 | 54 | } |
55 | 55 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | // |
85 | 85 | function unzip_batch_file($user, $batch_file) { |
86 | 86 | @mkdir("../../buda_batches"); |
87 | - for ($i=0; $i<1000; $i++) { |
|
87 | + for ($i = 0; $i < 1000; $i++) { |
|
88 | 88 | $batch_dir = "../../buda_batches/$i"; |
89 | 89 | $batch_dir_name = $i; |
90 | 90 | $ret = @mkdir($batch_dir); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | } |
136 | 136 | $job_files = []; |
137 | 137 | $cmdline = ''; |
138 | - foreach(scandir("$batch_dir/$fname") as $f2) { |
|
138 | + foreach (scandir("$batch_dir/$fname") as $f2) { |
|
139 | 139 | if ($f2[0] == '.') continue; |
140 | 140 | if ($f2 == 'cmdline') { |
141 | 141 | $cmdline = trim(file_get_contents("$batch_dir/$fname/cmdline")); |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | function stage_input_files($batch_dir, $batch_desc, $batch_id) { |
186 | 186 | $n = count($batch_desc->shared_files); |
187 | 187 | $batch_desc->shared_files_phys_names = []; |
188 | - for ($i=0; $i<$n; $i++) { |
|
188 | + for ($i = 0; $i < $n; $i++) { |
|
189 | 189 | $path = sprintf('%s/%s', $batch_dir, $batch_desc->shared_files[$i]); |
190 | 190 | [$md5, $size] = $batch_desc->shared_file_infos[$i]; |
191 | 191 | $phys_name = sprintf('batch_%d_%s', $batch_id, $md5); |
@@ -195,7 +195,7 @@ discard block |
||
195 | 195 | foreach ($batch_desc->jobs as $job) { |
196 | 196 | $n = count($batch_desc->unshared_files); |
197 | 197 | $job->phys_names = []; |
198 | - for ($i=0; $i<$n; $i++) { |
|
198 | + for ($i = 0; $i < $n; $i++) { |
|
199 | 199 | $path = sprintf('%s/%s/%s', |
200 | 200 | $batch_dir, $job->dir, $batch_desc->unshared_files[$i] |
201 | 201 | ); |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | } |
244 | 244 | $wrapper_cmdline = sprintf('"--dockerfile %s %s %s"', |
245 | 245 | $variant_desc->dockerfile, |
246 | - $wrapper_verbose?'--verbose':'', |
|
246 | + $wrapper_verbose ? '--verbose' : '', |
|
247 | 247 | $cmdline |
248 | 248 | ); |
249 | 249 | $cmd = sprintf( |
@@ -289,7 +289,7 @@ discard block |
||
289 | 289 | $max_runtime_days = (double)$max_runtime_days; |
290 | 290 | if ($max_runtime_days <= 0) error_page('bad runtime limit'); |
291 | 291 | if ($max_runtime_days > 100) error_page('bad runtime limit'); |
292 | - $max_fpops = $max_runtime_days * 3.5e9 * 86400; |
|
292 | + $max_fpops = $max_runtime_days*3.5e9*86400; |
|
293 | 293 | |
294 | 294 | $exp_runtime_days = get_str('exp_runtime_days'); |
295 | 295 | if (!is_numeric($exp_runtime_days)) error_page('bad expected runtime'); |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | if ($exp_runtime_days > $max_runtime_days) { |
300 | 300 | error_page('exp must be < max runtime'); |
301 | 301 | } |
302 | - $exp_fpops = $exp_runtime_days * 3.5e9 * 86400; |
|
302 | + $exp_fpops = $exp_runtime_days*3.5e9*86400; |
|
303 | 303 | |
304 | 304 | $app_desc = get_buda_desc($app); |
305 | 305 |