Passed
Pull Request — master (#4020)
by David
08:00
created
html/user/openid.php 1 patch
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 
70 70
     function __construct()
71 71
     {
72
-        $this->trustRoot = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];
72
+        $this->trustRoot = (!empty($_SERVER['HTTPS']) ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'];
73 73
         $uri = rtrim(preg_replace('#((?<=\?)|&)openid\.[^&]+#', '', $_SERVER['REQUEST_URI']), '?');
74
-        $this->returnUrl = $this->trustRoot . $uri;
74
+        $this->returnUrl = $this->trustRoot.$uri;
75 75
 
76 76
         $this->data = $_POST + $_GET; # OPs may send data as POST or GET.
77 77
 
78
-        if(!function_exists('curl_init') && !in_array('https', stream_get_wrappers())) {
78
+        if (!function_exists('curl_init') && !in_array('https', stream_get_wrappers())) {
79 79
             throw new ErrorException('You must have either https wrappers or curl enabled.');
80 80
         }
81 81
     }
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
     {
85 85
         switch ($name) {
86 86
         case 'identity':
87
-            if (strlen($value = trim((String) $value))) {
87
+            if (strlen($value = trim((String)$value))) {
88 88
                 if (preg_match('#^xri:/*#i', $value, $m)) {
89 89
                     $value = substr($value, strlen($m[0]));
90 90
                 } elseif (!preg_match('/^(?:[=@+\$!\(]|https?:)/i', $value)) {
@@ -139,23 +139,23 @@  discard block
 block discarded – undo
139 139
         return !!gethostbynamel($server);
140 140
     }
141 141
 
142
-    protected function request_curl($url, $method='GET', $params=array())
142
+    protected function request_curl($url, $method = 'GET', $params = array())
143 143
     {
144 144
         $params = http_build_query($params, '', '&');
145
-        $curl = curl_init($url . ($method == 'GET' && $params ? '?' . $params : ''));
145
+        $curl = curl_init($url.($method == 'GET' && $params ? '?'.$params : ''));
146 146
         curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
147 147
         curl_setopt($curl, CURLOPT_HEADER, false);
148 148
         curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
149 149
         curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
150 150
         curl_setopt($curl, CURLOPT_HTTPHEADER, array('Accept: application/xrds+xml, */*'));
151 151
 
152
-        if($this->verify_peer !== null) {
152
+        if ($this->verify_peer !== null) {
153 153
             curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, $this->verify_peer);
154
-            if($this->capath) {
154
+            if ($this->capath) {
155 155
                 curl_setopt($curl, CURLOPT_CAPATH, $this->capath);
156 156
             }
157 157
 
158
-            if($this->cainfo) {
158
+            if ($this->cainfo) {
159 159
                 curl_setopt($curl, CURLOPT_CAINFO, $this->cainfo);
160 160
             }
161 161
         }
@@ -171,17 +171,17 @@  discard block
 block discarded – undo
171 171
         }
172 172
         $response = curl_exec($curl);
173 173
 
174
-        if($method == 'HEAD') {
174
+        if ($method == 'HEAD') {
175 175
             $headers = array();
176
-            foreach(explode("\n", $response) as $header) {
177
-                $pos = strpos($header,':');
176
+            foreach (explode("\n", $response) as $header) {
177
+                $pos = strpos($header, ':');
178 178
                 $name = strtolower(trim(substr($header, 0, $pos)));
179
-                $headers[$name] = trim(substr($header, $pos+1));
179
+                $headers[$name] = trim(substr($header, $pos + 1));
180 180
             }
181 181
 
182 182
             # Updating claimed_id in case of redirections.
183 183
             $effective_url = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL);
184
-            if($effective_url != $url) {
184
+            if ($effective_url != $url) {
185 185
                 $this->identity = $this->claimed_id = $effective_url;
186 186
             }
187 187
 
@@ -195,14 +195,14 @@  discard block
 block discarded – undo
195 195
         return $response;
196 196
     }
197 197
 
198
-    protected function request_streams($url, $method='GET', $params=array())
198
+    protected function request_streams($url, $method = 'GET', $params = array())
199 199
     {
200
-        if(!$this->hostExists($url)) {
200
+        if (!$this->hostExists($url)) {
201 201
             throw new ErrorException('Invalid request.');
202 202
         }
203 203
 
204 204
         $params = http_build_query($params, '', '&');
205
-        switch($method) {
205
+        switch ($method) {
206 206
         case 'GET':
207 207
             $opts = array(
208 208
                 'http' => array(
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
                     'ignore_errors' => true,
212 212
                 )
213 213
             );
214
-            $url = $url . ($params ? '?' . $params : '');
214
+            $url = $url.($params ? '?'.$params : '');
215 215
             break;
216 216
         case 'POST':
217 217
             $opts = array(
@@ -236,31 +236,31 @@  discard block
 block discarded – undo
236 236
                 ))
237 237
             );
238 238
 
239
-            $url = $url . ($params ? '?' . $params : '');
240
-            $headers_tmp = get_headers ($url);
241
-            if(!$headers_tmp) {
239
+            $url = $url.($params ? '?'.$params : '');
240
+            $headers_tmp = get_headers($url);
241
+            if (!$headers_tmp) {
242 242
                 return array();
243 243
             }
244 244
 
245 245
             # Parsing headers.
246 246
             $headers = array();
247
-            foreach($headers_tmp as $header) {
248
-                $pos = strpos($header,':');
247
+            foreach ($headers_tmp as $header) {
248
+                $pos = strpos($header, ':');
249 249
                 $name = strtolower(trim(substr($header, 0, $pos)));
250
-                $headers[$name] = trim(substr($header, $pos+1));
250
+                $headers[$name] = trim(substr($header, $pos + 1));
251 251
 
252 252
                 # Following possible redirections. The point is just to have
253 253
                 # claimed_id change with them, because get_headers() will
254 254
                 # follow redirections automatically.
255 255
                 # We ignore redirections with relative paths.
256 256
                 # If any known provider uses them, file a bug report.
257
-                if($name == 'location') {
258
-                    if(strpos($headers[$name], 'http') === 0) {
257
+                if ($name == 'location') {
258
+                    if (strpos($headers[$name], 'http') === 0) {
259 259
                         $this->identity = $this->claimed_id = $headers[$name];
260
-                    } elseif($headers[$name][0] == '/') {
260
+                    } elseif ($headers[$name][0] == '/') {
261 261
                         $parsed_url = parse_url($this->claimed_id);
262 262
                         $this->identity =
263
-                        $this->claimed_id = $parsed_url['scheme'] . '://'
263
+                        $this->claimed_id = $parsed_url['scheme'].'://'
264 264
                                           . $parsed_url['host']
265 265
                                           . $headers[$name];
266 266
                     }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
             return $headers;
273 273
         }
274 274
 
275
-        if($this->verify_peer) {
275
+        if ($this->verify_peer) {
276 276
             $opts += array('ssl' => array(
277 277
                 'verify_peer' => true,
278 278
                 'capath'      => $this->capath,
@@ -280,14 +280,14 @@  discard block
 block discarded – undo
280 280
             ));
281 281
         }
282 282
 
283
-        $context = stream_context_create ($opts);
283
+        $context = stream_context_create($opts);
284 284
 
285 285
         return file_get_contents($url, false, $context);
286 286
     }
287 287
 
288
-    protected function request($url, $method='GET', $params=array())
288
+    protected function request($url, $method = 'GET', $params = array())
289 289
     {
290
-        if(function_exists('curl_init') && !ini_get('safe_mode') && !ini_get('open_basedir')) {
290
+        if (function_exists('curl_init') && !ini_get('safe_mode') && !ini_get('open_basedir')) {
291 291
             return $this->request_curl($url, $method, $params);
292 292
         }
293 293
         return $this->request_streams($url, $method, $params);
@@ -296,19 +296,19 @@  discard block
 block discarded – undo
296 296
     protected function build_url($url, $parts)
297 297
     {
298 298
         if (isset($url['query'], $parts['query'])) {
299
-            $parts['query'] = $url['query'] . '&' . $parts['query'];
299
+            $parts['query'] = $url['query'].'&'.$parts['query'];
300 300
         }
301 301
 
302 302
         $url = $parts + $url;
303
-        $url = $url['scheme'] . '://'
304
-             . (empty($url['username'])?''
305
-                 :(empty($url['password'])? "{$url['username']}@"
303
+        $url = $url['scheme'].'://'
304
+             . (empty($url['username']) ? ''
305
+                 :(empty($url['password']) ? "{$url['username']}@"
306 306
                  :"{$url['username']}:{$url['password']}@"))
307 307
              . $url['host']
308
-             . (empty($url['port'])?'':":{$url['port']}")
309
-             . (empty($url['path'])?'':$url['path'])
310
-             . (empty($url['query'])?'':"?{$url['query']}")
311
-             . (empty($url['fragment'])?'':"#{$url['fragment']}");
308
+             . (empty($url['port']) ? '' : ":{$url['port']}")
309
+             . (empty($url['path']) ? '' : $url['path'])
310
+             . (empty($url['query']) ? '' : "?{$url['query']}")
311
+             . (empty($url['fragment']) ? '' : "#{$url['fragment']}");
312 312
         return $url;
313 313
     }
314 314
 
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
         preg_match_all("#<{$tag}[^>]*$valueName=['\"](.+?)['\"][^>]*$attrName=['\"].*?$attrValue.*?['\"][^>]*/?>#i", $content, $matches2);
323 323
 
324 324
         $result = array_merge($matches1[1], $matches2[1]);
325
-        return empty($result)?false:$result[0];
325
+        return empty($result) ?false:$result[0];
326 326
     }
327 327
 
328 328
     /**
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
         $yadis = true;
349 349
 
350 350
         # We'll jump a maximum of 5 times, to avoid endless redirections.
351
-        for ($i = 0; $i < 5; $i ++) {
351
+        for ($i = 0; $i < 5; $i++) {
352 352
             if ($yadis) {
353 353
                 $headers = $this->request($url, 'HEAD');
354 354
 
@@ -370,12 +370,12 @@  discard block
 block discarded – undo
370 370
                     $content = $this->request($url, 'GET');
371 371
 
372 372
                     preg_match_all('#<Service.*?>(.*?)</Service>#s', $content, $m);
373
-                    foreach($m[1] as $content) {
374
-                        $content = ' ' . $content; # The space is added, so that strpos doesn't return 0.
373
+                    foreach ($m[1] as $content) {
374
+                        $content = ' '.$content; # The space is added, so that strpos doesn't return 0.
375 375
 
376 376
                         # OpenID 2
377 377
                         $ns = preg_quote('http://specs.openid.net/auth/2.0/');
378
-                        if(preg_match('#<Type>\s*'.$ns.'(server|signon)\s*</Type>#s', $content, $type)) {
378
+                        if (preg_match('#<Type>\s*'.$ns.'(server|signon)\s*</Type>#s', $content, $type)) {
379 379
                             if ($type[1] == 'server') $this->identifier_select = true;
380 380
 
381 381
                             preg_match('#<URI.*?>(.*)</URI>#', $content, $server);
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
                                 return false;
385 385
                             }
386 386
                             # Does the server advertise support for either AX or SREG?
387
-                            $this->ax   = (bool) strpos($content, '<Type>http://openid.net/srv/ax/1.0</Type>');
387
+                            $this->ax   = (bool)strpos($content, '<Type>http://openid.net/srv/ax/1.0</Type>');
388 388
                             $this->sreg = strpos($content, '<Type>http://openid.net/sreg/1.0</Type>')
389 389
                                        || strpos($content, '<Type>http://openid.net/extensions/sreg/1.1</Type>');
390 390
 
@@ -498,33 +498,33 @@  discard block
 block discarded – undo
498 498
         if ($this->required || $this->optional) {
499 499
             $params['openid.ns.ax'] = 'http://openid.net/srv/ax/1.0';
500 500
             $params['openid.ax.mode'] = 'fetch_request';
501
-            $this->aliases  = array();
501
+            $this->aliases = array();
502 502
             $counts   = array();
503 503
             $required = array();
504 504
             $optional = array();
505
-            foreach (array('required','optional') as $type) {
505
+            foreach (array('required', 'optional') as $type) {
506 506
                 foreach ($this->$type as $alias => $field) {
507 507
                     if (is_int($alias)) $alias = strtr($field, '/', '_');
508
-                    $this->aliases[$alias] = 'http://axschema.org/' . $field;
508
+                    $this->aliases[$alias] = 'http://axschema.org/'.$field;
509 509
                     if (empty($counts[$alias])) $counts[$alias] = 0;
510 510
                     $counts[$alias] += 1;
511 511
                     ${$type}[] = $alias;
512 512
                 }
513 513
             }
514 514
             foreach ($this->aliases as $alias => $ns) {
515
-                $params['openid.ax.type.' . $alias] = $ns;
515
+                $params['openid.ax.type.'.$alias] = $ns;
516 516
             }
517 517
             foreach ($counts as $alias => $count) {
518 518
                 if ($count == 1) continue;
519
-                $params['openid.ax.count.' . $alias] = $count;
519
+                $params['openid.ax.count.'.$alias] = $count;
520 520
             }
521 521
 
522 522
             # Don't send empty ax.requied and ax.if_available.
523 523
             # Google and possibly other providers refuse to support ax when one of these is empty.
524
-            if($required) {
524
+            if ($required) {
525 525
                 $params['openid.ax.required'] = implode(',', $required);
526 526
             }
527
-            if($optional) {
527
+            if ($optional) {
528 528
                 $params['openid.ax.if_available'] = implode(',', $optional);
529 529
             }
530 530
         }
@@ -537,8 +537,8 @@  discard block
 block discarded – undo
537 537
         # If we have an openid.delegate that is different from our claimed id,
538 538
         # we need to somehow preserve the claimed id between requests.
539 539
         # The simplest way is to just send it along with the return_to url.
540
-        if($this->identity != $this->claimed_id) {
541
-            $returnUrl .= (strpos($returnUrl, '?') ? '&' : '?') . 'openid.claimed_id=' . $this->claimed_id;
540
+        if ($this->identity != $this->claimed_id) {
541
+            $returnUrl .= (strpos($returnUrl, '?') ? '&' : '?').'openid.claimed_id='.$this->claimed_id;
542 542
         }
543 543
 
544 544
         $params = array(
@@ -612,15 +612,15 @@  discard block
 block discarded – undo
612 612
         # by presenting user_setup_url (for 1.1) or reporting
613 613
         # mode 'setup_needed' (for 2.0). Also catching all modes other than
614 614
         # id_res, in order to avoid throwing errors.
615
-        if(isset($this->data['openid_user_setup_url'])) {
615
+        if (isset($this->data['openid_user_setup_url'])) {
616 616
             $this->setup_url = $this->data['openid_user_setup_url'];
617 617
             return false;
618 618
         }
619
-        if($this->mode != 'id_res') {
619
+        if ($this->mode != 'id_res') {
620 620
             return false;
621 621
         }
622 622
 
623
-        $this->claimed_id = isset($this->data['openid_claimed_id'])?$this->data['openid_claimed_id']:$this->data['openid_identity'];
623
+        $this->claimed_id = isset($this->data['openid_claimed_id']) ? $this->data['openid_claimed_id'] : $this->data['openid_identity'];
624 624
         $params = array(
625 625
             'openid.assoc_handle' => $this->data['openid_assoc_handle'],
626 626
             'openid.signed'       => $this->data['openid_signed'],
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
             # If it's an OpenID 1 provider, and we've got claimed_id,
639 639
             # we have to append it to the returnUrl, like authUrl_v1 does.
640 640
             $this->returnUrl .= (strpos($this->returnUrl, '?') ? '&' : '?')
641
-                             .  'openid.claimed_id=' . $this->claimed_id;
641
+                             .  'openid.claimed_id='.$this->claimed_id;
642 642
         }
643 643
 
644 644
         if ($this->data['openid_return_to'] != $this->returnUrl) {
@@ -656,8 +656,8 @@  discard block
 block discarded – undo
656 656
             # In such case, validation would fail, since we'd send different data than OP
657 657
             # wants to verify. stripslashes() should solve that problem, but we can't
658 658
             # use it when magic_quotes is off.
659
-            $value = $this->data['openid_' . str_replace('.','_',$item)];
660
-            $params['openid.' . $item] = get_magic_quotes_gpc() ? stripslashes($value) : $value;
659
+            $value = $this->data['openid_'.str_replace('.', '_', $item)];
660
+            $params['openid.'.$item] = get_magic_quotes_gpc() ? stripslashes($value) : $value;
661 661
 
662 662
         }
663 663
 
@@ -695,18 +695,18 @@  discard block
 block discarded – undo
695 695
 
696 696
         $attributes = array();
697 697
         foreach ($this->data as $key => $value) {
698
-            $keyMatch = 'openid_' . $alias . '_value_';
698
+            $keyMatch = 'openid_'.$alias.'_value_';
699 699
             if (substr($key, 0, strlen($keyMatch)) != $keyMatch) {
700 700
                 continue;
701 701
             }
702 702
             $key = substr($key, strlen($keyMatch));
703
-            if (!isset($this->data['openid_' . $alias . '_type_' . $key])) {
703
+            if (!isset($this->data['openid_'.$alias.'_type_'.$key])) {
704 704
                 # OP is breaking the spec by returning a field without
705 705
                 # associated ns. This shouldn't happen, but it's better
706 706
                 # to check, than cause an E_NOTICE.
707 707
                 continue;
708 708
             }
709
-            $key = substr($this->data['openid_' . $alias . '_type_' . $key],
709
+            $key = substr($this->data['openid_'.$alias.'_type_'.$key],
710 710
                           strlen('http://axschema.org/'));
711 711
             $attributes[$key] = $value;
712 712
         }
Please login to merge, or discard this patch.
html/user/bolt.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
     if ($course->hidden && !($user->bolt->flags&BOLT_FLAG_SHOW_ALL)) {
37 37
         continue;
38 38
     }
39
-    $e = $user?BoltEnrollment::lookup($user->id, $course->id):null;
39
+    $e = $user ?BoltEnrollment::lookup($user->id, $course->id) : null;
40 40
     if ($e) {
41 41
         $start = date_str($e->create_time);
42 42
         $view = BoltView::lookup_id($e->last_view_id);
Please login to merge, or discard this patch.
html/user/team.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -26,38 +26,38 @@
 block discarded – undo
26 26
 
27 27
 page_head(tra("Teams"));
28 28
 
29
-echo "<p>".tra("%1 participants may form %2 teams %3.", PROJECT, "<b>", "</b>") ."
29
+echo "<p>".tra("%1 participants may form %2 teams %3.", PROJECT, "<b>", "</b>")."
30 30
     <p>
31
-    ". tra("You may belong to only one team. You can join or quit a team at any time."). "
31
+    ". tra("You may belong to only one team. You can join or quit a team at any time.")."
32 32
     <p>" .
33
-    tra("Each team has a %1 founder %2 who may:", "<b>", "</b>") . "
33
+    tra("Each team has a %1 founder %2 who may:", "<b>", "</b>")."
34 34
     <ul>
35
-    <li> " . tra("edit the team's name and description") . "
36
-    <li> " . tra("add or remove team admins") . "
37
-    <li> " . tra("remove members from the team") . "
38
-    <li> " . tra("disband a team if it has no members") . "
35
+    <li> " . tra("edit the team's name and description")."
36
+    <li> " . tra("add or remove team admins")."
37
+    <li> " . tra("remove members from the team")."
38
+    <li> " . tra("disband a team if it has no members")."
39 39
     </ul>
40 40
     <p>" .
41
-    tra("To join a team, visit its team page and click %1 Join this team %2.", "<b>", "</b>") . "
42
-    <h3>" . tra("Find a team") . "</h3>
41
+    tra("To join a team, visit its team page and click %1 Join this team %2.", "<b>", "</b>")."
42
+    <h3>" . tra("Find a team")."</h3>
43 43
 ";
44 44
 team_search_form(null);
45 45
 echo "
46 46
 
47
-    <h3>" . tra("Top teams") . "</h3>
47
+    <h3>" . tra("Top teams")."</h3>
48 48
     <ul>
49
-    <li> <a href=\"top_teams.php\">" . tra("All teams") . "</a>
49
+    <li> <a href=\"top_teams.php\">" . tra("All teams")."</a>
50 50
 ";
51 51
 
52
-for ($i=1; $i<count($team_types); $i++) {
52
+for ($i = 1; $i < count($team_types); $i++) {
53 53
     echo "<li> <a href=\"top_teams.php?type=".$i."\">".tra("%1 teams", team_type_name($i))."</a>
54 54
     ";
55 55
 }
56 56
 
57 57
 echo "
58 58
     </ul>
59
-    <h3>" . tra("Create a new team") . "</h3>
60
-    " . tra("If you cannot find a team that is right for you, you can %1 create a team %2.", "<a href=\"team_create_form.php\">","</a>");
59
+    <h3>" . tra("Create a new team")."</h3>
60
+    " . tra("If you cannot find a team that is right for you, you can %1 create a team %2.", "<a href=\"team_create_form.php\">", "</a>");
61 61
 page_tail();
62 62
 
63 63
 ?>
Please login to merge, or discard this patch.
html/user/top_teams.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
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") {
@@ -60,26 +60,26 @@  discard block
 block discarded – undo
60 60
 if ($type < 0 || $type >= count($team_types)) {
61 61
     $type = 0;
62 62
 }
63
-$type_url="";
64
-$type_name="";
63
+$type_url = "";
64
+$type_name = "";
65 65
 if ($type) {
66 66
     $type_url = "&type=$type";
67 67
     $type_name = team_type_name($type);
68 68
 }
69 69
 
70 70
 $offset = get_int("offset", true);
71
-if (!$offset) $offset=0;
72
-if ($offset % $teams_per_page) $offset = 0;
71
+if (!$offset) $offset = 0;
72
+if ($offset%$teams_per_page) $offset = 0;
73 73
 
74 74
 if ($offset < ITEM_LIMIT) {
75 75
     $cache_args = "sort_by=$sort_by&offset=$offset$type_url";
76
-    $cacheddata = get_cached_data(TOP_PAGES_TTL,$cache_args);
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
82
-        $data = get_top_teams($offset,$sort_by,$type);
82
+        $data = get_top_teams($offset, $sort_by, $type);
83 83
         
84 84
         // Calculate nusers before storing into the cache
85 85
         foreach ($data as $team) {
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
         echo "<a href=top_teams.php?sort_by=$sort_by&amp;offset=$new_offset".$type_url.">".tra("Previous %1", $teams_per_page)."</a> &middot; ";
116 116
 
117 117
     }
118
-    if ($n==$teams_per_page){ //If we aren't on the last page
118
+    if ($n == $teams_per_page) { //If we aren't on the last page
119 119
         $new_offset = $offset + $teams_per_page;
120 120
         echo "<a href=top_teams.php?sort_by=$sort_by&amp;offset=$new_offset".$type_url.">".tra("Next %1", $teams_per_page)."</a>";
121 121
     }
Please login to merge, or discard this patch.
html/user/forum_thread.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 $postid = get_int('postid', true);
31 31
 $filter = get_str('filter', true);
32 32
 
33
-if ($filter != "false"){
33
+if ($filter != "false") {
34 34
     $filter = true;
35 35
 } else {
36 36
     $filter = false;
@@ -79,8 +79,8 @@  discard block
 block discarded – undo
79 79
 if ($temp_sort_style) {
80 80
     $sort_style = $temp_sort_style;
81 81
 } else if ($sort_style) {
82
-    $forum_style = 0;   // this is deprecated
83
-    if ($logged_in_user){
82
+    $forum_style = 0; // this is deprecated
83
+    if ($logged_in_user) {
84 84
         $logged_in_user->prefs->thread_sorting = $sort_style;
85 85
         $logged_in_user->prefs->update("thread_sorting=$sort_style");
86 86
     } else {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     );
93 93
 } else {
94 94
     // get the sorting style from the user or a cookie
95
-    if ($logged_in_user){
95
+    if ($logged_in_user) {
96 96
         $sort_style = $logged_in_user->prefs->thread_sorting;
97 97
     } else {
98 98
         list($forum_style, $sort_style) = parse_forum_cookie();
@@ -120,10 +120,10 @@  discard block
 block discarded – undo
120 120
 
121 121
 if (false) {
122 122
 if ($forum->parent_type == 0) {
123
-    if ($category->is_helpdesk && !$thread->status){
124
-        if ($logged_in_user){
125
-            if ($thread->owner == $logged_in_user->id){
126
-                if ($thread->replies !=0) {
123
+    if ($category->is_helpdesk && !$thread->status) {
124
+        if ($logged_in_user) {
125
+            if ($thread->owner == $logged_in_user->id) {
126
+                if ($thread->replies != 0) {
127 127
                     // Show a "this question has been answered" to the author
128 128
                     echo "<p>";
129 129
                     show_button(
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
     // If logged in user is moderator, enable some extra features
190 190
     //
191 191
     if (is_moderator($logged_in_user, $forum)) {
192
-        if ($thread->hidden){
192
+        if ($thread->hidden) {
193 193
             show_button_small(
194 194
                 "forum_moderate_thread_action.php?action=unhide&amp;thread=".$thread->id."$tokens",
195 195
                 tra("Unhide"),
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                 tra("Hide this thread")
203 203
             );
204 204
         }
205
-        if ($thread->sticky){
205
+        if ($thread->sticky) {
206 206
             show_button_small(
207 207
                 "forum_moderate_thread_action.php?action=desticky&amp;thread=".$thread->id."$tokens",
208 208
                 tra("Make unsticky"),
@@ -308,5 +308,5 @@  discard block
 block discarded – undo
308 308
 $thread->update("views=views+1");
309 309
 
310 310
 page_tail();
311
-$cvs_version_tracker[]="\$Id$";
311
+$cvs_version_tracker[] = "\$Id$";
312 312
 ?>
Please login to merge, or discard this patch.
html/user/forum_reply.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $parent_post_id = 0;
51 51
 }
52 52
 
53
-if ($filter != "false"){
53
+if ($filter != "false") {
54 54
     $filter = true;
55 55
 } else {
56 56
     $filter = false;
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 }
66 66
 
67 67
 $warning = null;
68
-if ($content && (!$preview)){
69
-    if (post_str('add_signature',true)=="add_it"){
70
-        $add_signature=true;    // set a flag and concatenate later
71
-    }  else {
72
-        $add_signature=false;
68
+if ($content && (!$preview)) {
69
+    if (post_str('add_signature', true) == "add_it") {
70
+        $add_signature = true; // set a flag and concatenate later
71
+    } else {
72
+        $add_signature = false;
73 73
     }
74 74
     check_tokens($logged_in_user->authenticator);
75 75
     if (!akismet_check($logged_in_user, $content)) {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     }
89 89
 }
90 90
 
91
-page_head(tra("Post to thread"),'','','', $bbcode_js);
91
+page_head(tra("Post to thread"), '', '', '', $bbcode_js);
92 92
 
93 93
 show_forum_header($logged_in_user);
94 94
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     $x1 = tra("Message:").bbcode_info().post_warning();
143 143
     $x2 = "";
144 144
     if ($parent_post) {
145
-        $x2 .=" ".tra("reply to %1 Message ID %2:", "<a href=#".$parent_post->id.">", " ".$parent_post->id."</a>");
145
+        $x2 .= " ".tra("reply to %1 Message ID %2:", "<a href=#".$parent_post->id.">", " ".$parent_post->id."</a>");
146 146
     }
147 147
     $x2 .= "<form action=forum_reply.php?thread=".$thread->id;
148 148
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     $x2 .= " method=\"post\" name=\"post\" onsubmit=\"return checkForm(this)\">\n";
154 154
     $x2 .= form_tokens($logged_in_user->authenticator);
155 155
     $x2 .= start_table_str().$bbcode_html.end_table_str()."<textarea class=\"form-control\" name=\"content\" rows=\"18\">";
156
-    $no_quote = get_int("no_quote", true)==1;
156
+    $no_quote = get_int("no_quote", true) == 1;
157 157
     if ($preview) {
158 158
         $x2 .= htmlspecialchars($content);
159 159
     } else if (!$no_quote) {
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         }
163 163
     }
164 164
     if (!$logged_in_user->prefs->no_signature_by_default) {
165
-        $enable_signature="checked=\"true\"";
165
+        $enable_signature = "checked=\"true\"";
166 166
     } else {
167
-        $enable_signature="";
167
+        $enable_signature = "";
168 168
     }
169 169
     $x2 .= "</textarea><p> </p>
170 170
         <input class=\"btn btn-primary btn-sm \" type=\"submit\" name=\"preview\" value=\"".tra("Preview")."\">
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 }
180 180
 
181 181
 function quote_text($text) {
182
-    $text = "[quote]" . $text . "[/quote]";
182
+    $text = "[quote]".$text."[/quote]";
183 183
     return $text;
184 184
 }
185 185
 
186
-$cvs_version_tracker[]="\$Id$";
186
+$cvs_version_tracker[] = "\$Id$";
187 187
 ?>
Please login to merge, or discard this patch.
html/user/forum_search.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
     </select>");
57 57
 
58 58
 $forumid = null;
59
-if (get_str("forumid",true)){
59
+if (get_str("forumid", true)) {
60 60
     $forumid = get_str("forumid");
61 61
 }
62
-$forumlist="<option value=\"-1\">".tra("All")."</option>";
62
+$forumlist = "<option value=\"-1\">".tra("All")."</option>";
63 63
 $categories = BoincCategory::enum();
64 64
 foreach ($categories as $category) {
65 65
     $forums = BoincForum::enum("parent_type=0 and category=$category->id");
66 66
     foreach ($forums as $forum) {
67
-        if ($forum->id==$forumid){
68
-            $forumlist.="<option selected value=\"".$forum->id."\">".$forum->title."</option>";
67
+        if ($forum->id == $forumid) {
68
+            $forumlist .= "<option selected value=\"".$forum->id."\">".$forum->title."</option>";
69 69
         } else {
70
-            $forumlist.="<option value=\"".$forum->id."\">".$forum->title."</option>";
70
+            $forumlist .= "<option value=\"".$forum->id."\">".$forum->title."</option>";
71 71
         }
72 72
     }
73 73
 }
@@ -76,22 +76,22 @@  discard block
 block discarded – undo
76 76
     '<select class="form-control" name="search_forum">'.$forumlist.'</select');
77 77
 
78 78
 $sortlist = null;
79
-foreach ($thread_sort_styles as $id => $style){
80
-    if ($id == CREATE_TIME_NEW){
81
-        $sortlist.="<option selected value=\"".$id."\">".$style."</option>";
79
+foreach ($thread_sort_styles as $id => $style) {
80
+    if ($id == CREATE_TIME_NEW) {
81
+        $sortlist .= "<option selected value=\"".$id."\">".$style."</option>";
82 82
     } else {
83
-        $sortlist.="<option value=\"".$id."\">".$style."</option>";
83
+        $sortlist .= "<option value=\"".$id."\">".$style."</option>";
84 84
     }
85 85
 }
86 86
 row2(tra("Sort by"), 
87 87
     '<select class="form-control" name="search_sort">'.$sortlist.'</select');
88 88
 
89 89
 row1("&nbsp;");
90
-row2("","<input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Start the search")."\">");
90
+row2("", "<input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Start the search")."\">");
91 91
 echo "</form>";
92 92
 end_table();
93 93
 
94 94
 page_tail();
95 95
 
96
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
96
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
97 97
 ?>
Please login to merge, or discard this patch.
html/inc/prefs_project.inc 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 }
69 69
 
70 70
 if ($app_types->cpu) {
71
-    $project_pref_descs[] = new PREF_BOOL (
71
+    $project_pref_descs[] = new PREF_BOOL(
72 72
         tra("Use CPU"),
73 73
         "Request CPU-only tasks from this project.",
74 74
         "no_cpu",
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     );
78 78
 }
79 79
 if ($app_types->ati) {
80
-    $project_pref_descs[] = new PREF_BOOL (
80
+    $project_pref_descs[] = new PREF_BOOL(
81 81
         tra("Use AMD GPU"),
82 82
         "Request AMD GPU tasks from this project.",
83 83
         "no_ati",
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
     );
87 87
 }
88 88
 if ($app_types->cuda) {
89
-    $project_pref_descs[] = new PREF_BOOL (
89
+    $project_pref_descs[] = new PREF_BOOL(
90 90
         tra("Use NVIDIA GPU"),
91 91
         "Request NVIDIA GPU tasks from this project.",
92 92
         "no_cuda",
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
     );
96 96
 }
97 97
 if ($app_types->intel_gpu) {
98
-    $project_pref_descs[] = new PREF_BOOL (
98
+    $project_pref_descs[] = new PREF_BOOL(
99 99
         tra("Use Intel GPU"),
100 100
         "Request Intel GPU tasks from this project.",
101 101
         "no_intel_gpu",
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     $x = "";
121 121
 }
122 122
 
123
-$privacy_pref_descs = array (
123
+$privacy_pref_descs = array(
124 124
     new PREF_BOOL(
125 125
         tra("Is it OK for %1 and your team (if any) to email you?", PROJECT).$x,
126 126
         "",
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
     global $in_project_specific;
153 153
     global $venue_name;
154 154
 
155
-    switch($name) {
155
+    switch ($name) {
156 156
     case "venue":
157 157
         $venue_name = $attrs["name"];
158 158
         $top_parse_result = $parse_result;
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         break;
165 165
     default:
166 166
         if ($in_project_specific) {
167
-            $text= $text."<$name>";
167
+            $text = $text."<$name>";
168 168
         } else {
169 169
             $text = "";
170 170
         }
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
     global $venue_name;
180 180
     global $project_pref_descs;
181 181
 
182
-    foreach($project_pref_descs as $p) {
182
+    foreach ($project_pref_descs as $p) {
183 183
         if ($p->xml_parse($parse_result, $name, $text)) {
184 184
             return;
185 185
         }
186 186
     }
187
-    switch($name) {
187
+    switch ($name) {
188 188
     case "venue":
189 189
         $top_parse_result->$venue_name = $parse_result;
190 190
         $parse_result = $top_parse_result;
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
228 228
     return $parse_result;
229 229
 }
230 230
 
231
-function prefs_show_project($prefs, $columns=false) {
231
+function prefs_show_project($prefs, $columns = false) {
232 232
     global $project_pref_descs;
233 233
     if ($columns) {
234 234
         foreach ($project_pref_descs as $p) {
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     }
255 255
 }
256 256
 
257
-function prefs_show_project_specific($prefs, $columns=false) {
257
+function prefs_show_project_specific($prefs, $columns = false) {
258 258
     if ($columns) {
259 259
         $project_specific_prefs = project_specific_prefs_parse($prefs->project_specific);
260 260
         $project_specific_prefs->home = isset($prefs->home) ? project_specific_prefs_parse($prefs->home->project_specific) : "";
@@ -266,10 +266,10 @@  discard block
 block discarded – undo
266 266
     project_specific_prefs_show($project_specific_prefs, $columns);
267 267
 }
268 268
 
269
-function print_prefs_display_project($user, $columns=false) {
269
+function print_prefs_display_project($user, $columns = false) {
270 270
     $project_prefs = prefs_parse_project($user->project_prefs);
271 271
 
272
-    $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=". (int)!$columns .">".tra("(Switch View)")."</a></font>";
272
+    $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=project&cols=".(int)!$columns.">".tra("(Switch View)")."</a></font>";
273 273
     if ($columns) {
274 274
         start_table();
275 275
         row_heading(tra("Combined preferences").$switch_link);
@@ -311,14 +311,14 @@  discard block
 block discarded – undo
311 311
     }
312 312
 }
313 313
 
314
-function prefs_form_project($prefs, $error=false) {
314
+function prefs_form_project($prefs, $error = false) {
315 315
     global $project_pref_descs;
316 316
     foreach ($project_pref_descs as $p) {
317 317
         $p->show_form_row($prefs, $error);
318 318
     }
319 319
 }
320 320
 
321
-function prefs_form_project_specific($prefs_xml, $error=false) {
321
+function prefs_form_project_specific($prefs_xml, $error = false) {
322 322
     $prefs = project_specific_prefs_parse($prefs_xml);
323 323
     project_specific_prefs_edit($prefs, $error);
324 324
 }
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
 
358 358
 // given a prefs structure, return the corresponding XML string
359 359
 //
360
-function project_prefs_make_xml($prefs, $primary=true) {
360
+function project_prefs_make_xml($prefs, $primary = true) {
361 361
     global $project_pref_descs;
362 362
     $xml = "";
363 363
     if ($primary) {
@@ -392,8 +392,8 @@  discard block
 block discarded – undo
392 392
 //
393 393
 function project_prefs_update(&$user, $prefs) {
394 394
     $prefs_xml = BoincDb::escape_string(project_prefs_make_xml($prefs));
395
-    $send_email = $user->send_email?1:0;
396
-    $show_hosts = $user->show_hosts?1:0;
395
+    $send_email = $user->send_email ? 1 : 0;
396
+    $show_hosts = $user->show_hosts ? 1 : 0;
397 397
     $retval = $user->update("project_prefs='$prefs_xml', send_email=$send_email, show_hosts=$show_hosts");
398 398
     if (!$retval) {
399 399
         return 1;
Please login to merge, or discard this patch.
html/inc/submit.inc 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
     $b->create_time = (double)($batch->create_time);
171 171
     $b->est_completion_time = (double)($batch->est_completion_time);
172 172
     $b->njobs = (int)($batch->njobs);
173
-    $b->fraction_done = (double) $batch->fraction_done;
173
+    $b->fraction_done = (double)$batch->fraction_done;
174 174
     $b->nerror_jobs = (int)($batch->nerror_jobs);
175 175
     $b->state = (int)($batch->state);
176 176
     $b->completion_time = (double)($batch->completion_time);
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
     </result>
399 399
 </output_template>
400 400
 ";
401
-    for ($i=0; $i<2; $i++) {
401
+    for ($i = 0; $i < 2; $i++) {
402 402
         $job = new StdClass;
403 403
         $job->input_files = array();
404 404
         $job->input_files[] = $f;
Please login to merge, or discard this patch.