@@ -31,7 +31,7 @@ |
||
31 | 31 | function reg_form() { |
32 | 32 | $config = get_config(); |
33 | 33 | $disable_acct = parse_bool($config, "disable_account_creation"); |
34 | - page_head("Register", null, null, null, boinc_recaptcha_get_head_extra()); |
|
34 | + page_head("Register", null, null, null, boinc_recaptcha_get_head_extra()); |
|
35 | 35 | echo "<h3>Create an account</h3>"; |
36 | 36 | form_start("create_account_action.php", "post"); |
37 | 37 | create_account_form(0, "download_software.php"); |
@@ -58,10 +58,10 @@ |
||
58 | 58 | //panel(null, 'panel_contents'); |
59 | 59 | } |
60 | 60 | |
61 | -function left(){ |
|
61 | +function left() { |
|
62 | 62 | global $user, $no_web_account_creation, $project_id; |
63 | 63 | panel( |
64 | - $user?tra("Welcome, %1", $user->name):tra("What is %1?", PROJECT), |
|
64 | + $user ?tra("Welcome, %1", $user->name) : tra("What is %1?", PROJECT), |
|
65 | 65 | function() use($user) { |
66 | 66 | global $no_web_account_creation, $project_id; |
67 | 67 | if ($user) { |
@@ -58,7 +58,7 @@ |
||
58 | 58 | //panel(null, 'panel_contents'); |
59 | 59 | } |
60 | 60 | |
61 | -function left(){ |
|
61 | +function left() { |
|
62 | 62 | global $user, $no_web_account_creation, $project_id; |
63 | 63 | panel( |
64 | 64 | $user?tra("Welcome, %1", $user->name):tra("What is %1?", PROJECT), |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | // If $selection is provided, and if it matches one of the entries in the file, |
33 | 33 | // it will be selected by default. |
34 | 34 | // |
35 | -function show_combo_box($name, $filename, $selection=null) { |
|
35 | +function show_combo_box($name, $filename, $selection = null) { |
|
36 | 36 | echo "<select name=\"$name\" class=\"form-control\">\n"; |
37 | 37 | |
38 | 38 | $file = fopen($filename, "r"); |
@@ -63,14 +63,14 @@ discard block |
||
63 | 63 | <tr><td colspan=2> |
64 | 64 | <table border=0 cellpadding=5 |
65 | 65 | <tr> |
66 | -<td valign=top><a href=\"" . IMAGE_URL . $profile->userid . '.jpg' . "\"><img src=\"" . IMAGE_URL . $profile->userid . '_sm.jpg' . "\"></a> |
|
66 | +<td valign=top><a href=\"" . IMAGE_URL.$profile->userid.'.jpg'."\"><img src=\"".IMAGE_URL.$profile->userid.'_sm.jpg'."\"></a> |
|
67 | 67 | </td> |
68 | -<td valign=top>" .tra("%1 Your profile picture is shown to the left.", $warning) ." |
|
68 | +<td valign=top>" .tra("%1 Your profile picture is shown to the left.", $warning)." |
|
69 | 69 | <p>". |
70 | -tra("To replace it, click the \"Browse\" button and select a JPEG or PNG file (%1 or less).", "50KB") ."<br /> |
|
70 | +tra("To replace it, click the \"Browse\" button and select a JPEG or PNG file (%1 or less).", "50KB")."<br /> |
|
71 | 71 | <input name=picture type=file><br> |
72 | 72 | <p>". |
73 | -tra("To remove it from your profile, check this box:") . " |
|
73 | +tra("To remove it from your profile, check this box:")." |
|
74 | 74 | <input type=checkbox name=delete_pic> |
75 | 75 | <p> |
76 | 76 | </td></tr>"; |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | end_table(); |
79 | 79 | echo "</td></tr>"; |
80 | 80 | } else { |
81 | - rowify(tra("If you would like include a picture with your profile, click the \"Browse\" button and select a JPEG or PNG file. Please select images of %1 or less.", "50KB") . " |
|
81 | + rowify(tra("If you would like include a picture with your profile, click the \"Browse\" button and select a JPEG or PNG file. Please select images of %1 or less.", "50KB")." |
|
82 | 82 | <p> |
83 | 83 | <input name=picture type=file> |
84 | 84 | "); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | row1(tra("Language")); |
94 | 94 | echo "<tr><td> |
95 | 95 | <p>" . |
96 | - tra("Select the language in which your profile is written:") . " |
|
96 | + tra("Select the language in which your profile is written:")." |
|
97 | 97 | <p> |
98 | 98 | "; |
99 | 99 | if (isset($profile->language)) { |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | if (recaptcha_public_key()) { |
110 | 110 | table_row(boinc_recaptcha_get_html(recaptcha_public_key())); |
111 | 111 | } |
112 | - table_row("<p><input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Create/edit profile") ."\" name=\"submit\">"); |
|
112 | + table_row("<p><input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Create/edit profile")."\" name=\"submit\">"); |
|
113 | 113 | } |
114 | 114 | |
115 | 115 | // Returns an array containing: |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | |
124 | 124 | // Determine if the filetype uploaded is supported. |
125 | 125 | // TODO: Change these to constants. |
126 | - switch($size[2]) { |
|
126 | + switch ($size[2]) { |
|
127 | 127 | case '2': // JPEG |
128 | 128 | $image = imageCreateFromJPEG($fileName); |
129 | 129 | break; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | |
161 | 161 | function show_description() { |
162 | 162 | echo " |
163 | - <p>" .tra("Your %1 profile %2 lets you share your opinions and background with the %3 community.", "<b>", "</b>", PROJECT) . " |
|
163 | + <p>" .tra("Your %1 profile %2 lets you share your opinions and background with the %3 community.", "<b>", "</b>", PROJECT)." |
|
164 | 164 | <p> |
165 | 165 | "; |
166 | 166 | } |
@@ -178,14 +178,14 @@ discard block |
||
178 | 178 | row1(show_profile_heading1()); |
179 | 179 | rowify(show_profile_question1().bbcode_info()); |
180 | 180 | show_textarea("response1", $response1); |
181 | - row1( show_profile_heading2()); |
|
182 | - rowify( show_profile_question2().bbcode_info()); |
|
181 | + row1(show_profile_heading2()); |
|
182 | + rowify(show_profile_question2().bbcode_info()); |
|
183 | 183 | show_textarea("response2", $response2); |
184 | 184 | show_language_selection($profile); |
185 | 185 | } |
186 | 186 | |
187 | 187 | function show_textarea($name, $text) { |
188 | - rowify("<textarea name=\"$name\" class=\"form-control\" rows=\"10\">" . $text . "</textarea>"); |
|
188 | + rowify("<textarea name=\"$name\" class=\"form-control\" rows=\"10\">".$text."</textarea>"); |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | // $profile is null if user doesn't already have a profile. |
@@ -229,8 +229,8 @@ discard block |
||
229 | 229 | $delete_pic = "off"; |
230 | 230 | } |
231 | 231 | |
232 | - if (strlen($response1)==0 && |
|
233 | - strlen($response2)==0 && |
|
232 | + if (strlen($response1) == 0 && |
|
233 | + strlen($response2) == 0 && |
|
234 | 234 | $delete_pic != "on" && |
235 | 235 | !is_uploaded_file($_FILES['picture']['tmp_name']) |
236 | 236 | ) { |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | $profile->verification = 0; |
245 | 245 | } |
246 | 246 | |
247 | - $profile ? $has_picture = $profile->has_picture: $has_picture = false; |
|
247 | + $profile ? $has_picture = $profile->has_picture : $has_picture = false; |
|
248 | 248 | |
249 | 249 | if (is_uploaded_file($_FILES['picture']['tmp_name'])) { |
250 | 250 | $has_picture = true; |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | |
260 | 260 | // Write the original image file to disk. |
261 | 261 | // TODO: define a constant for image quality. |
262 | - ImageJPEG($images[0], IMAGE_PATH . $user->id . '.jpg'); |
|
263 | - ImageJPEG($images[1], IMAGE_PATH . $user->id . '_sm.jpg'); |
|
262 | + ImageJPEG($images[0], IMAGE_PATH.$user->id.'.jpg'); |
|
263 | + ImageJPEG($images[1], IMAGE_PATH.$user->id.'_sm.jpg'); |
|
264 | 264 | } |
265 | 265 | $response1 = sanitize_html($response1); |
266 | 266 | $response2 = sanitize_html($response2); |
267 | 267 | |
268 | - $has_picture = $has_picture?1:0; |
|
268 | + $has_picture = $has_picture ? 1 : 0; |
|
269 | 269 | if ($profile) { |
270 | 270 | $query = " response1 = '".BoincDb::escape_string($response1)."'," |
271 | 271 | ." response2 = '".BoincDb::escape_string($response2)."'," |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | page_tail(); |
308 | 308 | } |
309 | 309 | |
310 | -function show_profile_form($profile, $warning=null) { |
|
310 | +function show_profile_form($profile, $warning = null) { |
|
311 | 311 | if ($profile) { |
312 | 312 | page_head(tra("Edit your profile"), null, null, null, boinc_recaptcha_get_head_extra()); |
313 | 313 | } else { |
@@ -93,9 +93,9 @@ |
||
93 | 93 | global $job_keywords; |
94 | 94 | $kw = $job_keywords[$id]; |
95 | 95 | $u = $uprefs[$id]; |
96 | - $yes_checked = ($u == KW_YES)?"checked":""; |
|
97 | - $no_checked = ($u == KW_NO)?"checked":""; |
|
98 | - $maybe_checked = ($u == KW_MAYBE)?"checked":""; |
|
96 | + $yes_checked = ($u == KW_YES) ? "checked" : ""; |
|
97 | + $no_checked = ($u == KW_NO) ? "checked" : ""; |
|
98 | + $maybe_checked = ($u == KW_MAYBE) ? "checked" : ""; |
|
99 | 99 | |
100 | 100 | echo sprintf('<tr id="%s" hidden>%s', "row$id", "\n"); |
101 | 101 | echo sprintf(' <td width=50%% id="%s"></td>%s', "text$id", "\n"); |
@@ -298,7 +298,7 @@ |
||
298 | 298 | |
299 | 299 | render(); |
300 | 300 | |
301 | -EOT; |
|
301 | +eot; |
|
302 | 302 | echo "</script>\n"; |
303 | 303 | } |
304 | 304 |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | $app = BoincApp::lookup_id($ua->app_id); |
39 | 39 | $names[] = $app->name; |
40 | 40 | } |
41 | - $sub = $names?implode(', ', $names):'---'; |
|
41 | + $sub = $names ?implode(', ', $names) : '---'; |
|
42 | 42 | } |
43 | 43 | if ($u->manage_all) { |
44 | 44 | $admin = 'All applications'; |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | $app = BoincApp::lookup_id($ua->app_id); |
50 | 50 | $names[] = $app->name; |
51 | 51 | } |
52 | - $admin = $names?implode(', ', $names):'---'; |
|
52 | + $admin = $names ?implode(', ', $names) : '---'; |
|
53 | 53 | } |
54 | 54 | [$yes, $no] = read_kw_prefs($user); |
55 | 55 | global $job_keywords; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | implode('<br>', $kws), |
70 | 70 | $u->quota, |
71 | 71 | $u->max_jobs_in_progress, |
72 | - ($u->logical_start_time > time())?local_time_str($u->logical_start_time):'---' |
|
72 | + ($u->logical_start_time > time()) ?local_time_str($u->logical_start_time) : '---' |
|
73 | 73 | ); |
74 | 74 | } |
75 | 75 | |
@@ -199,18 +199,18 @@ discard block |
||
199 | 199 | $manage_apps = array_map('intval', $manage_apps); |
200 | 200 | foreach ($apps as $app) { |
201 | 201 | $s = in_array($app->id, $submit_apps); |
202 | - $m = in_array($app->id, $manage_apps)?1:0; |
|
202 | + $m = in_array($app->id, $manage_apps) ? 1 : 0; |
|
203 | 203 | if ($s || $m) { |
204 | 204 | BoincUserSubmitApp::insert( |
205 | 205 | "(user_id, app_id, manage) values ($user_id, $app->id, $m)" |
206 | 206 | ); |
207 | 207 | } |
208 | 208 | } |
209 | - $quota = (double) get_str('quota'); |
|
209 | + $quota = (double)get_str('quota'); |
|
210 | 210 | if ($quota != $us->quota) { |
211 | 211 | $us->update("quota=$quota"); |
212 | 212 | } |
213 | - $mj = (int) get_str('max_jobs_in_progress'); |
|
213 | + $mj = (int)get_str('max_jobs_in_progress'); |
|
214 | 214 | if ($mj != $us->max_jobs_in_progress) { |
215 | 215 | $us->update("max_jobs_in_progress=$mj"); |
216 | 216 | } |
@@ -31,14 +31,14 @@ |
||
31 | 31 | if (file_exists($path)) { |
32 | 32 | $x = file($path); |
33 | 33 | $yes = explode(' ', trim($x[0])); |
34 | - if ($yes[0]=='') $yes=[]; |
|
34 | + if ($yes[0] == '') $yes = []; |
|
35 | 35 | $yes = array_map('intval', $yes); |
36 | 36 | $no = explode(' ', trim($x[1])); |
37 | - if ($no[0]=='') $no=[]; |
|
37 | + if ($no[0] == '') $no = []; |
|
38 | 38 | $no = array_map('intval', $no); |
39 | 39 | return [$yes, $no]; |
40 | 40 | } else { |
41 | - return [[],[]]; |
|
41 | + return [[], []]; |
|
42 | 42 | } |
43 | 43 | } |
44 | 44 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | |
33 | 33 | function boinc_recaptcha_get_html($publickey) { |
34 | 34 | if ($publickey) { |
35 | - return '<div class="g-recaptcha" data-sitekey="' . $publickey . '"></div>'; |
|
35 | + return '<div class="g-recaptcha" data-sitekey="'.$publickey.'"></div>'; |
|
36 | 36 | } else { |
37 | 37 | return ''; |
38 | 38 | } |
@@ -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_days * 86400. |
|
289 | + $variant_desc->max_delay_days*86400. |
|
290 | 290 | ); |
291 | 291 | |
292 | 292 | $x .= " </workunit>\n<input_template>\n"; |
@@ -476,8 +476,8 @@ discard block |
||
476 | 476 | } |
477 | 477 | } |
478 | 478 | |
479 | -function app_form($desc=null) { |
|
480 | - page_head_select2($desc?"Edit BUDA app $desc->name":'Create BUDA app'); |
|
479 | +function app_form($desc = null) { |
|
480 | + page_head_select2($desc ? "Edit BUDA app $desc->name" : 'Create BUDA app'); |
|
481 | 481 | form_start('buda.php'); |
482 | 482 | form_input_hidden('action', 'app_action'); |
483 | 483 | if ($desc) { |
@@ -488,22 +488,22 @@ discard block |
||
488 | 488 | form_input_text('Internal name<br><small>No spaces</small>', 'name'); |
489 | 489 | } |
490 | 490 | form_input_text('User-visible name', 'long_name', |
491 | - $desc?$desc->long_name:null |
|
491 | + $desc ? $desc->long_name : null |
|
492 | 492 | ); |
493 | 493 | form_input_textarea( |
494 | 494 | 'Description<br><small>... of what the app does and of the research goals</small>', |
495 | 495 | 'description', |
496 | - $desc?$desc->description:null |
|
496 | + $desc ? $desc->description : null |
|
497 | 497 | ); |
498 | 498 | form_select2_multi('Science keywords', |
499 | 499 | 'sci_kw', |
500 | 500 | keyword_select_options(KW_CATEGORY_SCIENCE), |
501 | - $desc?$desc->sci_kw:null |
|
501 | + $desc ? $desc->sci_kw : null |
|
502 | 502 | ); |
503 | 503 | form_input_text( |
504 | 504 | 'URL of web page describing app', |
505 | 505 | 'url', |
506 | - !empty($desc->url)?$desc->url:'' |
|
506 | + !empty($desc->url) ? $desc->url : '' |
|
507 | 507 | ); |
508 | 508 | // don't include location keywords; |
509 | 509 | // various people may submit jobs to this app |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | } else { |
226 | 226 | form_input_text("Plan class$pc", 'variant', $variant); |
227 | 227 | } |
228 | - form_select("Dockerfile$sb", 'dockerfile', $sbitems, $variant_desc->dockerfile); |
|
228 | + form_select("dockerfile$sb", 'dockerfile', $sbitems, $variant_desc->dockerfile); |
|
229 | 229 | form_select2_multi("Application files$sb", 'app_files', $sbitems, $variant_desc->app_files); |
230 | 230 | form_input_text( |
231 | 231 | 'Input file names<br><small>Space-separated</small>', |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | // Note: we don't currently allow indirect file access. |
435 | 435 | // If we did, we'd need to create job.toml to mount project dir |
436 | 436 | |
437 | - app_list("Variant $variant added for app $app."); |
|
437 | + app_list("variant $variant added for app $app."); |
|
438 | 438 | } |
439 | 439 | |
440 | 440 | function variant_delete() { |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | if ($ret) { |
462 | 462 | error_page("delete failed"); |
463 | 463 | } |
464 | - $notice = "Variant $variant of app $app removed."; |
|
464 | + $notice = "variant $variant of app $app removed."; |
|
465 | 465 | app_list($notice); |
466 | 466 | } else { |
467 | 467 | page_head("Confirm"); |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | if ($ret) { |
492 | 492 | error_page('delete failed'); |
493 | 493 | } |
494 | - $notice = "App $app removed."; |
|
494 | + $notice = "app $app removed."; |
|
495 | 495 | app_list($notice); |
496 | 496 | } else { |
497 | 497 | page_head('Confirm'); |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | } |
557 | 557 | $dir = "$buda_root/$name"; |
558 | 558 | if (file_exists($dir)) { |
559 | - error_page("App $name already exists."); |
|
559 | + error_page("app $name already exists."); |
|
560 | 560 | } |
561 | 561 | mkdir($dir); |
562 | 562 | $desc->user_id = $user->id; |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | |
542 | 542 | $is_assim_move = is_assim_move($app); |
543 | 543 | |
544 | - page_head("Batch $batch_id"); |
|
544 | + page_head("batch $batch_id"); |
|
545 | 545 | text_start(800); |
546 | 546 | start_table(); |
547 | 547 | row2("name", $batch->name); |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | |
818 | 818 | if (get_int('confirmed', true)) { |
819 | 819 | retire_batch($batch); |
820 | - page_head("Batch $batch_id retired"); |
|
820 | + page_head("batch $batch_id retired"); |
|
821 | 821 | return_link(); |
822 | 822 | page_tail(); |
823 | 823 | } else { |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | if ($owner) { |
669 | 669 | row2('submitter', $owner->name); |
670 | 670 | } |
671 | - row2("application", $app?$app->name:'---'); |
|
671 | + row2("application", $app ? $app->name : '---'); |
|
672 | 672 | row2("state", batch_state_string($batch->state)); |
673 | 673 | //row2("# jobs", $batch->njobs); |
674 | 674 | //row2("# error jobs", $batch->nerror_jobs); |
@@ -758,11 +758,11 @@ discard block |
||
758 | 758 | "GFLOPS-hours" |
759 | 759 | ]; |
760 | 760 | row_heading_array($x); |
761 | - foreach($wus as $wu) { |
|
761 | + foreach ($wus as $wu) { |
|
762 | 762 | if ($status && $wu->status != $status) continue; |
763 | 763 | $y = ''; |
764 | 764 | $c = '---'; |
765 | - switch($wu->status) { |
|
765 | + switch ($wu->status) { |
|
766 | 766 | case WU_SUCCESS: |
767 | 767 | $resultid = $wu->canonical_resultid; |
768 | 768 | $y = sprintf('<font color="%s">completed</font>', COLOR_SUCCESS); |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | $results = BoincResult::enum("workunitid=$wuid"); |
843 | 843 | $upload_dir = parse_config(get_config(), "<upload_dir>"); |
844 | 844 | $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); |
845 | - foreach($results as $result) { |
|
845 | + foreach ($results as $result) { |
|
846 | 846 | $x = [ |
847 | 847 | "<a href=result.php?resultid=$result->id>$result->id</a>", |
848 | 848 | state_string($result) |
@@ -851,7 +851,7 @@ discard block |
||
851 | 851 | if ($result->server_state == RESULT_SERVER_STATE_OVER) { |
852 | 852 | $phys_names = get_outfile_phys_names($result); |
853 | 853 | $log_names = get_outfile_log_names($result); |
854 | - for ($i=0; $i<count($phys_names); $i++) { |
|
854 | + for ($i = 0; $i < count($phys_names); $i++) { |
|
855 | 855 | if ($is_assim_move) { |
856 | 856 | // file is in |
857 | 857 | // project/results/<batchid>/<wu_name>__file_<log_name> |