@@ -224,6 +224,9 @@ discard block |
||
224 | 224 | // (to accommodate long [pre] lines) |
225 | 225 | // and the left column (author info) has fixed size |
226 | 226 | // |
227 | +/** |
|
228 | + * @param string[] $headings |
|
229 | + */ |
|
227 | 230 | function start_forum_table($headings) { |
228 | 231 | $a = array(); |
229 | 232 | foreach ($headings as $h) { |
@@ -504,6 +507,9 @@ discard block |
||
504 | 507 | // Display an individual post. |
505 | 508 | // Generates a table row with two cells: author and message |
506 | 509 | // |
510 | +/** |
|
511 | + * @param integer $controls |
|
512 | + */ |
|
507 | 513 | function show_post( |
508 | 514 | $post, $thread, $forum, $logged_in_user, $start=0, |
509 | 515 | $latest_viewed=0, $controls=FORUM_CONTROLS, $filter=true |
@@ -879,6 +885,9 @@ discard block |
||
879 | 885 | // These take care of counts and timestamps. |
880 | 886 | // Don't do these things directly - use these functions |
881 | 887 | // |
888 | +/** |
|
889 | + * @param integer $parent_id |
|
890 | + */ |
|
882 | 891 | function create_post($content, $parent_id, $user, $forum, $thread, $signature) { |
883 | 892 | global $forum_error; |
884 | 893 | if (POST_MAX_LINKS |
@@ -1133,6 +1142,9 @@ discard block |
||
1133 | 1142 | // $sort_style - string (checked by switch statement) |
1134 | 1143 | // $show_hidden - bool (not directly passed to SQL) |
1135 | 1144 | // |
1145 | +/** |
|
1146 | + * @param boolean $show_hidden |
|
1147 | + */ |
|
1136 | 1148 | function get_thread_posts($threadid, $sort_style, $show_hidden) { |
1137 | 1149 | $sql = "thread=$threadid"; |
1138 | 1150 | if (!$show_hidden) { |
@@ -1158,6 +1170,9 @@ discard block |
||
1158 | 1170 | // Show links for post moderation actions; |
1159 | 1171 | // logged in user has moderation rights. |
1160 | 1172 | // |
1173 | +/** |
|
1174 | + * @param string $config |
|
1175 | + */ |
|
1161 | 1176 | function show_post_moderation_links( |
1162 | 1177 | $config, $logged_in_user, $post, $forum, $tokens |
1163 | 1178 | ){ |
@@ -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> : |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | } |
236 | 236 | |
237 | 237 | function page_link($url, $page_num, $items_per_page, $text) { |
238 | - return " <a href=\"$url&start=" . $page_num*$items_per_page . "\">$text</a> "; |
|
238 | + return " <a href=\"$url&start=".$page_num*$items_per_page."\">$text</a> "; |
|
239 | 239 | } |
240 | 240 | |
241 | 241 | // return a string for navigating pages |
242 | 242 | // |
243 | -function page_links($url, $nitems, $items_per_page, $start){ |
|
243 | +function page_links($url, $nitems, $items_per_page, $start) { |
|
244 | 244 | // How many pages to potentially show before and after this one: |
245 | 245 | $preshow = 3; |
246 | 246 | $postshow = 3; |
@@ -248,14 +248,14 @@ discard block |
||
248 | 248 | $x = ""; |
249 | 249 | |
250 | 250 | if ($nitems <= $items_per_page) return ""; |
251 | - $npages = ceil($nitems / $items_per_page); |
|
252 | - $curpage = ceil($start / $items_per_page); |
|
251 | + $npages = ceil($nitems/$items_per_page); |
|
252 | + $curpage = ceil($start/$items_per_page); |
|
253 | 253 | |
254 | 254 | // If this is not the first page, display "previous" |
255 | 255 | // |
256 | - if ($curpage > 0){ |
|
256 | + if ($curpage > 0) { |
|
257 | 257 | $x .= page_link( |
258 | - $url, $curpage-1, $items_per_page, |
|
258 | + $url, $curpage - 1, $items_per_page, |
|
259 | 259 | tra("Previous")." · " |
260 | 260 | ); |
261 | 261 | } |
@@ -270,8 +270,8 @@ discard block |
||
270 | 270 | } |
271 | 271 | // Display a list of pages surrounding this one |
272 | 272 | // |
273 | - for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++){ |
|
274 | - $page_str = (string)($i+1); |
|
273 | + for ($i = $curpage - $preshow; $i <= $curpage + $postshow; $i++) { |
|
274 | + $page_str = (string)($i + 1); |
|
275 | 275 | if ($i < 0) continue; |
276 | 276 | if ($i >= $npages) break; |
277 | 277 | |
@@ -280,20 +280,20 @@ discard block |
||
280 | 280 | } else { |
281 | 281 | $x .= page_link($url, $i, $items_per_page, $page_str); |
282 | 282 | } |
283 | - if ($i == $npages-1) break; |
|
284 | - if ($i == $curpage+$postshow) break; |
|
283 | + if ($i == $npages - 1) break; |
|
284 | + if ($i == $curpage + $postshow) break; |
|
285 | 285 | $x .= " · "; |
286 | 286 | } |
287 | 287 | |
288 | - if ($curpage + $postshow < $npages-1) { |
|
288 | + if ($curpage + $postshow < $npages - 1) { |
|
289 | 289 | $x .= " . . . "; |
290 | - $x .= page_link($url, $npages-1, $items_per_page, $npages); |
|
290 | + $x .= page_link($url, $npages - 1, $items_per_page, $npages); |
|
291 | 291 | } |
292 | 292 | // If there is a next page |
293 | 293 | // |
294 | - if ($curpage < $npages-1){ |
|
294 | + if ($curpage < $npages - 1) { |
|
295 | 295 | $x .= page_link( |
296 | - $url, $curpage+1, $items_per_page, |
|
296 | + $url, $curpage + 1, $items_per_page, |
|
297 | 297 | " · ".tra("Next") |
298 | 298 | ); |
299 | 299 | } |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | function cleanup_title($title) { |
315 | 315 | $x = sanitize_tags(bb2html($title)); |
316 | 316 | $x = trim($x); |
317 | - if (strlen($x)==0) return "(no title)"; |
|
317 | + if (strlen($x) == 0) return "(no title)"; |
|
318 | 318 | else return $x; |
319 | 319 | } |
320 | 320 | |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $i = 0; |
377 | 377 | foreach ($posts as $post) { |
378 | 378 | if ($post->id == $postid) { |
379 | - $start = $i - ($i % $num_to_show); |
|
379 | + $start = $i - ($i%$num_to_show); |
|
380 | 380 | $jump_to_post = $post; |
381 | 381 | break; |
382 | 382 | } |
@@ -403,7 +403,7 @@ discard block |
||
403 | 403 | // if jump to post, figure out what page to show |
404 | 404 | // |
405 | 405 | if ($jump_to_post) { |
406 | - $start = $ibest - ($ibest % $num_to_show); |
|
406 | + $start = $ibest - ($ibest%$num_to_show); |
|
407 | 407 | } else { |
408 | 408 | $start = $default_start; |
409 | 409 | } |
@@ -505,8 +505,8 @@ discard block |
||
505 | 505 | // Generates a table row with two cells: author and message |
506 | 506 | // |
507 | 507 | function show_post( |
508 | - $post, $thread, $forum, $logged_in_user, $start=0, |
|
509 | - $latest_viewed=0, $controls=FORUM_CONTROLS, $filter=true |
|
508 | + $post, $thread, $forum, $logged_in_user, $start = 0, |
|
509 | + $latest_viewed = 0, $controls = FORUM_CONTROLS, $filter = true |
|
510 | 510 | ) { |
511 | 511 | global $country_to_iso3166_2; |
512 | 512 | |
@@ -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 | |
@@ -534,9 +534,9 @@ discard block |
||
534 | 534 | // check whether the poster is on the list of people to ignore |
535 | 535 | // |
536 | 536 | $ignore_poster = false; |
537 | - if ($logged_in_user){ |
|
537 | + if ($logged_in_user) { |
|
538 | 538 | $tokens = url_tokens($logged_in_user->authenticator); |
539 | - if (is_ignoring($logged_in_user, $user)){ |
|
539 | + if (is_ignoring($logged_in_user, $user)) { |
|
540 | 540 | $ignore_poster = true; |
541 | 541 | } |
542 | 542 | } |
@@ -550,8 +550,8 @@ discard block |
||
550 | 550 | if (is_moderator($logged_in_user, $forum)) { |
551 | 551 | $can_edit = true; |
552 | 552 | } else if (can_reply($thread, $forum, $logged_in_user)) { |
553 | - $time_limit = $post->timestamp+MAXIMUM_EDIT_TIME; |
|
554 | - $can_edit = time()<$time_limit; |
|
553 | + $time_limit = $post->timestamp + MAXIMUM_EDIT_TIME; |
|
554 | + $can_edit = time() < $time_limit; |
|
555 | 555 | } else { |
556 | 556 | $can_edit = false; |
557 | 557 | } |
@@ -561,24 +561,24 @@ discard block |
||
561 | 561 | // Print the special user lines, if any |
562 | 562 | // |
563 | 563 | global $special_user_bitfield; |
564 | - $fstatus=""; |
|
564 | + $fstatus = ""; |
|
565 | 565 | $keys = array_keys($special_user_bitfield); |
566 | 566 | $is_posted_by_special = false; |
567 | - for ($i=0; $i<sizeof($special_user_bitfield);$i++) { |
|
567 | + for ($i = 0; $i < sizeof($special_user_bitfield); $i++) { |
|
568 | 568 | if ($user->prefs && $user->prefs->privilege($keys[$i])) { |
569 | - $fstatus.=$special_user_bitfield[$keys[$i]]."<br>"; |
|
569 | + $fstatus .= $special_user_bitfield[$keys[$i]]."<br>"; |
|
570 | 570 | $is_posted_by_special = true; |
571 | 571 | } |
572 | 572 | } |
573 | 573 | |
574 | 574 | // Highlight special users if set in prefs; |
575 | 575 | // |
576 | - if ($logged_in_user && $logged_in_user->prefs){ |
|
576 | + if ($logged_in_user && $logged_in_user->prefs) { |
|
577 | 577 | $highlight = $logged_in_user->prefs->highlight_special && $is_posted_by_special; |
578 | 578 | } else { |
579 | 579 | $highlight = $is_posted_by_special; |
580 | 580 | } |
581 | - $class = $highlight?' style="border-left: 5px solid LightGreen" ':''; |
|
581 | + $class = $highlight ? ' style="border-left: 5px solid LightGreen" ' : ''; |
|
582 | 582 | |
583 | 583 | // row and start of author col |
584 | 584 | // |
@@ -590,12 +590,12 @@ discard block |
||
590 | 590 | |
591 | 591 | echo user_links($user, 0); |
592 | 592 | echo "<br>"; |
593 | - if ($user->create_time > time()-ST_NEW_TIME) $fstatus.=ST_NEW."<br>"; |
|
593 | + if ($user->create_time > time() - ST_NEW_TIME) $fstatus .= ST_NEW."<br>"; |
|
594 | 594 | echo "<span class=\"small\">"; |
595 | 595 | if ($fstatus) echo "$fstatus"; |
596 | 596 | |
597 | - if (!$filter || !$ignore_poster){ |
|
598 | - if ($user->prefs && $user->prefs->avatar!="" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars==false))) { |
|
597 | + if (!$filter || !$ignore_poster) { |
|
598 | + if ($user->prefs && $user->prefs->avatar != "" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars == false))) { |
|
599 | 599 | echo "<img width=\"".AVATAR_WIDTH."\" height=\"".AVATAR_HEIGHT."\" src=\"".avatar_url($user->prefs->avatar)."\" alt=\"Avatar\"><br>"; |
600 | 600 | } |
601 | 601 | } |
@@ -603,14 +603,14 @@ discard block |
||
603 | 603 | |
604 | 604 | $url = "pm.php?action=new&userid=".$user->id; |
605 | 605 | $name = $user->name; |
606 | - show_button_small($url, tra("Send message"), tra("Send %1 a private message",$name)); |
|
606 | + show_button_small($url, tra("Send message"), tra("Send %1 a private message", $name)); |
|
607 | 607 | echo '<br>'.tra("Joined: %1", gmdate('j M y', $user->create_time)), "<br>"; |
608 | 608 | |
609 | 609 | if (!isset($user->nposts)) { |
610 | 610 | $user->nposts = BoincPost::count("user=$user->id"); |
611 | 611 | } |
612 | 612 | |
613 | - if (function_exists('project_forum_user_info')){ |
|
613 | + if (function_exists('project_forum_user_info')) { |
|
614 | 614 | project_forum_user_info($user); |
615 | 615 | } else { |
616 | 616 | echo tra("Posts: %1", $user->nposts)."<br>"; |
@@ -619,8 +619,8 @@ discard block |
||
619 | 619 | // |
620 | 620 | //echo "ID: ".$user->id."<br>"; |
621 | 621 | if (!NO_COMPUTING) { |
622 | - echo tra("Credit: %1", number_format($user->total_credit)) ."<br>"; |
|
623 | - echo tra("RAC: %1", number_format($user->expavg_credit))."<br>"; |
|
622 | + echo tra("Credit: %1", number_format($user->total_credit))."<br>"; |
|
623 | + echo tra("RAC: %1", number_format($user->expavg_credit))."<br>"; |
|
624 | 624 | } |
625 | 625 | |
626 | 626 | // to use this feature: |
@@ -649,7 +649,7 @@ discard block |
||
649 | 649 | echo "<form action=\"forum_rate.php?post=", $post->id, "\" method=\"post\">"; |
650 | 650 | } |
651 | 651 | |
652 | - if ($logged_in_user && $post->timestamp > $latest_viewed){ |
|
652 | + if ($logged_in_user && $post->timestamp > $latest_viewed) { |
|
653 | 653 | show_image(NEW_IMAGE, tra("You haven't read this message yet"), tra("Unread"), NEW_IMAGE_HEIGHT); |
654 | 654 | } |
655 | 655 | |
@@ -669,8 +669,8 @@ discard block |
||
669 | 669 | if ($post->modified) { |
670 | 670 | echo "<br>".tra("Last modified: %1", pretty_time_Str($post->modified)); |
671 | 671 | } |
672 | - if ($ignore_poster && $filter){ |
|
673 | - echo "<br>" .tra( |
|
672 | + if ($ignore_poster && $filter) { |
|
673 | + echo "<br>".tra( |
|
674 | 674 | "This post is hidden because the sender is on your 'ignore' list. Click %1 here %2 to view hidden posts", |
675 | 675 | "<a href=\"?id=".$thread->id."&filter=false&start=$start#".$post->id."\">", |
676 | 676 | "</a>" |
@@ -683,7 +683,7 @@ discard block |
||
683 | 683 | <p> |
684 | 684 | "; |
685 | 685 | |
686 | - if (!$filter || !$ignore_poster){ |
|
686 | + if (!$filter || !$ignore_poster) { |
|
687 | 687 | $posttext = $post->content; |
688 | 688 | |
689 | 689 | // If the creator of this post has a signature and |
@@ -691,7 +691,7 @@ discard block |
||
691 | 691 | // user has signatures enabled: show it |
692 | 692 | // |
693 | 693 | $posttext = output_transform($posttext, $options); |
694 | - if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)){ |
|
694 | + if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)) { |
|
695 | 695 | $sig = output_transform($user->prefs->signature, $options); |
696 | 696 | $posttext .= "<hr>$sig\n"; |
697 | 697 | } |
@@ -725,10 +725,10 @@ discard block |
||
725 | 725 | } |
726 | 726 | if (($controls == FORUM_CONTROLS) && (can_reply($thread, $forum, $logged_in_user))) { |
727 | 727 | echo " "; |
728 | - $url = "forum_reply.php?thread=" . $thread->id . "&post=" . $post->id . "&no_quote=1#input"; |
|
728 | + $url = "forum_reply.php?thread=".$thread->id."&post=".$post->id."&no_quote=1#input"; |
|
729 | 729 | // "Reply" is used as a verb |
730 | 730 | show_button($url, tra("Reply"), tra("Post a reply to this message")); |
731 | - $url = "forum_reply.php?thread=" . $thread->id . "&post=" . $post->id . "#input"; |
|
731 | + $url = "forum_reply.php?thread=".$thread->id."&post=".$post->id."#input"; |
|
732 | 732 | // "Quote" is used as a verb |
733 | 733 | show_button($url, tra("Quote"), tra("Post a reply by quoting this message")); |
734 | 734 | } |
@@ -800,9 +800,9 @@ discard block |
||
800 | 800 | |
801 | 801 | function post_rules() { |
802 | 802 | if (function_exists("project_forum_post_rules")) { |
803 | - $project_rules=project_forum_post_rules(); |
|
803 | + $project_rules = project_forum_post_rules(); |
|
804 | 804 | } else { |
805 | - $project_rules=""; |
|
805 | + $project_rules = ""; |
|
806 | 806 | } |
807 | 807 | return sprintf(" |
808 | 808 | <ul> |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | ); |
832 | 832 | } |
833 | 833 | |
834 | -function post_warning($forum=null) { |
|
834 | +function post_warning($forum = null) { |
|
835 | 835 | $x = "<br><br> |
836 | 836 | <table><tr><td align=left> |
837 | 837 | "; |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | $content = substr($content, 0, 64000); |
892 | 892 | $content = BoincDb::escape_string($content); |
893 | 893 | $now = time(); |
894 | - $sig = $signature?1:0; |
|
894 | + $sig = $signature ? 1 : 0; |
|
895 | 895 | $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)"); |
896 | 896 | if (!$id) { |
897 | 897 | $forum_error = "Failed to add post to DB."; |
@@ -911,7 +911,7 @@ discard block |
||
911 | 911 | // |
912 | 912 | function update_thread_timestamp($thread) { |
913 | 913 | $posts = BoincPost::enum("thread=$thread->id and hidden=0 order by timestamp desc limit 1"); |
914 | - if (count($posts)>0) { |
|
914 | + if (count($posts) > 0) { |
|
915 | 915 | $post = $posts[0]; |
916 | 916 | $thread->update("timestamp=$post->timestamp"); |
917 | 917 | } |
@@ -919,7 +919,7 @@ discard block |
||
919 | 919 | |
920 | 920 | function update_forum_timestamp($forum) { |
921 | 921 | $threads = BoincThread::enum("forum=$forum->id and hidden=0 order by timestamp desc limit 1"); |
922 | - if (count($threads)>0) { |
|
922 | + if (count($threads) > 0) { |
|
923 | 923 | $thread = $threads[0]; |
924 | 924 | $forum->update("timestamp=$thread->timestamp"); |
925 | 925 | } |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | if (is_news_forum($forum) && !$export) { |
943 | 943 | $status = 1; |
944 | 944 | } |
945 | - $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)"); |
|
945 | + $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)"); |
|
946 | 946 | if (!$id) { |
947 | 947 | $forum_error = "Failed to add thread to DB."; |
948 | 948 | return null; |
@@ -1070,22 +1070,22 @@ discard block |
||
1070 | 1070 | // $sticky - bool (not directly passed to SQL) |
1071 | 1071 | // |
1072 | 1072 | function get_forum_threads( |
1073 | - $forumID, $start=-1, $nRec=-1, $sort_style=MODIFIED_NEW, |
|
1073 | + $forumID, $start = -1, $nRec = -1, $sort_style = MODIFIED_NEW, |
|
1074 | 1074 | $show_hidden = 0, $sticky = 1 |
1075 | 1075 | ) { |
1076 | 1076 | //if (! (is_numeric($forumID) && is_numeric($min) && is_numeric($nRec))) { |
1077 | 1077 | // return NULL; // Something is wrong here. |
1078 | 1078 | //} |
1079 | 1079 | |
1080 | - $sql = 'forum = ' . $forumID ; |
|
1080 | + $sql = 'forum = '.$forumID; |
|
1081 | 1081 | $stickysql = ""; |
1082 | - if ($sticky){ |
|
1082 | + if ($sticky) { |
|
1083 | 1083 | $stickysql = "sticky DESC, "; |
1084 | 1084 | } |
1085 | 1085 | if (!$show_hidden) { |
1086 | 1086 | $sql .= ' AND hidden = 0'; |
1087 | 1087 | } |
1088 | - switch($sort_style) { |
|
1088 | + switch ($sort_style) { |
|
1089 | 1089 | case MODIFIED_NEW: |
1090 | 1090 | $sql .= ' ORDER BY '.$stickysql.'timestamp DESC'; |
1091 | 1091 | break; |
@@ -1138,7 +1138,7 @@ discard block |
||
1138 | 1138 | if (!$show_hidden) { |
1139 | 1139 | $sql .= ' AND hidden = 0'; |
1140 | 1140 | } |
1141 | - switch($sort_style) { |
|
1141 | + switch ($sort_style) { |
|
1142 | 1142 | case CREATE_TIME_NEW: |
1143 | 1143 | $sql .= ' ORDER BY timestamp desc'; |
1144 | 1144 | break; |
@@ -1160,7 +1160,7 @@ discard block |
||
1160 | 1160 | // |
1161 | 1161 | function show_post_moderation_links( |
1162 | 1162 | $config, $logged_in_user, $post, $forum, $tokens |
1163 | -){ |
|
1163 | +) { |
|
1164 | 1164 | $moderators_allowed_to_ban = parse_bool($config, "moderators_allowed_to_ban"); |
1165 | 1165 | $moderators_vote_to_ban = parse_bool($config, "moderators_vote_to_ban"); |
1166 | 1166 | |
@@ -1247,14 +1247,14 @@ discard block |
||
1247 | 1247 | // We do not tell the (ab)user how much this is - |
1248 | 1248 | // no need to make it easy for them to break the system. |
1249 | 1249 | // |
1250 | - if ($user->total_credit<$forum->post_min_total_credit || $user->expavg_credit<$forum->post_min_expavg_credit) { |
|
1250 | + if ($user->total_credit < $forum->post_min_total_credit || $user->expavg_credit < $forum->post_min_expavg_credit) { |
|
1251 | 1251 | 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)); |
1252 | 1252 | } |
1253 | 1253 | |
1254 | 1254 | // If the user is posting faster than forum regulations allow |
1255 | 1255 | // Tell the user to wait a while before creating any more posts |
1256 | 1256 | // |
1257 | - if (time()-$user->prefs->last_post <$forum->post_min_interval) { |
|
1257 | + if (time() - $user->prefs->last_post < $forum->post_min_interval) { |
|
1258 | 1258 | error_page(tra("You cannot create threads right now. Please wait before trying again. This is to protect against abuse of the system.")); |
1259 | 1259 | } |
1260 | 1260 | } |
@@ -1282,7 +1282,7 @@ discard block |
||
1282 | 1282 | |
1283 | 1283 | function is_moderator($user, $forum) { |
1284 | 1284 | if (!$user) return false; |
1285 | - $type = $forum?$forum->parent_type:0; |
|
1285 | + $type = $forum ? $forum->parent_type : 0; |
|
1286 | 1286 | switch ($type) { |
1287 | 1287 | case 0: |
1288 | 1288 | if ($user->prefs->privilege(S_MODERATOR)) return true; |
@@ -1319,7 +1319,7 @@ discard block |
||
1319 | 1319 | if (!is_forum_visible_to_user($thread_forum, $user)) return; |
1320 | 1320 | $owner = BoincUser::lookup_id($thread->owner); |
1321 | 1321 | echo "<tr><td>\n"; |
1322 | - switch($thread_forum->parent_type) { |
|
1322 | + switch ($thread_forum->parent_type) { |
|
1323 | 1323 | case 0: |
1324 | 1324 | $category = BoincCategory::lookup_id($thread_forum->category); |
1325 | 1325 | show_forum_title($category, $thread_forum, $thread, true); |
@@ -1329,7 +1329,7 @@ discard block |
||
1329 | 1329 | break; |
1330 | 1330 | } |
1331 | 1331 | echo ' |
1332 | - </td><td class="numbers">'.($thread->replies+1).'</td> |
|
1332 | + </td><td class="numbers">'.($thread->replies + 1).'</td> |
|
1333 | 1333 | <td>'.user_links($owner).'</td> |
1334 | 1334 | <td class="numbers">'.$thread->views.'</td> |
1335 | 1335 | <td class="lastpost">'.time_diff_str($thread->timestamp, time()).'</td> |
@@ -1363,13 +1363,13 @@ discard block |
||
1363 | 1363 | |
1364 | 1364 | function subscribed_post_web_line($notify) { |
1365 | 1365 | $thread = BoincThread::lookup_id($notify->opaque); |
1366 | - return tra("New posts in the thread %1","<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1366 | + return tra("New posts in the thread %1", "<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1367 | 1367 | } |
1368 | 1368 | |
1369 | 1369 | function subscribe_rss($notify, &$title, &$msg, &$url) { |
1370 | 1370 | $thread = BoincThread::lookup_id($notify->opaque); |
1371 | 1371 | $title = tra("New posts in subscribed thread"); |
1372 | - $msg = tra("There are new posts in the thread '%1'",$thread->title); |
|
1372 | + $msg = tra("There are new posts in the thread '%1'", $thread->title); |
|
1373 | 1373 | $url = secure_url_base()."forum_thread.php?id=$thread->id"; |
1374 | 1374 | } |
1375 | 1375 |
@@ -53,10 +53,10 @@ discard block |
||
53 | 53 | $preview = post_str("preview", true); |
54 | 54 | $warning = null; |
55 | 55 | |
56 | -if ($content && $title && (!$preview)){ |
|
57 | - if (post_str('add_signature', true) == "add_it"){ |
|
58 | - $add_signature = true; // set a flag and concatenate later |
|
59 | - } else { |
|
56 | +if ($content && $title && (!$preview)) { |
|
57 | + if (post_str('add_signature', true) == "add_it") { |
|
58 | + $add_signature = true; // set a flag and concatenate later |
|
59 | + } else { |
|
60 | 60 | $add_signature = false; |
61 | 61 | } |
62 | 62 | check_tokens($logged_in_user->authenticator); |
@@ -68,14 +68,14 @@ discard block |
||
68 | 68 | $title, $content, $logged_in_user, $forum, $add_signature, $export |
69 | 69 | ); |
70 | 70 | if ($thread) { |
71 | - header('Location: forum_thread.php?id=' . $thread->id); |
|
71 | + header('Location: forum_thread.php?id='.$thread->id); |
|
72 | 72 | } else { |
73 | 73 | error_page("Can't create thread. $forum_error"); |
74 | 74 | } |
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | -page_head(tra("Create new thread"),'','','', $bbcode_js); |
|
78 | +page_head(tra("Create new thread"), '', '', '', $bbcode_js); |
|
79 | 79 | show_forum_header($logged_in_user); |
80 | 80 | |
81 | 81 | if ($warning) { |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | $submit_help = "<br /><font color=\"red\">".tra("Remember to add a title")."</font>"; |
117 | 117 | } |
118 | 118 | |
119 | -if ($force_title && $title){ |
|
119 | +if ($force_title && $title) { |
|
120 | 120 | row2(tra("Title"), htmlspecialchars($title)."<input type=\"hidden\" name=\"title\" value=\"".htmlspecialchars($title)."\">"); |
121 | 121 | } else { |
122 | 122 | row2(tra("Title").$submit_help, |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | echo "</td></tr>"; |
133 | 133 | |
134 | 134 | if (!$logged_in_user->prefs->no_signature_by_default) { |
135 | - $enable_signature="checked=\"true\""; |
|
135 | + $enable_signature = "checked=\"true\""; |
|
136 | 136 | } else { |
137 | - $enable_signature=""; |
|
137 | + $enable_signature = ""; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | if (is_news_forum($forum)) { |
@@ -150,5 +150,5 @@ discard block |
||
150 | 150 | |
151 | 151 | page_tail(); |
152 | 152 | |
153 | -$cvs_version_tracker[]="\$Id$"; |
|
153 | +$cvs_version_tracker[] = "\$Id$"; |
|
154 | 154 | ?> |