@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | require_once("../inc/text_transform.inc"); |
25 | 25 | |
26 | 26 | define('THREADS_PER_PAGE', 50); |
27 | -define('FORUM_LH_PCT', '25%'); // width of LH column |
|
27 | +define('FORUM_LH_PCT', '25%'); // width of LH column |
|
28 | 28 | |
29 | 29 | $forum_error = ""; |
30 | 30 | // for functions that return null on error, |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | define('THREAD_SOLVED', 1); |
56 | 56 | |
57 | 57 | define('AVATAR_WIDTH', 100); |
58 | -define('AVATAR_HEIGHT',100); |
|
58 | +define('AVATAR_HEIGHT', 100); |
|
59 | 59 | |
60 | 60 | define('ST_NEW_TIME', 1209600); //3600*24*14 - 14 days |
61 | 61 | define('ST_NEW', 'New member'); |
@@ -80,24 +80,24 @@ discard block |
||
80 | 80 | define('IMAGE_HIDDEN', 'img/hidden.png'); |
81 | 81 | define('IMAGE_STICKY_LOCKED', 'img/sticky_locked_post.png'); |
82 | 82 | define('IMAGE_POST', 'img/post.png'); |
83 | -define('NEW_IMAGE_HEIGHT','15'); |
|
83 | +define('NEW_IMAGE_HEIGHT', '15'); |
|
84 | 84 | define('EMPHASIZE_IMAGE', 'img/emphasized_post.png'); |
85 | -define('EMPHASIZE_IMAGE_HEIGHT','15'); |
|
85 | +define('EMPHASIZE_IMAGE_HEIGHT', '15'); |
|
86 | 86 | define('FILTER_IMAGE', 'img/filtered_post.png'); |
87 | -define('FILTER_IMAGE_HEIGHT','15'); |
|
87 | +define('FILTER_IMAGE_HEIGHT', '15'); |
|
88 | 88 | define('RATE_POSITIVE_IMAGE', 'img/rate_positive.png'); |
89 | -define('RATE_POSITIVE_IMAGE_HEIGHT','9'); |
|
89 | +define('RATE_POSITIVE_IMAGE_HEIGHT', '9'); |
|
90 | 90 | define('RATE_NEGATIVE_IMAGE', 'img/rate_negative.png'); |
91 | -define('RATE_NEGATIVE_IMAGE_HEIGHT','9'); |
|
91 | +define('RATE_NEGATIVE_IMAGE_HEIGHT', '9'); |
|
92 | 92 | define('REPORT_POST_IMAGE', 'img/report_post.png'); |
93 | -define('REPORT_POST_IMAGE_HEIGHT','9'); |
|
93 | +define('REPORT_POST_IMAGE_HEIGHT', '9'); |
|
94 | 94 | |
95 | 95 | define('SOLUTION', tra('This answered my question')); |
96 | 96 | define('SUFFERER', tra('I also have this question')); |
97 | 97 | define('OFF_TOPIC', tra('Off-topic')); |
98 | 98 | |
99 | -define ('DEFAULT_LOW_RATING_THRESHOLD', -25); |
|
100 | -define ('DEFAULT_HIGH_RATING_THRESHOLD', 5); |
|
99 | +define('DEFAULT_LOW_RATING_THRESHOLD', -25); |
|
100 | +define('DEFAULT_HIGH_RATING_THRESHOLD', 5); |
|
101 | 101 | |
102 | 102 | // special user attributes |
103 | 103 | // |
@@ -175,15 +175,15 @@ discard block |
||
175 | 175 | |
176 | 176 | // return forum/thread title, with links. |
177 | 177 | // |
178 | -function forum_title($category, $forum, $thread, $link_thread=false) { |
|
178 | +function forum_title($category, $forum, $thread, $link_thread = false) { |
|
179 | 179 | if ($category) { |
180 | 180 | $is_helpdesk = $category->is_helpdesk; |
181 | 181 | } else { |
182 | 182 | $is_helpdesk = false; |
183 | 183 | } |
184 | 184 | |
185 | - $where = $is_helpdesk?tra("Questions and Answers"):tra("Message boards"); |
|
186 | - $top_url = $is_helpdesk?"forum_help_desk.php":"forum_index.php"; |
|
185 | + $where = $is_helpdesk ?tra("Questions and Answers") : tra("Message boards"); |
|
186 | + $top_url = $is_helpdesk ? "forum_help_desk.php" : "forum_index.php"; |
|
187 | 187 | |
188 | 188 | $x = ''; |
189 | 189 | if (!$forum && !$thread) { |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | return $x; |
218 | 218 | } |
219 | 219 | |
220 | -function team_forum_title($forum, $thread=null, $link_thread=false) { |
|
220 | +function team_forum_title($forum, $thread = null, $link_thread = false) { |
|
221 | 221 | $team = BoincTeam::lookup_id($forum->category); |
222 | 222 | $x = sprintf('<a href="forum_index.php">%s</a> :', |
223 | 223 | tra("Message boards") |
@@ -251,12 +251,12 @@ discard block |
||
251 | 251 | } |
252 | 252 | |
253 | 253 | function page_link($url, $page_num, $items_per_page, $text) { |
254 | - return " <a href=\"$url&start=" . $page_num*$items_per_page . "\">$text</a> "; |
|
254 | + return " <a href=\"$url&start=".$page_num*$items_per_page."\">$text</a> "; |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | // return a string for navigating pages |
258 | 258 | // |
259 | -function page_links($url, $nitems, $items_per_page, $start){ |
|
259 | +function page_links($url, $nitems, $items_per_page, $start) { |
|
260 | 260 | // How many pages to potentially show before and after this one: |
261 | 261 | $preshow = 3; |
262 | 262 | $postshow = 3; |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | $x = ""; |
265 | 265 | |
266 | 266 | if ($nitems <= $items_per_page) return ""; |
267 | - $npages = ceil($nitems / $items_per_page); |
|
268 | - $curpage = ceil($start / $items_per_page); |
|
267 | + $npages = ceil($nitems/$items_per_page); |
|
268 | + $curpage = ceil($start/$items_per_page); |
|
269 | 269 | |
270 | 270 | // If this is not the first page, display "previous" |
271 | 271 | // |
272 | - if ($curpage > 0){ |
|
272 | + if ($curpage > 0) { |
|
273 | 273 | $x .= page_link( |
274 | - $url, $curpage-1, $items_per_page, |
|
274 | + $url, $curpage - 1, $items_per_page, |
|
275 | 275 | tra("Previous")." · " |
276 | 276 | ); |
277 | 277 | } |
@@ -286,8 +286,8 @@ discard block |
||
286 | 286 | } |
287 | 287 | // Display a list of pages surrounding this one |
288 | 288 | // |
289 | - for ($i=$curpage-$preshow; $i<=$curpage+$postshow; $i++){ |
|
290 | - $page_str = (string)($i+1); |
|
289 | + for ($i = $curpage - $preshow; $i <= $curpage + $postshow; $i++) { |
|
290 | + $page_str = (string)($i + 1); |
|
291 | 291 | if ($i < 0) continue; |
292 | 292 | if ($i >= $npages) break; |
293 | 293 | |
@@ -296,20 +296,20 @@ discard block |
||
296 | 296 | } else { |
297 | 297 | $x .= page_link($url, $i, $items_per_page, $page_str); |
298 | 298 | } |
299 | - if ($i == $npages-1) break; |
|
300 | - if ($i == $curpage+$postshow) break; |
|
299 | + if ($i == $npages - 1) break; |
|
300 | + if ($i == $curpage + $postshow) break; |
|
301 | 301 | $x .= " · "; |
302 | 302 | } |
303 | 303 | |
304 | - if ($curpage + $postshow < $npages-1) { |
|
304 | + if ($curpage + $postshow < $npages - 1) { |
|
305 | 305 | $x .= " . . . "; |
306 | - $x .= page_link($url, $npages-1, $items_per_page, $npages); |
|
306 | + $x .= page_link($url, $npages - 1, $items_per_page, $npages); |
|
307 | 307 | } |
308 | 308 | // If there is a next page |
309 | 309 | // |
310 | - if ($curpage < $npages-1){ |
|
310 | + if ($curpage < $npages - 1) { |
|
311 | 311 | $x .= page_link( |
312 | - $url, $curpage+1, $items_per_page, |
|
312 | + $url, $curpage + 1, $items_per_page, |
|
313 | 313 | " · ".tra("Next") |
314 | 314 | ); |
315 | 315 | } |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | function cleanup_title($title) { |
331 | 331 | $x = sanitize_tags(bb2html($title)); |
332 | 332 | $x = trim($x); |
333 | - if (strlen($x)==0) return "(no title)"; |
|
333 | + if (strlen($x) == 0) return "(no title)"; |
|
334 | 334 | else return $x; |
335 | 335 | } |
336 | 336 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | $i = 0; |
393 | 393 | foreach ($posts as $post) { |
394 | 394 | if ($post->id == $postid) { |
395 | - $start = $i - ($i % $num_to_show); |
|
395 | + $start = $i - ($i%$num_to_show); |
|
396 | 396 | $jump_to_post = $post; |
397 | 397 | break; |
398 | 398 | } |
@@ -419,7 +419,7 @@ discard block |
||
419 | 419 | // if jump to post, figure out what page to show |
420 | 420 | // |
421 | 421 | if ($jump_to_post) { |
422 | - $start = $ibest - ($ibest % $num_to_show); |
|
422 | + $start = $ibest - ($ibest%$num_to_show); |
|
423 | 423 | } else { |
424 | 424 | $start = $default_start; |
425 | 425 | } |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | // Generates a table row with two cells: author and message |
528 | 528 | // |
529 | 529 | function show_post( |
530 | - $post, $thread, $forum, $logged_in_user, $start=0, |
|
531 | - $latest_viewed=0, $controls=FORUM_CONTROLS, $filter=true |
|
530 | + $post, $thread, $forum, $logged_in_user, $start = 0, |
|
531 | + $latest_viewed = 0, $controls = FORUM_CONTROLS, $filter = true |
|
532 | 532 | ) { |
533 | 533 | global $country_to_iso3166_2; |
534 | 534 | |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | |
537 | 537 | // If the user no longer exists, skip the post |
538 | 538 | // |
539 | - if (!$user){ |
|
539 | + if (!$user) { |
|
540 | 540 | return; |
541 | 541 | } |
542 | 542 | |
@@ -557,9 +557,9 @@ discard block |
||
557 | 557 | // check whether the poster is on the list of people to ignore |
558 | 558 | // |
559 | 559 | $ignore_poster = false; |
560 | - if ($logged_in_user){ |
|
560 | + if ($logged_in_user) { |
|
561 | 561 | $tokens = url_tokens($logged_in_user->authenticator); |
562 | - if (is_ignoring($logged_in_user, $user)){ |
|
562 | + if (is_ignoring($logged_in_user, $user)) { |
|
563 | 563 | $ignore_poster = true; |
564 | 564 | } |
565 | 565 | } |
@@ -573,8 +573,8 @@ discard block |
||
573 | 573 | if (is_moderator($logged_in_user, $forum)) { |
574 | 574 | $can_edit = true; |
575 | 575 | } else if (can_reply($thread, $forum, $logged_in_user)) { |
576 | - $time_limit = $post->timestamp+MAXIMUM_EDIT_TIME; |
|
577 | - $can_edit = time()<$time_limit; |
|
576 | + $time_limit = $post->timestamp + MAXIMUM_EDIT_TIME; |
|
577 | + $can_edit = time() < $time_limit; |
|
578 | 578 | } else { |
579 | 579 | $can_edit = false; |
580 | 580 | } |
@@ -584,24 +584,24 @@ discard block |
||
584 | 584 | // Print the special user lines, if any |
585 | 585 | // |
586 | 586 | global $special_user_bitfield; |
587 | - $fstatus=""; |
|
587 | + $fstatus = ""; |
|
588 | 588 | $keys = array_keys($special_user_bitfield); |
589 | 589 | $is_posted_by_special = false; |
590 | - for ($i=0; $i<sizeof($special_user_bitfield);$i++) { |
|
590 | + for ($i = 0; $i < sizeof($special_user_bitfield); $i++) { |
|
591 | 591 | if ($user->prefs && $user->prefs->privilege($keys[$i])) { |
592 | - $fstatus.="<nobr>".$special_user_bitfield[$keys[$i]]."<nobr><br>"; |
|
592 | + $fstatus .= "<nobr>".$special_user_bitfield[$keys[$i]]."<nobr><br>"; |
|
593 | 593 | $is_posted_by_special = true; |
594 | 594 | } |
595 | 595 | } |
596 | 596 | |
597 | 597 | // Highlight special users if set in prefs; |
598 | 598 | // |
599 | - if ($logged_in_user && $logged_in_user->prefs){ |
|
599 | + if ($logged_in_user && $logged_in_user->prefs) { |
|
600 | 600 | $highlight = $logged_in_user->prefs->highlight_special && $is_posted_by_special; |
601 | 601 | } else { |
602 | 602 | $highlight = $is_posted_by_special; |
603 | 603 | } |
604 | - $class = $highlight?' style="border-left: 5px solid LightGreen" ':''; |
|
604 | + $class = $highlight ? ' style="border-left: 5px solid LightGreen" ' : ''; |
|
605 | 605 | |
606 | 606 | // row and start of author col |
607 | 607 | // |
@@ -613,12 +613,12 @@ discard block |
||
613 | 613 | |
614 | 614 | echo user_links($user, 0, 30); |
615 | 615 | echo "<br>"; |
616 | - if ($user->create_time > time()-ST_NEW_TIME) $fstatus.=ST_NEW."<br>"; |
|
616 | + if ($user->create_time > time() - ST_NEW_TIME) $fstatus .= ST_NEW."<br>"; |
|
617 | 617 | echo "<span class=\"small\">"; |
618 | 618 | if ($fstatus) echo "$fstatus"; |
619 | 619 | |
620 | - if (!$filter || !$ignore_poster){ |
|
621 | - if ($user->prefs && $user->prefs->avatar!="" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars==false))) { |
|
620 | + if (!$filter || !$ignore_poster) { |
|
621 | + if ($user->prefs && $user->prefs->avatar != "" && (!$logged_in_user || ($logged_in_user->prefs->hide_avatars == false))) { |
|
622 | 622 | echo "<img width=\"".AVATAR_WIDTH."\" height=\"".AVATAR_HEIGHT."\" src=\"".avatar_url($user->prefs->avatar)."\" alt=\"Avatar\"><br>"; |
623 | 623 | } |
624 | 624 | } |
@@ -626,14 +626,14 @@ discard block |
||
626 | 626 | |
627 | 627 | $url = "pm.php?action=new&userid=".$user->id; |
628 | 628 | $name = $user->name; |
629 | - show_button_small($url, tra("Send message"), tra("Send %1 a private message",$name)); |
|
629 | + show_button_small($url, tra("Send message"), tra("Send %1 a private message", $name)); |
|
630 | 630 | echo '<br>'.tra("Joined: %1", gmdate('j M y', $user->create_time)), "<br>"; |
631 | 631 | |
632 | 632 | if (!isset($user->nposts)) { |
633 | 633 | $user->nposts = BoincPost::count("user=$user->id"); |
634 | 634 | } |
635 | 635 | |
636 | - if (function_exists('project_forum_user_info')){ |
|
636 | + if (function_exists('project_forum_user_info')) { |
|
637 | 637 | project_forum_user_info($user); |
638 | 638 | } else { |
639 | 639 | echo tra("Posts: %1", $user->nposts)."<br>"; |
@@ -642,8 +642,8 @@ discard block |
||
642 | 642 | // |
643 | 643 | //echo "ID: ".$user->id."<br>"; |
644 | 644 | if (!NO_COMPUTING) { |
645 | - echo tra("Credit: %1", number_format($user->total_credit)) ."<br>"; |
|
646 | - echo tra("RAC: %1", number_format($user->expavg_credit))."<br>"; |
|
645 | + echo tra("Credit: %1", number_format($user->total_credit))."<br>"; |
|
646 | + echo tra("RAC: %1", number_format($user->expavg_credit))."<br>"; |
|
647 | 647 | } |
648 | 648 | |
649 | 649 | // to use this feature: |
@@ -672,7 +672,7 @@ discard block |
||
672 | 672 | echo "<form action=\"forum_rate.php?post=", $post->id, "\" method=\"post\">"; |
673 | 673 | } |
674 | 674 | |
675 | - if ($logged_in_user && $post->timestamp > $latest_viewed){ |
|
675 | + if ($logged_in_user && $post->timestamp > $latest_viewed) { |
|
676 | 676 | show_image(NEW_IMAGE, tra("You haven't read this message yet"), tra("Unread"), NEW_IMAGE_HEIGHT); |
677 | 677 | } |
678 | 678 | |
@@ -692,8 +692,8 @@ discard block |
||
692 | 692 | if ($post->modified) { |
693 | 693 | echo "<br>".tra("Last modified: %1", pretty_time_Str($post->modified)); |
694 | 694 | } |
695 | - if ($ignore_poster && $filter){ |
|
696 | - echo "<br>" .tra( |
|
695 | + if ($ignore_poster && $filter) { |
|
696 | + echo "<br>".tra( |
|
697 | 697 | "This post is hidden because the sender is on your 'ignore' list. Click %1 here %2 to view hidden posts", |
698 | 698 | "<a href=\"?id=".$thread->id."&filter=false&start=$start#".$post->id."\">", |
699 | 699 | "</a>" |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | <p> |
707 | 707 | "; |
708 | 708 | |
709 | - if (!$filter || !$ignore_poster){ |
|
709 | + if (!$filter || !$ignore_poster) { |
|
710 | 710 | $posttext = $post->content; |
711 | 711 | |
712 | 712 | // If the creator of this post has a signature and |
@@ -714,7 +714,7 @@ discard block |
||
714 | 714 | // user has signatures enabled: show it |
715 | 715 | // |
716 | 716 | $posttext = output_transform($posttext, $options); |
717 | - if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)){ |
|
717 | + if ($post->signature && (!$logged_in_user || !$logged_in_user->prefs->hide_signatures)) { |
|
718 | 718 | $sig = output_transform($user->prefs->signature, $options); |
719 | 719 | $posttext .= "<hr>$sig\n"; |
720 | 720 | } |
@@ -748,10 +748,10 @@ discard block |
||
748 | 748 | } |
749 | 749 | if (($controls == FORUM_CONTROLS) && (can_reply($thread, $forum, $logged_in_user))) { |
750 | 750 | echo " "; |
751 | - $url = "forum_reply.php?thread=" . $thread->id . "&post=" . $post->id . "&no_quote=1#input"; |
|
751 | + $url = "forum_reply.php?thread=".$thread->id."&post=".$post->id."&no_quote=1#input"; |
|
752 | 752 | // "Reply" is used as a verb |
753 | 753 | show_button($url, tra("Reply"), tra("Post a reply to this message")); |
754 | - $url = "forum_reply.php?thread=" . $thread->id . "&post=" . $post->id . "#input"; |
|
754 | + $url = "forum_reply.php?thread=".$thread->id."&post=".$post->id."#input"; |
|
755 | 755 | // "Quote" is used as a verb |
756 | 756 | show_button($url, tra("Quote"), tra("Post a reply by quoting this message")); |
757 | 757 | } |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | $content = output_transform($post->content, $options); |
774 | 774 | $when = time_diff_str($post->timestamp, time()); |
775 | 775 | $user = BoincUser::lookup_id($post->user); |
776 | - if (!$user){ |
|
776 | + if (!$user) { |
|
777 | 777 | return; |
778 | 778 | } |
779 | 779 | |
@@ -787,10 +787,10 @@ discard block |
||
787 | 787 | switch ($forum->parent_type) { |
788 | 788 | case 0: |
789 | 789 | $category = BoincCategory::lookup_id($forum->category); |
790 | - $title= forum_title($category, $forum, $thread, true); |
|
790 | + $title = forum_title($category, $forum, $thread, true); |
|
791 | 791 | break; |
792 | 792 | case 1: |
793 | - $title= team_forum_title($forum); |
|
793 | + $title = team_forum_title($forum); |
|
794 | 794 | break; |
795 | 795 | } |
796 | 796 | row_array([ |
@@ -828,9 +828,9 @@ discard block |
||
828 | 828 | function post_rules() { |
829 | 829 | if (defined('FORUM_RULES')) return FORUM_RULES; |
830 | 830 | if (function_exists("project_forum_post_rules")) { |
831 | - $project_rules=project_forum_post_rules(); |
|
831 | + $project_rules = project_forum_post_rules(); |
|
832 | 832 | } else { |
833 | - $project_rules=""; |
|
833 | + $project_rules = ""; |
|
834 | 834 | } |
835 | 835 | return sprintf(" |
836 | 836 | <ul> |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | ); |
860 | 860 | } |
861 | 861 | |
862 | -function post_warning($forum=null) { |
|
862 | +function post_warning($forum = null) { |
|
863 | 863 | $x = '<p><div style="text-align:left">'; |
864 | 864 | |
865 | 865 | // let projects add extra instructions in specific forums, |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | $content = substr($content, 0, 64000); |
946 | 946 | $content = BoincDb::escape_string($content); |
947 | 947 | $now = time(); |
948 | - $sig = $signature?1:0; |
|
948 | + $sig = $signature ? 1 : 0; |
|
949 | 949 | $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)"); |
950 | 950 | if (!$id) { |
951 | 951 | $forum_error = "Failed to add post to DB."; |
@@ -965,7 +965,7 @@ discard block |
||
965 | 965 | // |
966 | 966 | function update_thread_timestamp($thread) { |
967 | 967 | $posts = BoincPost::enum("thread=$thread->id and hidden=0 order by timestamp desc limit 1"); |
968 | - if (count($posts)>0) { |
|
968 | + if (count($posts) > 0) { |
|
969 | 969 | $post = $posts[0]; |
970 | 970 | $thread->update("timestamp=$post->timestamp"); |
971 | 971 | } |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | |
974 | 974 | function update_forum_timestamp($forum) { |
975 | 975 | $threads = BoincThread::enum("forum=$forum->id and hidden=0 order by timestamp desc limit 1"); |
976 | - if (count($threads)>0) { |
|
976 | + if (count($threads) > 0) { |
|
977 | 977 | $thread = $threads[0]; |
978 | 978 | $forum->update("timestamp=$thread->timestamp"); |
979 | 979 | } |
@@ -996,7 +996,7 @@ discard block |
||
996 | 996 | if (is_news_forum($forum) && !$export) { |
997 | 997 | $status = 1; |
998 | 998 | } |
999 | - $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)"); |
|
999 | + $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)"); |
|
1000 | 1000 | if (!$id) { |
1001 | 1001 | $forum_error = "Failed to add thread to DB."; |
1002 | 1002 | return null; |
@@ -1125,22 +1125,22 @@ discard block |
||
1125 | 1125 | // $sticky - bool (not directly passed to SQL) |
1126 | 1126 | // |
1127 | 1127 | function get_forum_threads( |
1128 | - $forumID, $start=-1, $nRec=-1, $sort_style=MODIFIED_NEW, |
|
1128 | + $forumID, $start = -1, $nRec = -1, $sort_style = MODIFIED_NEW, |
|
1129 | 1129 | $show_hidden = 0, $sticky = 1 |
1130 | 1130 | ) { |
1131 | 1131 | //if (! (is_numeric($forumID) && is_numeric($min) && is_numeric($nRec))) { |
1132 | 1132 | // return NULL; // Something is wrong here. |
1133 | 1133 | //} |
1134 | 1134 | |
1135 | - $sql = 'forum = ' . $forumID ; |
|
1135 | + $sql = 'forum = '.$forumID; |
|
1136 | 1136 | $stickysql = ""; |
1137 | - if ($sticky){ |
|
1137 | + if ($sticky) { |
|
1138 | 1138 | $stickysql = "sticky DESC, "; |
1139 | 1139 | } |
1140 | 1140 | if (!$show_hidden) { |
1141 | 1141 | $sql .= ' AND hidden = 0'; |
1142 | 1142 | } |
1143 | - switch($sort_style) { |
|
1143 | + switch ($sort_style) { |
|
1144 | 1144 | case MODIFIED_NEW: |
1145 | 1145 | $sql .= ' ORDER BY '.$stickysql.'timestamp DESC'; |
1146 | 1146 | break; |
@@ -1193,7 +1193,7 @@ discard block |
||
1193 | 1193 | if (!$show_hidden) { |
1194 | 1194 | $sql .= ' AND hidden = 0'; |
1195 | 1195 | } |
1196 | - switch($sort_style) { |
|
1196 | + switch ($sort_style) { |
|
1197 | 1197 | case CREATE_TIME_NEW: |
1198 | 1198 | $sql .= ' ORDER BY timestamp desc'; |
1199 | 1199 | break; |
@@ -1215,7 +1215,7 @@ discard block |
||
1215 | 1215 | // |
1216 | 1216 | function show_post_moderation_links( |
1217 | 1217 | $config, $logged_in_user, $post, $forum, $tokens |
1218 | -){ |
|
1218 | +) { |
|
1219 | 1219 | $moderators_allowed_to_ban = parse_bool($config, "moderators_allowed_to_ban"); |
1220 | 1220 | $moderators_vote_to_ban = parse_bool($config, "moderators_vote_to_ban"); |
1221 | 1221 | |
@@ -1302,14 +1302,14 @@ discard block |
||
1302 | 1302 | // We do not tell the (ab)user how much this is - |
1303 | 1303 | // no need to make it easy for them to break the system. |
1304 | 1304 | // |
1305 | - if ($user->total_credit<$forum->post_min_total_credit || $user->expavg_credit<$forum->post_min_expavg_credit) { |
|
1305 | + if ($user->total_credit < $forum->post_min_total_credit || $user->expavg_credit < $forum->post_min_expavg_credit) { |
|
1306 | 1306 | 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)); |
1307 | 1307 | } |
1308 | 1308 | |
1309 | 1309 | // If the user is posting faster than forum regulations allow |
1310 | 1310 | // Tell the user to wait a while before creating any more posts |
1311 | 1311 | // |
1312 | - if (time()-$user->prefs->last_post <$forum->post_min_interval) { |
|
1312 | + if (time() - $user->prefs->last_post < $forum->post_min_interval) { |
|
1313 | 1313 | error_page(tra("You cannot create threads right now. Please wait before trying again. This is to protect against abuse of the system.")); |
1314 | 1314 | } |
1315 | 1315 | } |
@@ -1335,10 +1335,10 @@ discard block |
||
1335 | 1335 | // - edit their posts at any time |
1336 | 1336 | // - hide/unhide/move threads and posts |
1337 | 1337 | |
1338 | -function is_moderator($user, $forum=null) { |
|
1338 | +function is_moderator($user, $forum = null) { |
|
1339 | 1339 | if (!$user) return false; |
1340 | 1340 | BoincForumPrefs::lookup($user); |
1341 | - $type = $forum?$forum->parent_type:0; |
|
1341 | + $type = $forum ? $forum->parent_type : 0; |
|
1342 | 1342 | switch ($type) { |
1343 | 1343 | case 0: |
1344 | 1344 | if ($user->prefs->privilege(S_MODERATOR)) return true; |
@@ -1355,7 +1355,7 @@ discard block |
||
1355 | 1355 | return false; |
1356 | 1356 | } |
1357 | 1357 | |
1358 | -function thread_list_header($subscriptions=false) { |
|
1358 | +function thread_list_header($subscriptions = false) { |
|
1359 | 1359 | if ($subscriptions) { |
1360 | 1360 | $x = [ |
1361 | 1361 | tra("Thread"), |
@@ -1378,13 +1378,13 @@ discard block |
||
1378 | 1378 | // show a 1-line summary of thread and its forum. |
1379 | 1379 | // Used for search results and subscription list |
1380 | 1380 | // |
1381 | -function thread_list_item($thread, $user, $subscriptions=false) { |
|
1381 | +function thread_list_item($thread, $user, $subscriptions = false) { |
|
1382 | 1382 | $thread_forum = BoincForum::lookup_id($thread->forum); |
1383 | 1383 | if (!$thread_forum) return; |
1384 | 1384 | if (!is_forum_visible_to_user($thread_forum, $user)) return; |
1385 | 1385 | $owner = BoincUser::lookup_id($thread->owner); |
1386 | 1386 | if (!$owner) return; |
1387 | - switch($thread_forum->parent_type) { |
|
1387 | + switch ($thread_forum->parent_type) { |
|
1388 | 1388 | case 0: |
1389 | 1389 | $category = BoincCategory::lookup_id($thread_forum->category); |
1390 | 1390 | $title = forum_title($category, $thread_forum, $thread, true); |
@@ -1405,7 +1405,7 @@ discard block |
||
1405 | 1405 | } else { |
1406 | 1406 | $x = [ |
1407 | 1407 | $title, |
1408 | - $thread->replies+1, |
|
1408 | + $thread->replies + 1, |
|
1409 | 1409 | user_links($owner), |
1410 | 1410 | $thread->views, |
1411 | 1411 | time_diff_str($thread->timestamp, time()) |
@@ -1440,13 +1440,13 @@ discard block |
||
1440 | 1440 | |
1441 | 1441 | function subscribed_thread_web_line($notify) { |
1442 | 1442 | $thread = BoincThread::lookup_id($notify->opaque); |
1443 | - return tra("New posts in the thread %1","<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1443 | + return tra("New posts in the thread %1", "<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1444 | 1444 | } |
1445 | 1445 | |
1446 | 1446 | function subscribed_thread_rss($notify) { |
1447 | 1447 | $thread = BoincThread::lookup_id($notify->opaque); |
1448 | 1448 | $title = tra("New posts in subscribed thread"); |
1449 | - $msg = tra("There are new posts in the thread '%1'",$thread->title); |
|
1449 | + $msg = tra("There are new posts in the thread '%1'", $thread->title); |
|
1450 | 1450 | $url = secure_url_base()."forum_thread.php?id=$thread->id"; |
1451 | 1451 | return [$title, $msg, $url]; |
1452 | 1452 | } |
@@ -1458,13 +1458,13 @@ discard block |
||
1458 | 1458 | |
1459 | 1459 | function subscribed_forum_web_line($notify) { |
1460 | 1460 | $forum = BoincForum::lookup_id($notify->opaque); |
1461 | - return tra("New threads in the forum %1","<a href=forum_forum.php?id=$forum->id>$forum->title</a>"); |
|
1461 | + return tra("New threads in the forum %1", "<a href=forum_forum.php?id=$forum->id>$forum->title</a>"); |
|
1462 | 1462 | } |
1463 | 1463 | |
1464 | 1464 | function subscribed_forum_rss($notify) { |
1465 | 1465 | $forum = BoincForum::lookup_id($notify->opaque); |
1466 | 1466 | $title = tra("New posts in subscribed forum"); |
1467 | - $msg = tra("There are new threads in the forum '%1'",$forum->title); |
|
1467 | + $msg = tra("There are new threads in the forum '%1'", $forum->title); |
|
1468 | 1468 | $url = secure_url_base()."forum_forum.php?id=$forum->id"; |
1469 | 1469 | return [$title, $msg, $url]; |
1470 | 1470 | } |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | require_once('../inc/sanitize_html.inc'); |
27 | 27 | |
28 | 28 | class output_options { |
29 | - var $bb2html; // BBCode as HTML? (on) |
|
30 | - var $images_as_links; // Images as hyperlinks? (off) |
|
31 | - var $link_popup; // Links in new windows? (off) |
|
32 | - var $nl2br; // Convert newlines to <br>'s? (on) |
|
33 | - var $htmlitems; // Convert special chars to HTML entities? (on) |
|
34 | - var $htmlscrub; // Scrub "bad" HTML tags? (off) |
|
35 | - var $highlight_terms;// Array of terms to be highlighted (off) |
|
29 | + var $bb2html; // BBCode as HTML? (on) |
|
30 | + var $images_as_links; // Images as hyperlinks? (off) |
|
31 | + var $link_popup; // Links in new windows? (off) |
|
32 | + var $nl2br; // Convert newlines to <br>'s? (on) |
|
33 | + var $htmlitems; // Convert special chars to HTML entities? (on) |
|
34 | + var $htmlscrub; // Scrub "bad" HTML tags? (off) |
|
35 | + var $highlight_terms; // Array of terms to be highlighted (off) |
|
36 | 36 | |
37 | 37 | // Constructor - set the defaults. |
38 | 38 | |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | $options = new output_options; // Defaults in the class definition |
69 | 69 | } |
70 | 70 | if ($options->htmlitems) { |
71 | - $text = htmlspecialchars($text, ENT_COMPAT | ENT_HTML401 | ENT_SUBSTITUTE); |
|
71 | + $text = htmlspecialchars($text, ENT_COMPAT|ENT_HTML401|ENT_SUBSTITUTE); |
|
72 | 72 | } |
73 | 73 | if (is_array($options->highlight_terms)) { |
74 | 74 | $text = highlight_terms($text, $options->highlight_terms); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | // If $export is true, don't use BOINC CSS |
105 | 105 | |
106 | 106 | function substr2($s, $n1, $n2) { |
107 | - return substr($s, $n1, $n2-$n1); |
|
107 | + return substr($s, $n1, $n2 - $n1); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | // process non-nestable constructs: [pre] and [code] |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | |
178 | 178 | $httpsregex = "(?:\"?)https\:\/\/([^\[\"<\ ]+)(?:\"?)"; |
179 | 179 | // List of allowable tags |
180 | - $bbtags = array ( |
|
180 | + $bbtags = array( |
|
181 | 181 | "@\[b\](.*?)\[/b\]@is", |
182 | 182 | "@\[i\](.*?)\[/i\]@is", |
183 | 183 | "@\[u\](.*?)\[/u\]@is", |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | |
207 | 207 | // What the above tags are turned in to |
208 | 208 | if ($export) { |
209 | - $htmltags = array ( |
|
209 | + $htmltags = array( |
|
210 | 210 | "<b>\\1</b>", |
211 | 211 | "<i>\\1</i>", |
212 | 212 | "<u>\\1</u>", |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | "<a href=\"https://github.com/BOINC/boinc/wiki/\\1\">\\1</a>", |
234 | 234 | ); |
235 | 235 | } else { |
236 | - $htmltags = array ( |
|
236 | + $htmltags = array( |
|
237 | 237 | "<b>\\1</b>", |
238 | 238 | "<i>\\1</i>", |
239 | 239 | "<u>\\1</u>", |
@@ -265,7 +265,7 @@ discard block |
||
265 | 265 | $lasttext = ""; |
266 | 266 | $i = 0; |
267 | 267 | // $i<1000 to prevent DoS |
268 | - while ($text != $lasttext && $i<1000) { |
|
268 | + while ($text != $lasttext && $i < 1000) { |
|
269 | 269 | $lasttext = $text; |
270 | 270 | $text = preg_replace($bbtags, $htmltags, $text); |
271 | 271 | $i = $i + 1; |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | return $text; |
276 | 276 | } |
277 | 277 | |
278 | -function bb2html($text, $export=false) { |
|
278 | +function bb2html($text, $export = false) { |
|
279 | 279 | $text = replace_pre_code($text, $export); |
280 | 280 | return bb2html_aux($text, $export); |
281 | 281 | } |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | // for example inside <pre> containers |
285 | 285 | // The original \n was retained after the br when it was added |
286 | 286 | // |
287 | -function remove_br($text){ |
|
287 | +function remove_br($text) { |
|
288 | 288 | return str_replace("<br />", "", $text); |
289 | 289 | } |
290 | 290 | |
@@ -292,19 +292,19 @@ discard block |
||
292 | 292 | // |
293 | 293 | function externalize_links($text) { |
294 | 294 | // TODO: Convert this to PCRE |
295 | - $i=0; |
|
296 | - $linkpos=true; |
|
295 | + $i = 0; |
|
296 | + $linkpos = true; |
|
297 | 297 | $out = ""; |
298 | - while (true){ |
|
298 | + while (true) { |
|
299 | 299 | // Find a link |
300 | 300 | // |
301 | - $linkpos=strpos($text, "<a ", $i); |
|
302 | - if ($linkpos===false) break; |
|
301 | + $linkpos = strpos($text, "<a ", $i); |
|
302 | + if ($linkpos === false) break; |
|
303 | 303 | |
304 | 304 | // Replace with target='_new' |
305 | 305 | // |
306 | - $out .= substr($text, $i, $linkpos-$i)."<a target=\"_new\" "; |
|
307 | - $i = $linkpos+3; |
|
306 | + $out .= substr($text, $i, $linkpos - $i)."<a target=\"_new\" "; |
|
307 | + $i = $linkpos + 3; |
|
308 | 308 | } |
309 | 309 | $out .= substr($text, $i); |
310 | 310 | return $out; |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | // Converts image tags to links to the images. |
314 | 314 | // |
315 | -function image_as_link($text){ |
|
315 | +function image_as_link($text) { |
|
316 | 316 | $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si'; |
317 | 317 | $replacement = '<a href=${2}>[Image link]</a>'; |
318 | 318 | return preg_replace($pattern, $replacement, $text); |
@@ -330,5 +330,5 @@ discard block |
||
330 | 330 | return str_ireplace($search, $replace, $text); |
331 | 331 | } |
332 | 332 | |
333 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
333 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
334 | 334 | ?> |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | |
43 | 43 | $post_owner = BoincUser::lookup_id($post->user); |
44 | 44 | if (($logged_in_user->id != $post_owner->id) || (can_reply($thread, $forum, $logged_in_user) == false)) { |
45 | - error_page (tra("You are not authorized to edit this post.")); |
|
45 | + error_page(tra("You are not authorized to edit this post.")); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | $thread_owner = BoincUser::lookup_id($thread->owner); |
@@ -51,13 +51,13 @@ discard block |
||
51 | 51 | // (ie. not a response to another post) |
52 | 52 | // allow the user to modify the thread title |
53 | 53 | // |
54 | -$can_edit_title = ($post->parent_post==0 && $thread_owner->id==$logged_in_user->id && !is_banished($logged_in_user)); |
|
54 | +$can_edit_title = ($post->parent_post == 0 && $thread_owner->id == $logged_in_user->id && !is_banished($logged_in_user)); |
|
55 | 55 | |
56 | 56 | $content = post_str("content", true); |
57 | 57 | $title = post_str("title", true); |
58 | 58 | $preview = post_str("preview", true); |
59 | 59 | |
60 | -if (post_str('submit',true) && (!$preview)) { |
|
60 | +if (post_str('submit', true) && (!$preview)) { |
|
61 | 61 | if (POST_MAX_LINKS |
62 | 62 | && link_count($content) > POST_MAX_LINKS |
63 | 63 | && !is_moderator($logged_in_user, $forum) |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | } |
67 | 67 | check_tokens($logged_in_user->authenticator); |
68 | 68 | |
69 | - $add_signature = (post_str('add_signature', true) == "1")?1:0; |
|
69 | + $add_signature = (post_str('add_signature', true) == "1") ? 1 : 0; |
|
70 | 70 | $content = substr($content, 0, 64000); |
71 | 71 | $content = trim($content); |
72 | 72 | if (strlen($content)) { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | $now = time(); |
75 | 75 | $post->update("signature=$add_signature, content='$content', modified=$now"); |
76 | 76 | |
77 | - if ($can_edit_title){ |
|
77 | + if ($can_edit_title) { |
|
78 | 78 | $title = trim($title); |
79 | 79 | $title = sanitize_tags($title); |
80 | 80 | $title = BoincDb::escape_string($title); |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | } |
88 | 88 | } |
89 | 89 | |
90 | -page_head(tra("Edit post"),'','','', $bbcode_js); |
|
90 | +page_head(tra("Edit post"), '', '', '', $bbcode_js); |
|
91 | 91 | |
92 | 92 | switch ($forum->parent_type) { |
93 | 93 | case 0: |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | sprintf( |
123 | 123 | '<input type="text" size=%d name="title" value="%s">', |
124 | 124 | 80, |
125 | - htmlspecialchars($preview?$title:$thread->title) |
|
125 | + htmlspecialchars($preview ? $title : $thread->title) |
|
126 | 126 | ), |
127 | 127 | null, FORUM_LH_PCT |
128 | 128 | ); |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | $bbcode_html, |
140 | 140 | 12, |
141 | 141 | 80, |
142 | - htmlspecialchars($preview?$content:$post->content) |
|
142 | + htmlspecialchars($preview ? $content : $post->content) |
|
143 | 143 | ), |
144 | 144 | null, FORUM_LH_PCT |
145 | 145 | ); |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | '<input id="add_signature" name="add_signature" value="1" type="checkbox" %s> |
150 | 150 | <label for="add_signature">%s</label> |
151 | 151 | ', |
152 | - $post->signature?'checked="true"':'', |
|
152 | + $post->signature ? 'checked="true"' : '', |
|
153 | 153 | tra("Add my signature to this post") |
154 | 154 | ), |
155 | 155 | null, FORUM_LH_PCT |
@@ -170,5 +170,5 @@ discard block |
||
170 | 170 | |
171 | 171 | page_tail(); |
172 | 172 | |
173 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
173 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
174 | 174 | ?> |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $parent_post_id = 0; |
57 | 57 | } |
58 | 58 | |
59 | -if ($filter != "false"){ |
|
59 | +if ($filter != "false") { |
|
60 | 60 | $filter = true; |
61 | 61 | } else { |
62 | 62 | $filter = false; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | $warning = null; |
74 | -if ($content && (!$preview)){ |
|
74 | +if ($content && (!$preview)) { |
|
75 | 75 | check_tokens($logged_in_user->authenticator); |
76 | 76 | if (!akismet_check($logged_in_user, $content)) { |
77 | 77 | $warning = tra("Your post has been flagged as spam by the Akismet anti-spam system. Please modify your text and try again."); |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | } |
94 | 94 | } |
95 | 95 | |
96 | -page_head(tra("Post to thread")." '$thread->title'",'','','', $bbcode_js); |
|
96 | +page_head(tra("Post to thread")." '$thread->title'", '', '', '', $bbcode_js); |
|
97 | 97 | |
98 | 98 | if ($parent_post) { |
99 | 99 | echo sprintf( |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $x2 .= " method=\"post\" name=\"post\" onsubmit=\"return checkForm(this)\">\n"; |
162 | 162 | $x2 .= form_tokens($logged_in_user->authenticator); |
163 | 163 | $x2 .= $bbcode_html."<textarea class=\"form-control\" name=\"content\" rows=\"18\">"; |
164 | - $no_quote = get_int("no_quote", true)==1; |
|
164 | + $no_quote = get_int("no_quote", true) == 1; |
|
165 | 165 | if ($preview) { |
166 | 166 | $x2 .= htmlspecialchars($content); |
167 | 167 | } else if (!$no_quote) { |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | } |
171 | 171 | } |
172 | 172 | if (!$logged_in_user->prefs->no_signature_by_default) { |
173 | - $enable_signature='checked="true"'; |
|
173 | + $enable_signature = 'checked="true"'; |
|
174 | 174 | } else { |
175 | - $enable_signature=""; |
|
175 | + $enable_signature = ""; |
|
176 | 176 | } |
177 | 177 | $x2 .= sprintf('</textarea><p> </p> |
178 | 178 | <input class="btn btn-sm" %s type="submit" name="preview" value="%s"> |
@@ -200,11 +200,11 @@ discard block |
||
200 | 200 | return sprintf( |
201 | 201 | 'In reply to %s\'s message of %s: |
202 | 202 | [quote]%s[/quote]', |
203 | - $user?$user->name:'unknown user', |
|
203 | + $user ? $user->name : 'unknown user', |
|
204 | 204 | date_str($post->timestamp), |
205 | 205 | htmlspecialchars($post->content) |
206 | 206 | ); |
207 | 207 | } |
208 | 208 | |
209 | -$cvs_version_tracker[]="\$Id$"; |
|
209 | +$cvs_version_tracker[] = "\$Id$"; |
|
210 | 210 | ?> |
@@ -31,10 +31,10 @@ discard block |
||
31 | 31 | // Optionally filters by forum, user, time, or hidden if specified. |
32 | 32 | // |
33 | 33 | function search_thread_titles( |
34 | - $keyword_list, $forum="", $user="", $time="", $limit=200, |
|
35 | - $sort_style=CREATE_TIME_NEW, $show_hidden = false |
|
36 | -){ |
|
37 | - $search_string="%"; |
|
34 | + $keyword_list, $forum = "", $user = "", $time = "", $limit = 200, |
|
35 | + $sort_style = CREATE_TIME_NEW, $show_hidden = false |
|
36 | +) { |
|
37 | + $search_string = "%"; |
|
38 | 38 | foreach ($keyword_list as $key => $word) { |
39 | 39 | $search_string .= BoincDb::escape_string($word)."%"; |
40 | 40 | } |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if (!$show_hidden) { |
52 | 52 | $query .= " and thread.hidden = 0"; |
53 | 53 | } |
54 | - switch($sort_style) { |
|
54 | + switch ($sort_style) { |
|
55 | 55 | case MODIFIED_NEW: |
56 | 56 | $query .= ' ORDER BY timestamp DESC'; |
57 | 57 | break; |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | // |
85 | 85 | function search_post_content( |
86 | 86 | $keyword_list, $forum, $user, $time, $limit, $sort_style, $show_hidden |
87 | -){ |
|
87 | +) { |
|
88 | 88 | $db = BoincDb::get(); |
89 | 89 | |
90 | - $search_string="%"; |
|
91 | - foreach ($keyword_list as $key => $word){ |
|
90 | + $search_string = "%"; |
|
91 | + foreach ($keyword_list as $key => $word) { |
|
92 | 92 | $search_string .= BoincDb::escape_string($word)."%"; |
93 | 93 | } |
94 | 94 | $optional_join = ""; |
@@ -100,20 +100,20 @@ discard block |
||
100 | 100 | } |
101 | 101 | $query = "select post.* from ".$db->db_name.".post".$optional_join." where content like '".$search_string."'"; |
102 | 102 | if ($forum) { |
103 | - $query.=" and forum = $forum->id"; |
|
103 | + $query .= " and forum = $forum->id"; |
|
104 | 104 | } |
105 | 105 | if ($user) { |
106 | - $query.=" and post.user = $user->id "; |
|
106 | + $query .= " and post.user = $user->id "; |
|
107 | 107 | } |
108 | 108 | if ($time) { |
109 | - $query.=" and post.timestamp > $time"; |
|
109 | + $query .= " and post.timestamp > $time"; |
|
110 | 110 | } |
111 | 111 | if (!$show_hidden) { |
112 | 112 | $query .= " AND post.hidden = 0"; |
113 | 113 | } |
114 | - switch($sort_style) { |
|
114 | + switch ($sort_style) { |
|
115 | 115 | case VIEWS_MOST: |
116 | - $query.= ' ORDER BY views DESC'; |
|
116 | + $query .= ' ORDER BY views DESC'; |
|
117 | 117 | break; |
118 | 118 | case CREATE_TIME_NEW: |
119 | 119 | $query .= ' ORDER by post.timestamp desc'; |
@@ -128,13 +128,13 @@ discard block |
||
128 | 128 | $query .= ' ORDER BY post.timestamp DESC'; |
129 | 129 | break; |
130 | 130 | } |
131 | - $query.= " limit $limit"; |
|
131 | + $query .= " limit $limit"; |
|
132 | 132 | return BoincPost::enum_general($query); |
133 | 133 | } |
134 | 134 | |
135 | 135 | $logged_in_user = get_logged_in_user(false); |
136 | 136 | BoincForumPrefs::lookup($logged_in_user); |
137 | -if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)){ |
|
137 | +if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)) { |
|
138 | 138 | $show_hidden_posts = true; |
139 | 139 | } else { |
140 | 140 | $show_hidden_posts = false; |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | $search_max_time = post_int("search_max_time"); |
148 | 148 | $search_forum = post_int("search_forum"); |
149 | 149 | $search_sort = post_int("search_sort"); |
150 | -$search_list = explode(" ",$search_keywords); |
|
150 | +$search_list = explode(" ", $search_keywords); |
|
151 | 151 | if ($search_max_time) { |
152 | 152 | $min_timestamp = time() - ($search_max_time*3600*24); |
153 | 153 | } else { |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | $limit = 100; |
158 | 158 | |
159 | -if ($search_forum==-1){ |
|
159 | +if ($search_forum == -1) { |
|
160 | 160 | $forum = null; |
161 | 161 | } else if ($search_forum) { |
162 | 162 | $forum = BoincForum::lookup_id($search_forum); |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | |
174 | 174 | // Display the threads while we search for posts |
175 | 175 | // |
176 | -if (count($threads)){ |
|
177 | - echo "<h3>" . tra("Thread titles matching your query:") . "</h3>"; |
|
176 | +if (count($threads)) { |
|
177 | + echo "<h3>".tra("Thread titles matching your query:")."</h3>"; |
|
178 | 178 | start_table('table-striped'); |
179 | 179 | thread_list_header(); |
180 | - foreach ($threads as $thread){ |
|
180 | + foreach ($threads as $thread) { |
|
181 | 181 | if ($thread->hidden) continue; |
182 | 182 | thread_list_item($thread, $logged_in_user); |
183 | 183 | } |
@@ -193,8 +193,8 @@ discard block |
||
193 | 193 | $show_hidden_posts |
194 | 194 | ); |
195 | 195 | |
196 | -if (count($posts)){ |
|
197 | - echo "<h3>" . tra("Messages matching your query:") . "</h3>"; |
|
196 | +if (count($posts)) { |
|
197 | + echo "<h3>".tra("Messages matching your query:")."</h3>"; |
|
198 | 198 | start_table('table-striped'); |
199 | 199 | row_heading_array(['Info', 'Post'], ['', 'width=70%']); |
200 | 200 | $n = 1; |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | end_table(); |
218 | 218 | } |
219 | 219 | |
220 | -if (!count($threads) && !count($posts)){ |
|
220 | +if (!count($threads) && !count($posts)) { |
|
221 | 221 | echo "<p>".tra("Sorry, couldn't find anything matching your search query. You can try to broaden your search by using less words (or less specific words).")."</p> |
222 | 222 | <p>" |
223 | 223 | .tra("You can also %1 try the same search on Google. %2", |
@@ -228,5 +228,5 @@ discard block |
||
228 | 228 | echo "<p><a href=\"forum_search.php\">".tra("Perform another search")."</a></p>"; |
229 | 229 | page_tail(); |
230 | 230 | |
231 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
231 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
232 | 232 | ?> |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | $preview = post_str("preview", true); |
57 | 57 | $warning = null; |
58 | 58 | |
59 | -if ($content && $title && (!$preview)){ |
|
59 | +if ($content && $title && (!$preview)) { |
|
60 | 60 | if (post_str('add_signature', true)) { |
61 | - $add_signature = true; // set a flag and concatenate later |
|
62 | - } else { |
|
61 | + $add_signature = true; // set a flag and concatenate later |
|
62 | + } else { |
|
63 | 63 | $add_signature = false; |
64 | 64 | } |
65 | 65 | check_tokens($logged_in_user->authenticator); |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | if (post_str('subscribe', true)) { |
75 | 75 | BoincSubscription::replace($logged_in_user->id, $thread->id); |
76 | 76 | } |
77 | - header('Location: forum_thread.php?id=' . $thread->id); |
|
77 | + header('Location: forum_thread.php?id='.$thread->id); |
|
78 | 78 | } else { |
79 | 79 | error_page("Can't create thread. $forum_error"); |
80 | 80 | } |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | -page_head(tra("Create new thread"),'','','', $bbcode_js); |
|
84 | +page_head(tra("Create new thread"), '', '', '', $bbcode_js); |
|
85 | 85 | show_forum_header($logged_in_user); |
86 | 86 | |
87 | 87 | if ($warning) { |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $submit_help = "<br /><font color=\"red\">".tra("Remember to add a title")."</font>"; |
123 | 123 | } |
124 | 124 | |
125 | -if ($force_title && $title){ |
|
125 | +if ($force_title && $title) { |
|
126 | 126 | row2( |
127 | 127 | tra("Title"), |
128 | 128 | sprintf( |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | row2( |
137 | 137 | tra("Title").$submit_help, |
138 | 138 | sprintf('<input type="text" class="form-control" name="title" value="%s">', |
139 | - $title?htmlspecialchars($title):'' |
|
139 | + $title ?htmlspecialchars($title) : '' |
|
140 | 140 | ), |
141 | 141 | null, FORUM_LH_PCT |
142 | 142 | ); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | sprintf( |
148 | 148 | '%s <textarea class="form-control" name="content" rows="12" cols="80">%s</textarea>', |
149 | 149 | $bbcode_html, |
150 | - $content?htmlspecialchars($content):'' |
|
150 | + $content ?htmlspecialchars($content) : '' |
|
151 | 151 | ), |
152 | 152 | null, FORUM_LH_PCT |
153 | 153 | ); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | if (!$logged_in_user->prefs->no_signature_by_default) { |
156 | 156 | $enable_signature = 'checked="true"'; |
157 | 157 | } else { |
158 | - $enable_signature=''; |
|
158 | + $enable_signature = ''; |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | if (is_news_forum($forum)) { |
@@ -195,5 +195,5 @@ discard block |
||
195 | 195 | |
196 | 196 | page_tail(); |
197 | 197 | |
198 | -$cvs_version_tracker[]="\$Id$"; |
|
198 | +$cvs_version_tracker[] = "\$Id$"; |
|
199 | 199 | ?> |