@@ -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"); |
@@ -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 | } |
@@ -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(); |
@@ -199,25 +199,25 @@ discard block |
||
| 199 | 199 | $min = 1e99; |
| 200 | 200 | $max = 0; |
| 201 | 201 | foreach ($results as $r) { |
| 202 | - $f = $r->flops / (4.3e9 *3600); |
|
| 202 | + $f = $r->flops/(4.3e9*3600); |
|
| 203 | 203 | if ($f > $max) $max = $f; |
| 204 | 204 | if ($f < $min) $min = $f; |
| 205 | 205 | $x[] = $f; |
| 206 | 206 | } |
| 207 | 207 | $n = 800; |
| 208 | 208 | $count = []; |
| 209 | - for ($i=0; $i<$n; $i++) { |
|
| 209 | + for ($i = 0; $i < $n; $i++) { |
|
| 210 | 210 | $count[$i] = 0; |
| 211 | 211 | } |
| 212 | 212 | $range = $max - $min; |
| 213 | 213 | foreach ($x as $f) { |
| 214 | - $d = intval($n*($f-$min)/$range); |
|
| 215 | - if ($d >= $n) $d = $n-1; |
|
| 214 | + $d = intval($n*($f - $min)/$range); |
|
| 215 | + if ($d >= $n) $d = $n - 1; |
|
| 216 | 216 | $count[$d] += 1; |
| 217 | 217 | } |
| 218 | 218 | $data = []; |
| 219 | - for ($i=0; $i<$n; $i++) { |
|
| 220 | - $data[] = [$min+($i*$range)/$n, $count[$i]]; |
|
| 219 | + for ($i = 0; $i < $n; $i++) { |
|
| 220 | + $data[] = [$min + ($i*$range)/$n, $count[$i]]; |
|
| 221 | 221 | } |
| 222 | 222 | graph($data, 'hours', 'count'); |
| 223 | 223 | page_tail(); |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | |
| 226 | 226 | $batch = BoincBatch::lookup_id(get_int('batch_id')); |
| 227 | 227 | if (!$batch) error_page('no batch'); |
| 228 | -switch(get_str('action')) { |
|
| 228 | +switch (get_str('action')) { |
|
| 229 | 229 | case 'err_host': |
| 230 | 230 | err_host($batch); |
| 231 | 231 | break; |
@@ -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 limit 100"); |
| 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 | |