@@ -32,8 +32,7 @@ discard block |
||
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 |
||
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. |
@@ -30,8 +30,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -29,16 +29,14 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -29,8 +29,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -29,8 +29,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -56,17 +56,17 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -367,7 +367,7 @@ |
||
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) { |
@@ -784,9 +784,9 @@ discard block |
||
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 |
||
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 |
@@ -54,12 +54,12 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
233 | 233 | } |
234 | 234 | |
235 | 235 | function page_link($url, $page_num, $items_per_page, $text) { |
236 | - return " <a href=\"$url&start=" . $page_num*$items_per_page . "\">$text</a> "; |
|
236 | + return " <a href=\"$url&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 |
||
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")." · " |
258 | 258 | ); |
259 | 259 | } |
@@ -268,8 +268,8 @@ discard block |
||
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 |
||
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 .= " · "; |
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 | " · ".tra("Next") |
296 | 296 | ); |
297 | 297 | } |
@@ -312,7 +312,7 @@ discard block |
||
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 |
||
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 |
||
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 | } |
@@ -509,8 +509,8 @@ discard block |
||
509 | 509 | // Generates a table row with two cells: author and message |
510 | 510 | // |
511 | 511 | function show_post( |
512 | - $post, $thread, $forum, $logged_in_user, $start=0, |
|
513 | - $latest_viewed=0, $controls=FORUM_CONTROLS, $filter=true |
|
512 | + $post, $thread, $forum, $logged_in_user, $start = 0, |
|
513 | + $latest_viewed = 0, $controls = FORUM_CONTROLS, $filter = true |
|
514 | 514 | ) { |
515 | 515 | global $country_to_iso3166_2; |
516 | 516 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | // If the user no longer exists, skip the post |
520 | 520 | // |
521 | - if (!$user){ |
|
521 | + if (!$user) { |
|
522 | 522 | return; |
523 | 523 | } |
524 | 524 | |
@@ -539,9 +539,9 @@ discard block |
||
539 | 539 | // check whether the poster is on the list of people to ignore |
540 | 540 | // |
541 | 541 | $ignore_poster = false; |
542 | - if ($logged_in_user){ |
|
542 | + if ($logged_in_user) { |
|
543 | 543 | $tokens = url_tokens($logged_in_user->authenticator); |
544 | - if (is_ignoring($logged_in_user, $user)){ |
|
544 | + if (is_ignoring($logged_in_user, $user)) { |
|
545 | 545 | $ignore_poster = true; |
546 | 546 | } |
547 | 547 | } |
@@ -555,8 +555,8 @@ discard block |
||
555 | 555 | if (is_moderator($logged_in_user, $forum)) { |
556 | 556 | $can_edit = true; |
557 | 557 | } else if (can_reply($thread, $forum, $logged_in_user)) { |
558 | - $time_limit = $post->timestamp+MAXIMUM_EDIT_TIME; |
|
559 | - $can_edit = time()<$time_limit; |
|
558 | + $time_limit = $post->timestamp + MAXIMUM_EDIT_TIME; |
|
559 | + $can_edit = time() < $time_limit; |
|
560 | 560 | } else { |
561 | 561 | $can_edit = false; |
562 | 562 | } |
@@ -566,24 +566,24 @@ discard block |
||
566 | 566 | // Print the special user lines, if any |
567 | 567 | // |
568 | 568 | global $special_user_bitfield; |
569 | - $fstatus=""; |
|
569 | + $fstatus = ""; |
|
570 | 570 | $keys = array_keys($special_user_bitfield); |
571 | 571 | $is_posted_by_special = false; |
572 | - for ($i=0; $i<sizeof($special_user_bitfield);$i++) { |
|
572 | + for ($i = 0; $i < sizeof($special_user_bitfield); $i++) { |
|
573 | 573 | if ($user->prefs && $user->prefs->privilege($keys[$i])) { |
574 | - $fstatus.="<nobr>".$special_user_bitfield[$keys[$i]]."<nobr><br>"; |
|
574 | + $fstatus .= "<nobr>".$special_user_bitfield[$keys[$i]]."<nobr><br>"; |
|
575 | 575 | $is_posted_by_special = true; |
576 | 576 | } |
577 | 577 | } |
578 | 578 | |
579 | 579 | // Highlight special users if set in prefs; |
580 | 580 | // |
581 | - if ($logged_in_user && $logged_in_user->prefs){ |
|
581 | + if ($logged_in_user && $logged_in_user->prefs) { |
|
582 | 582 | $highlight = $logged_in_user->prefs->highlight_special && $is_posted_by_special; |
583 | 583 | } else { |
584 | 584 | $highlight = $is_posted_by_special; |
585 | 585 | } |
586 | - $class = $highlight?' style="border-left: 5px solid LightGreen" ':''; |
|
586 | + $class = $highlight ? ' style="border-left: 5px solid LightGreen" ' : ''; |
|
587 | 587 | |
588 | 588 | // row and start of author col |
589 | 589 | // |
@@ -595,12 +595,12 @@ discard block |
||
595 | 595 | |
596 | 596 | echo user_links($user, 0, 30); |
597 | 597 | echo "<br>"; |
598 | - if ($user->create_time > time()-ST_NEW_TIME) $fstatus.=ST_NEW."<br>"; |
|
598 | + if ($user->create_time > time() - ST_NEW_TIME) $fstatus .= ST_NEW."<br>"; |
|
599 | 599 | echo "<span class=\"small\">"; |
600 | 600 | if ($fstatus) echo "$fstatus"; |
601 | 601 | |
602 | - if (!$filter || !$ignore_poster){ |
|
603 | - if ($user->prefs && $user->prefs->avatar!="" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars==false))) { |
|
602 | + if (!$filter || !$ignore_poster) { |
|
603 | + if ($user->prefs && $user->prefs->avatar != "" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars == false))) { |
|
604 | 604 | echo "<img width=\"".AVATAR_WIDTH."\" height=\"".AVATAR_HEIGHT."\" src=\"".avatar_url($user->prefs->avatar)."\" alt=\"Avatar\"><br>"; |
605 | 605 | } |
606 | 606 | } |
@@ -608,14 +608,14 @@ discard block |
||
608 | 608 | |
609 | 609 | $url = "pm.php?action=new&userid=".$user->id; |
610 | 610 | $name = $user->name; |
611 | - show_button_small($url, tra("Send message"), tra("Send %1 a private message",$name)); |
|
611 | + show_button_small($url, tra("Send message"), tra("Send %1 a private message", $name)); |
|
612 | 612 | echo '<br>'.tra("Joined: %1", gmdate('j M y', $user->create_time)), "<br>"; |
613 | 613 | |
614 | 614 | if (!isset($user->nposts)) { |
615 | 615 | $user->nposts = BoincPost::count("user=$user->id"); |
616 | 616 | } |
617 | 617 | |
618 | - if (function_exists('project_forum_user_info')){ |
|
618 | + if (function_exists('project_forum_user_info')) { |
|
619 | 619 | project_forum_user_info($user); |
620 | 620 | } else { |
621 | 621 | echo tra("Posts: %1", $user->nposts)."<br>"; |
@@ -624,8 +624,8 @@ discard block |
||
624 | 624 | // |
625 | 625 | //echo "ID: ".$user->id."<br>"; |
626 | 626 | if (!NO_COMPUTING) { |
627 | - echo tra("Credit: %1", number_format($user->total_credit)) ."<br>"; |
|
628 | - echo tra("RAC: %1", number_format($user->expavg_credit))."<br>"; |
|
627 | + echo tra("Credit: %1", number_format($user->total_credit))."<br>"; |
|
628 | + echo tra("RAC: %1", number_format($user->expavg_credit))."<br>"; |
|
629 | 629 | } |
630 | 630 | |
631 | 631 | // to use this feature: |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | echo "<form action=\"forum_rate.php?post=", $post->id, "\" method=\"post\">"; |
655 | 655 | } |
656 | 656 | |
657 | - if ($logged_in_user && $post->timestamp > $latest_viewed){ |
|
657 | + if ($logged_in_user && $post->timestamp > $latest_viewed) { |
|
658 | 658 | show_image(NEW_IMAGE, tra("You haven't read this message yet"), tra("Unread"), NEW_IMAGE_HEIGHT); |
659 | 659 | } |
660 | 660 | |
@@ -674,8 +674,8 @@ discard block |
||
674 | 674 | if ($post->modified) { |
675 | 675 | echo "<br>".tra("Last modified: %1", pretty_time_Str($post->modified)); |
676 | 676 | } |
677 | - if ($ignore_poster && $filter){ |
|
678 | - echo "<br>" .tra( |
|
677 | + if ($ignore_poster && $filter) { |
|
678 | + echo "<br>".tra( |
|
679 | 679 | "This post is hidden because the sender is on your 'ignore' list. Click %1 here %2 to view hidden posts", |
680 | 680 | "<a href=\"?id=".$thread->id."&filter=false&start=$start#".$post->id."\">", |
681 | 681 | "</a>" |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | <p> |
689 | 689 | "; |
690 | 690 | |
691 | - if (!$filter || !$ignore_poster){ |
|
691 | + if (!$filter || !$ignore_poster) { |
|
692 | 692 | $posttext = $post->content; |
693 | 693 | |
694 | 694 | // If the creator of this post has a signature and |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | // user has signatures enabled: show it |
697 | 697 | // |
698 | 698 | $posttext = output_transform($posttext, $options); |
699 | - if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)){ |
|
699 | + if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)) { |
|
700 | 700 | $sig = output_transform($user->prefs->signature, $options); |
701 | 701 | $posttext .= "<hr>$sig\n"; |
702 | 702 | } |
@@ -730,10 +730,10 @@ discard block |
||
730 | 730 | } |
731 | 731 | if (($controls == FORUM_CONTROLS) && (can_reply($thread, $forum, $logged_in_user))) { |
732 | 732 | echo " "; |
733 | - $url = "forum_reply.php?thread=" . $thread->id . "&post=" . $post->id . "&no_quote=1#input"; |
|
733 | + $url = "forum_reply.php?thread=".$thread->id."&post=".$post->id."&no_quote=1#input"; |
|
734 | 734 | // "Reply" is used as a verb |
735 | 735 | show_button($url, tra("Reply"), tra("Post a reply to this message")); |
736 | - $url = "forum_reply.php?thread=" . $thread->id . "&post=" . $post->id . "#input"; |
|
736 | + $url = "forum_reply.php?thread=".$thread->id."&post=".$post->id."#input"; |
|
737 | 737 | // "Quote" is used as a verb |
738 | 738 | show_button($url, tra("Quote"), tra("Post a reply by quoting this message")); |
739 | 739 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | $content = output_transform($post->content, $options); |
756 | 756 | $when = time_diff_str($post->timestamp, time()); |
757 | 757 | $user = BoincUser::lookup_id($post->user); |
758 | - if (!$user){ |
|
758 | + if (!$user) { |
|
759 | 759 | return; |
760 | 760 | } |
761 | 761 | |
@@ -810,9 +810,9 @@ discard block |
||
810 | 810 | |
811 | 811 | function post_rules() { |
812 | 812 | if (function_exists("project_forum_post_rules")) { |
813 | - $project_rules=project_forum_post_rules(); |
|
813 | + $project_rules = project_forum_post_rules(); |
|
814 | 814 | } else { |
815 | - $project_rules=""; |
|
815 | + $project_rules = ""; |
|
816 | 816 | } |
817 | 817 | return sprintf(" |
818 | 818 | <ul> |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | ); |
842 | 842 | } |
843 | 843 | |
844 | -function post_warning($forum=null) { |
|
844 | +function post_warning($forum = null) { |
|
845 | 845 | $x = "<br><br> |
846 | 846 | <table><tr><td align=left> |
847 | 847 | "; |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | $content = substr($content, 0, 64000); |
902 | 902 | $content = BoincDb::escape_string($content); |
903 | 903 | $now = time(); |
904 | - $sig = $signature?1:0; |
|
904 | + $sig = $signature ? 1 : 0; |
|
905 | 905 | $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)"); |
906 | 906 | if (!$id) { |
907 | 907 | $forum_error = "Failed to add post to DB."; |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | // |
922 | 922 | function update_thread_timestamp($thread) { |
923 | 923 | $posts = BoincPost::enum("thread=$thread->id and hidden=0 order by timestamp desc limit 1"); |
924 | - if (count($posts)>0) { |
|
924 | + if (count($posts) > 0) { |
|
925 | 925 | $post = $posts[0]; |
926 | 926 | $thread->update("timestamp=$post->timestamp"); |
927 | 927 | } |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | |
930 | 930 | function update_forum_timestamp($forum) { |
931 | 931 | $threads = BoincThread::enum("forum=$forum->id and hidden=0 order by timestamp desc limit 1"); |
932 | - if (count($threads)>0) { |
|
932 | + if (count($threads) > 0) { |
|
933 | 933 | $thread = $threads[0]; |
934 | 934 | $forum->update("timestamp=$thread->timestamp"); |
935 | 935 | } |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | if (is_news_forum($forum) && !$export) { |
953 | 953 | $status = 1; |
954 | 954 | } |
955 | - $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)"); |
|
955 | + $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)"); |
|
956 | 956 | if (!$id) { |
957 | 957 | $forum_error = "Failed to add thread to DB."; |
958 | 958 | return null; |
@@ -1080,22 +1080,22 @@ discard block |
||
1080 | 1080 | // $sticky - bool (not directly passed to SQL) |
1081 | 1081 | // |
1082 | 1082 | function get_forum_threads( |
1083 | - $forumID, $start=-1, $nRec=-1, $sort_style=MODIFIED_NEW, |
|
1083 | + $forumID, $start = -1, $nRec = -1, $sort_style = MODIFIED_NEW, |
|
1084 | 1084 | $show_hidden = 0, $sticky = 1 |
1085 | 1085 | ) { |
1086 | 1086 | //if (! (is_numeric($forumID) && is_numeric($min) && is_numeric($nRec))) { |
1087 | 1087 | // return NULL; // Something is wrong here. |
1088 | 1088 | //} |
1089 | 1089 | |
1090 | - $sql = 'forum = ' . $forumID ; |
|
1090 | + $sql = 'forum = '.$forumID; |
|
1091 | 1091 | $stickysql = ""; |
1092 | - if ($sticky){ |
|
1092 | + if ($sticky) { |
|
1093 | 1093 | $stickysql = "sticky DESC, "; |
1094 | 1094 | } |
1095 | 1095 | if (!$show_hidden) { |
1096 | 1096 | $sql .= ' AND hidden = 0'; |
1097 | 1097 | } |
1098 | - switch($sort_style) { |
|
1098 | + switch ($sort_style) { |
|
1099 | 1099 | case MODIFIED_NEW: |
1100 | 1100 | $sql .= ' ORDER BY '.$stickysql.'timestamp DESC'; |
1101 | 1101 | break; |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | if (!$show_hidden) { |
1149 | 1149 | $sql .= ' AND hidden = 0'; |
1150 | 1150 | } |
1151 | - switch($sort_style) { |
|
1151 | + switch ($sort_style) { |
|
1152 | 1152 | case CREATE_TIME_NEW: |
1153 | 1153 | $sql .= ' ORDER BY timestamp desc'; |
1154 | 1154 | break; |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | // |
1171 | 1171 | function show_post_moderation_links( |
1172 | 1172 | $config, $logged_in_user, $post, $forum, $tokens |
1173 | -){ |
|
1173 | +) { |
|
1174 | 1174 | $moderators_allowed_to_ban = parse_bool($config, "moderators_allowed_to_ban"); |
1175 | 1175 | $moderators_vote_to_ban = parse_bool($config, "moderators_vote_to_ban"); |
1176 | 1176 | |
@@ -1257,14 +1257,14 @@ discard block |
||
1257 | 1257 | // We do not tell the (ab)user how much this is - |
1258 | 1258 | // no need to make it easy for them to break the system. |
1259 | 1259 | // |
1260 | - if ($user->total_credit<$forum->post_min_total_credit || $user->expavg_credit<$forum->post_min_expavg_credit) { |
|
1260 | + if ($user->total_credit < $forum->post_min_total_credit || $user->expavg_credit < $forum->post_min_expavg_credit) { |
|
1261 | 1261 | 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)); |
1262 | 1262 | } |
1263 | 1263 | |
1264 | 1264 | // If the user is posting faster than forum regulations allow |
1265 | 1265 | // Tell the user to wait a while before creating any more posts |
1266 | 1266 | // |
1267 | - if (time()-$user->prefs->last_post <$forum->post_min_interval) { |
|
1267 | + if (time() - $user->prefs->last_post < $forum->post_min_interval) { |
|
1268 | 1268 | error_page(tra("You cannot create threads right now. Please wait before trying again. This is to protect against abuse of the system.")); |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | |
1293 | 1293 | function is_moderator($user, $forum) { |
1294 | 1294 | if (!$user) return false; |
1295 | - $type = $forum?$forum->parent_type:0; |
|
1295 | + $type = $forum ? $forum->parent_type : 0; |
|
1296 | 1296 | switch ($type) { |
1297 | 1297 | case 0: |
1298 | 1298 | if ($user->prefs->privilege(S_MODERATOR)) return true; |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | $owner = BoincUser::lookup_id($thread->owner); |
1331 | 1331 | if (!$owner) return; |
1332 | 1332 | echo "<tr><td>\n"; |
1333 | - switch($thread_forum->parent_type) { |
|
1333 | + switch ($thread_forum->parent_type) { |
|
1334 | 1334 | case 0: |
1335 | 1335 | $category = BoincCategory::lookup_id($thread_forum->category); |
1336 | 1336 | show_forum_title($category, $thread_forum, $thread, true); |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | break; |
1341 | 1341 | } |
1342 | 1342 | echo ' |
1343 | - </td><td class="numbers">'.($thread->replies+1).'</td> |
|
1343 | + </td><td class="numbers">'.($thread->replies + 1).'</td> |
|
1344 | 1344 | <td>'.user_links($owner).'</td> |
1345 | 1345 | <td class="numbers">'.$thread->views.'</td> |
1346 | 1346 | <td class="lastpost">'.time_diff_str($thread->timestamp, time()).'</td> |
@@ -1374,13 +1374,13 @@ discard block |
||
1374 | 1374 | |
1375 | 1375 | function subscribed_post_web_line($notify) { |
1376 | 1376 | $thread = BoincThread::lookup_id($notify->opaque); |
1377 | - return tra("New posts in the thread %1","<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1377 | + return tra("New posts in the thread %1", "<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1378 | 1378 | } |
1379 | 1379 | |
1380 | 1380 | function subscribe_rss($notify, &$title, &$msg, &$url) { |
1381 | 1381 | $thread = BoincThread::lookup_id($notify->opaque); |
1382 | 1382 | $title = tra("New posts in subscribed thread"); |
1383 | - $msg = tra("There are new posts in the thread '%1'",$thread->title); |
|
1383 | + $msg = tra("There are new posts in the thread '%1'", $thread->title); |
|
1384 | 1384 | $url = secure_url_base()."forum_thread.php?id=$thread->id"; |
1385 | 1385 | } |
1386 | 1386 |
@@ -238,7 +238,7 @@ discard block |
||
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; |
@@ -251,7 +251,7 @@ discard block |
||
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 | 256 | $url, $curpage-1, $items_per_page, |
257 | 257 | tra("Previous")." · " |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | } |
269 | 269 | // Display a list of pages surrounding this one |
270 | 270 | // |
271 | - for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++){ |
|
271 | + for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++) { |
|
272 | 272 | $page_str = (string)($i+1); |
273 | 273 | if ($i < 0) continue; |
274 | 274 | if ($i >= $npages) break; |
@@ -289,7 +289,7 @@ discard block |
||
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 | 294 | $url, $curpage+1, $items_per_page, |
295 | 295 | " · ".tra("Next") |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | // If the user no longer exists, skip the post |
520 | 520 | // |
521 | - if (!$user){ |
|
521 | + if (!$user) { |
|
522 | 522 | return; |
523 | 523 | } |
524 | 524 | |
@@ -539,9 +539,9 @@ discard block |
||
539 | 539 | // check whether the poster is on the list of people to ignore |
540 | 540 | // |
541 | 541 | $ignore_poster = false; |
542 | - if ($logged_in_user){ |
|
542 | + if ($logged_in_user) { |
|
543 | 543 | $tokens = url_tokens($logged_in_user->authenticator); |
544 | - if (is_ignoring($logged_in_user, $user)){ |
|
544 | + if (is_ignoring($logged_in_user, $user)) { |
|
545 | 545 | $ignore_poster = true; |
546 | 546 | } |
547 | 547 | } |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | |
579 | 579 | // Highlight special users if set in prefs; |
580 | 580 | // |
581 | - if ($logged_in_user && $logged_in_user->prefs){ |
|
581 | + if ($logged_in_user && $logged_in_user->prefs) { |
|
582 | 582 | $highlight = $logged_in_user->prefs->highlight_special && $is_posted_by_special; |
583 | 583 | } else { |
584 | 584 | $highlight = $is_posted_by_special; |
@@ -599,7 +599,7 @@ discard block |
||
599 | 599 | echo "<span class=\"small\">"; |
600 | 600 | if ($fstatus) echo "$fstatus"; |
601 | 601 | |
602 | - if (!$filter || !$ignore_poster){ |
|
602 | + if (!$filter || !$ignore_poster) { |
|
603 | 603 | if ($user->prefs && $user->prefs->avatar!="" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars==false))) { |
604 | 604 | echo "<img width=\"".AVATAR_WIDTH."\" height=\"".AVATAR_HEIGHT."\" src=\"".avatar_url($user->prefs->avatar)."\" alt=\"Avatar\"><br>"; |
605 | 605 | } |
@@ -615,7 +615,7 @@ discard block |
||
615 | 615 | $user->nposts = BoincPost::count("user=$user->id"); |
616 | 616 | } |
617 | 617 | |
618 | - if (function_exists('project_forum_user_info')){ |
|
618 | + if (function_exists('project_forum_user_info')) { |
|
619 | 619 | project_forum_user_info($user); |
620 | 620 | } else { |
621 | 621 | echo tra("Posts: %1", $user->nposts)."<br>"; |
@@ -654,7 +654,7 @@ discard block |
||
654 | 654 | echo "<form action=\"forum_rate.php?post=", $post->id, "\" method=\"post\">"; |
655 | 655 | } |
656 | 656 | |
657 | - if ($logged_in_user && $post->timestamp > $latest_viewed){ |
|
657 | + if ($logged_in_user && $post->timestamp > $latest_viewed) { |
|
658 | 658 | show_image(NEW_IMAGE, tra("You haven't read this message yet"), tra("Unread"), NEW_IMAGE_HEIGHT); |
659 | 659 | } |
660 | 660 | |
@@ -674,7 +674,7 @@ discard block |
||
674 | 674 | if ($post->modified) { |
675 | 675 | echo "<br>".tra("Last modified: %1", pretty_time_Str($post->modified)); |
676 | 676 | } |
677 | - if ($ignore_poster && $filter){ |
|
677 | + if ($ignore_poster && $filter) { |
|
678 | 678 | echo "<br>" .tra( |
679 | 679 | "This post is hidden because the sender is on your 'ignore' list. Click %1 here %2 to view hidden posts", |
680 | 680 | "<a href=\"?id=".$thread->id."&filter=false&start=$start#".$post->id."\">", |
@@ -688,7 +688,7 @@ discard block |
||
688 | 688 | <p> |
689 | 689 | "; |
690 | 690 | |
691 | - if (!$filter || !$ignore_poster){ |
|
691 | + if (!$filter || !$ignore_poster) { |
|
692 | 692 | $posttext = $post->content; |
693 | 693 | |
694 | 694 | // If the creator of this post has a signature and |
@@ -696,7 +696,7 @@ discard block |
||
696 | 696 | // user has signatures enabled: show it |
697 | 697 | // |
698 | 698 | $posttext = output_transform($posttext, $options); |
699 | - if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)){ |
|
699 | + if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)) { |
|
700 | 700 | $sig = output_transform($user->prefs->signature, $options); |
701 | 701 | $posttext .= "<hr>$sig\n"; |
702 | 702 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | $content = output_transform($post->content, $options); |
756 | 756 | $when = time_diff_str($post->timestamp, time()); |
757 | 757 | $user = BoincUser::lookup_id($post->user); |
758 | - if (!$user){ |
|
758 | + if (!$user) { |
|
759 | 759 | return; |
760 | 760 | } |
761 | 761 | |
@@ -1089,7 +1089,7 @@ discard block |
||
1089 | 1089 | |
1090 | 1090 | $sql = 'forum = ' . $forumID ; |
1091 | 1091 | $stickysql = ""; |
1092 | - if ($sticky){ |
|
1092 | + if ($sticky) { |
|
1093 | 1093 | $stickysql = "sticky DESC, "; |
1094 | 1094 | } |
1095 | 1095 | if (!$show_hidden) { |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | // |
1171 | 1171 | function show_post_moderation_links( |
1172 | 1172 | $config, $logged_in_user, $post, $forum, $tokens |
1173 | -){ |
|
1173 | +) { |
|
1174 | 1174 | $moderators_allowed_to_ban = parse_bool($config, "moderators_allowed_to_ban"); |
1175 | 1175 | $moderators_vote_to_ban = parse_bool($config, "moderators_vote_to_ban"); |
1176 | 1176 |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | // @return String A human readable error message |
501 | 501 | // @param Integer $x An error number |
502 | 502 | // |
503 | -function windows_error_code_str($x){ |
|
503 | +function windows_error_code_str($x) { |
|
504 | 504 | $h=int2hex($x); |
505 | - switch($h){ |
|
505 | + switch($h) { |
|
506 | 506 | case "0xC0000005": return "STATUS_ACCESS_VIOLATION"; |
507 | 507 | case "0xC000001D": return "STATUS_ILLEGAL_INSTRUCTION"; |
508 | 508 | case "0xC0000094": return "STATUS_INTEGER_DIVIDE_BY_ZERO"; |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | // @return String A human readable error message |
524 | 524 | // @param Integer $x An error number |
525 | 525 | // |
526 | -function error_code_str($x){ |
|
526 | +function error_code_str($x) { |
|
527 | 527 | // severe Windows error numbers are always large negative integers |
528 | 528 | if ($x<-400) return windows_error_code_str($x); |
529 | - switch($x){ |
|
529 | + switch($x) { |
|
530 | 530 | case 0: return ""; |
531 | 531 | case 192: return "EXIT_STATEFILE_WRITE"; |
532 | 532 | case 193: return "EXIT_SIGNAL"; |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | return $platforms[$id]; |
54 | 54 | } |
55 | 55 | |
56 | -function anon_platform_string($result, $rsc_name=null) { |
|
56 | +function anon_platform_string($result, $rsc_name = null) { |
|
57 | 57 | $app = get_app($result->appid); |
58 | - $n = $app->user_friendly_name."<br>". tra("Anonymous platform"); |
|
58 | + $n = $app->user_friendly_name."<br>".tra("Anonymous platform"); |
|
59 | 59 | if ($rsc_name) { |
60 | 60 | $n .= " ($rsc_name)"; |
61 | 61 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | return $string_to_show; |
98 | 98 | } |
99 | 99 | if ($result->server_state <> RESULT_SERVER_STATE_OVER) return "---"; |
100 | - switch($result->outcome) { |
|
100 | + switch ($result->outcome) { |
|
101 | 101 | case RESULT_OUTCOME_SUCCESS: |
102 | 102 | switch ($result->validate_state) { |
103 | 103 | case VALIDATE_STATE_INIT: |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | ) { |
213 | 213 | return tra("Not started by deadline - canceled"); |
214 | 214 | } |
215 | - switch($result->client_state) { |
|
215 | + switch ($result->client_state) { |
|
216 | 216 | case RESULT_FILES_DOWNLOADING: return tra("Error while downloading"); |
217 | 217 | case RESULT_FILES_DOWNLOADED: |
218 | 218 | case RESULT_COMPUTE_ERROR: return tra("Error while computing"); |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | } |
232 | 232 | |
233 | 233 | function result_server_state_string($result) { |
234 | - switch($result->server_state) { |
|
234 | + switch ($result->server_state) { |
|
235 | 235 | case RESULT_SERVER_STATE_INACTIVE: return tra("Inactive"); |
236 | 236 | case RESULT_SERVER_STATE_UNSENT: return tra("Unsent"); |
237 | 237 | case RESULT_SERVER_STATE_IN_PROGRESS: return tra("In progress"); |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | } |
242 | 242 | |
243 | 243 | function result_outcome_string($result) { |
244 | - switch($result->outcome) { |
|
244 | + switch ($result->outcome) { |
|
245 | 245 | case RESULT_OUTCOME_INIT: return "---"; |
246 | 246 | case RESULT_OUTCOME_SUCCESS: return tra("Success"); |
247 | 247 | case RESULT_OUTCOME_COULDNT_SEND: return tra("Couldn't send"); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | } |
260 | 260 | |
261 | 261 | function result_client_state_string($result) { |
262 | - switch($result->client_state) { |
|
262 | + switch ($result->client_state) { |
|
263 | 263 | case RESULT_NEW: return tra("New"); |
264 | 264 | case RESULT_FILES_DOWNLOADING: return tra("Downloading"); |
265 | 265 | case RESULT_FILES_DOWNLOADED: return tra("Processing"); |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | } |
278 | 278 | |
279 | 279 | function validate_state_str($result) { |
280 | - switch($result->validate_state) { |
|
280 | + switch ($result->validate_state) { |
|
281 | 281 | case VALIDATE_STATE_INIT: return tra("Initial"); |
282 | 282 | case VALIDATE_STATE_VALID: return tra("Valid"); |
283 | 283 | case VALIDATE_STATE_INVALID: |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | } |
294 | 294 | |
295 | 295 | function assimilate_state_str($s) { |
296 | - switch($s) { |
|
296 | + switch ($s) { |
|
297 | 297 | case ASSIMILATE_INIT: return "Initial"; |
298 | 298 | case ASSIMILATE_READY: return "Ready to assimilate"; |
299 | 299 | case ASSIMILATE_DONE: return "Assimilated"; |
@@ -302,7 +302,7 @@ discard block |
||
302 | 302 | } |
303 | 303 | |
304 | 304 | function file_delete_state_str($s) { |
305 | - switch($s) { |
|
305 | + switch ($s) { |
|
306 | 306 | case FILE_DELETE_INIT: return "Initial"; |
307 | 307 | case FILE_DELETE_READY: return "Ready to delete"; |
308 | 308 | case FILE_DELETE_DONE: return "Deleted"; |
@@ -312,27 +312,27 @@ discard block |
||
312 | 312 | } |
313 | 313 | function wu_error_mask_str($s) { |
314 | 314 | $x = ""; |
315 | - if ($s & WU_ERROR_COULDNT_SEND_RESULT) { |
|
315 | + if ($s&WU_ERROR_COULDNT_SEND_RESULT) { |
|
316 | 316 | $x = $x." ".tra("Couldn't send result"); |
317 | 317 | $s -= WU_ERROR_COULDNT_SEND_RESULT; |
318 | 318 | } |
319 | - if ($s & WU_ERROR_TOO_MANY_ERROR_RESULTS) { |
|
319 | + if ($s&WU_ERROR_TOO_MANY_ERROR_RESULTS) { |
|
320 | 320 | $x = $x." ".tra("Too many errors (may have bug)"); |
321 | 321 | $s -= WU_ERROR_TOO_MANY_ERROR_RESULTS; |
322 | 322 | } |
323 | - if ($s & WU_ERROR_TOO_MANY_SUCCESS_RESULTS) { |
|
323 | + if ($s&WU_ERROR_TOO_MANY_SUCCESS_RESULTS) { |
|
324 | 324 | $x = $x." ".tra("Too many results (may be nondeterministic)"); |
325 | 325 | $s -= WU_ERROR_TOO_MANY_SUCCESS_RESULTS; |
326 | 326 | } |
327 | - if ($s & WU_ERROR_TOO_MANY_TOTAL_RESULTS) { |
|
327 | + if ($s&WU_ERROR_TOO_MANY_TOTAL_RESULTS) { |
|
328 | 328 | $x = $x." ".tra("Too many total results"); |
329 | 329 | $s -= WU_ERROR_TOO_MANY_TOTAL_RESULTS; |
330 | 330 | } |
331 | - if ($s & WU_ERROR_CANCELLED) { |
|
331 | + if ($s&WU_ERROR_CANCELLED) { |
|
332 | 332 | $x = $x." ".tra("WU cancelled"); |
333 | 333 | $s -= WU_ERROR_CANCELLED; |
334 | 334 | } |
335 | - if ($s & WU_ERROR_NO_CANONICAL_RESULT) { |
|
335 | + if ($s&WU_ERROR_NO_CANONICAL_RESULT) { |
|
336 | 336 | $x = $x." ".tra("Canonical result is missing"); |
337 | 337 | $s -= WU_ERROR_NO_CANONICAL_RESULT; |
338 | 338 | } |
@@ -340,9 +340,9 @@ discard block |
||
340 | 340 | $x = $x." ".tra("Unrecognized Error: %1", $s); |
341 | 341 | } |
342 | 342 | if (strlen($x)) { |
343 | - $x="<font color=\"#ff3333\">".$x."</font>"; |
|
343 | + $x = "<font color=\"#ff3333\">".$x."</font>"; |
|
344 | 344 | } else { |
345 | - $x=""; |
|
345 | + $x = ""; |
|
346 | 346 | } |
347 | 347 | return $x; |
348 | 348 | } |
@@ -426,10 +426,10 @@ discard block |
||
426 | 426 | if ($result->received_time) { |
427 | 427 | $r = time_str($result->received_time); |
428 | 428 | } else if ($result->report_deadline) { |
429 | - if ($result->report_deadline>time()) { |
|
430 | - $r = "<font color='#33cc33'>" . time_str($result->report_deadline) . "</font>"; |
|
429 | + if ($result->report_deadline > time()) { |
|
430 | + $r = "<font color='#33cc33'>".time_str($result->report_deadline)."</font>"; |
|
431 | 431 | } else { |
432 | - $r = "<font color='#ff3333'>" . time_str($result->report_deadline) . "</font>"; |
|
432 | + $r = "<font color='#ff3333'>".time_str($result->report_deadline)."</font>"; |
|
433 | 433 | } |
434 | 434 | } else { |
435 | 435 | $r = "---"; |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | // @param Integer $dec A signed integer |
491 | 491 | // |
492 | 492 | function int2hex($dec) { |
493 | - return "0x".strtoupper(substr(sprintf("%08x",$dec), -8)); |
|
493 | + return "0x".strtoupper(substr(sprintf("%08x", $dec), -8)); |
|
494 | 494 | } |
495 | 495 | |
496 | 496 | // Decode a windows error number into semi-human-readable, |
@@ -500,9 +500,9 @@ discard block |
||
500 | 500 | // @return String A human readable error message |
501 | 501 | // @param Integer $x An error number |
502 | 502 | // |
503 | -function windows_error_code_str($x){ |
|
504 | - $h=int2hex($x); |
|
505 | - switch($h){ |
|
503 | +function windows_error_code_str($x) { |
|
504 | + $h = int2hex($x); |
|
505 | + switch ($h) { |
|
506 | 506 | case "0xC0000005": return "STATUS_ACCESS_VIOLATION"; |
507 | 507 | case "0xC000001D": return "STATUS_ILLEGAL_INSTRUCTION"; |
508 | 508 | case "0xC0000094": return "STATUS_INTEGER_DIVIDE_BY_ZERO"; |
@@ -523,10 +523,10 @@ discard block |
||
523 | 523 | // @return String A human readable error message |
524 | 524 | // @param Integer $x An error number |
525 | 525 | // |
526 | -function error_code_str($x){ |
|
526 | +function error_code_str($x) { |
|
527 | 527 | // severe Windows error numbers are always large negative integers |
528 | - if ($x<-400) return windows_error_code_str($x); |
|
529 | - switch($x){ |
|
528 | + if ($x < -400) return windows_error_code_str($x); |
|
529 | + switch ($x) { |
|
530 | 530 | case 0: return ""; |
531 | 531 | case 192: return "EXIT_STATEFILE_WRITE"; |
532 | 532 | case 193: return "EXIT_SIGNAL"; |
@@ -687,7 +687,7 @@ discard block |
||
687 | 687 | return $x." (".int2hex($x).") ".error_code_str($x); |
688 | 688 | } |
689 | 689 | |
690 | -function show_result($result, $show_outfile_links=false) { |
|
690 | +function show_result($result, $show_outfile_links = false) { |
|
691 | 691 | start_table(); |
692 | 692 | row2(tra("Name"), $result->name); |
693 | 693 | row2(tra("Workunit"), "<a href=\"workunit.php?wuid=$result->workunitid\">$result->workunitid</a>"); |
@@ -736,7 +736,7 @@ discard block |
||
736 | 736 | echo "<h3>".tra("Stderr output")."</h3> <pre>" |
737 | 737 | .htmlspecialchars( |
738 | 738 | $result->stderr_out, |
739 | - ENT_QUOTES | (defined('ENT_SUBSTITUTE')?ENT_SUBSTITUTE:0), |
|
739 | + ENT_QUOTES|(defined('ENT_SUBSTITUTE') ?ENT_SUBSTITUTE:0), |
|
740 | 740 | 'utf-8' |
741 | 741 | ) |
742 | 742 | ."</pre>" |
@@ -751,7 +751,7 @@ discard block |
||
751 | 751 | |
752 | 752 | $apps = BoincApp::enum('deprecated=0 ORDER BY user_friendly_name'); |
753 | 753 | |
754 | - for ($i=0; $i<NSTATES; $i++) { |
|
754 | + for ($i = 0; $i < NSTATES; $i++) { |
|
755 | 755 | $state_count[$i] = 0; |
756 | 756 | } |
757 | 757 | foreach ($apps as $app) { |
@@ -793,7 +793,7 @@ discard block |
||
793 | 793 | $x .= "<a href=$url>".tra("Next")." ".$info->results_per_page."</a>"; |
794 | 794 | } |
795 | 795 | $x .= "<br>".tra("State").": "; |
796 | - for ($i=0; $i<NSTATES; $i++) { |
|
796 | + for ($i = 0; $i < NSTATES; $i++) { |
|
797 | 797 | if ($i) $x .= " · "; |
798 | 798 | if ($info->state == $i) { |
799 | 799 | $x .= $state_name[$i]; |
@@ -838,6 +838,6 @@ discard block |
||
838 | 838 | return $x; |
839 | 839 | } |
840 | 840 | |
841 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
841 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
842 | 842 | |
843 | 843 | ?> |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | </ol>", PROJECT); |
184 | 184 | } |
185 | 185 | |
186 | -function project_workunit($wu){ |
|
186 | +function project_workunit($wu) { |
|
187 | 187 | // shown in the workunit page |
188 | 188 | } |
189 | 189 | |
190 | -function project_user_summary($user){ |
|
190 | +function project_user_summary($user) { |
|
191 | 191 | // shown in the user summary page |
192 | 192 | } |
193 | 193 | |
194 | -function project_user_page_private($user){ |
|
194 | +function project_user_page_private($user) { |
|
195 | 195 | // shown in the private account page |
196 | 196 | } |
197 | 197 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)), |
259 | 259 | ); |
260 | 260 | |
261 | -function project_user_credit($user){ |
|
261 | +function project_user_credit($user) { |
|
262 | 262 | global $sub_projects; |
263 | 263 | foreach ($sub_projects as $sp) { |
264 | 264 | show_app_credit_user($user, $sp["name"], $sp["appids"]); |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | define("FORUM_QA_MERGED_MODE", true); |
50 | 50 | // Set to true to merge Message boards and Q&A section |
51 | -define ("DISABLE_PROFILES", true); |
|
51 | +define("DISABLE_PROFILES", true); |
|
52 | 52 | // enable profiles only after enabling reCAPTCHA |
53 | 53 | // https://boinc.berkeley.edu/trac/wiki/ProtectionFromSpam |
54 | 54 | define("USE_STOPFORUMSPAM", true); |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | </ol>", PROJECT); |
184 | 184 | } |
185 | 185 | |
186 | -function project_workunit($wu){ |
|
186 | +function project_workunit($wu) { |
|
187 | 187 | // shown in the workunit page |
188 | 188 | } |
189 | 189 | |
190 | -function project_user_summary($user){ |
|
190 | +function project_user_summary($user) { |
|
191 | 191 | // shown in the user summary page |
192 | 192 | } |
193 | 193 | |
194 | -function project_user_page_private($user){ |
|
194 | +function project_user_page_private($user) { |
|
195 | 195 | // shown in the private account page |
196 | 196 | } |
197 | 197 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)), |
259 | 259 | ); |
260 | 260 | |
261 | -function project_user_credit($user){ |
|
261 | +function project_user_credit($user) { |
|
262 | 262 | global $sub_projects; |
263 | 263 | foreach ($sub_projects as $sp) { |
264 | 264 | show_app_credit_user($user, $sp["name"], $sp["appids"]); |