@@ -59,7 +59,7 @@ |
||
59 | 59 | return 0; |
60 | 60 | } |
61 | 61 | |
62 | -function team_type_select($selected_type, $allow_none=false){ |
|
62 | +function team_type_select($selected_type, $allow_none=false) { |
|
63 | 63 | global $team_types; |
64 | 64 | |
65 | 65 | $types = $team_types; |
@@ -556,7 +556,7 @@ |
||
556 | 556 | function print_prefs_form( |
557 | 557 | $action, $subset, $venue, $user, $prefs, $cols, $error=false, |
558 | 558 | $project_error=false |
559 | -){ |
|
559 | +) { |
|
560 | 560 | if ($action == "add") { |
561 | 561 | $script = "add_venue.php"; |
562 | 562 | $submit_value = tra("Add preferences"); |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | shmop_close ($shmid); |
230 | 230 | } |
231 | 231 | |
232 | -function _setup_segments($gi){ |
|
232 | +function _setup_segments($gi) { |
|
233 | 233 | $gi->databaseType = GEOIP_COUNTRY_EDITION; |
234 | 234 | $gi->record_length = STANDARD_RECORD_LENGTH; |
235 | 235 | if ($gi->flags & GEOIP_SHARED_MEMORY) { |
@@ -241,18 +241,18 @@ discard block |
||
241 | 241 | $gi->databaseType = ord(@shmop_read ($gi->shmid, $offset, 1)); |
242 | 242 | $offset++; |
243 | 243 | |
244 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
244 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
245 | 245 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; |
246 | - } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ |
|
246 | + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
247 | 247 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; |
248 | 248 | } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0)|| |
249 | 249 | ($gi->databaseType == GEOIP_CITY_EDITION_REV1) |
250 | 250 | || ($gi->databaseType == GEOIP_ORG_EDITION) |
251 | 251 | || ($gi->databaseType == GEOIP_ISP_EDITION) |
252 | - || ($gi->databaseType == GEOIP_ASNUM_EDITION)){ |
|
252 | + || ($gi->databaseType == GEOIP_ASNUM_EDITION)) { |
|
253 | 253 | $gi->databaseSegments = 0; |
254 | 254 | $buf = @shmop_read ($gi->shmid, $offset, SEGMENT_RECORD_LENGTH); |
255 | - for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ |
|
255 | + for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++) { |
|
256 | 256 | $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); |
257 | 257 | } |
258 | 258 | if (($gi->databaseType == GEOIP_ORG_EDITION)|| |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | } |
268 | 268 | if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| |
269 | 269 | ($gi->databaseType == GEOIP_PROXY_EDITION)|| |
270 | - ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ |
|
270 | + ($gi->databaseType == GEOIP_NETSPEED_EDITION)) { |
|
271 | 271 | $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; |
272 | 272 | } |
273 | 273 | } else { |
@@ -275,21 +275,20 @@ discard block |
||
275 | 275 | fseek($gi->filehandle, -3, SEEK_END); |
276 | 276 | for ($i = 0; $i < STRUCTURE_INFO_MAX_SIZE; $i++) { |
277 | 277 | $delim = fread($gi->filehandle,3); |
278 | - if ($delim == (chr(255).chr(255).chr(255))){ |
|
278 | + if ($delim == (chr(255).chr(255).chr(255))) { |
|
279 | 279 | $gi->databaseType = ord(fread($gi->filehandle,1)); |
280 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
280 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
281 | 281 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV0; |
282 | - } |
|
283 | - else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1){ |
|
282 | + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
284 | 283 | $gi->databaseSegments = GEOIP_STATE_BEGIN_REV1; |
285 | - } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || |
|
284 | + } else if (($gi->databaseType == GEOIP_CITY_EDITION_REV0) || |
|
286 | 285 | ($gi->databaseType == GEOIP_CITY_EDITION_REV1) || |
287 | 286 | ($gi->databaseType == GEOIP_ORG_EDITION) || |
288 | 287 | ($gi->databaseType == GEOIP_ISP_EDITION) || |
289 | - ($gi->databaseType == GEOIP_ASNUM_EDITION)){ |
|
288 | + ($gi->databaseType == GEOIP_ASNUM_EDITION)) { |
|
290 | 289 | $gi->databaseSegments = 0; |
291 | 290 | $buf = fread($gi->filehandle,SEGMENT_RECORD_LENGTH); |
292 | - for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++){ |
|
291 | + for ($j = 0;$j < SEGMENT_RECORD_LENGTH;$j++) { |
|
293 | 292 | $gi->databaseSegments += (ord($buf[$j]) << ($j * 8)); |
294 | 293 | } |
295 | 294 | if ($gi->databaseType == GEOIP_ORG_EDITION) { |
@@ -303,7 +302,7 @@ discard block |
||
303 | 302 | } |
304 | 303 | if (($gi->databaseType == GEOIP_COUNTRY_EDITION)|| |
305 | 304 | ($gi->databaseType == GEOIP_PROXY_EDITION)|| |
306 | - ($gi->databaseType == GEOIP_NETSPEED_EDITION)){ |
|
305 | + ($gi->databaseType == GEOIP_NETSPEED_EDITION)) { |
|
307 | 306 | $gi->databaseSegments = GEOIP_COUNTRY_BEGIN; |
308 | 307 | } |
309 | 308 | fseek($gi->filehandle,$filepos,SEEK_SET); |
@@ -419,7 +418,7 @@ discard block |
||
419 | 418 | return false; |
420 | 419 | } |
421 | 420 | |
422 | -function _get_org($gi,$ipnum){ |
|
421 | +function _get_org($gi,$ipnum) { |
|
423 | 422 | $seek_org = _geoip_seek_country($gi,$ipnum); |
424 | 423 | if ($seek_org == $gi->databaseSegments) { |
425 | 424 | return NULL; |
@@ -443,10 +442,10 @@ discard block |
||
443 | 442 | return _get_org($gi, $ipnum); |
444 | 443 | } |
445 | 444 | |
446 | -function _get_region($gi,$ipnum){ |
|
447 | - if ($gi->databaseType == GEOIP_REGION_EDITION_REV0){ |
|
445 | +function _get_region($gi,$ipnum) { |
|
446 | + if ($gi->databaseType == GEOIP_REGION_EDITION_REV0) { |
|
448 | 447 | $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV0; |
449 | - if ($seek_region >= 1000){ |
|
448 | + if ($seek_region >= 1000) { |
|
450 | 449 | $country_code = "US"; |
451 | 450 | $region = chr(($seek_region - 1000)/26 + 65) . chr(($seek_region - 1000)%26 + 65); |
452 | 451 | } else { |
@@ -454,10 +453,10 @@ discard block |
||
454 | 453 | $region = ""; |
455 | 454 | } |
456 | 455 | return array ($country_code,$region); |
457 | - } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
456 | + } else if ($gi->databaseType == GEOIP_REGION_EDITION_REV1) { |
|
458 | 457 | $seek_region = _geoip_seek_country($gi,$ipnum) - GEOIP_STATE_BEGIN_REV1; |
459 | 458 | //print $seek_region; |
460 | - if ($seek_region < US_OFFSET){ |
|
459 | + if ($seek_region < US_OFFSET) { |
|
461 | 460 | $country_code = ""; |
462 | 461 | $region = ""; |
463 | 462 | } else if ($seek_region < CANADA_OFFSET) { |
@@ -482,7 +481,7 @@ discard block |
||
482 | 481 | return _get_region($gi, $ipnum); |
483 | 482 | } |
484 | 483 | |
485 | -function getdnsattributes ($l,$ip){ |
|
484 | +function getdnsattributes ($l,$ip) { |
|
486 | 485 | $r = new Net_DNS_Resolver(); |
487 | 486 | $r->nameservers = array("ws1.maxmind.com"); |
488 | 487 | $p = $r->search($l."." . $ip .".s.maxmind.com","TXT","IN"); |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | // @return String A human readable error message |
501 | 501 | // @param Integer $x An error number |
502 | 502 | // |
503 | -function windows_error_code_str($x){ |
|
503 | +function windows_error_code_str($x) { |
|
504 | 504 | $h=int2hex($x); |
505 | - switch($h){ |
|
505 | + switch($h) { |
|
506 | 506 | case "0xC0000005": return "STATUS_ACCESS_VIOLATION"; |
507 | 507 | case "0xC000001D": return "STATUS_ILLEGAL_INSTRUCTION"; |
508 | 508 | case "0xC0000094": return "STATUS_INTEGER_DIVIDE_BY_ZERO"; |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | // @return String A human readable error message |
524 | 524 | // @param Integer $x An error number |
525 | 525 | // |
526 | -function error_code_str($x){ |
|
526 | +function error_code_str($x) { |
|
527 | 527 | // severe Windows error numbers are always large negative integers |
528 | 528 | if ($x<-400) return windows_error_code_str($x); |
529 | - switch($x){ |
|
529 | + switch($x) { |
|
530 | 530 | case 0: return ""; |
531 | 531 | case 192: return "EXIT_STATEFILE_WRITE"; |
532 | 532 | case 193: return "EXIT_SIGNAL"; |
@@ -505,7 +505,7 @@ |
||
505 | 505 | geoip_close($gi); |
506 | 506 | |
507 | 507 | if ($selected_country=="") $selected_country="None"; |
508 | - if ($selected_country=="None" and $geoip_country!=""){ |
|
508 | + if ($selected_country=="None" and $geoip_country!="") { |
|
509 | 509 | $selected_country=$geoip_country; |
510 | 510 | } |
511 | 511 |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | </ol>", PROJECT); |
184 | 184 | } |
185 | 185 | |
186 | -function project_workunit($wu){ |
|
186 | +function project_workunit($wu) { |
|
187 | 187 | // shown in the workunit page |
188 | 188 | } |
189 | 189 | |
190 | -function project_user_summary($user){ |
|
190 | +function project_user_summary($user) { |
|
191 | 191 | // shown in the user summary page |
192 | 192 | } |
193 | 193 | |
194 | -function project_user_page_private($user){ |
|
194 | +function project_user_page_private($user) { |
|
195 | 195 | // shown in the private account page |
196 | 196 | } |
197 | 197 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)), |
259 | 259 | ); |
260 | 260 | |
261 | -function project_user_credit($user){ |
|
261 | +function project_user_credit($user) { |
|
262 | 262 | global $sub_projects; |
263 | 263 | foreach ($sub_projects as $sp) { |
264 | 264 | show_app_credit_user($user, $sp["name"], $sp["appids"]); |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | |
62 | 62 | $cache_args = "sort_by=$sort_by&offset=$offset"; |
63 | 63 | $cacheddata = get_cached_data(TOP_PAGES_TTL, $cache_args); |
64 | -if ($cacheddata){ |
|
64 | +if ($cacheddata) { |
|
65 | 65 | $data = unserialize($cacheddata); |
66 | 66 | } else { |
67 | 67 | $data = get_top_hosts($offset,$sort_by); |
@@ -87,7 +87,8 @@ discard block |
||
87 | 87 | |
88 | 88 | } |
89 | 89 | |
90 | -if ($n==$hosts_per_page){ //If we aren't on the last page |
|
90 | +if ($n==$hosts_per_page) { |
|
91 | +//If we aren't on the last page |
|
91 | 92 | $new_offset = $offset + $hosts_per_page; |
92 | 93 | echo "<a href=top_hosts.php?sort_by=$sort_by&offset=$new_offset>".tra("Next %1", $hosts_per_page)."</a>"; |
93 | 94 | } |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | } |
33 | 33 | define('ITEM_LIMIT', 10000); |
34 | 34 | |
35 | -function get_top_teams($offset, $sort_by, $type){ |
|
35 | +function get_top_teams($offset, $sort_by, $type) { |
|
36 | 36 | global $teams_per_page; |
37 | 37 | $db = BoincDb::get(true); |
38 | 38 | $type_clause = null; |
39 | - if ($type){ |
|
39 | + if ($type) { |
|
40 | 40 | $type_clause = "type=$type"; |
41 | 41 | } |
42 | 42 | if ($sort_by == "total_credit") { |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | $cache_args = "sort_by=$sort_by&offset=$offset$type_url"; |
76 | 76 | $cacheddata = get_cached_data(TOP_PAGES_TTL,$cache_args); |
77 | 77 | //If we have got the data in cache |
78 | - if ($cacheddata){ |
|
78 | + if ($cacheddata) { |
|
79 | 79 | $data = unserialize($cacheddata); // use the cached data |
80 | 80 | } else { |
81 | 81 | //if not do queries etc to generate new data |
@@ -115,7 +115,8 @@ discard block |
||
115 | 115 | echo "<a href=top_teams.php?sort_by=$sort_by&offset=$new_offset".$type_url.">".tra("Previous %1", $teams_per_page)."</a> · "; |
116 | 116 | |
117 | 117 | } |
118 | - if ($n==$teams_per_page){ //If we aren't on the last page |
|
118 | + if ($n==$teams_per_page) { |
|
119 | +//If we aren't on the last page |
|
119 | 120 | $new_offset = $offset + $teams_per_page; |
120 | 121 | echo "<a href=top_teams.php?sort_by=$sort_by&offset=$new_offset".$type_url.">".tra("Next %1", $teams_per_page)."</a>"; |
121 | 122 | } |
@@ -368,7 +368,8 @@ |
||
368 | 368 | $min_days = $argv[++$i]; |
369 | 369 | } else if ($argv[$i] == "--max_days") { |
370 | 370 | $max_days = $argv[++$i]; |
371 | - } else if ($argv[$i] == "--days") { // deprecated |
|
371 | + } else if ($argv[$i] == "--days") { |
|
372 | +// deprecated |
|
372 | 373 | $max_days = $argv[++$i]; |
373 | 374 | } |
374 | 375 | } |