@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | function check_passwd_ui($user, $passwd) { |
59 | 59 | $passwd_hash = md5($passwd.$user->email_addr); |
60 | - if(!check_passwd_hash($user, $passwd_hash)) { |
|
60 | + if (!check_passwd_hash($user, $passwd_hash)) { |
|
61 | 61 | sleep(LOGIN_FAIL_SLEEP_SEC); |
62 | 62 | page_head("Password incorrect"); |
63 | 63 | echo "The password you entered is incorrect. Please go back and try again.\n"; |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | function is_banned_email_addr($email_addr) { |
70 | 70 | global $banned_email_domains; |
71 | 71 | if (isset($banned_email_domains)) { |
72 | - foreach($banned_email_domains as $d) { |
|
72 | + foreach ($banned_email_domains as $d) { |
|
73 | 73 | $x = strstr($email_addr, $d); |
74 | 74 | if ($x == $d) return true; |
75 | 75 | } |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | // |
109 | 109 | function make_user( |
110 | 110 | $email_addr, $name, $passwd_hash, |
111 | - $country=null, $postal_code=null, $project_prefs=null, $teamid=0 |
|
111 | + $country = null, $postal_code = null, $project_prefs = null, $teamid = 0 |
|
112 | 112 | ) { |
113 | 113 | if (!is_valid_email_syntax($email_addr)) return null; |
114 | 114 | // caller generally has already checked |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | $users = BoincUser::enum( |
244 | 244 | sprintf("name like '%s%%'", $new_name) |
245 | 245 | ); |
246 | - foreach ($users as $u){ |
|
246 | + foreach ($users as $u) { |
|
247 | 247 | echo "<p>$u->name\n"; |
248 | 248 | } |
249 | 249 | page_tail(); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | show_error(tra("Passwords may only include ASCII characters.")); |
279 | 279 | } |
280 | 280 | |
281 | - if (strlen($passwd)<$min_passwd_length) { |
|
281 | + if (strlen($passwd) < $min_passwd_length) { |
|
282 | 282 | show_error( |
283 | 283 | tra("New password is too short: minimum password length is %1 characters.", $min_passwd_length) |
284 | 284 | ); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | // add other criteria like # of countries (based on IP addr) |
8 | 8 | // consider only hosts with recent last RPC time |
9 | 9 | |
10 | -define ('MAX_HOSTS', 100); |
|
10 | +define('MAX_HOSTS', 100); |
|
11 | 11 | |
12 | 12 | require_once('../inc/boinc_db.inc'); |
13 | 13 |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | // show a forum. |
27 | 27 | // $user is null if not logged in |
28 | 28 | // |
29 | -function forum_page($forum, $user, $msg=null) { |
|
29 | +function forum_page($forum, $user, $msg = null) { |
|
30 | 30 | global $forum_sort_styles; |
31 | 31 | |
32 | 32 | if (DISABLE_FORUMS) { |
@@ -53,14 +53,14 @@ discard block |
||
53 | 53 | |
54 | 54 | if (!$sort_style) { |
55 | 55 | // get the sort style either from the logged in user or a cookie |
56 | - if ($user){ |
|
56 | + if ($user) { |
|
57 | 57 | $sort_style = $user->prefs->forum_sorting; |
58 | 58 | } else { |
59 | 59 | list($sort_style, $thread_style) = parse_forum_cookie(); |
60 | 60 | } |
61 | 61 | } else { |
62 | 62 | // set the sort style |
63 | - if ($user){ |
|
63 | + if ($user) { |
|
64 | 64 | $user->prefs->forum_sorting = $sort_style; |
65 | 65 | $user->prefs->update("forum_sorting=$sort_style"); |
66 | 66 | } else { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | echo "<td><a href=\"forum_thread.php?id=$thread->id\">$title</a><br></td>"; |
249 | 249 | |
250 | 250 | echo ' |
251 | - <td>'.($thread->replies+1).'</td> |
|
251 | + <td>'.($thread->replies + 1).'</td> |
|
252 | 252 | <td>'.user_links($owner, BADGE_HEIGHT_SMALL).'</td> |
253 | 253 | <td>'.$thread->views.'</td> |
254 | 254 | <td>'.time_diff_str($thread->timestamp, time()).'</td> |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | flush(); |
258 | 258 | } |
259 | 259 | end_table(); |
260 | - echo "<br>$page_nav"; // show page links |
|
260 | + echo "<br>$page_nav"; // show page links |
|
261 | 261 | } |
262 | 262 | |
263 | 263 | $id = get_int("id"); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | if ($n === false) return ''; |
34 | 34 | $m = strpos($p, ']', $n); |
35 | 35 | if ($m === false) return ''; |
36 | - $x = substr($p, $n+5, $m-$n-5); |
|
36 | + $x = substr($p, $n + 5, $m - $n - 5); |
|
37 | 37 | |
38 | 38 | $n = strpos($x, ' '); |
39 | 39 | if ($n !== false) return substr($x, 0, $n); |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | if ($n === false) return ''; |
48 | 48 | $m = strpos($p, ']', $n); |
49 | 49 | if ($m === false) return ''; |
50 | - $x = substr($p, $n+5, $m-$n-5); |
|
50 | + $x = substr($p, $n + 5, $m - $n - 5); |
|
51 | 51 | $n = strpos($x, '_'); |
52 | 52 | if ($n !== false) return substr($x, 0, $n); |
53 | 53 | $n = strpos($x, 'r'); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | |
58 | 58 | function main() { |
59 | 59 | global $max_days; |
60 | - $t = time()-$max_days*86400; |
|
60 | + $t = time() - $max_days*86400; |
|
61 | 61 | $hosts = BoincHost::enum("rpc_time>$t"); |
62 | 62 | $descs = []; |
63 | 63 | foreach ($hosts as $host) { |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | // Intended to be subclassed (e.g., BoincDb, BossaDb) |
23 | 23 | // |
24 | 24 | class DbConn { |
25 | - var $db_conn; // a mysqli object |
|
26 | - var $db_name; // the DB name |
|
25 | + var $db_conn; // a mysqli object |
|
26 | + var $db_name; // the DB name |
|
27 | 27 | |
28 | 28 | function init_conn($user, $passwd, $host, $name) { |
29 | 29 | $x = explode(":", $host); |
30 | - if (sizeof($x)>1) { |
|
30 | + if (sizeof($x) > 1) { |
|
31 | 31 | $host = $x[0]; |
32 | 32 | $port = $x[1]; |
33 | 33 | } else { |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | } |
36 | 36 | try { |
37 | 37 | $this->db_conn = @new mysqli($host, $user, $passwd, $name, $port); |
38 | - } catch(Exception $e) { |
|
38 | + } catch (Exception $e) { |
|
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | if (mysqli_connect_error()) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | return $this->enum_general($classname, $query); |
137 | 137 | } |
138 | 138 | |
139 | - function enum($table, $classname, $where_clause=null, $order_clause=null) { |
|
139 | + function enum($table, $classname, $where_clause = null, $order_clause = null) { |
|
140 | 140 | return self::enum_fields( |
141 | 141 | $table, $classname, '*', $where_clause, $order_clause |
142 | 142 | ); |
@@ -181,15 +181,15 @@ discard block |
||
181 | 181 | if ($x) return (double)$x->$field; |
182 | 182 | return false; |
183 | 183 | } |
184 | - function count($table, $clause="TRUE") { |
|
184 | + function count($table, $clause = "TRUE") { |
|
185 | 185 | $query = "select count(*) as total from DBNAME.$table where $clause"; |
186 | 186 | return $this->get_int($query, 'total'); |
187 | 187 | } |
188 | - function sum($table, $field, $clause="") { |
|
188 | + function sum($table, $field, $clause = "") { |
|
189 | 189 | $query = "select sum($field) as total from DBNAME.$table $clause"; |
190 | 190 | return $this->get_double($query, 'total'); |
191 | 191 | } |
192 | - function max($table, $field, $clause="") { |
|
192 | + function max($table, $field, $clause = "") { |
|
193 | 193 | $query = "select max($field) as total from DBNAME.$table $clause"; |
194 | 194 | return $this->get_double($query, 'total'); |
195 | 195 | } |
@@ -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 "; |
@@ -380,7 +380,7 @@ discard block |
||
380 | 380 | // |
381 | 381 | function xml_get_jobs($r) { |
382 | 382 | $jobs = array(); |
383 | - foreach($r->batch->job as $j) { |
|
383 | + foreach ($r->batch->job as $j) { |
|
384 | 384 | $job = new StdClass; |
385 | 385 | $job->input_files = array(); |
386 | 386 | $job->command_line = (string)$j->command_line; |
@@ -431,16 +431,16 @@ discard block |
||
431 | 431 | // |
432 | 432 | function logical_end_time($r, $jobs, $user, $app) { |
433 | 433 | $total_flops = 0; |
434 | - foreach($jobs as $job) { |
|
434 | + foreach ($jobs as $job) { |
|
435 | 435 | //print_r($job); |
436 | 436 | if ($job->rsc_fpops_est) { |
437 | 437 | $total_flops += $job->rsc_fpops_est; |
438 | 438 | } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) { |
439 | - $total_flops += (double) $job->input_template->workunit->rsc_fpops_est; |
|
439 | + $total_flops += (double)$job->input_template->workunit->rsc_fpops_est; |
|
440 | 440 | } else if ($r->batch->job_params->rsc_fpops_est) { |
441 | - $total_flops += (double) $r->batch->job_params->rsc_fpops_est; |
|
441 | + $total_flops += (double)$r->batch->job_params->rsc_fpops_est; |
|
442 | 442 | } else { |
443 | - $x = (double) $template->workunit->rsc_fpops_est; |
|
443 | + $x = (double)$template->workunit->rsc_fpops_est; |
|
444 | 444 | if ($x) { |
445 | 445 | $total_flops += $x; |
446 | 446 | } else { |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | } |
449 | 449 | } |
450 | 450 | } |
451 | - $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
451 | + $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
452 | 452 | $x = exec($cmd); |
453 | 453 | if (!is_numeric($x) || (double)$x == 0) { |
454 | 454 | xml_error(-1, "$cmd returned $x"); |
@@ -533,15 +533,15 @@ discard block |
||
533 | 533 | } |
534 | 534 | |
535 | 535 | $job_params = new StdClass; |
536 | - $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound; |
|
537 | - $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est; |
|
538 | - $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound; |
|
539 | - $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound; |
|
540 | - $job_params->delay_bound = (double) $r->batch->job_params->delay_bound; |
|
536 | + $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound; |
|
537 | + $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est; |
|
538 | + $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound; |
|
539 | + $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound; |
|
540 | + $job_params->delay_bound = (double)$r->batch->job_params->delay_bound; |
|
541 | 541 | // could add quorum-related stuff |
542 | 542 | |
543 | - $input_template_filename = (string) $r->batch->input_template_filename; |
|
544 | - $output_template_filename = (string) $r->batch->output_template_filename; |
|
543 | + $input_template_filename = (string)$r->batch->input_template_filename; |
|
544 | + $output_template_filename = (string)$r->batch->output_template_filename; |
|
545 | 545 | // possibly empty |
546 | 546 | |
547 | 547 | submit_jobs( |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | } |
635 | 635 | |
636 | 636 | function n_outfiles($wu) { |
637 | - $path = project_dir() . "/$wu->output_template_filename"; |
|
637 | + $path = project_dir()."/$wu->output_template_filename"; |
|
638 | 638 | $r = simplexml_load_file($path); |
639 | 639 | return count($r->file_info); |
640 | 640 | } |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | "; |
842 | 842 | if ($result->server_state == 5) { // over? |
843 | 843 | $paths = get_outfile_paths($result); |
844 | - foreach($paths as $path) { |
|
844 | + foreach ($paths as $path) { |
|
845 | 845 | if (is_file($path)) { |
846 | 846 | $size = filesize($path); |
847 | 847 | echo " <outfile> |
@@ -885,7 +885,7 @@ discard block |
||
885 | 885 | } else { |
886 | 886 | $results = BoincResult::enum("workunitid=$job_id"); |
887 | 887 | foreach ($results as $r) { |
888 | - switch($r->outcome) { |
|
888 | + switch ($r->outcome) { |
|
889 | 889 | case 1: |
890 | 890 | case 3: |
891 | 891 | case 6: |
@@ -1000,8 +1000,8 @@ discard block |
||
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | $user = check_remote_submit_permissions($r, $app); |
1003 | - $in = file_get_contents(project_dir() . "/templates/".$app->name."_in"); |
|
1004 | - $out = file_get_contents(project_dir() . "/templates/".$app->name."_out"); |
|
1003 | + $in = file_get_contents(project_dir()."/templates/".$app->name."_in"); |
|
1004 | + $out = file_get_contents(project_dir()."/templates/".$app->name."_out"); |
|
1005 | 1005 | if ($in === false || $out === false) { |
1006 | 1006 | log_write("template file missing"); |
1007 | 1007 | xml_error(-1, "template file missing"); |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | |
1014 | 1014 | function ping($r) { |
1015 | 1015 | xml_start_tag("ping"); |
1016 | - BoincDb::get(); // errors out if DB down or web disabled |
|
1016 | + BoincDb::get(); // errors out if DB down or web disabled |
|
1017 | 1017 | echo "<success>1</success> |
1018 | 1018 | </ping> |
1019 | 1019 | "; |
@@ -1080,9 +1080,9 @@ discard block |
||
1080 | 1080 | $request_log = parse_config(get_config(), "<remote_submit_request_log>"); |
1081 | 1081 | if ($request_log) { |
1082 | 1082 | $log_dir = parse_config(get_config(), "<log_dir>"); |
1083 | - $request_log = $log_dir . "/" . $request_log; |
|
1083 | + $request_log = $log_dir."/".$request_log; |
|
1084 | 1084 | if ($file = fopen($request_log, "a")) { |
1085 | - fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n"); |
|
1085 | + fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n"); |
|
1086 | 1086 | fclose($file); |
1087 | 1087 | } |
1088 | 1088 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if ($user->authenticator != $auth) die('bad auth'); |
52 | 52 | } |
53 | 53 | |
54 | -function do_result_aux($result, $batch, $file_num=null) { |
|
54 | +function do_result_aux($result, $batch, $file_num = null) { |
|
55 | 55 | $phys_names = get_outfile_phys_names($result); |
56 | 56 | $log_names = get_outfile_log_names($result); |
57 | 57 | if ($file_num !== null) { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $dir_path = "submit/$batch->id/$result->name"; |
72 | 72 | system("rm -r $dir_path"); |
73 | 73 | mkdir($dir_path); |
74 | - for ($i=0; $i<count($phys_names); $i++) { |
|
74 | + for ($i = 0; $i < count($phys_names); $i++) { |
|
75 | 75 | $cmd = sprintf('ln -s %s %s/%s', |
76 | 76 | upload_path($phys_names[$i]), |
77 | 77 | $dir_path, |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | -function do_result($result_id, $auth, $file_num=null) { |
|
91 | +function do_result($result_id, $auth, $file_num = null) { |
|
92 | 92 | $result = BoincResult::lookup_id($result_id); |
93 | 93 | if (!$result) die("no result $result_id"); |
94 | 94 | $workunit = BoincWorkunit::lookup_id($result->workunitid); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | system($cmd); |
136 | 136 | } else { |
137 | 137 | mkdir(sprintf('%s/%s', $dir_path, $result->name)); |
138 | - for ($i=0; $i<count($phys_names); $i++) { |
|
138 | + for ($i = 0; $i < count($phys_names); $i++) { |
|
139 | 139 | $cmd = sprintf('ln -s %s %s/%s/%s', |
140 | 140 | upload_path($phys_names[$i]), |
141 | 141 | $dir_path, |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | // return list of files matching given pattern, |
92 | 92 | // in the format used for form_select() and form_select_multiple() |
93 | 93 | // |
94 | -function sandbox_select_items($user, $pattern=null) { |
|
94 | +function sandbox_select_items($user, $pattern = null) { |
|
95 | 95 | $sbfiles = sandbox_file_names($user); |
96 | 96 | $sbitems = []; |
97 | 97 | foreach ($sbfiles as $f) { |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | } |
113 | 113 | $files = sandbox_file_names($user); |
114 | 114 | foreach ($files as $f) { |
115 | - if ($regexp && !preg_match("/$regexp/",$f)) continue; |
|
115 | + if ($regexp && !preg_match("/$regexp/", $f)) continue; |
|
116 | 116 | $x .= "<option value=\"$f\">$f</option>\n"; |
117 | 117 | } |
118 | 118 | $x .= "</select>\n"; |
@@ -160,8 +160,8 @@ discard block |
||
160 | 160 | '%s <a href="%s&sort_field=%s&sort_rev=%d">%s</a>', |
161 | 161 | $title, |
162 | 162 | $url, $sort_field, |
163 | - $sort_rev?0:1, |
|
164 | - $sort_rev?'↑':'↓' |
|
163 | + $sort_rev ? 0 : 1, |
|
164 | + $sort_rev ? '↑' : '↓' |
|
165 | 165 | ); |
166 | 166 | } else { |
167 | 167 | return sprintf( |
@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | } |
71 | 71 | |
72 | 72 | if ($app_types->cpu) { |
73 | - $project_pref_descs[] = new PREF_BOOL ( |
|
73 | + $project_pref_descs[] = new PREF_BOOL( |
|
74 | 74 | tra("Allow CPU-only tasks"), |
75 | 75 | "Request CPU-only tasks from this project.", |
76 | 76 | "no_cpu", |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | ); |
80 | 80 | } |
81 | 81 | if ($app_types->ati) { |
82 | - $project_pref_descs[] = new PREF_BOOL ( |
|
82 | + $project_pref_descs[] = new PREF_BOOL( |
|
83 | 83 | tra("Use AMD GPU"), |
84 | 84 | "Request AMD GPU tasks from this project.", |
85 | 85 | "no_ati", |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | ); |
89 | 89 | } |
90 | 90 | if ($app_types->cuda) { |
91 | - $project_pref_descs[] = new PREF_BOOL ( |
|
91 | + $project_pref_descs[] = new PREF_BOOL( |
|
92 | 92 | tra("Use NVIDIA GPU"), |
93 | 93 | "Request NVIDIA GPU tasks from this project.", |
94 | 94 | "no_cuda", |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | ); |
98 | 98 | } |
99 | 99 | if ($app_types->intel_gpu) { |
100 | - $project_pref_descs[] = new PREF_BOOL ( |
|
100 | + $project_pref_descs[] = new PREF_BOOL( |
|
101 | 101 | tra("Use Intel GPU"), |
102 | 102 | "Request Intel GPU tasks from this project.", |
103 | 103 | "no_intel_gpu", |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | ); |
107 | 107 | } |
108 | 108 | if ($app_types->apple_gpu) { |
109 | - $project_pref_descs[] = new PREF_BOOL ( |
|
109 | + $project_pref_descs[] = new PREF_BOOL( |
|
110 | 110 | tra("Use Apple GPU"), |
111 | 111 | "Request Apple GPU tasks from this project.", |
112 | 112 | "no_apple_gpu", |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | $x = ""; |
132 | 132 | } |
133 | 133 | |
134 | -$privacy_pref_descs = array ( |
|
134 | +$privacy_pref_descs = array( |
|
135 | 135 | new PREF_BOOL( |
136 | 136 | tra("Is it OK for %1 and your team (if any) to email you?", PROJECT).$x, |
137 | 137 | "", |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | global $in_project_specific; |
180 | 180 | global $venue_name; |
181 | 181 | |
182 | - switch($name) { |
|
182 | + switch ($name) { |
|
183 | 183 | case "venue": |
184 | 184 | $venue_name = $attrs["name"]; |
185 | 185 | $top_parse_result = $parse_result; |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | break; |
192 | 192 | default: |
193 | 193 | if ($in_project_specific) { |
194 | - $text= $text."<$name>"; |
|
194 | + $text = $text."<$name>"; |
|
195 | 195 | } else { |
196 | 196 | $text = ""; |
197 | 197 | } |
@@ -206,12 +206,12 @@ discard block |
||
206 | 206 | global $venue_name; |
207 | 207 | global $project_pref_descs; |
208 | 208 | |
209 | - foreach($project_pref_descs as $p) { |
|
209 | + foreach ($project_pref_descs as $p) { |
|
210 | 210 | if ($p->xml_parse($parse_result, $name, $text)) { |
211 | 211 | return; |
212 | 212 | } |
213 | 213 | } |
214 | - switch($name) { |
|
214 | + switch ($name) { |
|
215 | 215 | case "venue": |
216 | 216 | $top_parse_result->$venue_name = $parse_result; |
217 | 217 | $parse_result = $top_parse_result; |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | return $parse_result; |
256 | 256 | } |
257 | 257 | |
258 | -function prefs_show_project($prefs, $columns=false) { |
|
258 | +function prefs_show_project($prefs, $columns = false) { |
|
259 | 259 | global $project_pref_descs; |
260 | 260 | if ($columns) { |
261 | 261 | foreach ($project_pref_descs as $p) { |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
297 | -function prefs_show_project_specific($prefs, $columns=false) { |
|
297 | +function prefs_show_project_specific($prefs, $columns = false) { |
|
298 | 298 | if ($columns) { |
299 | 299 | $project_specific_prefs = project_specific_prefs_parse($prefs->project_specific); |
300 | 300 | $project_specific_prefs->home = isset($prefs->home) ? project_specific_prefs_parse($prefs->home->project_specific) : ""; |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | project_specific_prefs_show($project_specific_prefs, $columns); |
307 | 307 | } |
308 | 308 | |
309 | -function print_prefs_display_project($user, $columns=false) { |
|
309 | +function print_prefs_display_project($user, $columns = false) { |
|
310 | 310 | $project_prefs = prefs_parse_project($user->project_prefs); |
311 | 311 | |
312 | - $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>"; |
|
312 | + $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=".(int)!$columns.">".tra("(Switch View)")."</a></font>"; |
|
313 | 313 | if ($columns) { |
314 | 314 | start_table(); |
315 | 315 | row_heading(tra("Combined preferences").$switch_link); |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | } |
361 | 361 | } |
362 | 362 | |
363 | -function prefs_form_project($prefs, $error=false) { |
|
363 | +function prefs_form_project($prefs, $error = false) { |
|
364 | 364 | global $project_pref_descs; |
365 | 365 | foreach ($project_pref_descs as $p) { |
366 | 366 | $p->show_form_row($prefs, $error); |
367 | 367 | } |
368 | 368 | } |
369 | 369 | |
370 | -function prefs_form_project_specific($prefs_xml, $error=false) { |
|
370 | +function prefs_form_project_specific($prefs_xml, $error = false) { |
|
371 | 371 | $prefs = project_specific_prefs_parse($prefs_xml); |
372 | 372 | project_specific_prefs_edit($prefs, $error); |
373 | 373 | } |
@@ -415,7 +415,7 @@ discard block |
||
415 | 415 | |
416 | 416 | // given a prefs structure, return the corresponding XML string |
417 | 417 | // |
418 | -function project_prefs_make_xml($prefs, $primary=true) { |
|
418 | +function project_prefs_make_xml($prefs, $primary = true) { |
|
419 | 419 | global $project_pref_descs; |
420 | 420 | $xml = ""; |
421 | 421 | if ($primary) { |
@@ -450,8 +450,8 @@ discard block |
||
450 | 450 | // |
451 | 451 | function project_prefs_update(&$user, $prefs) { |
452 | 452 | $prefs_xml = BoincDb::escape_string(project_prefs_make_xml($prefs)); |
453 | - $send_email = $user->send_email?1:0; |
|
454 | - $show_hosts = $user->show_hosts?1:0; |
|
453 | + $send_email = $user->send_email ? 1 : 0; |
|
454 | + $show_hosts = $user->show_hosts ? 1 : 0; |
|
455 | 455 | $retval = $user->update("project_prefs='$prefs_xml', send_email=$send_email, show_hosts=$show_hosts"); |
456 | 456 | if (!$retval) { |
457 | 457 | return 1; |