@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | return $x; |
52 | 52 | } |
53 | 53 | |
54 | -function pm_team_form($user, $teamid, $error=null) { |
|
54 | +function pm_team_form($user, $teamid, $error = null) { |
|
55 | 55 | global $bbcode_html, $bbcode_js; |
56 | 56 | $team = BoincTeam::lookup_id($teamid); |
57 | 57 | if (!$team) { |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | error_page("not admin"); |
62 | 62 | } |
63 | 63 | |
64 | - page_head(tra("Send message to team"),'','','', $bbcode_js); |
|
64 | + page_head(tra("Send message to team"), '', '', '', $bbcode_js); |
|
65 | 65 | |
66 | 66 | $subject = post_str("subject", true); |
67 | 67 | $content = post_str("content", true); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | function pm_form_page($replyto, $userid, $error = null) { |
114 | 114 | global $bbcode_html, $bbcode_js; |
115 | 115 | global $g_logged_in_user; |
116 | - page_head(tra("Send private message"),'','','', $bbcode_js); |
|
116 | + page_head(tra("Send private message"), '', '', '', $bbcode_js); |
|
117 | 117 | |
118 | 118 | if (post_str("preview", true) == tra("Preview")) { |
119 | 119 | $content = post_str("content", true); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | if (!$user) { |
138 | 138 | error_page("Sender no longer exists"); |
139 | 139 | } |
140 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
140 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
141 | 141 | $subject = $message->subject; |
142 | 142 | if (substr($subject, 0, 3) != "re:") { |
143 | 143 | $subject = "re: ".$subject; |
@@ -156,15 +156,15 @@ discard block |
||
156 | 156 | time_str($user->prefs->banished_until) |
157 | 157 | ); |
158 | 158 | } |
159 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
159 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
160 | 160 | } else { |
161 | 161 | $writeto = sanitize_tags(post_str("to", true)); |
162 | 162 | $subject = post_str("subject", true); |
163 | 163 | $content = post_str("content", true); |
164 | 164 | } |
165 | 165 | |
166 | - $content = $content?htmlspecialchars($content):''; |
|
167 | - $subject = $subject?htmlspecialchars($subject):''; |
|
166 | + $content = $content ?htmlspecialchars($content) : ''; |
|
167 | + $subject = $subject ?htmlspecialchars($subject) : ''; |
|
168 | 168 | |
169 | 169 | if ($error != null) { |
170 | 170 | echo "<p class=\"text-danger\">".$error."</p>\n"; |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | function send_pm_notification_email( |
221 | 221 | $logged_in_user, $to_user, $subject, $content |
222 | 222 | ) { |
223 | - $message = " |
|
223 | + $message = " |
|
224 | 224 | You have received a new private message at ".PROJECT.". |
225 | 225 | |
226 | 226 | From: $logged_in_user->name (ID $logged_in_user->id) |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $pm = BoincPrivateMessage::lookup_id($notify->opaque); |
251 | 251 | $from_user = BoincUser::lookup_id($pm->senderid); |
252 | 252 | if (!$pm || !$from_user) return null; |
253 | - return "<a href=pm.php>".tra("Private message%1 from %2, subject:" , "</a>", $from_user->name )." $pm->subject"; |
|
253 | + return "<a href=pm.php>".tra("Private message%1 from %2, subject:", "</a>", $from_user->name)." $pm->subject"; |
|
254 | 254 | } |
255 | 255 | |
256 | 256 | function pm_send_msg($from_user, $to_user, $subject, $content, $send_email) { |
@@ -314,11 +314,11 @@ discard block |
||
314 | 314 | |
315 | 315 | function pm_email_remind($user) { |
316 | 316 | if (!$user->prefs->pm_notification) { |
317 | - return "<br><small>" . |
|
317 | + return "<br><small>". |
|
318 | 318 | tra( |
319 | 319 | "For email notification, %1 edit community prefs %2", |
320 | 320 | '<a href="edit_forum_preferences_form.php">', '</a>' |
321 | - ) . |
|
321 | + ). |
|
322 | 322 | "</small>" |
323 | 323 | ; |
324 | 324 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | page_tail(); |
85 | 85 | } |
86 | 86 | |
87 | -function list_files($user, $notice=null) { |
|
87 | +function list_files($user, $notice = null) { |
|
88 | 88 | $dir = sandbox_dir($user); |
89 | 89 | if (!is_dir($dir)) error_page("Can't open sandbox directory"); |
90 | 90 | page_head("File sandbox"); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | $notice = ""; |
169 | 169 | $dir = sandbox_dir($user); |
170 | 170 | $count = count($_FILES['new_file']['tmp_name']); |
171 | - for ($i=0; $i<$count; $i++) { |
|
171 | + for ($i = 0; $i < $count; $i++) { |
|
172 | 172 | $tmp_name = $_FILES['new_file']['tmp_name'][$i]; |
173 | 173 | if (!is_uploaded_file($tmp_name)) { |
174 | 174 | error_page("$tmp_name is not uploaded file"); |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | |
33 | 33 | function sched_log_name($x) { |
34 | 34 | if ($x == 0) return "NO_SUCH_LOG"; |
35 | - return gmdate('Y-m-d_H/Y-m-d_H:i', $x) . ".txt"; |
|
35 | + return gmdate('Y-m-d_H/Y-m-d_H:i', $x).".txt"; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | function sched_log_link($x) { |
39 | 39 | if (file_exists("sched_logs")) { |
40 | - return "<a href=\"../sched_logs/" . sched_log_name($x) . "\">" . time_str($x) . "</a>"; |
|
40 | + return "<a href=\"../sched_logs/".sched_log_name($x)."\">".time_str($x)."</a>"; |
|
41 | 41 | } else { |
42 | 42 | return time_str($x); |
43 | 43 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | function location_form($host) { |
47 | 47 | $none = "selected"; |
48 | - $h=$w=$s=$m=""; |
|
48 | + $h = $w = $s = $m = ""; |
|
49 | 49 | if ($host->venue == "home") $h = "selected"; |
50 | 50 | if ($host->venue == "work") $w = "selected"; |
51 | 51 | if ($host->venue == "school") $s = "selected"; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | row2(tra("Product name"), $host->product_name); |
100 | 100 | } |
101 | 101 | $x = $host->timezone/3600; |
102 | - if ($x >= 0) $x="+$x"; |
|
102 | + if ($x >= 0) $x = "+$x"; |
|
103 | 103 | row2(tra("Local Standard Time"), tra("UTC %1 hours", $x)); |
104 | 104 | } else { |
105 | 105 | $owner = BoincUser::lookup_id($host->userid); |
@@ -293,20 +293,20 @@ discard block |
||
293 | 293 | // Older clients may have the old-style serialnum in the DB |
294 | 294 | // despite the server being upgraded. |
295 | 295 | // |
296 | -function vbox_desc($parsed_ser){ |
|
296 | +function vbox_desc($parsed_ser) { |
|
297 | 297 | if (empty($parsed_ser['vbox'])) return '---'; |
298 | 298 | $f = $parsed_ser['vbox']; |
299 | 299 | $desc = sprintf('Virtualbox (%s) %s', |
300 | 300 | $f[1], tra("installed") |
301 | 301 | ); |
302 | - if (sizeof($f)<=2){ |
|
302 | + if (sizeof($f) <= 2) { |
|
303 | 303 | return $desc; |
304 | 304 | } |
305 | - if ($f[2]=="1" and $f[3]=="1") { |
|
305 | + if ($f[2] == "1" and $f[3] == "1") { |
|
306 | 306 | return $desc.tra(", CPU has hardware virtualization support and it is enabled"); |
307 | - } elseif ($f[2]=="1" and $f[3]=="0") { |
|
307 | + } elseif ($f[2] == "1" and $f[3] == "0") { |
|
308 | 308 | return $desc.tra(", CPU has hardware virtualization support but it is disabled"); |
309 | - } elseif ($f[2]=="0") { |
|
309 | + } elseif ($f[2] == "0") { |
|
310 | 310 | return $desc.tra(", CPU does not have hardware virtualization support"); |
311 | 311 | } |
312 | 312 | return $desc; |
@@ -331,13 +331,13 @@ discard block |
||
331 | 331 | |
332 | 332 | // return a human-readable version of the GPU info |
333 | 333 | // |
334 | -function gpu_desc($parsed_ser, $detail=true) { |
|
334 | +function gpu_desc($parsed_ser, $detail = true) { |
|
335 | 335 | $str = ""; |
336 | 336 | foreach ($parsed_ser as $d) { |
337 | 337 | if (!is_gpu_type($d[0])) continue; |
338 | 338 | if (count($d) < 4) continue; |
339 | 339 | if ($str) $str .= "<p>"; |
340 | - if ($d[2]!="" && $d[2]!="1") $str .= "[".$d[2]."] "; |
|
340 | + if ($d[2] != "" && $d[2] != "1") $str .= "[".$d[2]."] "; |
|
341 | 341 | if ($d[0] == "CUDA") { |
342 | 342 | $str .= "NVIDIA"; |
343 | 343 | } else if ($d[0] == "CAL") { |
@@ -543,14 +543,14 @@ discard block |
||
543 | 543 | if ($pos1 === false) return $x; |
544 | 544 | $pos2 = strpos($model, ']'); |
545 | 545 | if ($pos2 === false) return $x; |
546 | - $a = substr($model, $pos1+1, $pos2-$pos1-1); |
|
546 | + $a = substr($model, $pos1 + 1, $pos2 - $pos1 - 1); |
|
547 | 547 | $y = explode(" ", $a); |
548 | 548 | if (count($y) == 0) return $x; |
549 | 549 | if ($y[0] == "Family") { |
550 | 550 | $x->info = $a; |
551 | 551 | } else { |
552 | 552 | $x->arch = $y[0]; |
553 | - $x->info = substr($a, strlen($y[0])+1); |
|
553 | + $x->info = substr($a, strlen($y[0]) + 1); |
|
554 | 554 | } |
555 | 555 | return $x; |
556 | 556 | } |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | $avg_time = 0; |
640 | 640 | |
641 | 641 | $results = BoincResult::enum("hostid=$hostid order by received_time"); |
642 | - foreach($results as $result) { |
|
642 | + foreach ($results as $result) { |
|
643 | 643 | if ($result->granted_credit <= 0) continue; |
644 | 644 | $total += $result->granted_credit; |
645 | 645 | |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | |
733 | 733 | function link_url($sort, $rev, $show_all) { |
734 | 734 | global $userid; |
735 | - $x = $userid ? "&userid=$userid":""; |
|
735 | + $x = $userid ? "&userid=$userid" : ""; |
|
736 | 736 | return "hosts_user.php?sort=$sort&rev=$rev&show_all=$show_all$x"; |
737 | 737 | } |
738 | 738 | |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | } |
807 | 807 | |
808 | 808 | function show_user_hosts($userid, $private, $show_all, $sort, $rev) { |
809 | - $desc = false; // whether the sort order's default is decreasing |
|
809 | + $desc = false; // whether the sort order's default is decreasing |
|
810 | 810 | switch ($sort) { |
811 | 811 | case "total_credit": $sort_clause = "total_credit"; $desc = true; break; |
812 | 812 | case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break; |
@@ -829,7 +829,7 @@ discard block |
||
829 | 829 | more_or_less($sort, $rev, $show_all); |
830 | 830 | |
831 | 831 | $now = time(); |
832 | - $old_hosts=0; |
|
832 | + $old_hosts = 0; |
|
833 | 833 | $i = 1; |
834 | 834 | $hosts = BoincHost::enum("userid=$userid order by $sort_clause"); |
835 | 835 | $any_product_name = false; |
@@ -841,9 +841,9 @@ discard block |
||
841 | 841 | } |
842 | 842 | user_host_table_start($private, $sort, $rev, $show_all, $any_product_name); |
843 | 843 | foreach ($hosts as $host) { |
844 | - $is_old=false; |
|
844 | + $is_old = false; |
|
845 | 845 | if (($now - $host->rpc_time) > 30*86400) { |
846 | - $is_old=true; |
|
846 | + $is_old = true; |
|
847 | 847 | $old_hosts++; |
848 | 848 | } |
849 | 849 | if (!$show_all && $is_old) continue; |
@@ -852,7 +852,7 @@ discard block |
||
852 | 852 | } |
853 | 853 | end_table(); |
854 | 854 | |
855 | - if ($old_hosts>0) { |
|
855 | + if ($old_hosts > 0) { |
|
856 | 856 | more_or_less($sort, $rev, $show_all); |
857 | 857 | } |
858 | 858 |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | if ($owner) { |
478 | 478 | row2('submitter', $owner->name); |
479 | 479 | } |
480 | - row2("application", $app?$app->name:'---'); |
|
480 | + row2("application", $app ? $app->name : '---'); |
|
481 | 481 | row2("state", batch_state_string($batch->state)); |
482 | 482 | //row2("# jobs", $batch->njobs); |
483 | 483 | //row2("# error jobs", $batch->nerror_jobs); |
@@ -536,9 +536,9 @@ discard block |
||
536 | 536 | "status" |
537 | 537 | ]; |
538 | 538 | row_heading_array($x); |
539 | - foreach($wus as $wu) { |
|
539 | + foreach ($wus as $wu) { |
|
540 | 540 | $y = ''; |
541 | - switch($wu->status) { |
|
541 | + switch ($wu->status) { |
|
542 | 542 | case WU_SUCCESS: |
543 | 543 | $resultid = $wu->canonical_resultid; |
544 | 544 | $y = '<font color="green">completed</font>'; |
@@ -611,7 +611,7 @@ discard block |
||
611 | 611 | $results = BoincResult::enum("workunitid=$wuid"); |
612 | 612 | $upload_dir = parse_config(get_config(), "<upload_dir>"); |
613 | 613 | $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); |
614 | - foreach($results as $result) { |
|
614 | + foreach ($results as $result) { |
|
615 | 615 | $x = [ |
616 | 616 | "<a href=result.php?resultid=$result->id>$result->id</a>", |
617 | 617 | state_string($result) |
@@ -620,7 +620,7 @@ discard block |
||
620 | 620 | if ($result->server_state == RESULT_SERVER_STATE_OVER) { |
621 | 621 | $phys_names = get_outfile_phys_names($result); |
622 | 622 | $log_names = get_outfile_log_names($result); |
623 | - for ($i=0; $i<count($phys_names); $i++) { |
|
623 | + for ($i = 0; $i < count($phys_names); $i++) { |
|
624 | 624 | if ($is_assim_move) { |
625 | 625 | // file is in |
626 | 626 | // project/results/<batchid>/<wu_name>__file_<log_name> |
@@ -45,14 +45,14 @@ discard block |
||
45 | 45 | //define("STYLESHEET", "aaa.css"); |
46 | 46 | //define("STYLESHEET2", "bbb.css"); |
47 | 47 | //define("SHORTCUT_ICON", "f.gif"); // browser tab icon |
48 | -define('DARK_MODE', true); // enable dark mode if selected by user |
|
48 | +define('DARK_MODE', true); // enable dark mode if selected by user |
|
49 | 49 | |
50 | 50 | //-------------- enable/disable web features |
51 | 51 | |
52 | 52 | define('UNIQUE_USER_NAME', true); |
53 | 53 | define("FORUM_QA_MERGED_MODE", true); |
54 | 54 | // Set to true to merge Message boards and Q&A section |
55 | -define ("DISABLE_PROFILES", true); |
|
55 | +define("DISABLE_PROFILES", true); |
|
56 | 56 | // enable profiles only after enabling reCAPTCHA |
57 | 57 | // https://github.com/BOINC/boinc/wiki/ProtectionFromSpam |
58 | 58 | define("USE_STOPFORUMSPAM", true); |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | </ol>", PROJECT); |
194 | 194 | } |
195 | 195 | |
196 | -function project_workunit($wu){ |
|
196 | +function project_workunit($wu) { |
|
197 | 197 | // shown in the workunit page |
198 | 198 | } |
199 | 199 | |
200 | -function project_user_summary($user){ |
|
200 | +function project_user_summary($user) { |
|
201 | 201 | // shown in the user summary page |
202 | 202 | } |
203 | 203 | |
204 | -function project_user_page_private($user){ |
|
204 | +function project_user_page_private($user) { |
|
205 | 205 | // shown in the private account page |
206 | 206 | } |
207 | 207 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)), |
285 | 285 | ); |
286 | 286 | |
287 | -function project_user_credit($user){ |
|
287 | +function project_user_credit($user) { |
|
288 | 288 | global $sub_projects; |
289 | 289 | foreach ($sub_projects as $sp) { |
290 | 290 | show_app_credit_user($user, $sp["name"], $sp["appids"]); |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | return $platforms[$id]; |
54 | 54 | } |
55 | 55 | |
56 | -function anon_platform_string($result, $rsc_name=null) { |
|
56 | +function anon_platform_string($result, $rsc_name = null) { |
|
57 | 57 | $app = get_app($result->appid); |
58 | - $n = $app->user_friendly_name."<br>". tra("Anonymous platform"); |
|
58 | + $n = $app->user_friendly_name."<br>".tra("Anonymous platform"); |
|
59 | 59 | if ($rsc_name) { |
60 | 60 | $n .= " ($rsc_name)"; |
61 | 61 | } |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | return $string_to_show; |
103 | 103 | } |
104 | 104 | if ($result->server_state <> RESULT_SERVER_STATE_OVER) return "---"; |
105 | - switch($result->outcome) { |
|
105 | + switch ($result->outcome) { |
|
106 | 106 | case RESULT_OUTCOME_SUCCESS: |
107 | 107 | switch ($result->validate_state) { |
108 | 108 | case VALIDATE_STATE_INIT: |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | ) { |
241 | 241 | return tra("Not started by deadline - canceled"); |
242 | 242 | } |
243 | - switch($result->client_state) { |
|
243 | + switch ($result->client_state) { |
|
244 | 244 | case RESULT_FILES_DOWNLOADING: return tra("Error while downloading"); |
245 | 245 | case RESULT_FILES_DOWNLOADED: |
246 | 246 | case RESULT_COMPUTE_ERROR: return tra("Error while computing"); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | function result_server_state_string($result) { |
262 | - switch($result->server_state) { |
|
262 | + switch ($result->server_state) { |
|
263 | 263 | case RESULT_SERVER_STATE_INACTIVE: return tra("Inactive"); |
264 | 264 | case RESULT_SERVER_STATE_UNSENT: return tra("Unsent"); |
265 | 265 | case RESULT_SERVER_STATE_IN_PROGRESS: return tra("In progress"); |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | } |
270 | 270 | |
271 | 271 | function result_outcome_string($result) { |
272 | - switch($result->outcome) { |
|
272 | + switch ($result->outcome) { |
|
273 | 273 | case RESULT_OUTCOME_INIT: return "---"; |
274 | 274 | case RESULT_OUTCOME_SUCCESS: return tra("Success"); |
275 | 275 | case RESULT_OUTCOME_COULDNT_SEND: return tra("Couldn't send"); |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | } |
288 | 288 | |
289 | 289 | function result_client_state_string($result) { |
290 | - switch($result->client_state) { |
|
290 | + switch ($result->client_state) { |
|
291 | 291 | case RESULT_NEW: return tra("New"); |
292 | 292 | case RESULT_FILES_DOWNLOADING: return tra("Downloading"); |
293 | 293 | case RESULT_FILES_DOWNLOADED: return tra("Processing"); |
@@ -305,7 +305,7 @@ discard block |
||
305 | 305 | } |
306 | 306 | |
307 | 307 | function validate_state_str($result) { |
308 | - switch($result->validate_state) { |
|
308 | + switch ($result->validate_state) { |
|
309 | 309 | case VALIDATE_STATE_INIT: return tra("Initial"); |
310 | 310 | case VALIDATE_STATE_VALID: return tra("Valid"); |
311 | 311 | case VALIDATE_STATE_INVALID: |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | } |
322 | 322 | |
323 | 323 | function assimilate_state_str($s) { |
324 | - switch($s) { |
|
324 | + switch ($s) { |
|
325 | 325 | case ASSIMILATE_INIT: return "Initial"; |
326 | 326 | case ASSIMILATE_READY: return "Ready to assimilate"; |
327 | 327 | case ASSIMILATE_DONE: return "Assimilated"; |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | |
332 | 332 | function file_delete_state_str($s) { |
333 | - switch($s) { |
|
333 | + switch ($s) { |
|
334 | 334 | case FILE_DELETE_INIT: return "Initial"; |
335 | 335 | case FILE_DELETE_READY: return "Ready to delete"; |
336 | 336 | case FILE_DELETE_DONE: return "Deleted"; |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | // convert WU error bitmask to str. |
343 | 343 | // If $color, add HTML red color |
344 | 344 | // |
345 | -function wu_error_mask_str($s, $color=false) { |
|
345 | +function wu_error_mask_str($s, $color = false) { |
|
346 | 346 | $x = ""; |
347 | 347 | if ($s & WU_ERROR_COULDNT_SEND_RESULT) { |
348 | 348 | $x = $x." ".tra("Couldn't send result"); |
@@ -456,10 +456,10 @@ discard block |
||
456 | 456 | if ($result->received_time) { |
457 | 457 | $r = time_str($result->received_time); |
458 | 458 | } else if ($result->report_deadline) { |
459 | - if ($result->report_deadline>time()) { |
|
460 | - $r = "<font color='#33cc33'>" . time_str($result->report_deadline) . "</font>"; |
|
459 | + if ($result->report_deadline > time()) { |
|
460 | + $r = "<font color='#33cc33'>".time_str($result->report_deadline)."</font>"; |
|
461 | 461 | } else { |
462 | - $r = "<font color='#ff3333'>" . time_str($result->report_deadline) . "</font>"; |
|
462 | + $r = "<font color='#ff3333'>".time_str($result->report_deadline)."</font>"; |
|
463 | 463 | } |
464 | 464 | } else { |
465 | 465 | $r = "---"; |
@@ -520,7 +520,7 @@ discard block |
||
520 | 520 | // @param Integer $dec A signed integer |
521 | 521 | // |
522 | 522 | function int2hex($dec) { |
523 | - return "0x".strtoupper(substr(sprintf("%08x",$dec), -8)); |
|
523 | + return "0x".strtoupper(substr(sprintf("%08x", $dec), -8)); |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | // Decode a windows error number into semi-human-readable, |
@@ -530,9 +530,9 @@ discard block |
||
530 | 530 | // @return String A human readable error message |
531 | 531 | // @param Integer $x An error number |
532 | 532 | // |
533 | -function windows_error_code_str($x){ |
|
534 | - $h=int2hex($x); |
|
535 | - switch($h){ |
|
533 | +function windows_error_code_str($x) { |
|
534 | + $h = int2hex($x); |
|
535 | + switch ($h) { |
|
536 | 536 | case "0xC0000005": return "STATUS_ACCESS_VIOLATION"; |
537 | 537 | case "0xC000001D": return "STATUS_ILLEGAL_INSTRUCTION"; |
538 | 538 | case "0xC0000094": return "STATUS_INTEGER_DIVIDE_BY_ZERO"; |
@@ -553,10 +553,10 @@ discard block |
||
553 | 553 | // @return String A human readable error message |
554 | 554 | // @param Integer $x An error number |
555 | 555 | // |
556 | -function error_code_str($x){ |
|
556 | +function error_code_str($x) { |
|
557 | 557 | // severe Windows error numbers are always large negative integers |
558 | - if ($x<-400) return windows_error_code_str($x); |
|
559 | - switch($x){ |
|
558 | + if ($x < -400) return windows_error_code_str($x); |
|
559 | + switch ($x) { |
|
560 | 560 | case 0: return ""; |
561 | 561 | case 192: return "EXIT_STATEFILE_WRITE"; |
562 | 562 | case 193: return "EXIT_SIGNAL"; |
@@ -717,7 +717,7 @@ discard block |
||
717 | 717 | return $x." (".int2hex($x).") ".error_code_str($x); |
718 | 718 | } |
719 | 719 | |
720 | -function show_result($result, $show_outfile_links=false) { |
|
720 | +function show_result($result, $show_outfile_links = false) { |
|
721 | 721 | start_table(); |
722 | 722 | row2(tra("Name"), $result->name); |
723 | 723 | row2(tra("Workunit"), "<a href=\"workunit.php?wuid=$result->workunitid\">$result->workunitid</a>"); |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | echo "<h3>".tra("Stderr output")."</h3> <pre>" |
770 | 770 | .htmlspecialchars( |
771 | 771 | $result->stderr_out, |
772 | - ENT_QUOTES | (defined('ENT_SUBSTITUTE')?ENT_SUBSTITUTE:0), |
|
772 | + ENT_QUOTES|(defined('ENT_SUBSTITUTE') ?ENT_SUBSTITUTE:0), |
|
773 | 773 | 'utf-8' |
774 | 774 | ) |
775 | 775 | ."</pre>" |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | |
786 | 786 | $apps = BoincApp::enum('deprecated=0 ORDER BY user_friendly_name'); |
787 | 787 | |
788 | - for ($i=0; $i<NSTATES; $i++) { |
|
788 | + for ($i = 0; $i < NSTATES; $i++) { |
|
789 | 789 | $state_count[$i] = 0; |
790 | 790 | } |
791 | 791 | foreach ($apps as $app) { |
@@ -828,7 +828,7 @@ discard block |
||
828 | 828 | $x .= "<a href=$url>".tra("Next")." ".$info->results_per_page."</a>"; |
829 | 829 | } |
830 | 830 | $x .= "<br>".tra("State").": "; |
831 | - for ($i=0; $i<NSTATES; $i++) { |
|
831 | + for ($i = 0; $i < NSTATES; $i++) { |
|
832 | 832 | if ($i) $x .= " · "; |
833 | 833 | if ($info->state == $i) { |
834 | 834 | $x .= $state_name[$i]; |
@@ -37,7 +37,7 @@ |
||
37 | 37 | $desc->long_name, |
38 | 38 | $desc->description, |
39 | 39 | kw_array_to_str($desc->sci_kw), |
40 | - empty($desc->url)?'':"<a href=$desc->url>View</a>", |
|
40 | + empty($desc->url) ? '' : "<a href=$desc->url>View</a>", |
|
41 | 41 | 'Yes' |
42 | 42 | ); |
43 | 43 | } |
@@ -24,72 +24,72 @@ discard block |
||
24 | 24 | define('KW_CATEGORY_SCIENCE', 0); |
25 | 25 | define('KW_CATEGORY_LOC', 1); |
26 | 26 | |
27 | -define('KW_ASTRONOMY', 1); |
|
28 | -define('KW_SETI', 2); |
|
29 | -define('KW_PULSARS', 3); |
|
30 | -define('KW_GW', 4); |
|
31 | -define('KW_COSMOLOGY', 5); |
|
32 | -define('KW_PHYSICS', 6); |
|
27 | +define('KW_ASTRONOMY', 1); |
|
28 | +define('KW_SETI', 2); |
|
29 | +define('KW_PULSARS', 3); |
|
30 | +define('KW_GW', 4); |
|
31 | +define('KW_COSMOLOGY', 5); |
|
32 | +define('KW_PHYSICS', 6); |
|
33 | 33 | define('KW_PARTICLE_PHYSICS', 7); |
34 | -define('KW_NANOSCIENCE', 8); |
|
35 | -define('KW_BIOMED', 9); |
|
34 | +define('KW_NANOSCIENCE', 8); |
|
35 | +define('KW_BIOMED', 9); |
|
36 | 36 | define('KW_DRUG_DISCOVERY', 10); |
37 | -define('KW_PROTEINS', 11); |
|
38 | -define('KW_GENETICS', 12); |
|
39 | -define('KW_DISEASE', 13); |
|
40 | -define('KW_CANCER', 14); |
|
41 | -define('KW_MATH_CS', 15); |
|
42 | -define('KW_AI', 16); |
|
43 | -define('KW_OCEANIA', 17); |
|
44 | -define('KW_AUSTRALIA', 18); |
|
37 | +define('KW_PROTEINS', 11); |
|
38 | +define('KW_GENETICS', 12); |
|
39 | +define('KW_DISEASE', 13); |
|
40 | +define('KW_CANCER', 14); |
|
41 | +define('KW_MATH_CS', 15); |
|
42 | +define('KW_AI', 16); |
|
43 | +define('KW_OCEANIA', 17); |
|
44 | +define('KW_AUSTRALIA', 18); |
|
45 | 45 | |
46 | -define('KW_EUROPE', 20); |
|
47 | -define('KW_GERMANY', 21); |
|
48 | -define('KW_ASIA', 22); |
|
49 | -define('KW_AMERICAS', 23); |
|
50 | -define('KW_US', 24); |
|
51 | -define('KW_UCB', 25); |
|
52 | -define('KW_AEI', 26); |
|
53 | -define('KW_CERN', 27); |
|
54 | -define('KW_UW', 28); |
|
55 | -define('KW_EARTH_SCI', 29); |
|
56 | -define('KW_SPAIN', 30); |
|
57 | -define('KW_SAN_JORGE', 31); |
|
58 | -define('KW_NUMBER_THEORY', 32); |
|
59 | -define('KW_CRYPTO', 33); |
|
60 | -define('KW_ENV_RESEARCH', 34); |
|
61 | -define('KW_CLIMATE', 35); |
|
62 | -define('KW_CZECH', 36); |
|
46 | +define('KW_EUROPE', 20); |
|
47 | +define('KW_GERMANY', 21); |
|
48 | +define('KW_ASIA', 22); |
|
49 | +define('KW_AMERICAS', 23); |
|
50 | +define('KW_US', 24); |
|
51 | +define('KW_UCB', 25); |
|
52 | +define('KW_AEI', 26); |
|
53 | +define('KW_CERN', 27); |
|
54 | +define('KW_UW', 28); |
|
55 | +define('KW_EARTH_SCI', 29); |
|
56 | +define('KW_SPAIN', 30); |
|
57 | +define('KW_SAN_JORGE', 31); |
|
58 | +define('KW_NUMBER_THEORY', 32); |
|
59 | +define('KW_CRYPTO', 33); |
|
60 | +define('KW_ENV_RESEARCH', 34); |
|
61 | +define('KW_CLIMATE', 35); |
|
62 | +define('KW_CZECH', 36); |
|
63 | 63 | define('KW_CHARLES_PRAGUE', 37); |
64 | -define('KW_RECHENKRAFT', 38); |
|
65 | -define('KW_RHEINMAIN', 39); |
|
66 | -define('KW_HUNGARY', 40); |
|
67 | -define('KW_IRELAND', 41); |
|
68 | -define('KW_UC_DUBLIN', 42); |
|
69 | -define('KW_POLAND', 43); |
|
70 | -define('KW_RUSSIA', 44); |
|
64 | +define('KW_RECHENKRAFT', 38); |
|
65 | +define('KW_RHEINMAIN', 39); |
|
66 | +define('KW_HUNGARY', 40); |
|
67 | +define('KW_IRELAND', 41); |
|
68 | +define('KW_UC_DUBLIN', 42); |
|
69 | +define('KW_POLAND', 43); |
|
70 | +define('KW_RUSSIA', 44); |
|
71 | 71 | define('KW_SW_STATE_RUSSIA', 45); |
72 | -define('KW_RAS', 46); |
|
73 | -define('KW_PRBB', 47); |
|
74 | -define('KW_UK', 48); |
|
75 | -define('KW_OXFORD', 49); |
|
76 | -define('KW_CHINA', 50); |
|
77 | -define('KW_U_DAYTON', 51); |
|
78 | -define('KW_WRIGHT_STATE', 52); |
|
79 | -define('KW_USC', 53); |
|
80 | -define('KW_FULLERTON', 54); |
|
81 | -define('KW_ARIZONA_STATE', 55); |
|
82 | -define('KW_U_ILLINOIS', 56); |
|
83 | -define('KW_U_WARSAW', 57); |
|
84 | -define('KW_RPI', 58); |
|
85 | -define('KW_INTERNATIONAL', 59); |
|
86 | -define('KW_UND', 60); |
|
87 | -define('KW_HOLLAND', 61); |
|
88 | -define('KW_CHEMISTRY', 62); |
|
89 | -define('KW_GAMES', 63); |
|
90 | -define('KW_VIRUS', 64); |
|
91 | -define('KW_FRANCE', 65); |
|
92 | -define('KW_CANADA', 66); |
|
72 | +define('KW_RAS', 46); |
|
73 | +define('KW_PRBB', 47); |
|
74 | +define('KW_UK', 48); |
|
75 | +define('KW_OXFORD', 49); |
|
76 | +define('KW_CHINA', 50); |
|
77 | +define('KW_U_DAYTON', 51); |
|
78 | +define('KW_WRIGHT_STATE', 52); |
|
79 | +define('KW_USC', 53); |
|
80 | +define('KW_FULLERTON', 54); |
|
81 | +define('KW_ARIZONA_STATE', 55); |
|
82 | +define('KW_U_ILLINOIS', 56); |
|
83 | +define('KW_U_WARSAW', 57); |
|
84 | +define('KW_RPI', 58); |
|
85 | +define('KW_INTERNATIONAL', 59); |
|
86 | +define('KW_UND', 60); |
|
87 | +define('KW_HOLLAND', 61); |
|
88 | +define('KW_CHEMISTRY', 62); |
|
89 | +define('KW_GAMES', 63); |
|
90 | +define('KW_VIRUS', 64); |
|
91 | +define('KW_FRANCE', 65); |
|
92 | +define('KW_CANADA', 66); |
|
93 | 93 | |
94 | 94 | $job_keywords = array(); |
95 | 95 | |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | } |
331 | 331 | } |
332 | 332 | |
333 | -function kw_options($id, $indent='') { |
|
333 | +function kw_options($id, $indent = '') { |
|
334 | 334 | global $job_keywords; |
335 | 335 | $kw = $job_keywords[$id]; |
336 | 336 | $opts = [[$id, "$indent$kw->name"]]; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | return $kw->name; |
348 | 348 | } |
349 | 349 | |
350 | -function kw_array_to_str($kws, $sep='<br>') { |
|
350 | +function kw_array_to_str($kws, $sep = '<br>') { |
|
351 | 351 | $x = array_map('strval', $kws); |
352 | 352 | $x = array_map('kw_id_to_name', $x); |
353 | 353 | return implode($sep, $x); |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $app = BoincApp::lookup_id($ua->app_id); |
37 | 37 | $names[] = $app->name; |
38 | 38 | } |
39 | - $sub = $names?implode(', ', $names):'---'; |
|
39 | + $sub = $names ?implode(', ', $names) : '---'; |
|
40 | 40 | } |
41 | 41 | if ($u->manage_all) { |
42 | 42 | $admin = 'All applications'; |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | $app = BoincApp::lookup_id($ua->app_id); |
48 | 48 | $names[] = $app->name; |
49 | 49 | } |
50 | - $admin = $names?implode(', ', $names):'---'; |
|
50 | + $admin = $names ?implode(', ', $names) : '---'; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | table_row( |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | $admin, |
60 | 60 | $u->quota, |
61 | 61 | $u->max_jobs_in_progress, |
62 | - ($u->logical_start_time > time())?local_time_str($u->logical_start_time):'---' |
|
62 | + ($u->logical_start_time > time()) ?local_time_str($u->logical_start_time) : '---' |
|
63 | 63 | ); |
64 | 64 | } |
65 | 65 | |
@@ -184,18 +184,18 @@ discard block |
||
184 | 184 | $manage_apps = array_map('intval', $manage_apps); |
185 | 185 | foreach ($apps as $app) { |
186 | 186 | $s = in_array($app->id, $submit_apps); |
187 | - $m = in_array($app->id, $manage_apps)?1:0; |
|
187 | + $m = in_array($app->id, $manage_apps) ? 1 : 0; |
|
188 | 188 | if ($s || $m) { |
189 | 189 | BoincUserSubmitApp::insert( |
190 | 190 | "(user_id, app_id, manage) values ($user_id, $app->id, $m)" |
191 | 191 | ); |
192 | 192 | } |
193 | 193 | } |
194 | - $quota = (double) get_str('quota'); |
|
194 | + $quota = (double)get_str('quota'); |
|
195 | 195 | if ($quota != $us->quota) { |
196 | 196 | $us->update("quota=$quota"); |
197 | 197 | } |
198 | - $mj = (int) get_str('max_jobs_in_progress'); |
|
198 | + $mj = (int)get_str('max_jobs_in_progress'); |
|
199 | 199 | if ($mj != $us->max_jobs_in_progress) { |
200 | 200 | $us->update("max_jobs_in_progress=$mj"); |
201 | 201 | } |