Passed
Push — master ( 274801...346e7c )
by Kevin
11:49 queued 04:25
created
html/inc/user.inc 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
         $name = substr($name, 0, $name_limit)."...";
344 344
     }
345 345
     $x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$name."</a>";
346
-    if (function_exists("project_user_links")){
346
+    if (function_exists("project_user_links")) {
347 347
         $x .= project_user_links($user);
348 348
     }
349 349
     if ($badge_height) {
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 // Returns a cacheable community links data object
465 465
 // @param user The user to produce a community links object for
466 466
 
467
-function get_community_links_object($user){
467
+function get_community_links_object($user) {
468 468
     $cache_object = new StdClass;
469 469
     $cache_object->post_count = total_posts($user);
470 470
     $cache_object->user = $user;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
     return $cache_object;
481 481
 }
482 482
 
483
-function community_links($clo, $logged_in_user){
483
+function community_links($clo, $logged_in_user) {
484 484
     $user = $clo->user;
485 485
     $team = $clo->team;
486 486
     $friends = $clo->friends;
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 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
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
     }
175 175
 
176 176
     if (!NO_STATS) {
177
-        $cpid = md5($user->cross_project_id . $user->email_addr);
177
+        $cpid = md5($user->cross_project_id.$user->email_addr);
178 178
         $x = "";
179 179
         shuffle($cpid_stats_sites);
180 180
         foreach ($cpid_stats_sites as $site) {
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 // if $badge_height is > 0, show badges
329 329
 // if $name_limit, limit name to N chars
330 330
 //
331
-function user_links($user, $badge_height=0, $name_limit=0) {
331
+function user_links($user, $badge_height = 0, $name_limit = 0) {
332 332
     BoincForumPrefs::lookup($user);
333 333
     if (is_banished($user)) {
334 334
         return "(banished: ID $user->id)";
@@ -343,13 +343,13 @@  discard block
 block discarded – undo
343 343
         $name = substr($name, 0, $name_limit)."...";
344 344
     }
345 345
     $x .= " <a href=\"".url_base()."show_user.php?userid=".$user->id."\">".$name."</a>";
346
-    if (function_exists("project_user_links")){
346
+    if (function_exists("project_user_links")) {
347 347
         $x .= project_user_links($user);
348 348
     }
349 349
     if ($badge_height) {
350 350
         $x .= badges_string(true, $user, $badge_height);
351 351
     }
352
-    return $name_limit?"<nobr>$x</nobr>":$x;
352
+    return $name_limit ? "<nobr>$x</nobr>" : $x;
353 353
 }
354 354
 
355 355
 function show_community_private($user) {
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 
397 397
             // if there's a foundership request, notify the founder
398 398
             //
399
-            if ($user->id==$team->userid && $team->ping_user >0) {
399
+            if ($user->id == $team->userid && $team->ping_user > 0) {
400 400
                 $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>";
401 401
             }
402 402
             row2(tra("Member of team"), $x);
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
     $x = "<a href=\"user_search.php\">".tra("Find friends")."</a><br/>\n";
422 422
     $n = count($friends);
423 423
     if ($n) {
424
-        foreach($friends as $friend) {
424
+        foreach ($friends as $friend) {
425 425
             $fuser = BoincUser::lookup_id($friend->user_dest);
426 426
             if (!$fuser) continue;
427 427
             $x .= friend_links($fuser);
@@ -464,7 +464,7 @@  discard block
 block discarded – undo
464 464
 // Returns a cacheable community links data object
465 465
 // @param user The user to produce a community links object for
466 466
 
467
-function get_community_links_object($user){
467
+function get_community_links_object($user) {
468 468
     $cache_object = new StdClass;
469 469
     $cache_object->post_count = total_posts($user);
470 470
     $cache_object->user = $user;
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
     $cache_object->friends = array();
473 473
 
474 474
     $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1");
475
-    foreach($friends as $friend) {
475
+    foreach ($friends as $friend) {
476 476
         $fuser = BoincUser::lookup_id($friend->user_dest);
477 477
         if (!$fuser) continue;
478 478
         $cache_object->friends[] = $fuser;
@@ -480,7 +480,7 @@  discard block
 block discarded – undo
480 480
     return $cache_object;
481 481
 }
482 482
 
483
-function community_links($clo, $logged_in_user){
483
+function community_links($clo, $logged_in_user) {
484 484
     $user = $clo->user;
485 485
     $team = $clo->team;
486 486
     $friends = $clo->friends;
@@ -506,15 +506,15 @@  discard block
 block discarded – undo
506 506
                 "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>"
507 507
             );
508 508
         } else if ($friend) {
509
-            row2(tra("Friends"),  "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>");
509
+            row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>");
510 510
         } else {
511
-            row2(tra("Friends"),  "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>");
511
+            row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>");
512 512
         }
513 513
     }
514 514
     
515 515
     if ($friends) {
516 516
         $x = "";
517
-        foreach($friends as $friend) {
517
+        foreach ($friends as $friend) {
518 518
             $x .= friend_links($friend);
519 519
         }
520 520
         row2(tra("Friends")." (".sizeof($friends).")", $x);
@@ -558,6 +558,6 @@  discard block
 block discarded – undo
558 558
 }
559 559
 
560 560
 
561
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
561
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
562 562
 
563 563
 ?>
Please login to merge, or discard this patch.
html/inc/forum.inc 1 patch
Spacing   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -54,12 +54,12 @@  discard block
 block discarded – undo
54 54
 define('THREAD_SOLVED', 1);
55 55
 
56 56
 define('AVATAR_WIDTH', 100);
57
-define('AVATAR_HEIGHT',100);
57
+define('AVATAR_HEIGHT', 100);
58 58
 
59 59
 define('ST_NEW_TIME', 1209600); //3600*24*14 - 14 days
60 60
 define('ST_NEW', 'New member');
61 61
 
62
-define('MAXIMUM_EDIT_TIME',3600);
62
+define('MAXIMUM_EDIT_TIME', 3600);
63 63
     // allow edits of forums posts up till one hour after posting.
64 64
 
65 65
 define('MAX_FORUM_LOGGING_TIME', 2419200); //3600*24*28 - 28 days
@@ -77,24 +77,24 @@  discard block
 block discarded – undo
77 77
 define('IMAGE_HIDDEN', 'img/hidden.png');
78 78
 define('IMAGE_STICKY_LOCKED', 'img/sticky_locked_post.png');
79 79
 define('IMAGE_POST', 'img/post.png');
80
-define('NEW_IMAGE_HEIGHT','15');
80
+define('NEW_IMAGE_HEIGHT', '15');
81 81
 define('EMPHASIZE_IMAGE', 'img/emphasized_post.png');
82
-define('EMPHASIZE_IMAGE_HEIGHT','15');
82
+define('EMPHASIZE_IMAGE_HEIGHT', '15');
83 83
 define('FILTER_IMAGE', 'img/filtered_post.png');
84
-define('FILTER_IMAGE_HEIGHT','15');
84
+define('FILTER_IMAGE_HEIGHT', '15');
85 85
 define('RATE_POSITIVE_IMAGE', 'img/rate_positive.png');
86
-define('RATE_POSITIVE_IMAGE_HEIGHT','9');
86
+define('RATE_POSITIVE_IMAGE_HEIGHT', '9');
87 87
 define('RATE_NEGATIVE_IMAGE', 'img/rate_negative.png');
88
-define('RATE_NEGATIVE_IMAGE_HEIGHT','9');
88
+define('RATE_NEGATIVE_IMAGE_HEIGHT', '9');
89 89
 define('REPORT_POST_IMAGE', 'img/report_post.png');
90
-define('REPORT_POST_IMAGE_HEIGHT','9');
90
+define('REPORT_POST_IMAGE_HEIGHT', '9');
91 91
 
92 92
 define('SOLUTION', tra('This answered my question'));
93 93
 define('SUFFERER', tra('I also have this question'));
94 94
 define('OFF_TOPIC', tra('Off-topic'));
95 95
 
96
-define ('DEFAULT_LOW_RATING_THRESHOLD', -25);
97
-define ('DEFAULT_HIGH_RATING_THRESHOLD', 5);
96
+define('DEFAULT_LOW_RATING_THRESHOLD', -25);
97
+define('DEFAULT_HIGH_RATING_THRESHOLD', 5);
98 98
 
99 99
 // special user attributes
100 100
 //
@@ -164,15 +164,15 @@  discard block
 block discarded – undo
164 164
 
165 165
 // Output the forum/thread title.
166 166
 //
167
-function show_forum_title($category, $forum, $thread, $link_thread=false) {
167
+function show_forum_title($category, $forum, $thread, $link_thread = false) {
168 168
     if ($category) {
169 169
         $is_helpdesk = $category->is_helpdesk;
170 170
     } else {
171 171
         $is_helpdesk = false;
172 172
     }
173 173
 
174
-    $where = $is_helpdesk?tra("Questions and Answers"):tra("Message boards");
175
-    $top_url = $is_helpdesk?"forum_help_desk.php":"forum_index.php";
174
+    $where = $is_helpdesk ?tra("Questions and Answers") : tra("Message boards");
175
+    $top_url = $is_helpdesk ? "forum_help_desk.php" : "forum_index.php";
176 176
 
177 177
     if (!$forum && !$thread) {
178 178
         echo "<span class=\"title\">$where</span>\n";
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
     }
201 201
 }
202 202
 
203
-function show_team_forum_title($forum, $thread=null, $link_thread=false) {
203
+function show_team_forum_title($forum, $thread = null, $link_thread = false) {
204 204
     $team = BoincTeam::lookup_id($forum->category);
205 205
     echo "<span class=title>
206 206
         <a href=\"forum_index.php\">".tra("Message boards")."</a> :
@@ -233,12 +233,12 @@  discard block
 block discarded – undo
233 233
 }
234 234
 
235 235
 function page_link($url, $page_num, $items_per_page, $text) {
236
-    return " <a href=\"$url&amp;start=" . $page_num*$items_per_page . "\">$text</a> ";
236
+    return " <a href=\"$url&amp;start=".$page_num*$items_per_page."\">$text</a> ";
237 237
 }
238 238
 
239 239
 // return a string for navigating pages
240 240
 //
241
-function page_links($url, $nitems, $items_per_page, $start){
241
+function page_links($url, $nitems, $items_per_page, $start) {
242 242
     // How many pages to potentially show before and after this one:
243 243
     $preshow = 3;
244 244
     $postshow = 3;
@@ -246,14 +246,14 @@  discard block
 block discarded – undo
246 246
     $x = "";
247 247
     
248 248
     if ($nitems <= $items_per_page) return "";
249
-    $npages = ceil($nitems / $items_per_page);
250
-    $curpage = ceil($start / $items_per_page);
249
+    $npages = ceil($nitems/$items_per_page);
250
+    $curpage = ceil($start/$items_per_page);
251 251
 
252 252
     // If this is not the first page, display "previous"
253 253
     //
254
-    if ($curpage > 0){
254
+    if ($curpage > 0) {
255 255
         $x .= page_link(
256
-            $url, $curpage-1, $items_per_page,
256
+            $url, $curpage - 1, $items_per_page,
257 257
             tra("Previous")." &middot; "
258 258
         );
259 259
     }
@@ -268,8 +268,8 @@  discard block
 block discarded – undo
268 268
     }
269 269
     // Display a list of pages surrounding this one
270 270
     //
271
-    for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++){
272
-        $page_str = (string)($i+1);
271
+    for ($i = $curpage - $preshow; $i <= $curpage + $postshow; $i++) {
272
+        $page_str = (string)($i + 1);
273 273
         if ($i < 0) continue;
274 274
         if ($i >= $npages) break;
275 275
 
@@ -278,20 +278,20 @@  discard block
 block discarded – undo
278 278
         } else {
279 279
             $x .= page_link($url, $i, $items_per_page, $page_str);
280 280
         }
281
-        if ($i == $npages-1) break;
282
-        if ($i == $curpage+$postshow) break;
281
+        if ($i == $npages - 1) break;
282
+        if ($i == $curpage + $postshow) break;
283 283
         $x .= " &middot; ";
284 284
     }
285 285
 
286
-    if ($curpage + $postshow < $npages-1) {
286
+    if ($curpage + $postshow < $npages - 1) {
287 287
         $x .= " . . . ";
288
-        $x .= page_link($url, $npages-1, $items_per_page, $npages);
288
+        $x .= page_link($url, $npages - 1, $items_per_page, $npages);
289 289
     }
290 290
     // If there is a next page
291 291
     //
292
-    if ($curpage < $npages-1){
292
+    if ($curpage < $npages - 1) {
293 293
         $x .= page_link(
294
-            $url, $curpage+1, $items_per_page,
294
+            $url, $curpage + 1, $items_per_page,
295 295
             " &middot; ".tra("Next")
296 296
         );
297 297
     }
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 function cleanup_title($title) {
313 313
     $x = sanitize_tags(bb2html($title));
314 314
     $x = trim($x);
315
-    if (strlen($x)==0) return "(no title)";
315
+    if (strlen($x) == 0) return "(no title)";
316 316
     else return $x;
317 317
 }
318 318
 
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
             $i = 0;
375 375
             foreach ($posts as $post) {
376 376
                 if ($post->id == $postid) {
377
-                    $start = $i - ($i % $num_to_show);
377
+                    $start = $i - ($i%$num_to_show);
378 378
                     $jump_to_post = $post;
379 379
                     break;
380 380
                 }
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
             // if jump to post, figure out what page to show
402 402
             //
403 403
             if ($jump_to_post) {
404
-                $start = $ibest - ($ibest % $num_to_show);
404
+                $start = $ibest - ($ibest%$num_to_show);
405 405
             } else {
406 406
                 $start = $default_start;
407 407
             }
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
 // Generates a table row with two cells: author and message
504 504
 //
505 505
 function show_post(
506
-    $post, $thread, $forum, $logged_in_user, $start=0,
507
-    $latest_viewed=0, $controls=FORUM_CONTROLS, $filter=true
506
+    $post, $thread, $forum, $logged_in_user, $start = 0,
507
+    $latest_viewed = 0, $controls = FORUM_CONTROLS, $filter = true
508 508
 ) {
509 509
     global $country_to_iso3166_2;
510 510
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 
517 517
     // If the user no longer exists, skip the post
518 518
     //
519
-    if (!$user){
519
+    if (!$user) {
520 520
         return;
521 521
     }
522 522
 
@@ -532,9 +532,9 @@  discard block
 block discarded – undo
532 532
     // check whether the poster is on the list of people to ignore
533 533
     //
534 534
     $ignore_poster = false;
535
-    if ($logged_in_user){
535
+    if ($logged_in_user) {
536 536
         $tokens = url_tokens($logged_in_user->authenticator);
537
-        if (is_ignoring($logged_in_user, $user)){
537
+        if (is_ignoring($logged_in_user, $user)) {
538 538
             $ignore_poster = true;
539 539
         }
540 540
     }
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
             if (is_moderator($logged_in_user, $forum)) {
549 549
                 $can_edit = true;
550 550
             } else if (can_reply($thread, $forum, $logged_in_user)) {
551
-                $time_limit = $post->timestamp+MAXIMUM_EDIT_TIME;
552
-                $can_edit = time()<$time_limit;
551
+                $time_limit = $post->timestamp + MAXIMUM_EDIT_TIME;
552
+                $can_edit = time() < $time_limit;
553 553
             } else {
554 554
                 $can_edit = false;
555 555
             }
@@ -559,24 +559,24 @@  discard block
 block discarded – undo
559 559
     // Print the special user lines, if any
560 560
     //
561 561
     global $special_user_bitfield;
562
-    $fstatus="";
562
+    $fstatus = "";
563 563
     $keys = array_keys($special_user_bitfield);
564 564
     $is_posted_by_special = false;
565
-    for ($i=0; $i<sizeof($special_user_bitfield);$i++) {
565
+    for ($i = 0; $i < sizeof($special_user_bitfield); $i++) {
566 566
         if ($user->prefs && $user->prefs->privilege($keys[$i])) {
567
-            $fstatus.="<nobr>".$special_user_bitfield[$keys[$i]]."<nobr><br>";
567
+            $fstatus .= "<nobr>".$special_user_bitfield[$keys[$i]]."<nobr><br>";
568 568
             $is_posted_by_special = true;
569 569
         }
570 570
     }
571 571
     
572 572
     // Highlight special users if set in prefs;
573 573
     //
574
-    if ($logged_in_user && $logged_in_user->prefs){
574
+    if ($logged_in_user && $logged_in_user->prefs) {
575 575
         $highlight = $logged_in_user->prefs->highlight_special && $is_posted_by_special;
576 576
     } else {
577 577
         $highlight = $is_posted_by_special;
578 578
     }
579
-    $class = $highlight?' style="border-left: 5px solid LightGreen" ':'';
579
+    $class = $highlight ? ' style="border-left: 5px solid LightGreen" ' : '';
580 580
 
581 581
     // row and start of author col
582 582
     //
@@ -588,12 +588,12 @@  discard block
 block discarded – undo
588 588
 
589 589
     echo user_links($user, 0, 30);
590 590
     echo "<br>";
591
-    if ($user->create_time > time()-ST_NEW_TIME) $fstatus.=ST_NEW."<br>";
591
+    if ($user->create_time > time() - ST_NEW_TIME) $fstatus .= ST_NEW."<br>";
592 592
     echo "<span class=\"small\">";
593 593
     if ($fstatus) echo "$fstatus";
594 594
 
595
-    if (!$filter || !$ignore_poster){
596
-        if ($user->prefs && $user->prefs->avatar!="" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars==false))) {
595
+    if (!$filter || !$ignore_poster) {
596
+        if ($user->prefs && $user->prefs->avatar != "" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars == false))) {
597 597
             echo "<img width=\"".AVATAR_WIDTH."\" height=\"".AVATAR_HEIGHT."\" src=\"".avatar_url($user->prefs->avatar)."\" alt=\"Avatar\"><br>";
598 598
         }
599 599
     }
@@ -601,14 +601,14 @@  discard block
 block discarded – undo
601 601
     
602 602
     $url = "pm.php?action=new&amp;userid=".$user->id;
603 603
     $name = $user->name;
604
-    show_button_small($url, tra("Send message"), tra("Send %1 a private message",$name));
604
+    show_button_small($url, tra("Send message"), tra("Send %1 a private message", $name));
605 605
     echo '<br>'.tra("Joined: %1", gmdate('j M y', $user->create_time)), "<br>";
606 606
 
607 607
     if (!isset($user->nposts)) {
608 608
         $user->nposts = BoincPost::count("user=$user->id");
609 609
     }
610 610
     
611
-    if (function_exists('project_forum_user_info')){
611
+    if (function_exists('project_forum_user_info')) {
612 612
         project_forum_user_info($user);
613 613
     } else {
614 614
         echo tra("Posts: %1", $user->nposts)."<br>";
@@ -617,8 +617,8 @@  discard block
 block discarded – undo
617 617
         //
618 618
         //echo "ID: ".$user->id."<br>";
619 619
         if (!NO_COMPUTING) {
620
-            echo tra("Credit: %1", number_format($user->total_credit)) ."<br>";
621
-            echo tra("RAC: %1",    number_format($user->expavg_credit))."<br>";
620
+            echo tra("Credit: %1", number_format($user->total_credit))."<br>";
621
+            echo tra("RAC: %1", number_format($user->expavg_credit))."<br>";
622 622
         }
623 623
 
624 624
         // to use this feature:
@@ -647,7 +647,7 @@  discard block
 block discarded – undo
647 647
         echo "<form action=\"forum_rate.php?post=", $post->id, "\" method=\"post\">";
648 648
     }
649 649
 
650
-    if ($logged_in_user && $post->timestamp > $latest_viewed){
650
+    if ($logged_in_user && $post->timestamp > $latest_viewed) {
651 651
         show_image(NEW_IMAGE, tra("You haven't read this message yet"), tra("Unread"), NEW_IMAGE_HEIGHT);
652 652
     }
653 653
 
@@ -667,8 +667,8 @@  discard block
 block discarded – undo
667 667
     if ($post->modified) {
668 668
         echo "<br>".tra("Last modified: %1", pretty_time_Str($post->modified));
669 669
     }
670
-    if ($ignore_poster && $filter){
671
-        echo "<br>" .tra(
670
+    if ($ignore_poster && $filter) {
671
+        echo "<br>".tra(
672 672
             "This post is hidden because the sender is on your 'ignore' list.  Click %1 here %2 to view hidden posts",
673 673
             "<a href=\"?id=".$thread->id."&amp;filter=false&amp;start=$start#".$post->id."\">",
674 674
             "</a>"
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
         <p>
682 682
     ";
683 683
 
684
-    if (!$filter || !$ignore_poster){
684
+    if (!$filter || !$ignore_poster) {
685 685
         $posttext = $post->content;
686 686
 
687 687
         // If the creator of this post has a signature and
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
         // user has signatures enabled: show it
690 690
         //
691 691
         $posttext = output_transform($posttext, $options);
692
-        if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)){
692
+        if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)) {
693 693
             $sig = output_transform($user->prefs->signature, $options);
694 694
             $posttext .= "<hr>$sig\n";
695 695
         }
@@ -723,10 +723,10 @@  discard block
 block discarded – undo
723 723
         }
724 724
         if (($controls == FORUM_CONTROLS) && (can_reply($thread, $forum, $logged_in_user))) {
725 725
             echo "&nbsp;&nbsp;&nbsp;&nbsp;";
726
-            $url = "forum_reply.php?thread=" . $thread->id . "&amp;post=" . $post->id . "&amp;no_quote=1#input";
726
+            $url = "forum_reply.php?thread=".$thread->id."&amp;post=".$post->id."&amp;no_quote=1#input";
727 727
             // "Reply" is used as a verb
728 728
             show_button($url, tra("Reply"), tra("Post a reply to this message"));
729
-            $url = "forum_reply.php?thread=" . $thread->id . "&amp;post=" . $post->id . "#input";
729
+            $url = "forum_reply.php?thread=".$thread->id."&amp;post=".$post->id."#input";
730 730
             // "Quote" is used as a verb
731 731
             show_button($url, tra("Quote"), tra("Post a reply by quoting this message"));
732 732
         }
@@ -798,9 +798,9 @@  discard block
 block discarded – undo
798 798
 
799 799
 function post_rules() {
800 800
     if (function_exists("project_forum_post_rules")) {
801
-      $project_rules=project_forum_post_rules();
801
+      $project_rules = project_forum_post_rules();
802 802
     } else {
803
-      $project_rules="";
803
+      $project_rules = "";
804 804
     }
805 805
     return sprintf("
806 806
         <ul>
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
     );
830 830
 }
831 831
 
832
-function post_warning($forum=null) {
832
+function post_warning($forum = null) {
833 833
     $x = "<br><br>
834 834
         <table><tr><td align=left>
835 835
     ";
@@ -889,7 +889,7 @@  discard block
 block discarded – undo
889 889
     $content = substr($content, 0, 64000);
890 890
     $content = BoincDb::escape_string($content);
891 891
     $now = time();
892
-    $sig = $signature?1:0;
892
+    $sig = $signature ? 1 : 0;
893 893
     $id = BoincPost::insert("(thread, user, timestamp, content, modified, parent_post, score, votes, signature, hidden) values ($thread->id, $user->id, $now, '$content', 0, $parent_id, 0, 0, $sig, 0)");
894 894
     if (!$id) {
895 895
         $forum_error = "Failed to add post to DB.";
@@ -909,7 +909,7 @@  discard block
 block discarded – undo
909 909
 //
910 910
 function update_thread_timestamp($thread) {
911 911
     $posts = BoincPost::enum("thread=$thread->id and hidden=0 order by timestamp desc limit 1");
912
-    if (count($posts)>0) {
912
+    if (count($posts) > 0) {
913 913
         $post = $posts[0];
914 914
         $thread->update("timestamp=$post->timestamp");
915 915
     }
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 
918 918
 function update_forum_timestamp($forum) {
919 919
     $threads = BoincThread::enum("forum=$forum->id and hidden=0 order by timestamp desc limit 1");
920
-    if (count($threads)>0) {
920
+    if (count($threads) > 0) {
921 921
         $thread = $threads[0];
922 922
         $forum->update("timestamp=$thread->timestamp");
923 923
     }
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
     if (is_news_forum($forum) && !$export) {
941 941
         $status = 1;
942 942
     }
943
-    $id  = BoincThread::insert("(forum, owner, status, title, timestamp, views, replies, activity, sufferers, score, votes, create_time, hidden, sticky, locked) values ($forum->id, $user->id, $status, '$title', $now, 0, -1, 0, 0, 0, 0, $now, 0, 0, 0)");
943
+    $id = BoincThread::insert("(forum, owner, status, title, timestamp, views, replies, activity, sufferers, score, votes, create_time, hidden, sticky, locked) values ($forum->id, $user->id, $status, '$title', $now, 0, -1, 0, 0, 0, 0, $now, 0, 0, 0)");
944 944
     if (!$id) {
945 945
         $forum_error = "Failed to add thread to DB.";
946 946
         return null;
@@ -1068,22 +1068,22 @@  discard block
 block discarded – undo
1068 1068
 // $sticky - bool (not directly passed to SQL)
1069 1069
 //
1070 1070
 function get_forum_threads(
1071
-    $forumID, $start=-1, $nRec=-1, $sort_style=MODIFIED_NEW,
1071
+    $forumID, $start = -1, $nRec = -1, $sort_style = MODIFIED_NEW,
1072 1072
     $show_hidden = 0, $sticky = 1
1073 1073
 ) {
1074 1074
     //if (! (is_numeric($forumID) && is_numeric($min) && is_numeric($nRec))) {
1075 1075
     //    return NULL;  // Something is wrong here.
1076 1076
     //}
1077 1077
         
1078
-    $sql = 'forum = ' . $forumID ;
1078
+    $sql = 'forum = '.$forumID;
1079 1079
     $stickysql = "";
1080
-    if ($sticky){
1080
+    if ($sticky) {
1081 1081
         $stickysql = "sticky DESC, ";
1082 1082
     }
1083 1083
     if (!$show_hidden) {
1084 1084
         $sql .= ' AND hidden = 0';
1085 1085
     }
1086
-    switch($sort_style) {
1086
+    switch ($sort_style) {
1087 1087
     case MODIFIED_NEW:
1088 1088
         $sql .= ' ORDER BY '.$stickysql.'timestamp DESC';
1089 1089
         break;
@@ -1136,7 +1136,7 @@  discard block
 block discarded – undo
1136 1136
     if (!$show_hidden) {
1137 1137
         $sql .= ' AND hidden = 0';
1138 1138
     }
1139
-    switch($sort_style) {
1139
+    switch ($sort_style) {
1140 1140
     case CREATE_TIME_NEW:
1141 1141
         $sql .= ' ORDER BY timestamp desc';
1142 1142
         break;
@@ -1158,7 +1158,7 @@  discard block
 block discarded – undo
1158 1158
 //
1159 1159
 function show_post_moderation_links(
1160 1160
     $config, $logged_in_user, $post, $forum, $tokens
1161
-){
1161
+) {
1162 1162
     $moderators_allowed_to_ban = parse_bool($config, "moderators_allowed_to_ban"); 
1163 1163
     $moderators_vote_to_ban = parse_bool($config, "moderators_vote_to_ban");
1164 1164
 
@@ -1245,14 +1245,14 @@  discard block
 block discarded – undo
1245 1245
     // We do not tell the (ab)user how much this is -
1246 1246
     // no need to make it easy for them to break the system.
1247 1247
     //
1248
-    if ($user->total_credit<$forum->post_min_total_credit || $user->expavg_credit<$forum->post_min_expavg_credit) {
1248
+    if ($user->total_credit < $forum->post_min_total_credit || $user->expavg_credit < $forum->post_min_expavg_credit) {
1249 1249
         error_page(tra("To create a new thread in %1 you must have a certain level of average credit. This is to protect against abuse of the system.", $forum->title));
1250 1250
     }
1251 1251
 
1252 1252
     // If the user is posting faster than forum regulations allow
1253 1253
     // Tell the user to wait a while before creating any more posts
1254 1254
     //
1255
-    if (time()-$user->prefs->last_post <$forum->post_min_interval) {
1255
+    if (time() - $user->prefs->last_post < $forum->post_min_interval) {
1256 1256
         error_page(tra("You cannot create threads right now. Please wait before trying again. This is to protect against abuse of the system."));
1257 1257
     }
1258 1258
 }
@@ -1280,7 +1280,7 @@  discard block
 block discarded – undo
1280 1280
 
1281 1281
 function is_moderator($user, $forum) {
1282 1282
     if (!$user) return false;
1283
-    $type = $forum?$forum->parent_type:0;
1283
+    $type = $forum ? $forum->parent_type : 0;
1284 1284
     switch ($type) {
1285 1285
     case 0:
1286 1286
         if ($user->prefs->privilege(S_MODERATOR)) return true;
@@ -1317,7 +1317,7 @@  discard block
 block discarded – undo
1317 1317
     if (!is_forum_visible_to_user($thread_forum, $user)) return;
1318 1318
     $owner = BoincUser::lookup_id($thread->owner);
1319 1319
     echo "<tr><td>\n";
1320
-    switch($thread_forum->parent_type) {
1320
+    switch ($thread_forum->parent_type) {
1321 1321
     case 0:
1322 1322
         $category = BoincCategory::lookup_id($thread_forum->category);
1323 1323
         show_forum_title($category, $thread_forum, $thread, true);
@@ -1327,7 +1327,7 @@  discard block
 block discarded – undo
1327 1327
         break;
1328 1328
     }
1329 1329
     echo '
1330
-        </td><td class="numbers">'.($thread->replies+1).'</td>
1330
+        </td><td class="numbers">'.($thread->replies + 1).'</td>
1331 1331
         <td>'.user_links($owner).'</td>
1332 1332
         <td class="numbers">'.$thread->views.'</td>
1333 1333
         <td class="lastpost">'.time_diff_str($thread->timestamp, time()).'</td>
@@ -1361,13 +1361,13 @@  discard block
 block discarded – undo
1361 1361
 
1362 1362
 function subscribed_post_web_line($notify) {
1363 1363
     $thread = BoincThread::lookup_id($notify->opaque);
1364
-    return tra("New posts in the thread %1","<a href=forum_thread.php?id=$thread->id>$thread->title</a>");
1364
+    return tra("New posts in the thread %1", "<a href=forum_thread.php?id=$thread->id>$thread->title</a>");
1365 1365
 }
1366 1366
 
1367 1367
 function subscribe_rss($notify, &$title, &$msg, &$url) {
1368 1368
     $thread = BoincThread::lookup_id($notify->opaque);
1369 1369
     $title = tra("New posts in subscribed thread");
1370
-    $msg = tra("There are new posts in the thread '%1'",$thread->title);
1370
+    $msg = tra("There are new posts in the thread '%1'", $thread->title);
1371 1371
     $url = secure_url_base()."forum_thread.php?id=$thread->id";
1372 1372
 }
1373 1373
 
Please login to merge, or discard this patch.