Passed
Pull Request — master (#5698)
by David
08:58
created
html/inc/bootstrap.inc 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
         // prefix for links; needed for pages not in top dir
142 142
     $user,
143 143
         // logged-in user, if any
144
-    $fixed=false,
144
+    $fixed = false,
145 145
         // if true, navbar is fixed at top of page.
146 146
         // NOTE: if you do this, you must set a global var $fixed_navbar
147 147
         // to true at compile time
148 148
         // (it needs to be set when page_head() is called).
149
-    $inverse=false
149
+    $inverse = false
150 150
         // white on black?
151 151
 ) {
152 152
     global $master_url;
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 // output a panel.
216 216
 // $content_func is a function that generates the panel contents
217 217
 //
218
-function panel($title, $content_func, $class="panel-primary", $body_class="") {
218
+function panel($title, $content_func, $class = "panel-primary", $body_class = "") {
219 219
     echo sprintf('<div class="panel %s">
220 220
         ', $class
221 221
     );
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
 // $left_width is the width of left column in 1/12 units.
243 243
 // $arg is passed to the functions.
244 244
 //
245
-function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) {
245
+function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) {
246 246
     echo '
247 247
         <div class="container-fluid">
248 248
     ';
@@ -257,7 +257,7 @@  discard block
 block discarded – undo
257 257
             </div>
258 258
         ';
259 259
     }
260
-    $right_width = 12-$left_width;
260
+    $right_width = 12 - $left_width;
261 261
     echo '
262 262
         <div class="row">
263 263
         <div class="col-sm-'.$left_width.'">
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 //      use extra = "name=x"
282 282
 //      call forum_focus(x, foo) after defining the field
283 283
 //
284
-function form_start($action, $method='get', $extra='') {
284
+function form_start($action, $method = 'get', $extra = '') {
285 285
     echo sprintf(
286 286
         '<div class="container-fluid">
287 287
         <form class="form-horizontal" method="%s" action="%s" %s>'
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 // just the input field
314 314
 //
315 315
 function form_input_text_field(
316
-    $name, $value='', $type='text', $attrs='', $extra=''
316
+    $name, $value = '', $type = 'text', $attrs = '', $extra = ''
317 317
 ) {
318 318
     return sprintf(
319 319
         '<input %s type="%s" class="form-control" name="%s" value="%s">%s',
@@ -324,7 +324,7 @@  discard block
 block discarded – undo
324 324
 // the whole row
325 325
 //
326 326
 function form_input_text(
327
-    $label, $name, $value='', $type='text', $attrs='', $extra=''
327
+    $label, $name, $value = '', $type = 'text', $attrs = '', $extra = ''
328 328
 ) {
329 329
     echo sprintf('
330 330
         <div class="form-group">
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
     );
353 353
 }
354 354
 
355
-function form_input_textarea($label, $name, $value='', $nrows=4) {
355
+function form_input_textarea($label, $name, $value = '', $nrows = 4) {
356 356
     echo sprintf('
357 357
         <div class="form-group">
358 358
             <label align=right class="%s" for="%s">%s</label>
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
 
369 369
 // $items is either a string of <option> elements, or an array
370 370
 //
371
-function form_select($label, $name, $items, $selected=null) {
371
+function form_select($label, $name, $items, $selected = null) {
372 372
     echo sprintf('
373 373
         <div class="form-group">
374 374
             <label align=right class="%s" for="%s">%s</label>
@@ -381,7 +381,7 @@  discard block
 block discarded – undo
381 381
         foreach ($items as $i) {
382 382
             echo sprintf(
383 383
                 '<option %s value=%s>%s</option>',
384
-                ($i[0]==$selected)?'selected':'',
384
+                ($i[0] == $selected) ? 'selected' : '',
385 385
                 $i[0], $i[1]
386 386
             );
387 387
         }
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 // same, for multiple select.
395 395
 // $selected, if non-null, is a list of selected values
396 396
 //
397
-function form_select_multiple($label, $name, $items, $selected=null) {
397
+function form_select_multiple($label, $name, $items, $selected = null) {
398 398
     echo sprintf('
399 399
         <div class="form-group">
400 400
             <label align=right class="%s" for="%s">%s</label>
@@ -406,7 +406,7 @@  discard block
 block discarded – undo
406 406
     foreach ($items as $i) {
407 407
         echo sprintf(
408 408
             '<option %s value=%s>%s</option>',
409
-            ($selected && in_array($i[0], $selected))?'selected':'',
409
+            ($selected && in_array($i[0], $selected)) ? 'selected' : '',
410 410
             $i[0], $i[1]
411 411
         );
412 412
     }
@@ -415,12 +415,12 @@  discard block
 block discarded – undo
415 415
 
416 416
 // return a list of string for checkbox items
417 417
 //
418
-function checkbox_item_strings($items, $attrs='') {
418
+function checkbox_item_strings($items, $attrs = '') {
419 419
     $x = [];
420 420
     foreach ($items as $i) {
421 421
         $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s
422 422
             ',
423
-            $attrs, $i[0], $i[2]?"checked":"", $i[1]
423
+            $attrs, $i[0], $i[2] ? "checked" : "", $i[1]
424 424
         );
425 425
     }
426 426
     return $x;
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 
429 429
 // $items is list of (name, label, checked)
430 430
 //
431
-function form_checkboxes($label, $items, $attrs='') {
431
+function form_checkboxes($label, $items, $attrs = '') {
432 432
     echo sprintf('
433 433
         <div class="form-group">
434 434
             <label align=right class="%s">%s</label>
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
         FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS
455 455
     );
456 456
     foreach ($items as $i) {
457
-        $checked = ($selected == $i[0])?"checked":"";
457
+        $checked = ($selected == $i[0]) ? "checked" : "";
458 458
         echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br>
459 459
             ',
460 460
             $name, $i[0], $checked, $i[1]
@@ -487,7 +487,7 @@  discard block
 block discarded – undo
487 487
 ';
488 488
 }
489 489
 
490
-function form_submit($text, $attrs='') {
490
+function form_submit($text, $attrs = '') {
491 491
     form_general(
492 492
         "",
493 493
         sprintf(
@@ -497,11 +497,11 @@  discard block
 block discarded – undo
497 497
     );
498 498
 }
499 499
 
500
-function form_checkbox($label, $name, $checked=false) {
500
+function form_checkbox($label, $name, $checked = false) {
501 501
     echo sprintf('
502 502
         <div class="form-group">
503 503
             <input type="checkbox" name="%s" %s> &nbsp; <span class="lead">%s</span>
504 504
         </div>
505
-        ', $name, $checked?"checked":"", $label
505
+        ', $name, $checked ? "checked" : "", $label
506 506
     );
507 507
 }
Please login to merge, or discard this patch.
html/inc/user.inc 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 // they've participated in
34 34
 //
35 35
 function get_other_projects($user) {
36
-    $cpid = md5($user->cross_project_id . $user->email_addr);
36
+    $cpid = md5($user->cross_project_id.$user->email_addr);
37 37
     $url = "http://boinc.netsoft-online.com/get_user.php?cpid=".$cpid;
38 38
 
39 39
     // Check the cache for that URL
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
     }
177 177
 
178 178
     if (!NO_STATS) {
179
-        $cpid = md5($user->cross_project_id . $user->email_addr);
179
+        $cpid = md5($user->cross_project_id.$user->email_addr);
180 180
         $x = "";
181 181
         shuffle($cpid_stats_sites);
182 182
         foreach ($cpid_stats_sites as $site) {
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         $u = normalize_user_url($user->url);
261 261
         row2(
262 262
             tra("URL"),
263
-            $u?sprintf('<a href="%s">%s</a>', $u, $u):tra('Invalid URL')
263
+            $u ?sprintf('<a href="%s">%s</a>', $u, $u) : tra('Invalid URL')
264 264
         );
265 265
     }
266 266
     if (USER_COUNTRY) {
@@ -372,7 +372,7 @@  discard block
 block discarded – undo
372 372
 // if $badge_height is > 0, show badges
373 373
 // if $name_limit, limit name to N chars
374 374
 //
375
-function user_links($user, $badge_height=0, $name_limit=0) {
375
+function user_links($user, $badge_height = 0, $name_limit = 0) {
376 376
     BoincForumPrefs::lookup($user);
377 377
     if (is_banished($user)) {
378 378
         return "(banished: ID $user->id)";
@@ -400,13 +400,13 @@  discard block
 block discarded – undo
400 400
         $user->id,
401 401
         $name
402 402
     );
403
-    if (function_exists("project_user_links")){
403
+    if (function_exists("project_user_links")) {
404 404
         $x .= project_user_links($user);
405 405
     }
406 406
     if ($badge_height) {
407 407
         $x .= badges_string(true, $user, $badge_height);
408 408
     }
409
-    return $name_limit?"<nobr>$x</nobr>":$x;
409
+    return $name_limit ? "<nobr>$x</nobr>" : $x;
410 410
 }
411 411
 
412 412
 function show_community_private($user) {
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 
454 454
             // if there's a foundership request, notify the founder
455 455
             //
456
-            if ($user->id==$team->userid && $team->ping_user >0) {
456
+            if ($user->id == $team->userid && $team->ping_user > 0) {
457 457
                 $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>";
458 458
             }
459 459
             row2(tra("Member of team"), $x);
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
     $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1");
478 478
     $x = [];
479 479
     if ($friends) {
480
-        foreach($friends as $friend) {
480
+        foreach ($friends as $friend) {
481 481
             $fuser = BoincUser::lookup_id($friend->user_dest);
482 482
             if (!$fuser) continue;
483 483
             $x[] = friend_links($fuser);
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 // Returns a cacheable community links data object
525 525
 // @param user The user to produce a community links object for
526 526
 
527
-function get_community_links_object($user){
527
+function get_community_links_object($user) {
528 528
     $cache_object = new StdClass;
529 529
     $cache_object->post_count = total_posts($user);
530 530
     $cache_object->user = $user;
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
     $cache_object->friends = array();
533 533
 
534 534
     $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1");
535
-    foreach($friends as $friend) {
535
+    foreach ($friends as $friend) {
536 536
         $fuser = BoincUser::lookup_id($friend->user_dest);
537 537
         if (!$fuser) continue;
538 538
         $cache_object->friends[] = $fuser;
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 
543 543
 // show community links of another user (described by $clo)
544 544
 //
545
-function community_links($clo, $logged_in_user){
545
+function community_links($clo, $logged_in_user) {
546 546
     $user = $clo->user;
547 547
     $team = $clo->team;
548 548
     $friends = $clo->friends;
@@ -568,15 +568,15 @@  discard block
 block discarded – undo
568 568
                 "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>"
569 569
             );
570 570
         } else if ($friend) {
571
-            row2(tra("Friends"),  "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>");
571
+            row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>");
572 572
         } else {
573
-            row2(tra("Friends"),  "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>");
573
+            row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>");
574 574
         }
575 575
     }
576 576
 
577 577
     if ($friends) {
578 578
         $x = [];
579
-        foreach($friends as $friend) {
579
+        foreach ($friends as $friend) {
580 580
             $x[] = friend_links($friend);
581 581
         }
582 582
         row2(tra('Friends'), implode('<br>', $x));
@@ -620,6 +620,6 @@  discard block
 block discarded – undo
620 620
 }
621 621
 
622 622
 
623
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
623
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
624 624
 
625 625
 ?>
Please login to merge, or discard this patch.
html/inc/util.inc 1 patch
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -33,17 +33,17 @@  discard block
 block discarded – undo
33 33
 //
34 34
 $config = get_config();
35 35
 global $master_url;
36
-$master_url = parse_config($config , "<master_url>");
36
+$master_url = parse_config($config, "<master_url>");
37 37
 $recaptcha_public_key = parse_config($config, "<recaptcha_public_key>");
38 38
 $recaptcha_private_key = parse_config($config, "<recaptcha_private_key>");
39 39
 
40 40
 // Set parameters to defaults if not defined in config.xml
41 41
 
42 42
 $x = parse_config($config, "<user_country>");
43
-define('USER_COUNTRY', ($x===null)?1:(int)$x);
43
+define('USER_COUNTRY', ($x === null) ? 1 : (int)$x);
44 44
 
45 45
 $x = parse_config($config, "<user_url>");
46
-define('USER_URL', ($x===null)?1:(int)$x);
46
+define('USER_URL', ($x === null) ? 1 : (int)$x);
47 47
 
48 48
 // Set parameters to defaults if not defined in project.inc
49 49
 
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 }
152 152
 
153 153
 function url_base() {
154
-    return is_https()?secure_url_base():URL_BASE;
154
+    return is_https() ?secure_url_base() : URL_BASE;
155 155
 }
156 156
 
157
-function send_cookie($name, $value, $permanent, $ops=false) {
157
+function send_cookie($name, $value, $permanent, $ops = false) {
158 158
     global $master_url;
159 159
 
160 160
     // the following allows independent login for projects on the same server
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
         $path = substr($path, 0, -1);
166 166
         $path .= "_ops/";
167 167
     }
168
-    $expire = $permanent?time()+3600*24*365:0;
168
+    $expire = $permanent ?time() + 3600*24*365 : 0;
169 169
     setcookie($name, $value, $expire, $path);
170 170
 }
171 171
 
172
-function clear_cookie($name, $ops=false) {
172
+function clear_cookie($name, $ops = false) {
173 173
     global $master_url;
174 174
     $url = parse_url($master_url);
175 175
     $path = $url['path'];
@@ -177,13 +177,13 @@  discard block
 block discarded – undo
177 177
         $path = substr($path, 0, -1);
178 178
         $path .= "_ops/";
179 179
     }
180
-    setcookie($name, '', time()-3600, $path);
180
+    setcookie($name, '', time() - 3600, $path);
181 181
 }
182 182
 
183 183
 $g_logged_in_user = null;
184 184
 $got_logged_in_user = false;
185 185
 
186
-function get_logged_in_user($must_be_logged_in=true) {
186
+function get_logged_in_user($must_be_logged_in = true) {
187 187
     global $g_logged_in_user, $got_logged_in_user;
188 188
     if ($got_logged_in_user) {
189 189
         // this could have been called earlier with $must_be_logged_in false
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
             $next_url = $_SERVER['REQUEST_URI'];
210 210
             $n = strrpos($next_url, "/");
211 211
             if ($n) {
212
-                $next_url = substr($next_url, $n+1);
212
+                $next_url = substr($next_url, $n + 1);
213 213
             }
214 214
         }
215 215
         $next_url = urlencode($next_url);
@@ -220,7 +220,7 @@  discard block
 block discarded – undo
220 220
     return $g_logged_in_user;
221 221
 }
222 222
 
223
-function show_login_info($prefix="") {
223
+function show_login_info($prefix = "") {
224 224
     $user = get_logged_in_user(false);
225 225
     if ($user) {
226 226
         $url_tokens = url_tokens($user->authenticator);
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
     }
231 231
 }
232 232
 
233
-$cache_control_extra="";
233
+$cache_control_extra = "";
234 234
 $is_login_page = false;
235 235
 
236 236
 // Call this to start pages.
@@ -242,11 +242,11 @@  discard block
 block discarded – undo
242 242
 // with an existing web framework can more easily do so.
243 243
 // To do so, define page_head() in the project include file.
244 244
 //
245
-if (!function_exists("page_head")){
245
+if (!function_exists("page_head")) {
246 246
 function page_head(
247 247
     $title,
248 248
         // page title. Put in <title>, used as title for browser tab.
249
-    $body_attrs=null,
249
+    $body_attrs = null,
250 250
         // <body XXXX>
251 251
         // e.g. Javascript to put focus in an input field
252 252
         // (onload="document.form.foo.focus()")
@@ -255,10 +255,10 @@  discard block
 block discarded – undo
255 255
         // if set, include schedulers.txt.
256 256
         // also pass to project_banner() in case you want a different
257 257
         // header for your main page.
258
-    $url_prefix="",
258
+    $url_prefix = "",
259 259
         // prepend this to links.
260 260
         // Use for web pages not in the top directory
261
-    $head_extra=null
261
+    $head_extra = null
262 262
         // extra stuff to put in <head>. E.g.:
263 263
         // reCAPTCHA code (create_profile.php)
264 264
         // bbcode javascript (forums)
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
         header("Content-type: text/html; charset=utf-8");
281 281
         header("Expires: Mon, 26 Jul 1997 05:00:00 UTC");
282 282
             // Date in the past
283
-        header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " UTC");
283
+        header("Last-Modified: ".gmdate("D, d M Y H:i:s")." UTC");
284 284
             // always modified
285 285
         header("Cache-Control: $cache_control_extra no-cache, must-revalidate, post-check=0, pre-check=0");
286 286
             // for HTTP/1.1
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
     if ($head_extra) {
302 302
         echo "\n$head_extra\n";
303 303
     }
304
-    if ($is_main && (!defined('NO_COMPUTING')||!NO_COMPUTING)) {
304
+    if ($is_main && (!defined('NO_COMPUTING') || !NO_COMPUTING)) {
305 305
         readfile("schedulers.txt");
306 306
     }
307 307
 
308
-    $t = $title?$title:PROJECT;
308
+    $t = $title ? $title : PROJECT;
309 309
     echo "<title>$t</title>\n";
310 310
     echo '
311 311
         <meta charset="utf-8">
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
     echo '<div class="container-fluid">
363 363
     ';
364 364
 
365
-    switch($title) {    //kludge
365
+    switch ($title) {    //kludge
366 366
     case tra("Log in"):
367 367
     case tra("Create an account"):
368 368
     case tra("Server status page"):
@@ -377,13 +377,13 @@  discard block
 block discarded – undo
377 377
 
378 378
 // See the comments for page_head()
379 379
 //
380
-if (!function_exists("page_tail")){
380
+if (!function_exists("page_tail")) {
381 381
 function page_tail(
382
-    $show_date=false,
382
+    $show_date = false,
383 383
         // true for pages that are generated periodically rather than on the fly
384
-    $url_prefix="",
384
+    $url_prefix = "",
385 385
         // use for pages not at top level
386
-    $is_main=false
386
+    $is_main = false
387 387
         // passed to project_footer;
388 388
 ) {
389 389
     echo "<br>\n";
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
 }
399 399
 }
400 400
 
401
-function display_cvs_versions(){
401
+function display_cvs_versions() {
402 402
     global $cvs_version_tracker;
403 403
     echo "\n<!-- SVN VERSIONS -->\n";
404
-    for ($i=0;$i<sizeof($cvs_version_tracker);$i++) {
404
+    for ($i = 0; $i < sizeof($cvs_version_tracker); $i++) {
405 405
         echo "<!-- ".$cvs_version_tracker[$i]." -->\n";
406 406
     }
407 407
 }
@@ -426,24 +426,24 @@  discard block
 block discarded – undo
426 426
 // convert time interval in seconds to a string of the form
427 427
 // 'D days h hours m min s sec'.
428 428
 
429
-function time_diff($x, $res=3) {
429
+function time_diff($x, $res = 3) {
430 430
     $x = (int)$x;
431 431
     $days    = (int)($x/86400);
432
-    $hours   = (int)(($x-$days*86400)/3600);
433
-    $minutes = (int)(($x-$days*86400-$hours*3600)/60);
434
-    $seconds = $x % 60;
432
+    $hours   = (int)(($x - $days*86400)/3600);
433
+    $minutes = (int)(($x - $days*86400 - $hours*3600)/60);
434
+    $seconds = $x%60;
435 435
 
436 436
     $s = "";
437 437
     if ($days) {
438 438
         $s .= "$days ".tra("days")." ";
439 439
     }
440
-    if ($res>0 && ($hours || strlen($s))) {
440
+    if ($res > 0 && ($hours || strlen($s))) {
441 441
         $s .= "$hours ".tra("hours")." ";
442 442
     }
443
-    if ($res>1 && ($minutes || strlen($s))) {
443
+    if ($res > 1 && ($minutes || strlen($s))) {
444 444
         $s .= "$minutes ".tra("min")." ";
445 445
     }
446
-    if ($res>2) {
446
+    if ($res > 2) {
447 447
         $s .= "$seconds ".tra("sec")." ";
448 448
     }
449 449
     return $s;
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
 
458 458
 function time_str($x) {
459 459
     if ($x == 0) return "---";
460
-    return gmdate('j M Y, G:i:s', (int)$x) . " UTC";
460
+    return gmdate('j M Y, G:i:s', (int)$x)." UTC";
461 461
 }
462 462
 
463 463
 function local_time_str($x) {
@@ -469,14 +469,14 @@  discard block
 block discarded – undo
469 469
     return time_str($x);
470 470
 }
471 471
 
472
-function start_table_str($class="", $style="") {
473
-    $s = $style?'style="'.$style.'"':'';
472
+function start_table_str($class = "", $style = "") {
473
+    $s = $style ? 'style="'.$style.'"' : '';
474 474
     return '<div class="table">
475 475
       <table '.$s.' width="100%" class="table table-condensed '.$class.'" >
476 476
     ';
477 477
 }
478 478
 
479
-function start_table($class="", $style="") {
479
+function start_table($class = "", $style = "") {
480 480
     echo start_table_str($class, $style);
481 481
 }
482 482
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
     echo "</tr>\n";
522 522
 }
523 523
 
524
-function row1($x, $ncols=2, $class="heading") {
524
+function row1($x, $ncols = 2, $class = "heading") {
525 525
     if ($class == "heading") {
526 526
         echo "<tr><th class=\"bg-primary\" colspan=\"$ncols\">$x</th></tr>\n";
527 527
     } else {
@@ -535,10 +535,10 @@  discard block
 block discarded – undo
535 535
 
536 536
 // a table row with 2 columns, with the left on right-aligned
537 537
 
538
-function row2($x, $y, $show_error=false, $lwidth='40%') {
539
-    if ($x==="") $x="<br>";
540
-    if ($y==="") $y="<br>";
541
-    $attrs = $show_error?VALUE_ATTRS_ERR:VALUE_ATTRS;
538
+function row2($x, $y, $show_error = false, $lwidth = '40%') {
539
+    if ($x === "") $x = "<br>";
540
+    if ($y === "") $y = "<br>";
541
+    $attrs = $show_error ?VALUE_ATTRS_ERR:VALUE_ATTRS;
542 542
     echo "<tr>
543 543
         <td width=\"$lwidth\" ".NAME_ATTRS.">$x</td>
544 544
         <td $attrs >$y</td>
@@ -549,7 +549,7 @@  discard block
 block discarded – undo
549 549
 // output the first part of row2();
550 550
 // then write the content, followed by </td></tr>
551 551
 
552
-function row2_init($x, $lwidth='40%') {
552
+function row2_init($x, $lwidth = '40%') {
553 553
     echo sprintf('<tr>
554 554
         <td width="%s" %s>%s</td>
555 555
         <td %s>',
@@ -565,31 +565,31 @@  discard block
 block discarded – undo
565 565
     echo "<tr><td>$string</td></tr>";
566 566
 }
567 567
 
568
-function row_array($x, $attrs=null) {
568
+function row_array($x, $attrs = null) {
569 569
     echo "<tr>\n";
570 570
     $i = 0;
571 571
     foreach ($x as $h) {
572
-        $a = $attrs?$attrs[$i]:"";
572
+        $a = $attrs ? $attrs[$i] : "";
573 573
         echo "<td $a>$h</td>\n";
574 574
         $i++;
575 575
     }
576 576
     echo "</tr>\n";
577 577
 }
578 578
 
579
-define ('ALIGN_RIGHT', 'style="text-align:right;"');
579
+define('ALIGN_RIGHT', 'style="text-align:right;"');
580 580
 
581
-function row_heading_array($x, $attrs=null, $class='bg-primary') {
581
+function row_heading_array($x, $attrs = null, $class = 'bg-primary') {
582 582
     echo "<tr>";
583 583
     $i = 0;
584 584
     foreach ($x as $h) {
585
-        $a = $attrs?$attrs[$i]:"";
585
+        $a = $attrs ? $attrs[$i] : "";
586 586
         echo "<th $a class=\"$class\">$h</th>";
587 587
         $i++;
588 588
     }
589 589
     echo "</tr>\n";
590 590
 }
591 591
 
592
-function row_heading($x, $class='bg-primary') {
592
+function row_heading($x, $class = 'bg-primary') {
593 593
     echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr>
594 594
         ', $class, $x
595 595
     );
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 // If $ellipsis is true, then an ellipsis is added to any sentence which
650 650
 // is cut short.
651 651
 
652
-function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) {
652
+function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis = false) {
653 653
     $words = explode($delimiter, $sentence);
654 654
     $total_chars = 0;
655 655
     $trunc = false;
@@ -732,8 +732,8 @@  discard block
 block discarded – undo
732 732
 
733 733
 // returns null if the arg is optional and missing
734 734
 //
735
-function get_int($name, $optional=false) {
736
-    $x=null;
735
+function get_int($name, $optional = false) {
736
+    $x = null;
737 737
     if (isset($_GET[$name])) $x = $_GET[$name];
738 738
     if (!is_numeric($x)) {
739 739
         if ($optional) {
@@ -752,7 +752,7 @@  discard block
 block discarded – undo
752 752
 
753 753
 // returns null if the arg is optional and missing
754 754
 //
755
-function post_num($name, $optional=false) {
755
+function post_num($name, $optional = false) {
756 756
     $x = null;
757 757
     if (isset($_POST[$name])) $x = $_POST[$name];
758 758
     if (!is_numeric($x)) {
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 
768 768
 // returns null if the arg is optional and missing
769 769
 //
770
-function post_int($name, $optional=false) {
770
+function post_int($name, $optional = false) {
771 771
     $x = post_num($name, $optional);
772 772
     if (is_null($x)) return null;
773 773
     $y = (int)$x;
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
     }
786 786
 }
787 787
 
788
-function get_str($name, $optional=false) {
788
+function get_str($name, $optional = false) {
789 789
     if (isset($_GET[$name])) {
790 790
         $x = $_GET[$name];
791 791
     } else {
@@ -797,7 +797,7 @@  discard block
 block discarded – undo
797 797
     return undo_magic_quotes($x);
798 798
 }
799 799
 
800
-function post_str($name, $optional=false) {
800
+function post_str($name, $optional = false) {
801 801
     if (isset($_POST[$name])) {
802 802
         $x = $_POST[$name];
803 803
     } else {
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
     return undo_magic_quotes($x);
810 810
 }
811 811
 
812
-function post_arr($name, $optional=false) {
812
+function post_arr($name, $optional = false) {
813 813
     if (isset($_POST[$name]) && is_array($_POST[$name])) {
814 814
         $x = $_POST[$name];
815 815
     } else {
@@ -825,7 +825,7 @@  discard block
 block discarded – undo
825 825
     // the mb_* functions are not included by default
826 826
     // return (mb_detect_encoding($passwd) -= 'ASCII');
827 827
 
828
-    for ($i=0; $i<strlen($str); $i++) {
828
+    for ($i = 0; $i < strlen($str); $i++) {
829 829
         $c = ord(substr($str, $i));
830 830
         if ($c < 32 || $c > 127) return false;
831 831
     }
@@ -849,7 +849,7 @@  discard block
 block discarded – undo
849 849
     $number = str_replace(',', '.', $number); // replace the german decimal separator
850 850
     // if no value was entered and this is ok
851 851
     //
852
-    if ($number=='' && !$low) return true;
852
+    if ($number == '' && !$low) return true;
853 853
 
854 854
     // the supplied value contains alphabetic characters
855 855
     //
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 
867 867
 // Generate a "select" element from an array of values
868 868
 //
869
-function select_from_array($name, $array, $selection=null, $width=240) {
869
+function select_from_array($name, $array, $selection = null, $width = 240) {
870 870
     $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"';
871 871
 
872 872
     foreach ($array as $key => $value) {
@@ -891,8 +891,8 @@  discard block
 block discarded – undo
891 891
     return $str;
892 892
 }
893 893
 
894
-function strip_bbcode($string){
895
-    return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string);
894
+function strip_bbcode($string) {
895
+    return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/", "", $string);
896 896
 }
897 897
 
898 898
 function current_url() {
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 // the colors for bootstrap' btn-success are almost illegible;
918 918
 // the green is too light.  Use a darker green.
919 919
 //
920
-function button_style($color='green', $font_size=null) {
920
+function button_style($color = 'green', $font_size = null) {
921 921
     $fs = '';
922 922
     if ($font_size) {
923 923
         $fs = sprintf('; font-size:%dpx', $font_size);
@@ -936,7 +936,7 @@  discard block
 block discarded – undo
936 936
 // class: class of the button, e.g. btn
937 937
 // extra: Additional text in href tag
938 938
 //
939
-function button_text($url, $text, $desc=null, $class=null, $extra='') {
939
+function button_text($url, $text, $desc = null, $class = null, $extra = '') {
940 940
     if (!$desc) {
941 941
         $desc = $text;
942 942
     }
@@ -951,19 +951,19 @@  discard block
 block discarded – undo
951 951
     );
952 952
 }
953 953
 
954
-function show_button($url, $text, $desc=null, $class=null, $extra=null) {
954
+function show_button($url, $text, $desc = null, $class = null, $extra = null) {
955 955
     echo button_text($url, $text, $desc, $class, $extra);
956 956
 }
957 957
 
958 958
 // for places with a bunch of buttons, like forum posts
959 959
 //
960
-function show_button_small($url, $text, $desc=null) {
960
+function show_button_small($url, $text, $desc = null) {
961 961
     echo button_text($url, $text, $desc, "btn-primary btn-xs");
962 962
 }
963 963
 
964 964
 // used for showing icons
965 965
 //
966
-function show_image($src, $title, $alt, $height=null) {
966
+function show_image($src, $title, $alt, $height = null) {
967 967
     $h = "";
968 968
     if ($height) {
969 969
         $h = "height=\"$height\"";
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 // tries instead to connect to <replica_db_host> if tag exists.
1001 1001
 // DEPRECATED - use boinc_db.inc
1002 1002
 //
1003
-function db_init($try_replica=false) {
1003
+function db_init($try_replica = false) {
1004 1004
     check_web_stopped();
1005 1005
     $retval = db_init_aux($try_replica);
1006 1006
     if ($retval == 1) {
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 // Check this to avoid XSS vulnerability
1117 1117
 //
1118 1118
 function sanitize_sort_by($x) {
1119
-    switch($x) {
1119
+    switch ($x) {
1120 1120
     case 'expavg_credit':
1121 1121
     case 'total_credit':
1122 1122
         return;
@@ -1133,9 +1133,9 @@  discard block
 block discarded – undo
1133 1133
     return $c/(200/24);
1134 1134
 }
1135 1135
 
1136
-function do_download($path,$name="") {
1137
-    if (strcmp($name,"") == 0) {
1138
-        $name=basename($path);
1136
+function do_download($path, $name = "") {
1137
+    if (strcmp($name, "") == 0) {
1138
+        $name = basename($path);
1139 1139
     }
1140 1140
     header('Content-Description: File Transfer');
1141 1141
     header('Content-Type: application/octet-stream');
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
     header('Expires: 0');
1145 1145
     header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
1146 1146
     header('Pragma: public');
1147
-    header('Content-Length: ' . filesize($path));
1147
+    header('Content-Length: '.filesize($path));
1148 1148
     flush();
1149 1149
     readfile($path);
1150 1150
 }
@@ -1193,10 +1193,10 @@  discard block
 block discarded – undo
1193 1193
 // Otherwise return 0.
1194 1194
 // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)"
1195 1195
 //
1196
-function boinc_client_version(){
1196
+function boinc_client_version() {
1197 1197
     if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0;
1198 1198
     $x = $_SERVER['HTTP_USER_AGENT'];
1199
-    $e =  "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
1199
+    $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/";
1200 1200
     if (preg_match($e, $x, $matches)) {
1201 1201
         return $matches[1]*10000 + $matches[2]*100 + $matches[3];
1202 1202
     }
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
     $rem_name = $name."_remaining";
1226 1226
     return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\"
1227 1227
         onkeyup=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\">".$text."</textarea>
1228
-        <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen-strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining")
1228
+        <br><input name=\"$rem_name\" type=\"text\" id=\"$rem_name\" value=\"".($maxlen - strlen($text))."\" size=\"3\" maxlength=\"3\" readonly> ".tra("characters remaining")
1229 1229
     ;
1230 1230
 }
1231 1231
 
@@ -1255,7 +1255,7 @@  discard block
 block discarded – undo
1255 1255
 // use the following around text with long lines,
1256 1256
 // to limit the width and make it more readable.
1257 1257
 //
1258
-function text_start($width=640) {
1258
+function text_start($width = 640) {
1259 1259
     echo sprintf("<div style=\"max-width: %dpx;\">\n", $width);
1260 1260
 }
1261 1261
 function text_end() {
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
 }
1282 1282
 
1283 1283
 function cert_filename() {
1284
-    return defined("CERT_FILENAME")?CERT_FILENAME:"cert1.php";
1284
+    return defined("CERT_FILENAME") ?CERT_FILENAME:"cert1.php";
1285 1285
 }
1286 1286
 
1287 1287
 // if user hasn't validated their email addr, tell them to
@@ -1298,6 +1298,6 @@  discard block
 block discarded – undo
1298 1298
     }
1299 1299
 }
1300 1300
 
1301
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
1301
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
1302 1302
 
1303 1303
 ?>
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
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
     $parent_post_id = 0;
54 54
 }
55 55
 
56
-if ($filter != "false"){
56
+if ($filter != "false") {
57 57
     $filter = true;
58 58
 } else {
59 59
     $filter = false;
@@ -68,11 +68,11 @@  discard block
 block discarded – undo
68 68
 }
69 69
 
70 70
 $warning = null;
71
-if ($content && (!$preview)){
72
-    if (post_str('add_signature',true)=="add_it"){
73
-        $add_signature=true;    // set a flag and concatenate later
74
-    }  else {
75
-        $add_signature=false;
71
+if ($content && (!$preview)) {
72
+    if (post_str('add_signature', true) == "add_it") {
73
+        $add_signature = true; // set a flag and concatenate later
74
+    } else {
75
+        $add_signature = false;
76 76
     }
77 77
     check_tokens($logged_in_user->authenticator);
78 78
     if (!akismet_check($logged_in_user, $content)) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     }
92 92
 }
93 93
 
94
-page_head(tra("Post to thread"),'','','', $bbcode_js);
94
+page_head(tra("Post to thread"), '', '', '', $bbcode_js);
95 95
 
96 96
 show_forum_header($logged_in_user);
97 97
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
     $x1 = tra("Message:").bbcode_info().post_warning();
146 146
     $x2 = "";
147 147
     if ($parent_post) {
148
-        $x2 .=" ".tra("reply to %1 Message ID %2:", "<a href=#".$parent_post->id.">", " ".$parent_post->id."</a>");
148
+        $x2 .= " ".tra("reply to %1 Message ID %2:", "<a href=#".$parent_post->id.">", " ".$parent_post->id."</a>");
149 149
     }
150 150
     $x2 .= "<form action=forum_reply.php?thread=".$thread->id;
151 151
 
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
     $x2 .= " method=\"post\" name=\"post\" onsubmit=\"return checkForm(this)\">\n";
157 157
     $x2 .= form_tokens($logged_in_user->authenticator);
158 158
     $x2 .= start_table_str().$bbcode_html.end_table_str()."<textarea class=\"form-control\" name=\"content\" rows=\"18\">";
159
-    $no_quote = get_int("no_quote", true)==1;
159
+    $no_quote = get_int("no_quote", true) == 1;
160 160
     if ($preview) {
161 161
         $x2 .= htmlspecialchars($content);
162 162
     } else if (!$no_quote) {
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
         }
166 166
     }
167 167
     if (!$logged_in_user->prefs->no_signature_by_default) {
168
-        $enable_signature='checked="true"';
168
+        $enable_signature = 'checked="true"';
169 169
     } else {
170
-        $enable_signature="";
170
+        $enable_signature = "";
171 171
     }
172 172
     $x2 .= sprintf('</textarea><p> </p>
173 173
         <input class="btn btn-sm" %s type="submit" name="preview" value="%s">
@@ -187,9 +187,9 @@  discard block
 block discarded – undo
187 187
 }
188 188
 
189 189
 function quote_text($text) {
190
-    $text = "[quote]" . $text . "[/quote]";
190
+    $text = "[quote]".$text."[/quote]";
191 191
     return $text;
192 192
 }
193 193
 
194
-$cvs_version_tracker[]="\$Id$";
194
+$cvs_version_tracker[] = "\$Id$";
195 195
 ?>
Please login to merge, or discard this patch.
html/user/forum_search.php 1 patch
Spacing   +10 added lines, -10 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,11 +76,11 @@  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"),
@@ -98,5 +98,5 @@  discard block
 block discarded – undo
98 98
 
99 99
 page_tail();
100 100
 
101
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
101
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
102 102
 ?>
Please login to merge, or discard this patch.