@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if ($template) { |
| 60 | 60 | $t = (double)$template->workunit->rsc_fpops_est; |
| 61 | 61 | } |
| 62 | - foreach($r->batch->job as $job) { |
|
| 62 | + foreach ($r->batch->job as $job) { |
|
| 63 | 63 | $y = (double)$job->rsc_fpops_est; |
| 64 | 64 | if ($y) { |
| 65 | 65 | $x += $y; |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | function est_elapsed_time($r, $template) { |
| 86 | 86 | // crude estimate: batch FLOPs / project FLOPS |
| 87 | 87 | // |
| 88 | - return batch_flop_count($r, $template) / project_flops(); |
|
| 88 | + return batch_flop_count($r, $template)/project_flops(); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // if batch-level input template filename was given, read it; |
@@ -95,9 +95,9 @@ discard block |
||
| 95 | 95 | // |
| 96 | 96 | function read_input_template($app, $r) { |
| 97 | 97 | if ((isset($r->batch)) && (isset($r->batch->workunit_template_file)) && ($r->batch->workunit_template_file)) { |
| 98 | - $path = project_dir() . "/templates/".$r->batch->workunit_template_file; |
|
| 98 | + $path = project_dir()."/templates/".$r->batch->workunit_template_file; |
|
| 99 | 99 | } else { |
| 100 | - $path = project_dir() . "/templates/$app->name"."_in"; |
|
| 100 | + $path = project_dir()."/templates/$app->name"."_in"; |
|
| 101 | 101 | } |
| 102 | 102 | if (file_exists($path)) { |
| 103 | 103 | $x = simplexml_load_file($path); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | function validate_batch($jobs, $template) { |
| 146 | 146 | $i = 0; |
| 147 | 147 | $n = count($template->file_info); |
| 148 | - foreach($jobs as $job) { |
|
| 148 | + foreach ($jobs as $job) { |
|
| 149 | 149 | $m = count($job->input_files); |
| 150 | 150 | if ($n != $m) { |
| 151 | 151 | log_write("wrong # of input files for job $i: need $n, got $m"); |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | // stage all the files |
| 215 | 215 | // |
| 216 | 216 | function stage_files(&$jobs, $user) { |
| 217 | - foreach($jobs as $job) { |
|
| 217 | + foreach ($jobs as $job) { |
|
| 218 | 218 | foreach ($job->input_files as $file) { |
| 219 | 219 | if ($file->mode != "remote") { |
| 220 | 220 | $file->name = stage_file($file, $user); |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | // |
| 228 | 228 | function submit_jobs( |
| 229 | 229 | $jobs, $job_params, $app, $batch_id, $priority, $app_version_num, |
| 230 | - $input_template_filename, // batch-level; can also specify per job |
|
| 230 | + $input_template_filename, // batch-level; can also specify per job |
|
| 231 | 231 | $output_template_filename, |
| 232 | 232 | $user |
| 233 | 233 | ) { |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | // one line per job |
| 238 | 238 | // |
| 239 | 239 | $x = ""; |
| 240 | - foreach($jobs as $job) { |
|
| 240 | + foreach ($jobs as $job) { |
|
| 241 | 241 | if ($job->name) { |
| 242 | 242 | $x .= " --wu_name $job->name"; |
| 243 | 243 | } |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | $x .= "\n"; |
| 273 | 273 | } |
| 274 | 274 | |
| 275 | - $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
| 275 | + $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
| 276 | 276 | |
| 277 | 277 | if ($user->seti_id) { |
| 278 | 278 | $cmd .= " --target_user $user->id "; |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | // |
| 384 | 384 | function xml_get_jobs($r) { |
| 385 | 385 | $jobs = array(); |
| 386 | - foreach($r->batch->job as $j) { |
|
| 386 | + foreach ($r->batch->job as $j) { |
|
| 387 | 387 | $job = new StdClass; |
| 388 | 388 | $job->input_files = array(); |
| 389 | 389 | $job->command_line = (string)$j->command_line; |
@@ -436,16 +436,16 @@ discard block |
||
| 436 | 436 | // |
| 437 | 437 | function logical_end_time($r, $jobs, $user, $app) { |
| 438 | 438 | $total_flops = 0; |
| 439 | - foreach($jobs as $job) { |
|
| 439 | + foreach ($jobs as $job) { |
|
| 440 | 440 | //print_r($job); |
| 441 | 441 | if ($job->rsc_fpops_est) { |
| 442 | 442 | $total_flops += $job->rsc_fpops_est; |
| 443 | 443 | } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) { |
| 444 | - $total_flops += (double) $job->input_template->workunit->rsc_fpops_est; |
|
| 444 | + $total_flops += (double)$job->input_template->workunit->rsc_fpops_est; |
|
| 445 | 445 | } else if ($r->batch->job_params->rsc_fpops_est) { |
| 446 | - $total_flops += (double) $r->batch->job_params->rsc_fpops_est; |
|
| 446 | + $total_flops += (double)$r->batch->job_params->rsc_fpops_est; |
|
| 447 | 447 | } else { |
| 448 | - $x = (double) $template->workunit->rsc_fpops_est; |
|
| 448 | + $x = (double)$template->workunit->rsc_fpops_est; |
|
| 449 | 449 | if ($x) { |
| 450 | 450 | $total_flops += $x; |
| 451 | 451 | } else { |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | } |
| 454 | 454 | } |
| 455 | 455 | } |
| 456 | - $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
| 456 | + $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
| 457 | 457 | $x = exec($cmd); |
| 458 | 458 | if (!is_numeric($x) || (double)$x == 0) { |
| 459 | 459 | xml_error(-1, "$cmd returned $x"); |
@@ -538,15 +538,15 @@ discard block |
||
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | $job_params = new StdClass; |
| 541 | - $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound; |
|
| 542 | - $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est; |
|
| 543 | - $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound; |
|
| 544 | - $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound; |
|
| 545 | - $job_params->delay_bound = (double) $r->batch->job_params->delay_bound; |
|
| 541 | + $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound; |
|
| 542 | + $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est; |
|
| 543 | + $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound; |
|
| 544 | + $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound; |
|
| 545 | + $job_params->delay_bound = (double)$r->batch->job_params->delay_bound; |
|
| 546 | 546 | // could add quorum-related stuff |
| 547 | 547 | |
| 548 | - $input_template_filename = (string) $r->batch->input_template_filename; |
|
| 549 | - $output_template_filename = (string) $r->batch->output_template_filename; |
|
| 548 | + $input_template_filename = (string)$r->batch->input_template_filename; |
|
| 549 | + $output_template_filename = (string)$r->batch->output_template_filename; |
|
| 550 | 550 | // possibly empty |
| 551 | 551 | |
| 552 | 552 | submit_jobs( |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | function n_outfiles($wu) { |
| 642 | - $path = project_dir() . "/$wu->output_template_filename"; |
|
| 642 | + $path = project_dir()."/$wu->output_template_filename"; |
|
| 643 | 643 | $r = simplexml_load_file($path); |
| 644 | 644 | return count($r->file_info); |
| 645 | 645 | } |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | "; |
| 847 | 847 | if ($result->server_state == 5) { // over? |
| 848 | 848 | $paths = get_outfile_paths($result); |
| 849 | - foreach($paths as $path) { |
|
| 849 | + foreach ($paths as $path) { |
|
| 850 | 850 | if (is_file($path)) { |
| 851 | 851 | $size = filesize($path); |
| 852 | 852 | echo " <outfile> |
@@ -890,7 +890,7 @@ discard block |
||
| 890 | 890 | } else { |
| 891 | 891 | $results = BoincResult::enum("workunitid=$job_id"); |
| 892 | 892 | foreach ($results as $r) { |
| 893 | - switch($r->outcome) { |
|
| 893 | + switch ($r->outcome) { |
|
| 894 | 894 | case 1: |
| 895 | 895 | case 3: |
| 896 | 896 | case 6: |
@@ -1005,8 +1005,8 @@ discard block |
||
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | $user = check_remote_submit_permissions($r, $app); |
| 1008 | - $in = file_get_contents(project_dir() . "/templates/".$app->name."_in"); |
|
| 1009 | - $out = file_get_contents(project_dir() . "/templates/".$app->name."_out"); |
|
| 1008 | + $in = file_get_contents(project_dir()."/templates/".$app->name."_in"); |
|
| 1009 | + $out = file_get_contents(project_dir()."/templates/".$app->name."_out"); |
|
| 1010 | 1010 | if ($in === false || $out === false) { |
| 1011 | 1011 | log_write("template file missing"); |
| 1012 | 1012 | xml_error(-1, "template file missing"); |
@@ -1018,7 +1018,7 @@ discard block |
||
| 1018 | 1018 | |
| 1019 | 1019 | function ping($r) { |
| 1020 | 1020 | xml_start_tag("ping"); |
| 1021 | - BoincDb::get(); // errors out if DB down or web disabled |
|
| 1021 | + BoincDb::get(); // errors out if DB down or web disabled |
|
| 1022 | 1022 | echo "<success>1</success> |
| 1023 | 1023 | </ping> |
| 1024 | 1024 | "; |
@@ -1092,9 +1092,9 @@ discard block |
||
| 1092 | 1092 | $request_log = parse_config(get_config(), "<remote_submit_request_log>"); |
| 1093 | 1093 | if ($request_log) { |
| 1094 | 1094 | $log_dir = parse_config(get_config(), "<log_dir>"); |
| 1095 | - $request_log = $log_dir . "/" . $request_log; |
|
| 1095 | + $request_log = $log_dir."/".$request_log; |
|
| 1096 | 1096 | if ($file = fopen($request_log, "a")) { |
| 1097 | - fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $req . "\n</submit_rpc_handler>\n"); |
|
| 1097 | + fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$req."\n</submit_rpc_handler>\n"); |
|
| 1098 | 1098 | fclose($file); |
| 1099 | 1099 | } |
| 1100 | 1100 | } |
@@ -179,7 +179,7 @@ discard block |
||
| 179 | 179 | foreach ($res_in_prog as $res) { |
| 180 | 180 | $wus_in_prog[$res->workunitid] = true; |
| 181 | 181 | } |
| 182 | - unset($res_in_progress); // does this do anything? |
|
| 182 | + unset($res_in_progress); // does this do anything? |
|
| 183 | 183 | |
| 184 | 184 | $fp_total = 0; |
| 185 | 185 | $fp_done = 0; |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | // get the total size of output files of a batch |
| 353 | 353 | // |
| 354 | 354 | function batch_output_file_size($batchid) { |
| 355 | - $batch_td_size=0; |
|
| 355 | + $batch_td_size = 0; |
|
| 356 | 356 | $wus = BoincWorkunit::enum_fields( |
| 357 | 357 | 'canonical_resultid', |
| 358 | 358 | "batch=$batchid" |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | } |
| 386 | 386 | |
| 387 | 387 | function boinc_get_wu_output_files_url($user, $wu_id) { |
| 388 | - $auth_str = md5($user->authenticator.$wu_id); |
|
| 388 | + $auth_str = md5($user->authenticator.$wu_id); |
|
| 389 | 389 | return "get_output.php?cmd=workunit_files&wu_id=$wu_id&auth_str=$auth_str"; |
| 390 | 390 | } |
| 391 | 391 | |
@@ -419,7 +419,7 @@ discard block |
||
| 419 | 419 | if (!file_exists($path)) return null; |
| 420 | 420 | $x = file_get_contents($path); |
| 421 | 421 | $n = sscanf($x, "%s %d", $md5, $size); |
| 422 | - if ($n != 2 || strlen($md5)!=32) { |
|
| 422 | + if ($n != 2 || strlen($md5) != 32) { |
|
| 423 | 423 | return null; |
| 424 | 424 | } |
| 425 | 425 | return [$md5, $size]; |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | require_once('../inc/util.inc'); |
| 6 | 6 | require_once('../inc/sandbox.inc'); |
| 7 | 7 | |
| 8 | -function sb_file_select($user, $suffix=null) { |
|
| 8 | +function sb_file_select($user, $suffix = null) { |
|
| 9 | 9 | $sbfiles = sandbox_file_names($user); |
| 10 | 10 | $sbitems = []; |
| 11 | 11 | $exp = null; |
@@ -30,14 +30,14 @@ discard block |
||
| 30 | 30 | $master_url = master_url(); |
| 31 | 31 | $idx = strpos($master_url, '://'); |
| 32 | 32 | if ($idx) { |
| 33 | - $url = substr($master_url, $idx+strlen('://')); |
|
| 33 | + $url = substr($master_url, $idx + strlen('://')); |
|
| 34 | 34 | } else { |
| 35 | 35 | $url = $master_url; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | // convert invalid characters into underscores |
| 39 | 39 | // |
| 40 | -for ($i=0; $i<strlen($url); $i++) { |
|
| 40 | +for ($i = 0; $i < strlen($url); $i++) { |
|
| 41 | 41 | $c = $url[$i]; |
| 42 | 42 | if (!ctype_alnum($c) && $c != '.' && $c != '-' && $c != '_') { |
| 43 | 43 | $url[$i] = '_'; |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | |
| 47 | 47 | //remove trailing underscore(s) |
| 48 | 48 | // |
| 49 | -$account_file = "account_" . rtrim($url, '_') . ".xml"; |
|
| 49 | +$account_file = "account_".rtrim($url, '_').".xml"; |
|
| 50 | 50 | |
| 51 | 51 | page_head(tra("Account keys")); |
| 52 | 52 | text_start(); |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | <p>", |
| 59 | 59 | tra("This key can be used to:"), |
| 60 | 60 | "<ul> |
| 61 | - <li><a href=get_passwd.php>",tra("log in to your account on the web"),"</a>; |
|
| 61 | + <li><a href=get_passwd.php>",tra("log in to your account on the web"), "</a>; |
|
| 62 | 62 | <li>", |
| 63 | 63 | tra("attach a computer to your account without using the BOINC Manager. |
| 64 | 64 | To do so, install BOINC, |
| 65 | 65 | create a file named %1 in the BOINC |
| 66 | - data directory, and set its contents to:","<b>$account_file</b>")," |
|
| 66 | + data directory, and set its contents to:","<b>$account_file</b>"), " |
|
| 67 | 67 | <p><pre>", |
| 68 | 68 | htmlspecialchars( |
| 69 | 69 | "<account> |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | as described above, but cannot be used to log in to your account or change it in any way. |
| 78 | 78 | If you want to attach untrusted or insecure computers to your account, |
| 79 | 79 | do so using your weak account key. |
| 80 | - Your weak account key is:")," |
|
| 80 | + Your weak account key is:"), " |
|
| 81 | 81 | <p><pre>$weak_auth</pre><p> |
| 82 | 82 | ", |
| 83 | - tra("The key depends on your account's email address and password. If you change either of these, the weak account key will change.")," |
|
| 83 | + tra("The key depends on your account's email address and password. If you change either of these, the weak account key will change."), " |
|
| 84 | 84 | </td></tr></table>" |
| 85 | 85 | ; |
| 86 | 86 | text_end(); |
@@ -24,77 +24,77 @@ 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); |
|
| 93 | -define('KW_PSU', 67); |
|
| 94 | -define('KW_SU', 68); |
|
| 95 | -define('KW_SINAI_U', 69); |
|
| 96 | -define('KW_AFRICA', 70); |
|
| 97 | -define('KW_EGYPT', 71); |
|
| 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 | +define('KW_PSU', 67); |
|
| 94 | +define('KW_SU', 68); |
|
| 95 | +define('KW_SINAI_U', 69); |
|
| 96 | +define('KW_AFRICA', 70); |
|
| 97 | +define('KW_EGYPT', 71); |
|
| 98 | 98 | |
| 99 | 99 | $job_keywords = array(); |
| 100 | 100 | |
@@ -352,7 +352,7 @@ discard block |
||
| 352 | 352 | } |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | -function kw_options($id, $indent='') { |
|
| 355 | +function kw_options($id, $indent = '') { |
|
| 356 | 356 | global $job_keywords; |
| 357 | 357 | $kw = $job_keywords[$id]; |
| 358 | 358 | $opts = [[$id, "$indent$kw->name"]]; |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | return $kw->name; |
| 370 | 370 | } |
| 371 | 371 | |
| 372 | -function kw_array_to_str($kws, $sep='<br>') { |
|
| 372 | +function kw_array_to_str($kws, $sep = '<br>') { |
|
| 373 | 373 | $x = array_map('strval', $kws); |
| 374 | 374 | $x = array_map('kw_id_to_name', $x); |
| 375 | 375 | return implode($sep, $x); |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | // show list of BUDA apps and variants, |
| 37 | 37 | // w/ buttons for adding and deleting |
| 38 | 38 | // |
| 39 | -function app_list($notice=null) { |
|
| 39 | +function app_list($notice = null) { |
|
| 40 | 40 | global $buda_root; |
| 41 | 41 | if (!is_dir($buda_root)) { |
| 42 | 42 | mkdir($buda_root); |
@@ -224,7 +224,7 @@ discard block |
||
| 224 | 224 | // |
| 225 | 225 | $x = "<input_template>\n"; |
| 226 | 226 | $ninfiles = count($desc->input_file_names); |
| 227 | - for ($i=0; $i<$ninfiles; $i++) { |
|
| 227 | + for ($i = 0; $i < $ninfiles; $i++) { |
|
| 228 | 228 | $x .= " <file_info>\n <sticky/>\n <no_delete/>\n <executable/>\n </file_info>\n"; |
| 229 | 229 | } |
| 230 | 230 | $x .= " <workunit>\n"; |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | ); |
| 246 | 246 | |
| 247 | 247 | $x .= sprintf(" <max_delay>%f</max_delay>\n", |
| 248 | - $desc->max_delay_days * 86400. |
|
| 248 | + $desc->max_delay_days*86400. |
|
| 249 | 249 | ); |
| 250 | 250 | |
| 251 | 251 | $x .= " <buda_app_name>$app</buda_app_name>\n"; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | } else { |
| 319 | 319 | $creating = true; |
| 320 | 320 | } |
| 321 | - $variant = sprintf('%s_%s', $cpu_type, $plan_class?$plan_class:'cpu'); |
|
| 321 | + $variant = sprintf('%s_%s', $cpu_type, $plan_class ? $plan_class : 'cpu'); |
|
| 322 | 322 | if (!is_valid_filename($variant)) { |
| 323 | 323 | error_page(filename_rules()); |
| 324 | 324 | } |
@@ -463,8 +463,8 @@ discard block |
||
| 463 | 463 | } |
| 464 | 464 | } |
| 465 | 465 | |
| 466 | -function app_form($desc=null) { |
|
| 467 | - page_head_select2($desc?"Edit BUDA app $desc->name":'Create BUDA app'); |
|
| 466 | +function app_form($desc = null) { |
|
| 467 | + page_head_select2($desc ? "Edit BUDA app $desc->name" : 'Create BUDA app'); |
|
| 468 | 468 | form_start('buda.php'); |
| 469 | 469 | form_input_hidden('action', 'app_action'); |
| 470 | 470 | if ($desc) { |
@@ -346,7 +346,7 @@ |
||
| 346 | 346 | handle_get_info(); |
| 347 | 347 | } else { |
| 348 | 348 | $dev = get_str("dev", true); |
| 349 | - $user_agent = get_str("user_agent", true); // for debugging |
|
| 349 | + $user_agent = get_str("user_agent", true); // for debugging |
|
| 350 | 350 | if (!$user_agent) { |
| 351 | 351 | $user_agent = $_SERVER['HTTP_USER_AGENT']; |
| 352 | 352 | } |
@@ -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 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | 'max_jobs_in_progress', $usub->max_jobs_in_progress |
| 149 | 149 | ); |
| 150 | 150 | form_general('Run jobs only on own computers?', |
| 151 | - $user->seti_id?'yes':'no' |
|
| 151 | + $user->seti_id ? 'yes' : 'no' |
|
| 152 | 152 | ); |
| 153 | 153 | form_submit('Update'); |
| 154 | 154 | form_end(); |
@@ -204,18 +204,18 @@ discard block |
||
| 204 | 204 | $manage_apps = array_map('intval', $manage_apps); |
| 205 | 205 | foreach ($apps as $app) { |
| 206 | 206 | $s = in_array($app->id, $submit_apps); |
| 207 | - $m = in_array($app->id, $manage_apps)?1:0; |
|
| 207 | + $m = in_array($app->id, $manage_apps) ? 1 : 0; |
|
| 208 | 208 | if ($s || $m) { |
| 209 | 209 | BoincUserSubmitApp::insert( |
| 210 | 210 | "(user_id, app_id, manage) values ($user_id, $app->id, $m)" |
| 211 | 211 | ); |
| 212 | 212 | } |
| 213 | 213 | } |
| 214 | - $quota = (double) get_str('quota'); |
|
| 214 | + $quota = (double)get_str('quota'); |
|
| 215 | 215 | if ($quota != $us->quota) { |
| 216 | 216 | $us->update("quota=$quota"); |
| 217 | 217 | } |
| 218 | - $mj = (int) get_str('max_jobs_in_progress'); |
|
| 218 | + $mj = (int)get_str('max_jobs_in_progress'); |
|
| 219 | 219 | if ($mj != $us->max_jobs_in_progress) { |
| 220 | 220 | $us->update("max_jobs_in_progress=$mj"); |
| 221 | 221 | } |
@@ -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>' |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | // just the input field |
| 347 | 347 | // |
| 348 | 348 | function form_input_text_field( |
| 349 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
| 349 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
| 350 | 350 | ) { |
| 351 | 351 | return sprintf( |
| 352 | 352 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -357,7 +357,7 @@ discard block |
||
| 357 | 357 | // the whole row |
| 358 | 358 | // |
| 359 | 359 | function form_input_text( |
| 360 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
| 360 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
| 361 | 361 | ) { |
| 362 | 362 | echo sprintf(' |
| 363 | 363 | <div class="form-group"> |
@@ -385,7 +385,7 @@ discard block |
||
| 385 | 385 | ); |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
| 388 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
| 389 | 389 | echo sprintf(' |
| 390 | 390 | <div class="form-group"> |
| 391 | 391 | <label align=right class="%s" for="%s">%s</label> |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | // $items is either a string of <option> elements, |
| 403 | 403 | // or an array of [value, name] pairs |
| 404 | 404 | // |
| 405 | -function form_select($label, $name, $items, $selected=null) { |
|
| 405 | +function form_select($label, $name, $items, $selected = null) { |
|
| 406 | 406 | echo sprintf(' |
| 407 | 407 | <div class="form-group"> |
| 408 | 408 | <label align=right class="%s" for="%s">%s</label> |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | foreach ($items as $i) { |
| 416 | 416 | echo sprintf( |
| 417 | 417 | '<option %s value="%s">%s</option>', |
| 418 | - ($i[0]==$selected)?'selected':'', |
|
| 418 | + ($i[0] == $selected) ? 'selected' : '', |
|
| 419 | 419 | $i[0], $i[1] |
| 420 | 420 | ); |
| 421 | 421 | } |
@@ -428,7 +428,7 @@ discard block |
||
| 428 | 428 | // same, for multiple select. |
| 429 | 429 | // $selected, if non-null, is a list of selected values |
| 430 | 430 | // |
| 431 | -function form_select_multiple($label, $name, $items, $selected=null, $size=0) { |
|
| 431 | +function form_select_multiple($label, $name, $items, $selected = null, $size = 0) { |
|
| 432 | 432 | echo sprintf(' |
| 433 | 433 | <div class="form-group"> |
| 434 | 434 | <label align=right class="%s" for="%s">%s</label> |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | foreach ($items as $i) { |
| 441 | 441 | echo sprintf( |
| 442 | 442 | '<option %s value="%s">%s</option>', |
| 443 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
| 443 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
| 444 | 444 | $i[0], $i[1] |
| 445 | 445 | ); |
| 446 | 446 | } |
@@ -449,12 +449,12 @@ discard block |
||
| 449 | 449 | |
| 450 | 450 | // return a list of strings for checkbox items |
| 451 | 451 | // |
| 452 | -function checkbox_item_strings($items, $attrs='') { |
|
| 452 | +function checkbox_item_strings($items, $attrs = '') { |
|
| 453 | 453 | $x = []; |
| 454 | 454 | foreach ($items as $i) { |
| 455 | 455 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
| 456 | 456 | ', |
| 457 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
| 457 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
| 458 | 458 | ); |
| 459 | 459 | } |
| 460 | 460 | return $x; |
@@ -462,7 +462,7 @@ discard block |
||
| 462 | 462 | |
| 463 | 463 | // $items is list of (name, label, checked) |
| 464 | 464 | // |
| 465 | -function form_checkboxes($label, $items, $attrs='') { |
|
| 465 | +function form_checkboxes($label, $items, $attrs = '') { |
|
| 466 | 466 | echo sprintf(' |
| 467 | 467 | <div class="form-group"> |
| 468 | 468 | <label align=right class="%s">%s</label> |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | // |
| 482 | 482 | function form_radio_buttons( |
| 483 | 483 | $label, $name, $items, $selected, |
| 484 | - $assign_ids=false // assign IDs to buttons based on names |
|
| 484 | + $assign_ids = false // assign IDs to buttons based on names |
|
| 485 | 485 | ) { |
| 486 | 486 | echo sprintf(' |
| 487 | 487 | <div class="form-group"> |
@@ -491,7 +491,7 @@ discard block |
||
| 491 | 491 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
| 492 | 492 | ); |
| 493 | 493 | foreach ($items as $i) { |
| 494 | - $checked = ($selected == $i[0])?"checked":""; |
|
| 494 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
| 495 | 495 | if ($assign_ids) { |
| 496 | 496 | $id = sprintf('id="%s_%s"', $name, $i[0]); |
| 497 | 497 | } else { |
@@ -529,7 +529,7 @@ discard block |
||
| 529 | 529 | '; |
| 530 | 530 | } |
| 531 | 531 | |
| 532 | -function form_submit($text, $attrs='') { |
|
| 532 | +function form_submit($text, $attrs = '') { |
|
| 533 | 533 | form_general( |
| 534 | 534 | "", |
| 535 | 535 | sprintf( |
@@ -539,7 +539,7 @@ discard block |
||
| 539 | 539 | ); |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | -function form_checkbox($label, $name, $checked=false) { |
|
| 542 | +function form_checkbox($label, $name, $checked = false) { |
|
| 543 | 543 | echo sprintf(' |
| 544 | 544 | <div class="form-group"> |
| 545 | 545 | <label align=right class="%s">%s</label> |
@@ -551,7 +551,7 @@ discard block |
||
| 551 | 551 | <input type="checkbox" name="%s" %s> |
| 552 | 552 | </div> |
| 553 | 553 | </div> |
| 554 | - ', $name, $checked?"checked":"" |
|
| 554 | + ', $name, $checked ? "checked" : "" |
|
| 555 | 555 | ); |
| 556 | 556 | } |
| 557 | 557 | |
@@ -579,7 +579,7 @@ discard block |
||
| 579 | 579 | // $selected is the list of selected values. |
| 580 | 580 | // $extra is e.g. id=foo |
| 581 | 581 | // |
| 582 | -function form_select2_multi($label, $name, $items, $selected=null, $extra='') { |
|
| 582 | +function form_select2_multi($label, $name, $items, $selected = null, $extra = '') { |
|
| 583 | 583 | echo sprintf(' |
| 584 | 584 | <div class="form-group"> |
| 585 | 585 | <label align=right class="%s" for="%s">%s</label> |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | foreach ($items as $i) { |
| 592 | 592 | echo sprintf( |
| 593 | 593 | '<option %s value="%s">%s</option>', |
| 594 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
| 594 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
| 595 | 595 | $i[0], $i[1] |
| 596 | 596 | ); |
| 597 | 597 | } |