@@ -38,8 +38,8 @@ discard block |
||
38 | 38 | proc_terminate($p); |
39 | 39 | // echo "child process is $ret\n"; |
40 | 40 | $pids=preg_split('/\s+/',$ret); |
41 | - foreach($pids as $pid){ |
|
42 | - if(is_numeric($pid)){ |
|
41 | + foreach($pids as $pid) { |
|
42 | + if(is_numeric($pid)) { |
|
43 | 43 | if($GLOBALS["debug"])echo "killing child process $pid\n"; |
44 | 44 | posix_kill($pid,9); |
45 | 45 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | $p = proc_open("$cmd", $descs, $pipes); |
61 | 61 | while (1) { |
62 | 62 | $ctime=time(); |
63 | - if($ctime-$stime >=2 and ! file_exists("log.1")){ |
|
63 | + if($ctime-$stime >=2 and ! file_exists("log.1")) { |
|
64 | 64 | if($GLOBALS["debug"]) echo "time out "."<br>"; |
65 | 65 | terminate_job($p); |
66 | 66 | break; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $steps = $end_step-$start_step; |
158 | 158 | $avg_cpu = $cpu/$steps; |
159 | 159 | #$avg_cpu = $cpu/$count; |
160 | - if ($GLOBALS["debug"]){ |
|
160 | + if ($GLOBALS["debug"]) { |
|
161 | 161 | echo "test steps is ".$steps."<br>"; |
162 | 162 | echo "avg_cpu is ".$avg_cpu."<br>"; |
163 | 163 | } |
@@ -169,20 +169,19 @@ discard block |
||
169 | 169 | return array($avg_cpu,$test_steps); |
170 | 170 | } |
171 | 171 | |
172 | -function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps){ |
|
172 | +function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps) { |
|
173 | 173 | $dump_types = 0; |
174 | 174 | $fd = fopen($lammps_script,"r"); |
175 | - if (!$fd){ |
|
175 | + if (!$fd) { |
|
176 | 176 | echo "can not open file $lammps_script\n"; |
177 | 177 | exit(-1); |
178 | 178 | } |
179 | - while (!feof($fd)){ |
|
179 | + while (!feof($fd)) { |
|
180 | 180 | $line = fgets($fd, 4096); |
181 | 181 | //if (preg_match("/^\s*dump/", $line) |
182 | 182 | // and preg_match_all("/dump\S+\.\w{3}/", $line, $matches, PREG_PATTERN_ORDER)) |
183 | 183 | |
184 | - if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) |
|
185 | - { |
|
184 | + if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) { |
|
186 | 185 | if($GLOBALS["debug"]){print "matches=";print_r($matches);} |
187 | 186 | |
188 | 187 | $dump_types=(int)$matches[1]; |
@@ -194,7 +193,7 @@ discard block |
||
194 | 193 | |
195 | 194 | $structure_file_size = filesize($structure_file); |
196 | 195 | $fd = fopen($cmd_file,"r"); |
197 | - if (!$fd){ |
|
196 | + if (!$fd) { |
|
198 | 197 | echo "can not open file $cmd_file\n"; |
199 | 198 | exit(-1); |
200 | 199 | } |
@@ -202,10 +201,10 @@ discard block |
||
202 | 201 | |
203 | 202 | $loopno=1; |
204 | 203 | $looprun=1; |
205 | - while (!feof($fd)){ |
|
204 | + while (!feof($fd)) { |
|
206 | 205 | $line = fgets($fd,4096); |
207 | - if(preg_match("/loopnumber\s+\d+/", $line, $matches)){ |
|
208 | - if(preg_match("/\d+/", $matches[0], $no)){ |
|
206 | + if(preg_match("/loopnumber\s+\d+/", $line, $matches)) { |
|
207 | + if(preg_match("/\d+/", $matches[0], $no)) { |
|
209 | 208 | //$loopno=$no[0]; |
210 | 209 | if($no[0]>$loopno)$loopno=$no[0]; |
211 | 210 | } |
@@ -215,7 +214,7 @@ discard block |
||
215 | 214 | } |
216 | 215 | } |
217 | 216 | fclose($fd); |
218 | - if($GLOBALS["debug"]){ |
|
217 | + if($GLOBALS["debug"]) { |
|
219 | 218 | print "max loopno(number of loops to run)=".$loopno."<br>"; |
220 | 219 | print "max looprun(steps for each loop)=".$looprun."<br>"; |
221 | 220 | } |
@@ -231,7 +230,7 @@ discard block |
||
231 | 230 | $app_fixed_size = 5e7; |
232 | 231 | $est_size = $log_size+$dump_size+$app_fixed_size; |
233 | 232 | |
234 | - if($GLOBALS["debug"]){ |
|
233 | + if($GLOBALS["debug"]) { |
|
235 | 234 | print "test_steps=".$test_steps."<br>"; |
236 | 235 | print "test_log_size=".$test_log_size."<br>"; |
237 | 236 | print "log_size1=".$log_size1."<br>"; |
@@ -367,7 +366,7 @@ discard block |
||
367 | 366 | $err="Your test job <strong>failed</strong> |
368 | 367 | <br>Please refer to the following Error Message:<br><p> |
369 | 368 | "; |
370 | - foreach($err_msgs as $line){ |
|
369 | + foreach($err_msgs as $line) { |
|
371 | 370 | $err=$err.$line."<br>"; |
372 | 371 | } |
373 | 372 | $err=$err." <p> |
@@ -380,9 +379,9 @@ discard block |
||
380 | 379 | $info->rsc_fpops_est = $est_cpu_time * 1.5e9; |
381 | 380 | $info->rsc_fpops_bound = $info->rsc_fpops_est * 20; |
382 | 381 | |
383 | - if ($disk==0){ |
|
382 | + if ($disk==0) { |
|
384 | 383 | $info->rsc_disk_bound=1000000; |
385 | - } else{ |
|
384 | + } else { |
|
386 | 385 | $info->rsc_disk_bound = $disk; |
387 | 386 | } |
388 | 387 | |
@@ -444,7 +443,7 @@ discard block |
||
444 | 443 | |
445 | 444 | $njobs=0; |
446 | 445 | $cmdlines = file($info->cmdline_file_path); |
447 | - foreach ($cmdlines as $cmdline){ |
|
446 | + foreach ($cmdlines as $cmdline) { |
|
448 | 447 | if (preg_match("/^\s*-var/", $cmdline)) { |
449 | 448 | $njobs++; |
450 | 449 | } |
@@ -460,7 +459,7 @@ discard block |
||
460 | 459 | |
461 | 460 | $i = 0; |
462 | 461 | foreach ($cmdlines as $cmdline) { |
463 | - if (preg_match("/^\s*-var/", $cmdline)){ |
|
462 | + if (preg_match("/^\s*-var/", $cmdline)) { |
|
464 | 463 | submit_job($app, $batch_id, $info, $cmdline, $i); |
465 | 464 | $i++; |
466 | 465 | } |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | // Action part |
52 | 52 | // |
53 | 53 | $success_page=0; |
54 | -if (get_str("submit",true)){ |
|
54 | +if (get_str("submit",true)) { |
|
55 | 55 | check_tokens($user->authenticator); |
56 | 56 | $reason = get_str("reason"); |
57 | - if (send_report_post_email($user, $forum, $thread, $post, $reason)){ |
|
57 | + if (send_report_post_email($user, $forum, $thread, $post, $reason)) { |
|
58 | 58 | $success_page=1; |
59 | 59 | } else { |
60 | 60 | echo "send email failed"; |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | .tra("A moderator will now look at your report and decide what will happen - this may take a little while, so please be patient"); |
73 | 73 | |
74 | 74 | echo "<p><a href=\"forum_thread.php?id=$thread->id&postid=$post->id\">".tra("Return to thread")."</a>"; |
75 | -} elseif ($success_page==0){ |
|
75 | +} elseif ($success_page==0) { |
|
76 | 76 | page_head(tra("Report a forum post")); |
77 | 77 | if (!$no_forum_rating) { |
78 | 78 | echo "<p>".tra("Before reporting this post, consider using the +/- rating system instead. If enough users rate a post negatively it will eventually be hidden.<br />You can find the rating system at the bottom of the post.")."</p> |
@@ -52,7 +52,8 @@ |
||
52 | 52 | echo "<teams>\n"; |
53 | 53 | $total = 0; |
54 | 54 | foreach ($team_id_array as $team_id) { |
55 | - if (is_numeric($team_id)) { //make sure only numbers get through |
|
55 | + if (is_numeric($team_id)) { |
|
56 | +//make sure only numbers get through |
|
56 | 57 | $team = BoincTeam::lookup_id($team_id); |
57 | 58 | if ($team) { |
58 | 59 | show_team_xml($team); |
@@ -691,7 +691,8 @@ |
||
691 | 691 | <id>$result->id</id> |
692 | 692 | <state>".state_string($result)."</state> |
693 | 693 | "; |
694 | - if ($result->server_state == 5) { // over? |
|
694 | + if ($result->server_state == 5) { |
|
695 | +// over? |
|
695 | 696 | $paths = get_outfile_paths($result); |
696 | 697 | foreach($paths as $path) { |
697 | 698 | if (is_file($path)) { |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | page_tail(); |
45 | 45 | exit; |
46 | 46 | } |
47 | - if (substr($user->authenticator, 0, 1) == 'x'){ |
|
47 | + if (substr($user->authenticator, 0, 1) == 'x') { |
|
48 | 48 | sleep(LOGIN_FAIL_SLEEP_SEC); |
49 | 49 | error_page("This account has been administratively disabled."); |
50 | 50 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | Please <a href=get_passwd.php>try again</a>. |
106 | 106 | "; |
107 | 107 | page_tail(); |
108 | - } else if (substr($user->authenticator, 0, 1) == 'x'){ |
|
108 | + } else if (substr($user->authenticator, 0, 1) == 'x') { |
|
109 | 109 | sleep(LOGIN_FAIL_SLEEP_SEC); |
110 | 110 | error_page("This account has been administratively disabled."); |
111 | 111 | } else { |
@@ -57,7 +57,7 @@ |
||
57 | 57 | $clause = "hostid=$hostid"; |
58 | 58 | page_head(tra("$s tasks for computer %1", $host->id)); |
59 | 59 | $show_host_link = false; |
60 | -} else if ($userid){ |
|
60 | +} else if ($userid) { |
|
61 | 61 | $user = get_logged_in_user(); |
62 | 62 | if ($userid != $user->id) { |
63 | 63 | error_page(tra("No access")); |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | </form> |
53 | 53 | <hr> |
54 | 54 | "; |
55 | - if (strcmp($err_msg,"")!=0){ |
|
55 | + if (strcmp($err_msg,"")!=0) { |
|
56 | 56 | echo "<p>$err_msg<hr>"; |
57 | 57 | } |
58 | 58 | $files = array(); |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $s = stat($tmp_name); |
117 | 117 | $size = $s['size']; |
118 | 118 | list($exist, $elf) = sandbox_lf_exist($user, $md5); |
119 | - if ($exist){ |
|
119 | + if ($exist) { |
|
120 | 120 | $notice .= "<strong>Notice:</strong> Invalid Upload<br/>"; |
121 | 121 | $notice .= "You are trying to upload file <strong>$name</strong><br/>"; |
122 | 122 | $notice .= "Another file <strong>$elf</strong> with the same content (md5: $md5) already exists!<br/>"; |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | error_page("no such physical file"); |
150 | 150 | } |
151 | 151 | $bused = sandbox_file_in_use($user, $name); |
152 | - if ($bused){ |
|
152 | + if ($bused) { |
|
153 | 153 | $notice = "<strong>$name</strong> is being used by batch(es), you can not delete it now!<br/>"; |
154 | - } else{ |
|
154 | + } else { |
|
155 | 155 | $notice = "<strong>$name</strong> is not being used by any batch(es) and successfully deleted from your sandbox<br/>"; |
156 | 156 | unlink("$dir/$name"); |
157 | 157 | unlink($p); |
@@ -33,8 +33,8 @@ |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | $set_lang = get_str("set_lang", true); |
36 | -if ($set_lang){ |
|
37 | - if (!in_array($set_lang, $languages) && $set_lang!="auto"){ |
|
36 | +if ($set_lang) { |
|
37 | + if (!in_array($set_lang, $languages) && $set_lang!="auto") { |
|
38 | 38 | error_page("Language not supported"); |
39 | 39 | } else { |
40 | 40 | send_cookie('lang', $set_lang, true); |
@@ -28,10 +28,10 @@ |
||
28 | 28 | // |
29 | 29 | function show_platforms() { |
30 | 30 | $xmlFragment = unserialize(get_cached_data(3600, "project_config_platform_xml")); |
31 | - if ($xmlFragment==false){ |
|
31 | + if ($xmlFragment==false) { |
|
32 | 32 | $platforms = BoincDB::get()->enum_fields("platform, DBNAME.app_version, DBNAME.app", "BoincPlatform", "platform.name, platform.user_friendly_name, plan_class", "app_version.platformid = platform.id and app_version.appid = app.id and app_version.deprecated=0 and app.deprecated=0 group by platform.name, plan_class", ""); |
33 | 33 | $xmlFragment = " <platforms>"; |
34 | - foreach ($platforms as $platform){ |
|
34 | + foreach ($platforms as $platform) { |
|
35 | 35 | $xmlFragment .= " |
36 | 36 | <platform> |
37 | 37 | <platform_name>$platform->name</platform_name> |