Passed
Push — master ( 4da011...8fb909 )
by Kevin
08:22 queued 12s
created
html/inc/ReCaptcha/RequestMethod.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@
 block discarded – undo
29 29
 /**
30 30
  * Method used to send the request to the service.
31 31
  */
32
-interface RequestMethod
33
-{
32
+interface RequestMethod {
34 33
 
35 34
     /**
36 35
      * Submit the request with the specified parameters.
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/CurlPost.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -34,8 +34,7 @@  discard block
 block discarded – undo
34 34
  * Note: this requires the cURL extension to be enabled in PHP
35 35
  * @see http://php.net/manual/en/book.curl.php
36 36
  */
37
-class CurlPost implements RequestMethod
38
-{
37
+class CurlPost implements RequestMethod {
39 38
     /**
40 39
      * URL to which requests are sent via cURL.
41 40
      * @const string
@@ -48,8 +47,7 @@  discard block
 block discarded – undo
48 47
      */
49 48
     private $curl;
50 49
 
51
-    public function __construct(Curl $curl = null)
52
-    {
50
+    public function __construct(Curl $curl = null) {
53 51
         if (!is_null($curl)) {
54 52
             $this->curl = $curl;
55 53
         } else {
@@ -63,8 +61,7 @@  discard block
 block discarded – undo
63 61
      * @param RequestParameters $params Request parameters
64 62
      * @return string Body of the reCAPTCHA response
65 63
      */
66
-    public function submit(RequestParameters $params)
67
-    {
64
+    public function submit(RequestParameters $params) {
68 65
         $handle = $this->curl->init(self::SITE_VERIFY_URL);
69 66
 
70 67
         $options = array(
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/Post.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -32,8 +32,7 @@  discard block
 block discarded – undo
32 32
 /**
33 33
  * Sends POST requests to the reCAPTCHA service.
34 34
  */
35
-class Post implements RequestMethod
36
-{
35
+class Post implements RequestMethod {
37 36
     /**
38 37
      * URL to which requests are POSTed.
39 38
      * @const string
@@ -46,8 +45,7 @@  discard block
 block discarded – undo
46 45
      * @param RequestParameters $params Request parameters
47 46
      * @return string Body of the reCAPTCHA response
48 47
      */
49
-    public function submit(RequestParameters $params)
50
-    {
48
+    public function submit(RequestParameters $params) {
51 49
         /**
52 50
          * PHP 5.6.0 changed the way you specify the peer name for SSL context options.
53 51
          * Using "CN_name" will still work, but it will raise deprecated errors.
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/Socket.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -30,8 +30,7 @@  discard block
 block discarded – undo
30 30
  * Convenience wrapper around native socket and file functions to allow for
31 31
  * mocking.
32 32
  */
33
-class Socket
34
-{
33
+class Socket {
35 34
     private $handle = null;
36 35
 
37 36
     /**
@@ -45,8 +44,7 @@  discard block
 block discarded – undo
45 44
      * @param float $timeout
46 45
      * @return resource
47 46
      */
48
-    public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null)
49
-    {
47
+    public function fsockopen($hostname, $port = -1, &$errno = 0, &$errstr = '', $timeout = null) {
50 48
         $this->handle = fsockopen($hostname, $port, $errno, $errstr, (is_null($timeout) ? ini_get("default_socket_timeout") : $timeout));
51 49
 
52 50
         if ($this->handle != false && $errno === 0 && $errstr === '') {
@@ -63,8 +61,7 @@  discard block
 block discarded – undo
63 61
      * @param int $length
64 62
      * @return int | bool
65 63
      */
66
-    public function fwrite($string, $length = null)
67
-    {
64
+    public function fwrite($string, $length = null) {
68 65
         return fwrite($this->handle, $string, (is_null($length) ? strlen($string) : $length));
69 66
     }
70 67
 
@@ -75,8 +72,7 @@  discard block
 block discarded – undo
75 72
      * @param int $length
76 73
      * @return string
77 74
      */
78
-    public function fgets($length = null)
79
-    {
75
+    public function fgets($length = null) {
80 76
         return fgets($this->handle, $length);
81 77
     }
82 78
 
@@ -86,8 +82,7 @@  discard block
 block discarded – undo
86 82
      * @see http://php.net/feof
87 83
      * @return bool
88 84
      */
89
-    public function feof()
90
-    {
85
+    public function feof() {
91 86
         return feof($this->handle);
92 87
     }
93 88
 
@@ -97,8 +92,7 @@  discard block
 block discarded – undo
97 92
      * @see http://php.net/fclose
98 93
      * @return bool
99 94
      */
100
-    public function fclose()
101
-    {
95
+    public function fclose() {
102 96
         return fclose($this->handle);
103 97
     }
104 98
 }
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestMethod/Curl.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,16 +29,14 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * Convenience wrapper around the cURL functions to allow mocking.
31 31
  */
32
-class Curl
33
-{
32
+class Curl {
34 33
 
35 34
     /**
36 35
      * @see http://php.net/curl_init
37 36
      * @param string $url
38 37
      * @return resource cURL handle
39 38
      */
40
-    public function init($url = null)
41
-    {
39
+    public function init($url = null) {
42 40
         return curl_init($url);
43 41
     }
44 42
 
@@ -48,8 +46,7 @@  discard block
 block discarded – undo
48 46
      * @param array $options
49 47
      * @return bool
50 48
      */
51
-    public function setoptArray($ch, array $options)
52
-    {
49
+    public function setoptArray($ch, array $options) {
53 50
         return curl_setopt_array($ch, $options);
54 51
     }
55 52
 
@@ -58,8 +55,7 @@  discard block
 block discarded – undo
58 55
      * @param resource $ch
59 56
      * @return mixed
60 57
      */
61
-    public function exec($ch)
62
-    {
58
+    public function exec($ch) {
63 59
         return curl_exec($ch);
64 60
     }
65 61
 
@@ -67,8 +63,7 @@  discard block
 block discarded – undo
67 63
      * @see http://php.net/curl_close
68 64
      * @param resource $ch
69 65
      */
70
-    public function close($ch)
71
-    {
66
+    public function close($ch) {
72 67
         curl_close($ch);
73 68
     }
74 69
 }
Please login to merge, or discard this patch.
html/inc/ReCaptcha/Response.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * The response returned from the service.
31 31
  */
32
-class Response
33
-{
32
+class Response {
34 33
     /**
35 34
      * Succes or failure.
36 35
      * @var boolean
@@ -49,8 +48,7 @@  discard block
 block discarded – undo
49 48
      * @param string $json
50 49
      * @return \ReCaptcha\Response
51 50
      */
52
-    public static function fromJson($json)
53
-    {
51
+    public static function fromJson($json) {
54 52
         $responseData = json_decode($json, true);
55 53
 
56 54
         if (!$responseData) {
@@ -74,8 +72,7 @@  discard block
 block discarded – undo
74 72
      * @param boolean $success
75 73
      * @param array $errorCodes
76 74
      */
77
-    public function __construct($success, array $errorCodes = array())
78
-    {
75
+    public function __construct($success, array $errorCodes = array()) {
79 76
         $this->success = $success;
80 77
         $this->errorCodes = $errorCodes;
81 78
     }
@@ -85,8 +82,7 @@  discard block
 block discarded – undo
85 82
      *
86 83
      * @return boolean
87 84
      */
88
-    public function isSuccess()
89
-    {
85
+    public function isSuccess() {
90 86
         return $this->success;
91 87
     }
92 88
 
@@ -95,8 +91,7 @@  discard block
 block discarded – undo
95 91
      *
96 92
      * @return array
97 93
      */
98
-    public function getErrorCodes()
99
-    {
94
+    public function getErrorCodes() {
100 95
         return $this->errorCodes;
101 96
     }
102 97
 }
Please login to merge, or discard this patch.
html/inc/ReCaptcha/RequestParameters.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -29,8 +29,7 @@  discard block
 block discarded – undo
29 29
 /**
30 30
  * Stores and formats the parameters for the request to the reCAPTCHA service.
31 31
  */
32
-class RequestParameters
33
-{
32
+class RequestParameters {
34 33
     /**
35 34
      * Site secret.
36 35
      * @var string
@@ -63,8 +62,7 @@  discard block
 block discarded – undo
63 62
      * @param string $remoteIp User's IP address.
64 63
      * @param string $version Version of this client library.
65 64
      */
66
-    public function __construct($secret, $response, $remoteIp = null, $version = null)
67
-    {
65
+    public function __construct($secret, $response, $remoteIp = null, $version = null) {
68 66
         $this->secret = $secret;
69 67
         $this->response = $response;
70 68
         $this->remoteIp = $remoteIp;
@@ -76,8 +74,7 @@  discard block
 block discarded – undo
76 74
      *
77 75
      * @return array Array formatted parameters.
78 76
      */
79
-    public function toArray()
80
-    {
77
+    public function toArray() {
81 78
         $params = array('secret' => $this->secret, 'response' => $this->response);
82 79
 
83 80
         if (!is_null($this->remoteIp)) {
@@ -96,8 +93,7 @@  discard block
 block discarded – undo
96 93
      *
97 94
      * @return string Query string formatted parameters.
98 95
      */
99
-    public function toQueryString()
100
-    {
96
+    public function toQueryString() {
101 97
         return http_build_query($this->toArray(), '', '&');
102 98
     }
103 99
 }
Please login to merge, or discard this patch.
html/inc/dir_hier.inc 1 patch
Upper-Lower-Casing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,17 +56,17 @@  discard block
 block discarded – undo
56 56
     $dl_md5_path = "$dl_path.md5";
57 57
     $have_md5_file = false;
58 58
     $md5 = md5_file($path);
59
-    if ($md5 === FALSE) {
59
+    if ($md5 === false) {
60 60
         return -2;
61 61
     }
62 62
     $size = filesize($path);
63
-    if ($size === FALSE) {
63
+    if ($size === false) {
64 64
         return -2;
65 65
     }
66 66
 
67 67
     if (file_exists($dl_md5_path)) {
68 68
         $x = file_get_contents($dl_md5_path);
69
-        if ($x === FALSE) {
69
+        if ($x === false) {
70 70
             return -2;
71 71
         }
72 72
         $x = explode(" ", $x);
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
     if (file_exists($dl_path)) {
79 79
         if ($have_md5_file) {
80 80
             $s = filesize($dl_path);
81
-            if ($s === FALSE) {
81
+            if ($s === false) {
82 82
                 return -2;
83 83
             }
84 84
             if ($s == $dl_size && $dl_md5 == $md5) {
@@ -91,11 +91,11 @@  discard block
 block discarded – undo
91 91
             // missing the .md5 file; need to look at the file
92 92
             //
93 93
             $m = md5_file($dl_path);
94
-            if ($m === FALSE) {
94
+            if ($m === false) {
95 95
                 return -2;
96 96
             }
97 97
             if ($m == $md5) {
98
-                if (file_put_contents($dl_md5_path, "$md5 $size\n") === FALSE) {
98
+                if (file_put_contents($dl_md5_path, "$md5 $size\n") === false) {
99 99
                     return -2;
100 100
                 }
101 101
                 return 0;
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
             return -1;
104 104
         }
105 105
     } else {
106
-        if (file_put_contents($dl_md5_path, "$md5 $size\n") === FALSE) {
106
+        if (file_put_contents($dl_md5_path, "$md5 $size\n") === false) {
107 107
             return -2;
108 108
         }
109 109
         return 1;
Please login to merge, or discard this patch.
html/inc/forum.inc 4 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -367,7 +367,7 @@
 block discarded – undo
367 367
                 $i++;
368 368
             }
369 369
             if ($start === null) {
370
-                echo "Post $postid not found.";
370
+                echo "post $postid not found.";
371 371
                 return;
372 372
             }
373 373
         } else if ($logged_in_user && $logged_in_user->prefs->jump_to_unread) {
Please login to merge, or discard this patch.
Braces   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 
225 225
 // return a string for navigating pages
226 226
 //
227
-function page_links($url, $nitems, $items_per_page, $start){
227
+function page_links($url, $nitems, $items_per_page, $start) {
228 228
     // How many pages to potentially show before and after this one:
229 229
     $preshow = 3;
230 230
     $postshow = 3;
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
 
238 238
     // If this is not the first page, display "previous"
239 239
     //
240
-    if ($curpage > 0){
240
+    if ($curpage > 0) {
241 241
         $x .= page_link(
242 242
             $url, $curpage-1, $items_per_page,
243 243
             tra("Previous")." · "
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
     }
255 255
     // Display a list of pages surrounding this one
256 256
     //
257
-    for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++){
257
+    for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++) {
258 258
         $page_str = (string)($i+1);
259 259
         if ($i < 0) continue;
260 260
         if ($i >= $npages) break;
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
     }
276 276
     // If there is a next page
277 277
     //
278
-    if ($curpage < $npages-1){
278
+    if ($curpage < $npages-1) {
279 279
         $x .= page_link(
280 280
             $url, $curpage+1, $items_per_page,
281 281
             " &middot; ".tra("Next")
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 
503 503
     // If the user no longer exists, skip the post
504 504
     //
505
-    if (!$user){
505
+    if (!$user) {
506 506
         return;
507 507
     }
508 508
 
@@ -518,9 +518,9 @@  discard block
 block discarded – undo
518 518
     // check whether the poster is on the list of people to ignore
519 519
     //
520 520
     $ignore_poster = false;
521
-    if ($logged_in_user){
521
+    if ($logged_in_user) {
522 522
         $tokens = url_tokens($logged_in_user->authenticator);
523
-        if (is_ignoring($logged_in_user, $user)){
523
+        if (is_ignoring($logged_in_user, $user)) {
524 524
             $ignore_poster = true;
525 525
         }
526 526
     }
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
     
558 558
     // Highlight special users if set in prefs;
559 559
     //
560
-    if ($logged_in_user && $logged_in_user->prefs){
560
+    if ($logged_in_user && $logged_in_user->prefs) {
561 561
         $highlight = $logged_in_user->prefs->highlight_special && $is_posted_by_special;
562 562
     } else {
563 563
         $highlight = $is_posted_by_special;
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
     echo "<span class=\"small\">";
579 579
     if ($fstatus) echo "$fstatus";
580 580
 
581
-    if (!$filter || !$ignore_poster){
581
+    if (!$filter || !$ignore_poster) {
582 582
         if ($user->prefs && $user->prefs->avatar!="" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars==false))) {
583 583
             echo "<img width=\"".AVATAR_WIDTH."\" height=\"".AVATAR_HEIGHT."\" src=\"".avatar_url($user->prefs->avatar)."\" alt=\"Avatar\"><br>";
584 584
         }
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
         $user->nposts = BoincPost::count("user=$user->id");
595 595
     }
596 596
     
597
-    if (function_exists('project_forum_user_info')){
597
+    if (function_exists('project_forum_user_info')) {
598 598
         project_forum_user_info($user);
599 599
     } else {
600 600
         echo tra("Posts: %1", $user->nposts)."<br>";
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
         echo "<form action=\"forum_rate.php?post=", $post->id, "\" method=\"post\">";
634 634
     }
635 635
 
636
-    if ($logged_in_user && $post->timestamp > $latest_viewed){
636
+    if ($logged_in_user && $post->timestamp > $latest_viewed) {
637 637
         show_image(NEW_IMAGE, tra("You haven't read this message yet"), tra("Unread"), NEW_IMAGE_HEIGHT);
638 638
     }
639 639
 
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
     if ($post->modified) {
654 654
         echo "<br>".tra("Last modified: %1", pretty_time_Str($post->modified));
655 655
     }
656
-    if ($ignore_poster && $filter){
656
+    if ($ignore_poster && $filter) {
657 657
         echo "<br>" .tra(
658 658
             "This post is hidden because the sender is on your 'ignore' list.  Click %1 here %2 to view hidden posts",
659 659
             "<a href=\"?id=".$thread->id."&amp;filter=false&amp;start=$start#".$post->id."\">",
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
         <p>
668 668
     ";
669 669
 
670
-    if (!$filter || !$ignore_poster){
670
+    if (!$filter || !$ignore_poster) {
671 671
         $posttext = $post->content;
672 672
 
673 673
         // If the creator of this post has a signature and
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
         // user has signatures enabled: show it
676 676
         //
677 677
         $posttext = output_transform($posttext, $options);
678
-        if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)){
678
+        if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)) {
679 679
             $sig = output_transform($user->prefs->signature, $options);
680 680
             $posttext .= "<hr>$sig\n";
681 681
         }
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
         
1036 1036
     $sql = 'forum = ' . $forumID ;
1037 1037
     $stickysql = "";
1038
-    if ($sticky){
1038
+    if ($sticky) {
1039 1039
         $stickysql = "sticky DESC, ";
1040 1040
     }
1041 1041
     if (!$show_hidden) {
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 //
1117 1117
 function show_post_moderation_links(
1118 1118
     $config, $logged_in_user, $post, $forum, $tokens
1119
-){
1119
+) {
1120 1120
     $moderators_allowed_to_ban = parse_bool($config, "moderators_allowed_to_ban"); 
1121 1121
     $moderators_vote_to_ban = parse_bool($config, "moderators_vote_to_ban");
1122 1122
 
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -784,9 +784,9 @@  discard block
 block discarded – undo
784 784
 
785 785
 function post_rules() {
786 786
     if (function_exists("project_forum_post_rules")) {
787
-      $project_rules=project_forum_post_rules();
787
+        $project_rules=project_forum_post_rules();
788 788
     } else {
789
-      $project_rules="";
789
+        $project_rules="";
790 790
     }
791 791
     return sprintf("
792 792
         <ul>
@@ -1229,7 +1229,7 @@  discard block
 block discarded – undo
1229 1229
     }
1230 1230
     if ($thread->hidden) {
1231 1231
         error_page(
1232
-           tra("Can't post to a hidden thread.")
1232
+            tra("Can't post to a hidden thread.")
1233 1233
         );
1234 1234
     }
1235 1235
 
Please login to merge, or discard this 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.