@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return $x; |
52 | 52 | } |
53 | 53 | |
54 | -function pm_team_form($user, $teamid, $error=null) { |
|
54 | +function pm_team_form($user, $teamid, $error = null) { |
|
55 | 55 | global $bbcode_html, $bbcode_js; |
56 | 56 | $team = BoincTeam::lookup_id($teamid); |
57 | 57 | if (!$team) { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | error_page("not admin"); |
62 | 62 | } |
63 | 63 | |
64 | - page_head(tra("Send message to team"),'','','', $bbcode_js); |
|
64 | + page_head(tra("Send message to team"), '', '', '', $bbcode_js); |
|
65 | 65 | |
66 | 66 | $subject = post_str("subject", true); |
67 | 67 | $content = post_str("content", true); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | function pm_form_page($replyto, $userid, $error = null) { |
114 | 114 | global $bbcode_html, $bbcode_js; |
115 | 115 | global $g_logged_in_user; |
116 | - page_head(tra("Send private message"),'','','', $bbcode_js); |
|
116 | + page_head(tra("Send private message"), '', '', '', $bbcode_js); |
|
117 | 117 | |
118 | 118 | if (post_str("preview", true) == tra("Preview")) { |
119 | 119 | $content = post_str("content", true); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if (!$user) { |
138 | 138 | error_page("Sender no longer exists"); |
139 | 139 | } |
140 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
140 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
141 | 141 | $subject = $message->subject; |
142 | 142 | if (substr($subject, 0, 3) != "re:") { |
143 | 143 | $subject = "re: ".$subject; |
@@ -156,15 +156,15 @@ discard block |
||
156 | 156 | time_str($user->prefs->banished_until) |
157 | 157 | ); |
158 | 158 | } |
159 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
159 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
160 | 160 | } else { |
161 | 161 | $writeto = sanitize_tags(post_str("to", true)); |
162 | 162 | $subject = post_str("subject", true); |
163 | 163 | $content = post_str("content", true); |
164 | 164 | } |
165 | 165 | |
166 | - $content = $content?htmlspecialchars($content):''; |
|
167 | - $subject = $subject?htmlspecialchars($subject):''; |
|
166 | + $content = $content ?htmlspecialchars($content) : ''; |
|
167 | + $subject = $subject ?htmlspecialchars($subject) : ''; |
|
168 | 168 | |
169 | 169 | if ($error != null) { |
170 | 170 | echo "<p class=\"text-danger\">".$error."</p>\n"; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | function send_pm_notification_email( |
221 | 221 | $logged_in_user, $to_user, $subject, $content |
222 | 222 | ) { |
223 | - $message = " |
|
223 | + $message = " |
|
224 | 224 | You have received a new private message at ".PROJECT.". |
225 | 225 | |
226 | 226 | From: $logged_in_user->name (ID $logged_in_user->id) |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $pm = BoincPrivateMessage::lookup_id($notify->opaque); |
251 | 251 | $from_user = BoincUser::lookup_id($pm->senderid); |
252 | 252 | if (!$pm || !$from_user) return null; |
253 | - return "<a href=pm.php>".tra("Private message%1 from %2, subject:" , "</a>", $from_user->name )." $pm->subject"; |
|
253 | + return "<a href=pm.php>".tra("Private message%1 from %2, subject:", "</a>", $from_user->name)." $pm->subject"; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | function pm_send_msg($from_user, $to_user, $subject, $content, $send_email) { |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | |
315 | 315 | function pm_email_remind($user) { |
316 | 316 | if (!$user->prefs->pm_notification) { |
317 | - return "<br><small>" . |
|
317 | + return "<br><small>". |
|
318 | 318 | tra( |
319 | 319 | "For email notification, %1 edit community prefs %2", |
320 | 320 | '<a href="edit_forum_preferences_form.php">', '</a>' |
321 | - ) . |
|
321 | + ). |
|
322 | 322 | "</small>" |
323 | 323 | ; |
324 | 324 | } |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | |
33 | 33 | function sched_log_name($x) { |
34 | 34 | if ($x == 0) return "NO_SUCH_LOG"; |
35 | - return gmdate('Y-m-d_H/Y-m-d_H:i', $x) . ".txt"; |
|
35 | + return gmdate('Y-m-d_H/Y-m-d_H:i', $x).".txt"; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | function sched_log_link($x) { |
39 | 39 | if (file_exists("sched_logs")) { |
40 | - return "<a href=\"../sched_logs/" . sched_log_name($x) . "\">" . time_str($x) . "</a>"; |
|
40 | + return "<a href=\"../sched_logs/".sched_log_name($x)."\">".time_str($x)."</a>"; |
|
41 | 41 | } else { |
42 | 42 | return time_str($x); |
43 | 43 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | function location_form($host) { |
47 | 47 | $none = "selected"; |
48 | - $h=$w=$s=$m=""; |
|
48 | + $h = $w = $s = $m = ""; |
|
49 | 49 | if ($host->venue == "home") $h = "selected"; |
50 | 50 | if ($host->venue == "work") $w = "selected"; |
51 | 51 | if ($host->venue == "school") $s = "selected"; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | row2(tra("Product name"), $host->product_name); |
100 | 100 | } |
101 | 101 | $x = $host->timezone/3600; |
102 | - if ($x >= 0) $x="+$x"; |
|
102 | + if ($x >= 0) $x = "+$x"; |
|
103 | 103 | row2(tra("Local Standard Time"), tra("UTC %1 hours", $x)); |
104 | 104 | } else { |
105 | 105 | $owner = BoincUser::lookup_id($host->userid); |
@@ -293,20 +293,20 @@ discard block |
||
293 | 293 | // Older clients may have the old-style serialnum in the DB |
294 | 294 | // despite the server being upgraded. |
295 | 295 | // |
296 | -function vbox_desc($parsed_ser){ |
|
296 | +function vbox_desc($parsed_ser) { |
|
297 | 297 | if (empty($parsed_ser['vbox'])) return '---'; |
298 | 298 | $f = $parsed_ser['vbox']; |
299 | 299 | $desc = sprintf('Virtualbox (%s) %s', |
300 | 300 | $f[1], tra("installed") |
301 | 301 | ); |
302 | - if (sizeof($f)<=2){ |
|
302 | + if (sizeof($f) <= 2) { |
|
303 | 303 | return $desc; |
304 | 304 | } |
305 | - if ($f[2]=="1" and $f[3]=="1") { |
|
305 | + if ($f[2] == "1" and $f[3] == "1") { |
|
306 | 306 | return $desc.tra(", CPU has hardware virtualization support and it is enabled"); |
307 | - } elseif ($f[2]=="1" and $f[3]=="0") { |
|
307 | + } elseif ($f[2] == "1" and $f[3] == "0") { |
|
308 | 308 | return $desc.tra(", CPU has hardware virtualization support but it is disabled"); |
309 | - } elseif ($f[2]=="0") { |
|
309 | + } elseif ($f[2] == "0") { |
|
310 | 310 | return $desc.tra(", CPU does not have hardware virtualization support"); |
311 | 311 | } |
312 | 312 | return $desc; |
@@ -331,13 +331,13 @@ discard block |
||
331 | 331 | |
332 | 332 | // return a human-readable version of the GPU info |
333 | 333 | // |
334 | -function gpu_desc($parsed_ser, $detail=true) { |
|
334 | +function gpu_desc($parsed_ser, $detail = true) { |
|
335 | 335 | $str = ""; |
336 | 336 | foreach ($parsed_ser as $d) { |
337 | 337 | if (!is_gpu_type($d[0])) continue; |
338 | 338 | if (count($d) < 4) continue; |
339 | 339 | if ($str) $str .= "<p>"; |
340 | - if ($d[2]!="" && $d[2]!="1") $str .= "[".$d[2]."] "; |
|
340 | + if ($d[2] != "" && $d[2] != "1") $str .= "[".$d[2]."] "; |
|
341 | 341 | if ($d[0] == "CUDA") { |
342 | 342 | $str .= "NVIDIA"; |
343 | 343 | } else if ($d[0] == "CAL") { |
@@ -543,14 +543,14 @@ discard block |
||
543 | 543 | if ($pos1 === false) return $x; |
544 | 544 | $pos2 = strpos($model, ']'); |
545 | 545 | if ($pos2 === false) return $x; |
546 | - $a = substr($model, $pos1+1, $pos2-$pos1-1); |
|
546 | + $a = substr($model, $pos1 + 1, $pos2 - $pos1 - 1); |
|
547 | 547 | $y = explode(" ", $a); |
548 | 548 | if (count($y) == 0) return $x; |
549 | 549 | if ($y[0] == "Family") { |
550 | 550 | $x->info = $a; |
551 | 551 | } else { |
552 | 552 | $x->arch = $y[0]; |
553 | - $x->info = substr($a, strlen($y[0])+1); |
|
553 | + $x->info = substr($a, strlen($y[0]) + 1); |
|
554 | 554 | } |
555 | 555 | return $x; |
556 | 556 | } |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | $avg_time = 0; |
640 | 640 | |
641 | 641 | $results = BoincResult::enum("hostid=$hostid order by received_time"); |
642 | - foreach($results as $result) { |
|
642 | + foreach ($results as $result) { |
|
643 | 643 | if ($result->granted_credit <= 0) continue; |
644 | 644 | $total += $result->granted_credit; |
645 | 645 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | |
733 | 733 | function link_url($sort, $rev, $show_all) { |
734 | 734 | global $userid; |
735 | - $x = $userid ? "&userid=$userid":""; |
|
735 | + $x = $userid ? "&userid=$userid" : ""; |
|
736 | 736 | return "hosts_user.php?sort=$sort&rev=$rev&show_all=$show_all$x"; |
737 | 737 | } |
738 | 738 | |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | } |
807 | 807 | |
808 | 808 | function show_user_hosts($userid, $private, $show_all, $sort, $rev) { |
809 | - $desc = false; // whether the sort order's default is decreasing |
|
809 | + $desc = false; // whether the sort order's default is decreasing |
|
810 | 810 | switch ($sort) { |
811 | 811 | case "total_credit": $sort_clause = "total_credit"; $desc = true; break; |
812 | 812 | case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break; |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | more_or_less($sort, $rev, $show_all); |
830 | 830 | |
831 | 831 | $now = time(); |
832 | - $old_hosts=0; |
|
832 | + $old_hosts = 0; |
|
833 | 833 | $i = 1; |
834 | 834 | $hosts = BoincHost::enum("userid=$userid order by $sort_clause"); |
835 | 835 | $any_product_name = false; |
@@ -841,9 +841,9 @@ discard block |
||
841 | 841 | } |
842 | 842 | user_host_table_start($private, $sort, $rev, $show_all, $any_product_name); |
843 | 843 | foreach ($hosts as $host) { |
844 | - $is_old=false; |
|
844 | + $is_old = false; |
|
845 | 845 | if (($now - $host->rpc_time) > 30*86400) { |
846 | - $is_old=true; |
|
846 | + $is_old = true; |
|
847 | 847 | $old_hosts++; |
848 | 848 | } |
849 | 849 | if (!$show_all && $is_old) continue; |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | } |
853 | 853 | end_table(); |
854 | 854 | |
855 | - if ($old_hosts>0) { |
|
855 | + if ($old_hosts > 0) { |
|
856 | 856 | more_or_less($sort, $rev, $show_all); |
857 | 857 | } |
858 | 858 |
@@ -293,13 +293,13 @@ |
||
293 | 293 | // Older clients may have the old-style serialnum in the DB |
294 | 294 | // despite the server being upgraded. |
295 | 295 | // |
296 | -function vbox_desc($parsed_ser){ |
|
296 | +function vbox_desc($parsed_ser) { |
|
297 | 297 | if (empty($parsed_ser['vbox'])) return '---'; |
298 | 298 | $f = $parsed_ser['vbox']; |
299 | 299 | $desc = sprintf('Virtualbox (%s) %s', |
300 | 300 | $f[1], tra("installed") |
301 | 301 | ); |
302 | - if (sizeof($f)<=2){ |
|
302 | + if (sizeof($f)<=2) { |
|
303 | 303 | return $desc; |
304 | 304 | } |
305 | 305 | if ($f[2]=="1" and $f[3]=="1") { |
@@ -459,7 +459,7 @@ |
||
459 | 459 | |
460 | 460 | $is_assim_move = is_assim_move($app); |
461 | 461 | |
462 | - page_head("Batch $batch_id"); |
|
462 | + page_head("batch $batch_id"); |
|
463 | 463 | text_start(800); |
464 | 464 | start_table(); |
465 | 465 | row2("name", $batch->name); |
@@ -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> |
@@ -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 |
@@ -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; |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // output a panel. |
227 | 227 | // $content_func is a function that generates the panel contents |
228 | 228 | // |
229 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { |
|
229 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { |
|
230 | 230 | echo sprintf('<div class="panel %s"> |
231 | 231 | ', $class |
232 | 232 | ); |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | // $left_width is the width of left column in 1/12 units. |
254 | 254 | // $arg is passed to the functions. |
255 | 255 | // |
256 | -function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) { |
|
256 | +function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) { |
|
257 | 257 | echo ' |
258 | 258 | <div class="container-fluid"> |
259 | 259 | '; |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | </div> |
269 | 269 | '; |
270 | 270 | } |
271 | - $right_width = 12-$left_width; |
|
271 | + $right_width = 12 - $left_width; |
|
272 | 272 | echo ' |
273 | 273 | <div class="row"> |
274 | 274 | <div class="col-sm-'.$left_width.'"> |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | // use extra = "name=x" |
293 | 293 | // call forum_focus(x, foo) after defining the field |
294 | 294 | // |
295 | -function form_start($action, $method='get', $extra='') { |
|
295 | +function form_start($action, $method = 'get', $extra = '') { |
|
296 | 296 | echo sprintf( |
297 | 297 | '<div class="container-fluid"> |
298 | 298 | <form class="form-horizontal" method="%s" action="%s" %s>' |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | // just the input field |
325 | 325 | // |
326 | 326 | function form_input_text_field( |
327 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
327 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
328 | 328 | ) { |
329 | 329 | return sprintf( |
330 | 330 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | // the whole row |
336 | 336 | // |
337 | 337 | function form_input_text( |
338 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
338 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
339 | 339 | ) { |
340 | 340 | echo sprintf(' |
341 | 341 | <div class="form-group"> |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | ); |
364 | 364 | } |
365 | 365 | |
366 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
366 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
367 | 367 | echo sprintf(' |
368 | 368 | <div class="form-group"> |
369 | 369 | <label align=right class="%s" for="%s">%s</label> |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | // $items is either a string of <option> elements, |
381 | 381 | // or an array of [value, name] pairs |
382 | 382 | // |
383 | -function form_select($label, $name, $items, $selected=null) { |
|
383 | +function form_select($label, $name, $items, $selected = null) { |
|
384 | 384 | echo sprintf(' |
385 | 385 | <div class="form-group"> |
386 | 386 | <label align=right class="%s" for="%s">%s</label> |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | foreach ($items as $i) { |
394 | 394 | echo sprintf( |
395 | 395 | '<option %s value=%s>%s</option>', |
396 | - ($i[0]==$selected)?'selected':'', |
|
396 | + ($i[0] == $selected) ? 'selected' : '', |
|
397 | 397 | $i[0], $i[1] |
398 | 398 | ); |
399 | 399 | } |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | // same, for multiple select. |
407 | 407 | // $selected, if non-null, is a list of selected values |
408 | 408 | // |
409 | -function form_select_multiple($label, $name, $items, $selected=null, $size=0) { |
|
409 | +function form_select_multiple($label, $name, $items, $selected = null, $size = 0) { |
|
410 | 410 | echo sprintf(' |
411 | 411 | <div class="form-group"> |
412 | 412 | <label align=right class="%s" for="%s">%s</label> |
@@ -418,7 +418,7 @@ discard block |
||
418 | 418 | foreach ($items as $i) { |
419 | 419 | echo sprintf( |
420 | 420 | '<option %s value=%s>%s</option>', |
421 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
421 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
422 | 422 | $i[0], $i[1] |
423 | 423 | ); |
424 | 424 | } |
@@ -427,12 +427,12 @@ discard block |
||
427 | 427 | |
428 | 428 | // return a list of strings for checkbox items |
429 | 429 | // |
430 | -function checkbox_item_strings($items, $attrs='') { |
|
430 | +function checkbox_item_strings($items, $attrs = '') { |
|
431 | 431 | $x = []; |
432 | 432 | foreach ($items as $i) { |
433 | 433 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
434 | 434 | ', |
435 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
435 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
436 | 436 | ); |
437 | 437 | } |
438 | 438 | return $x; |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | |
441 | 441 | // $items is list of (name, label, checked) |
442 | 442 | // |
443 | -function form_checkboxes($label, $items, $attrs='') { |
|
443 | +function form_checkboxes($label, $items, $attrs = '') { |
|
444 | 444 | echo sprintf(' |
445 | 445 | <div class="form-group"> |
446 | 446 | <label align=right class="%s">%s</label> |
@@ -459,7 +459,7 @@ discard block |
||
459 | 459 | // |
460 | 460 | function form_radio_buttons( |
461 | 461 | $label, $name, $items, $selected, |
462 | - $assign_ids=false // assign IDs to buttons based on names |
|
462 | + $assign_ids = false // assign IDs to buttons based on names |
|
463 | 463 | ) { |
464 | 464 | echo sprintf(' |
465 | 465 | <div class="form-group"> |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
470 | 470 | ); |
471 | 471 | foreach ($items as $i) { |
472 | - $checked = ($selected == $i[0])?"checked":""; |
|
472 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
473 | 473 | if ($assign_ids) { |
474 | 474 | $id = sprintf('id="%s_%s"', $name, $i[0]); |
475 | 475 | } else { |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | '; |
508 | 508 | } |
509 | 509 | |
510 | -function form_submit($text, $attrs='') { |
|
510 | +function form_submit($text, $attrs = '') { |
|
511 | 511 | form_general( |
512 | 512 | "", |
513 | 513 | sprintf( |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | ); |
518 | 518 | } |
519 | 519 | |
520 | -function form_checkbox($label, $name, $checked=false) { |
|
520 | +function form_checkbox($label, $name, $checked = false) { |
|
521 | 521 | echo sprintf(' |
522 | 522 | <div class="form-group"> |
523 | 523 | <label align=right class="%s">%s</label> |
@@ -529,7 +529,7 @@ discard block |
||
529 | 529 | <input type="checkbox" name="%s" %s> |
530 | 530 | </div> |
531 | 531 | </div> |
532 | - ', $name, $checked?"checked":"" |
|
532 | + ', $name, $checked ? "checked" : "" |
|
533 | 533 | ); |
534 | 534 | } |
535 | 535 | |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | // $selected is the list of selected values. |
558 | 558 | // $extra is e.g. id=foo |
559 | 559 | // |
560 | -function form_select2_multi($label, $name, $items, $selected=null, $extra='') { |
|
560 | +function form_select2_multi($label, $name, $items, $selected = null, $extra = '') { |
|
561 | 561 | echo sprintf(' |
562 | 562 | <div class="form-group"> |
563 | 563 | <label align=right class="%s" for="%s">%s</label> |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | foreach ($items as $i) { |
570 | 570 | echo sprintf( |
571 | 571 | '<option %s value=%s>%s</option>', |
572 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
572 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
573 | 573 | $i[0], $i[1] |
574 | 574 | ); |
575 | 575 | } |
@@ -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 | } |
@@ -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 | } |
@@ -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]; |