@@ -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 | } |
@@ -104,8 +104,7 @@ discard block |
||
104 | 104 | |
105 | 105 | if ($myCache->isInCache($cache_name)) { |
106 | 106 | $myCache->strokeFromCache($cache_name); |
107 | - } |
|
108 | - else { |
|
107 | + } else { |
|
109 | 108 | // Initialize dataset |
110 | 109 | $dataset = array(); |
111 | 110 | $stats_xml = boincstats_get_project_stats('daily', $cpid); |
@@ -114,9 +113,10 @@ discard block |
||
114 | 113 | for ($j = 30; $j < 90; $j++) { |
115 | 114 | $dataset[] = (int) $stats_xml->records->record[$j]; |
116 | 115 | } |
117 | - } |
|
118 | - else { |
|
119 | - for ($i = 0; $i <= $dataset_size; $i++) $dataset[] = 0; |
|
116 | + } else { |
|
117 | + for ($i = 0; $i <= $dataset_size; $i++) { |
|
118 | + $dataset[] = 0; |
|
119 | + } |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | // Get color configuration |
@@ -226,8 +226,7 @@ discard block |
||
226 | 226 | |
227 | 227 | if ($myCache->isInCache($cache_name)) { |
228 | 228 | $myCache->strokeFromCache($cache_name); |
229 | - } |
|
230 | - else { |
|
229 | + } else { |
|
231 | 230 | // Initialize dataset |
232 | 231 | $dataset = array(); |
233 | 232 | $stats_xml = boincstats_get_project_stats('daily'); |
@@ -236,9 +235,10 @@ discard block |
||
236 | 235 | for ($j = 30; $j < 90; $j++) { |
237 | 236 | $dataset[] = (int) $stats_xml->records->record[$j]; |
238 | 237 | } |
239 | - } |
|
240 | - else { |
|
241 | - for ($i = 0; $i <= 30; $i++) $dataset[] = 0; |
|
238 | + } else { |
|
239 | + for ($i = 0; $i <= 30; $i++) { |
|
240 | + $dataset[] = 0; |
|
241 | + } |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | // Create and populate the pData object |
@@ -316,8 +316,7 @@ discard block |
||
316 | 316 | directory must be writeable by the web server.', |
317 | 317 | array('@parent_dir' => dirname($cache_dir)), WATCHDOG_ERROR); |
318 | 318 | return FALSE; |
319 | - } |
|
320 | - else { |
|
319 | + } else { |
|
321 | 320 | // Create the cache dir |
322 | 321 | if (!mkdir($cache_dir, 0775)) { |
323 | 322 | watchdog('boincstats', 'Failed to create @cache_dir directory. Check |
@@ -326,8 +325,7 @@ discard block |
||
326 | 325 | return FALSE; |
327 | 326 | } |
328 | 327 | } |
329 | - } |
|
330 | - else { |
|
328 | + } else { |
|
331 | 329 | watchdog('boincstats', 'Cache directory at @cache_dir is not writeable. |
332 | 330 | Please allow webserver write access.', |
333 | 331 | array('@cache_dir' => $cache_dir), WATCHDOG_ERROR); |
@@ -370,8 +368,7 @@ discard block |
||
370 | 368 | foreach ($get as $arg => $value) { |
371 | 369 | if ($value !== NULL) { |
372 | 370 | $args[] = "{$arg}=" . rawurlencode($value); |
373 | - } |
|
374 | - else { |
|
371 | + } else { |
|
375 | 372 | $args[] = $arg; |
376 | 373 | } |
377 | 374 | } |
@@ -467,8 +464,7 @@ discard block |
||
467 | 464 | drupal_set_message(t('The BOINC stats system is not configured. Please |
468 | 465 | !configure_it', array('!configure_it' => l(t('configure it now'), |
469 | 466 | 'admin/boinc/stats'))), 'error', FALSE); |
470 | - } |
|
471 | - else { |
|
467 | + } else { |
|
472 | 468 | drupal_set_message(t('There is a problem with the site. Please contact |
473 | 469 | the system administrator.'), 'error', FALSE); |
474 | 470 | } |
@@ -27,19 +27,19 @@ |
||
27 | 27 | exit("Error: couldn't get log_dir from config file."); |
28 | 28 | } |
29 | 29 | |
30 | -if( isset($_GET["f"]) ){ |
|
30 | +if( isset($_GET["f"]) ) { |
|
31 | 31 | $f = $_GET["f"]; |
32 | 32 | $f = escapeshellcmd($f); |
33 | 33 | } else { |
34 | 34 | $f = ""; |
35 | 35 | } |
36 | -if( isset($_GET["s"]) ){ |
|
36 | +if( isset($_GET["s"]) ) { |
|
37 | 37 | $s = $_GET["s"]; |
38 | 38 | $s = escapeshellcmd($s); |
39 | 39 | } else { |
40 | 40 | $s = ""; |
41 | 41 | } |
42 | -if( isset($_GET["l"]) ){ |
|
42 | +if( isset($_GET["l"]) ) { |
|
43 | 43 | $l = (int)$_GET["l"]; |
44 | 44 | } else { |
45 | 45 | $l = 0; |
@@ -387,8 +387,7 @@ |
||
387 | 387 | $team = node_load($nid); |
388 | 388 | $output .= '<p>' . bts('You may create a message board for use by @team', |
389 | 389 | array('@team' => $team->title), NULL, 'boinc:team-forum') . ':</p>'; |
390 | - } |
|
391 | - else { |
|
390 | + } else { |
|
392 | 391 | $output .= '<p>' . bts('This is a team-only message board', array(), NULL, 'boinc:team-forum') . ':</p>'; |
393 | 392 | } |
394 | 393 | $output .= '<ul>'; |