@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | </select>"); |
57 | 57 | |
58 | 58 | $forumid = null; |
59 | -if (get_str("forumid",true)){ |
|
59 | +if (get_str("forumid", true)) { |
|
60 | 60 | $forumid = get_str("forumid"); |
61 | 61 | } |
62 | -$forumlist="<option value=\"-1\">".tra("All")."</option>"; |
|
62 | +$forumlist = "<option value=\"-1\">".tra("All")."</option>"; |
|
63 | 63 | $categories = BoincCategory::enum(); |
64 | 64 | foreach ($categories as $category) { |
65 | 65 | $forums = BoincForum::enum("parent_type=0 and category=$category->id"); |
66 | 66 | foreach ($forums as $forum) { |
67 | - if ($forum->id==$forumid){ |
|
68 | - $forumlist.="<option selected value=\"".$forum->id."\">".$forum->title."</option>"; |
|
67 | + if ($forum->id == $forumid) { |
|
68 | + $forumlist .= "<option selected value=\"".$forum->id."\">".$forum->title."</option>"; |
|
69 | 69 | } else { |
70 | - $forumlist.="<option value=\"".$forum->id."\">".$forum->title."</option>"; |
|
70 | + $forumlist .= "<option value=\"".$forum->id."\">".$forum->title."</option>"; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | '<select class="form-control" name="search_forum">'.$forumlist.'</select'); |
77 | 77 | |
78 | 78 | $sortlist = null; |
79 | -foreach ($thread_sort_styles as $id => $style){ |
|
80 | - if ($id == CREATE_TIME_NEW){ |
|
81 | - $sortlist.="<option selected value=\"".$id."\">".$style."</option>"; |
|
79 | +foreach ($thread_sort_styles as $id => $style) { |
|
80 | + if ($id == CREATE_TIME_NEW) { |
|
81 | + $sortlist .= "<option selected value=\"".$id."\">".$style."</option>"; |
|
82 | 82 | } else { |
83 | - $sortlist.="<option value=\"".$id."\">".$style."</option>"; |
|
83 | + $sortlist .= "<option value=\"".$id."\">".$style."</option>"; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | row2(tra("Sort by"), |
@@ -98,5 +98,5 @@ discard block |
||
98 | 98 | |
99 | 99 | page_tail(); |
100 | 100 | |
101 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
101 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
102 | 102 | ?> |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // they've participated in |
34 | 34 | // |
35 | 35 | function get_other_projects($user) { |
36 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
36 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
37 | 37 | $url = "http://boinc.netsoft-online.com/get_user.php?cpid=".$cpid; |
38 | 38 | |
39 | 39 | // Check the cache for that URL |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | usort($user->projects, "cmp"); |
123 | 123 | if ($personal) { |
124 | - $t = tra("Projects in which you are participating"); |
|
124 | + $t = tra("Projects in which you are participating"); |
|
125 | 125 | } else { |
126 | 126 | $t = tra("Projects in which %1 is participating", $user->name); |
127 | 127 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | if (!NO_STATS) { |
183 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
183 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
184 | 184 | $x = ""; |
185 | 185 | shuffle($cpid_stats_sites); |
186 | 186 | foreach ($cpid_stats_sites as $site) { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $u = normalize_user_url($user->url); |
265 | 265 | row2( |
266 | 266 | tra("URL"), |
267 | - $u?sprintf('<a href="%s">%s</a>', $u, $u):tra('Invalid URL') |
|
267 | + $u ?sprintf('<a href="%s">%s</a>', $u, $u) : tra('Invalid URL') |
|
268 | 268 | ); |
269 | 269 | } |
270 | 270 | if (USER_COUNTRY) { |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | // if $badge_height is > 0, show badges |
376 | 376 | // if $name_limit, limit name to N chars |
377 | 377 | // |
378 | -function user_links($user, $badge_height=0, $name_limit=0) { |
|
378 | +function user_links($user, $badge_height = 0, $name_limit = 0) { |
|
379 | 379 | if (!$user) { |
380 | 380 | error_log("user_links(): null arg\n"); |
381 | 381 | return; |
@@ -407,13 +407,13 @@ discard block |
||
407 | 407 | $user->id, |
408 | 408 | $name |
409 | 409 | ); |
410 | - if (function_exists("project_user_links")){ |
|
410 | + if (function_exists("project_user_links")) { |
|
411 | 411 | $x .= project_user_links($user); |
412 | 412 | } |
413 | 413 | if ($badge_height) { |
414 | 414 | $x .= badges_string(true, $user, $badge_height); |
415 | 415 | } |
416 | - return $name_limit?"<nobr>$x</nobr>":$x; |
|
416 | + return $name_limit ? "<nobr>$x</nobr>" : $x; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | function show_community_private($user) { |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | |
461 | 461 | // if there's a foundership request, notify the founder |
462 | 462 | // |
463 | - if ($user->id==$team->userid && $team->ping_user >0) { |
|
463 | + if ($user->id == $team->userid && $team->ping_user > 0) { |
|
464 | 464 | $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>"; |
465 | 465 | } |
466 | 466 | row2(tra("Member of team"), $x); |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
485 | 485 | $x = []; |
486 | 486 | if ($friends) { |
487 | - foreach($friends as $friend) { |
|
487 | + foreach ($friends as $friend) { |
|
488 | 488 | $fuser = BoincUser::lookup_id($friend->user_dest); |
489 | 489 | if (!$fuser) continue; |
490 | 490 | $x[] = friend_links($fuser); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | |
531 | 531 | // return an object with data to show the user's community links |
532 | 532 | // |
533 | -function get_community_links_object($user){ |
|
533 | +function get_community_links_object($user) { |
|
534 | 534 | $cache_object = new StdClass; |
535 | 535 | $cache_object->post_count = total_posts($user); |
536 | 536 | $cache_object->user = $user; |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | $cache_object->friends = array(); |
539 | 539 | |
540 | 540 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
541 | - foreach($friends as $friend) { |
|
541 | + foreach ($friends as $friend) { |
|
542 | 542 | $fuser = BoincUser::lookup_id($friend->user_dest); |
543 | 543 | if (!$fuser) continue; |
544 | 544 | $cache_object->friends[] = $fuser; |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | |
549 | 549 | // show community links of another user (described by $clo) |
550 | 550 | // |
551 | -function community_links($clo, $logged_in_user){ |
|
551 | +function community_links($clo, $logged_in_user) { |
|
552 | 552 | $user = $clo->user; |
553 | 553 | if (!$user) { |
554 | 554 | error_log("community_links(): null user\n"); |
@@ -578,15 +578,15 @@ discard block |
||
578 | 578 | "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>" |
579 | 579 | ); |
580 | 580 | } else if ($friend) { |
581 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
581 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
582 | 582 | } else { |
583 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
583 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | |
587 | 587 | if ($friends) { |
588 | 588 | $x = []; |
589 | - foreach($friends as $friend) { |
|
589 | + foreach ($friends as $friend) { |
|
590 | 590 | $x[] = friend_links($friend); |
591 | 591 | } |
592 | 592 | row2(tra('Friends'), implode('<br>', $x)); |
@@ -653,6 +653,6 @@ discard block |
||
653 | 653 | } |
654 | 654 | |
655 | 655 | |
656 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
656 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
657 | 657 | |
658 | 658 | ?> |
@@ -32,12 +32,12 @@ discard block |
||
32 | 32 | |
33 | 33 | function sched_log_name($x) { |
34 | 34 | if ($x == 0) return "NO_SUCH_LOG"; |
35 | - return gmdate('Y-m-d_H/Y-m-d_H:i', $x) . ".txt"; |
|
35 | + return gmdate('Y-m-d_H/Y-m-d_H:i', $x).".txt"; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | function sched_log_link($x) { |
39 | 39 | if (file_exists("sched_logs")) { |
40 | - return "<a href=\"../sched_logs/" . sched_log_name($x) . "\">" . time_str($x) . "</a>"; |
|
40 | + return "<a href=\"../sched_logs/".sched_log_name($x)."\">".time_str($x)."</a>"; |
|
41 | 41 | } else { |
42 | 42 | return time_str($x); |
43 | 43 | } |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | |
46 | 46 | function location_form($host) { |
47 | 47 | $none = "selected"; |
48 | - $h=$w=$s=$m=""; |
|
48 | + $h = $w = $s = $m = ""; |
|
49 | 49 | if ($host->venue == "home") $h = "selected"; |
50 | 50 | if ($host->venue == "work") $w = "selected"; |
51 | 51 | if ($host->venue == "school") $s = "selected"; |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | row2(tra("Product name"), $host->product_name); |
100 | 100 | } |
101 | 101 | $x = $host->timezone/3600; |
102 | - if ($x >= 0) $x="+$x"; |
|
102 | + if ($x >= 0) $x = "+$x"; |
|
103 | 103 | row2(tra("Local Standard Time"), tra("UTC %1 hours", $x)); |
104 | 104 | } else { |
105 | 105 | $owner = BoincUser::lookup_id($host->userid); |
@@ -259,15 +259,15 @@ discard block |
||
259 | 259 | // "[vbox|5.0.0|1|1]", where now two additional flags give information about |
260 | 260 | // hardware virtualization support. Older clients may have the old-style |
261 | 261 | // serialnum in the DB despite the server being upgraded. |
262 | -function vbox_desc($x){ |
|
263 | - if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)){ |
|
262 | +function vbox_desc($x) { |
|
263 | + if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/", $x, $matches)) { |
|
264 | 264 | $desc = "Virtualbox (".$matches[1].") ".tra("installed"); |
265 | - if (sizeof($matches)>2){ |
|
266 | - if ($matches[3]=="1" and $matches[4]=="1") { |
|
265 | + if (sizeof($matches) > 2) { |
|
266 | + if ($matches[3] == "1" and $matches[4] == "1") { |
|
267 | 267 | return $desc.tra(", CPU has hardware virtualization support and it is enabled"); |
268 | - } elseif ($matches[3]=="1" and $matches[4]=="0") { |
|
268 | + } elseif ($matches[3] == "1" and $matches[4] == "0") { |
|
269 | 269 | return $desc.tra(", CPU has hardware virtualization support but it is disabled"); |
270 | - } elseif ($matches[3]=="0") { |
|
270 | + } elseif ($matches[3] == "0") { |
|
271 | 271 | return $desc.tra(", CPU does not have hardware virtualization support"); |
272 | 272 | } |
273 | 273 | } else { |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | // Given string of the form [BOINC|vers][type|model|count|RAM|driver-vers][vbox|vers], |
282 | 282 | // return a human-readable version of the GPU info |
283 | 283 | // |
284 | -function gpu_desc($x, $detail=true) { |
|
284 | +function gpu_desc($x, $detail = true) { |
|
285 | 285 | $descs = explode("]", $x); |
286 | 286 | array_pop($descs); |
287 | 287 | $str = ""; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | if ($d[0] == "vbox") continue; |
294 | 294 | if (count($d) < 4) continue; |
295 | 295 | if ($str) $str .= "<p>"; |
296 | - if ($d[2]!="" && $d[2]!="1") $str .= "[".$d[2]."] "; |
|
296 | + if ($d[2] != "" && $d[2] != "1") $str .= "[".$d[2]."] "; |
|
297 | 297 | if ($d[0] == "CUDA") { |
298 | 298 | $str .= "NVIDIA"; |
299 | 299 | } else if ($d[0] == "CAL") { |
@@ -500,14 +500,14 @@ discard block |
||
500 | 500 | if ($pos1 === false) return $x; |
501 | 501 | $pos2 = strpos($model, ']'); |
502 | 502 | if ($pos2 === false) return $x; |
503 | - $a = substr($model, $pos1+1, $pos2-$pos1-1); |
|
503 | + $a = substr($model, $pos1 + 1, $pos2 - $pos1 - 1); |
|
504 | 504 | $y = explode(" ", $a); |
505 | 505 | if (count($y) == 0) return $x; |
506 | 506 | if ($y[0] == "Family") { |
507 | 507 | $x->info = $a; |
508 | 508 | } else { |
509 | 509 | $x->arch = $y[0]; |
510 | - $x->info = substr($a, strlen($y[0])+1); |
|
510 | + $x->info = substr($a, strlen($y[0]) + 1); |
|
511 | 511 | } |
512 | 512 | return $x; |
513 | 513 | } |
@@ -596,7 +596,7 @@ discard block |
||
596 | 596 | $avg_time = 0; |
597 | 597 | |
598 | 598 | $results = BoincResult::enum("hostid=$hostid order by received_time"); |
599 | - foreach($results as $result) { |
|
599 | + foreach ($results as $result) { |
|
600 | 600 | if ($result->granted_credit <= 0) continue; |
601 | 601 | $total += $result->granted_credit; |
602 | 602 | |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | |
690 | 690 | function link_url($sort, $rev, $show_all) { |
691 | 691 | global $userid; |
692 | - $x = $userid ? "&userid=$userid":""; |
|
692 | + $x = $userid ? "&userid=$userid" : ""; |
|
693 | 693 | return "hosts_user.php?sort=$sort&rev=$rev&show_all=$show_all$x"; |
694 | 694 | } |
695 | 695 | |
@@ -763,7 +763,7 @@ discard block |
||
763 | 763 | } |
764 | 764 | |
765 | 765 | function show_user_hosts($userid, $private, $show_all, $sort, $rev) { |
766 | - $desc = false; // whether the sort order's default is decreasing |
|
766 | + $desc = false; // whether the sort order's default is decreasing |
|
767 | 767 | switch ($sort) { |
768 | 768 | case "total_credit": $sort_clause = "total_credit"; $desc = true; break; |
769 | 769 | case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break; |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | more_or_less($sort, $rev, $show_all); |
787 | 787 | |
788 | 788 | $now = time(); |
789 | - $old_hosts=0; |
|
789 | + $old_hosts = 0; |
|
790 | 790 | $i = 1; |
791 | 791 | $hosts = BoincHost::enum("userid=$userid order by $sort_clause"); |
792 | 792 | $any_product_name = false; |
@@ -798,9 +798,9 @@ discard block |
||
798 | 798 | } |
799 | 799 | user_host_table_start($private, $sort, $rev, $show_all, $any_product_name); |
800 | 800 | foreach ($hosts as $host) { |
801 | - $is_old=false; |
|
801 | + $is_old = false; |
|
802 | 802 | if (($now - $host->rpc_time) > 30*86400) { |
803 | - $is_old=true; |
|
803 | + $is_old = true; |
|
804 | 804 | $old_hosts++; |
805 | 805 | } |
806 | 806 | if (!$show_all && $is_old) continue; |
@@ -809,7 +809,7 @@ discard block |
||
809 | 809 | } |
810 | 810 | end_table(); |
811 | 811 | |
812 | - if ($old_hosts>0) { |
|
812 | + if ($old_hosts > 0) { |
|
813 | 813 | more_or_less($sort, $rev, $show_all); |
814 | 814 | } |
815 | 815 | |
@@ -829,6 +829,6 @@ discard block |
||
829 | 829 | } |
830 | 830 | } |
831 | 831 | |
832 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
832 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
833 | 833 | |
834 | 834 | ?> |
@@ -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 | /* This function depends on sanitized HTML */ |
317 | 317 | // Build some regex (should be a *lot* faster) |
318 | 318 | $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si'; |
@@ -333,5 +333,5 @@ discard block |
||
333 | 333 | return str_ireplace($search, $replace, $text); |
334 | 334 | } |
335 | 335 | |
336 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
336 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
337 | 337 | ?> |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | $parent_post_id = 0; |
54 | 54 | } |
55 | 55 | |
56 | -if ($filter != "false"){ |
|
56 | +if ($filter != "false") { |
|
57 | 57 | $filter = true; |
58 | 58 | } else { |
59 | 59 | $filter = false; |
@@ -68,11 +68,11 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | $warning = null; |
71 | -if ($content && (!$preview)){ |
|
72 | - if (post_str('add_signature',true)=="add_it"){ |
|
73 | - $add_signature=true; // set a flag and concatenate later |
|
74 | - } else { |
|
75 | - $add_signature=false; |
|
71 | +if ($content && (!$preview)) { |
|
72 | + if (post_str('add_signature', true) == "add_it") { |
|
73 | + $add_signature = true; // set a flag and concatenate later |
|
74 | + } else { |
|
75 | + $add_signature = false; |
|
76 | 76 | } |
77 | 77 | check_tokens($logged_in_user->authenticator); |
78 | 78 | if (!akismet_check($logged_in_user, $content)) { |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | } |
92 | 92 | } |
93 | 93 | |
94 | -page_head(tra("Post to thread"),'','','', $bbcode_js); |
|
94 | +page_head(tra("Post to thread"), '', '', '', $bbcode_js); |
|
95 | 95 | |
96 | 96 | show_forum_header($logged_in_user); |
97 | 97 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | $x1 = tra("Message:").bbcode_info().post_warning(); |
146 | 146 | $x2 = ""; |
147 | 147 | if ($parent_post) { |
148 | - $x2 .=" ".tra("reply to %1 Message ID %2:", "<a href=#".$parent_post->id.">", " ".$parent_post->id."</a>"); |
|
148 | + $x2 .= " ".tra("reply to %1 Message ID %2:", "<a href=#".$parent_post->id.">", " ".$parent_post->id."</a>"); |
|
149 | 149 | } |
150 | 150 | $x2 .= "<form action=forum_reply.php?thread=".$thread->id; |
151 | 151 | |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | $x2 .= " method=\"post\" name=\"post\" onsubmit=\"return checkForm(this)\">\n"; |
157 | 157 | $x2 .= form_tokens($logged_in_user->authenticator); |
158 | 158 | $x2 .= start_table_str().$bbcode_html.end_table_str()."<textarea class=\"form-control\" name=\"content\" rows=\"18\">"; |
159 | - $no_quote = get_int("no_quote", true)==1; |
|
159 | + $no_quote = get_int("no_quote", true) == 1; |
|
160 | 160 | if ($preview) { |
161 | 161 | $x2 .= htmlspecialchars($content); |
162 | 162 | } else if (!$no_quote) { |
@@ -165,9 +165,9 @@ discard block |
||
165 | 165 | } |
166 | 166 | } |
167 | 167 | if (!$logged_in_user->prefs->no_signature_by_default) { |
168 | - $enable_signature='checked="true"'; |
|
168 | + $enable_signature = 'checked="true"'; |
|
169 | 169 | } else { |
170 | - $enable_signature=""; |
|
170 | + $enable_signature = ""; |
|
171 | 171 | } |
172 | 172 | $x2 .= sprintf('</textarea><p> </p> |
173 | 173 | <input class="btn btn-sm" %s type="submit" name="preview" value="%s"> |
@@ -191,11 +191,11 @@ discard block |
||
191 | 191 | return sprintf( |
192 | 192 | 'In reply to %s\'s message of %s: |
193 | 193 | [quote]%s[/quote]', |
194 | - $user?$user->name:'unknown user', |
|
194 | + $user ? $user->name : 'unknown user', |
|
195 | 195 | date_str($post->timestamp), |
196 | 196 | htmlspecialchars($post->content) |
197 | 197 | ); |
198 | 198 | } |
199 | 199 | |
200 | -$cvs_version_tracker[]="\$Id$"; |
|
200 | +$cvs_version_tracker[] = "\$Id$"; |
|
201 | 201 | ?> |
@@ -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 | |
@@ -811,9 +811,9 @@ discard block |
||
811 | 811 | function post_rules() { |
812 | 812 | if (defined('FORUM_RULES')) return FORUM_RULES; |
813 | 813 | if (function_exists("project_forum_post_rules")) { |
814 | - $project_rules=project_forum_post_rules(); |
|
814 | + $project_rules = project_forum_post_rules(); |
|
815 | 815 | } else { |
816 | - $project_rules=""; |
|
816 | + $project_rules = ""; |
|
817 | 817 | } |
818 | 818 | return sprintf(" |
819 | 819 | <ul> |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | ); |
843 | 843 | } |
844 | 844 | |
845 | -function post_warning($forum=null) { |
|
845 | +function post_warning($forum = null) { |
|
846 | 846 | $x = "<br><br> |
847 | 847 | <table><tr><td align=left> |
848 | 848 | "; |
@@ -902,7 +902,7 @@ discard block |
||
902 | 902 | $content = substr($content, 0, 64000); |
903 | 903 | $content = BoincDb::escape_string($content); |
904 | 904 | $now = time(); |
905 | - $sig = $signature?1:0; |
|
905 | + $sig = $signature ? 1 : 0; |
|
906 | 906 | $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)"); |
907 | 907 | if (!$id) { |
908 | 908 | $forum_error = "Failed to add post to DB."; |
@@ -922,7 +922,7 @@ discard block |
||
922 | 922 | // |
923 | 923 | function update_thread_timestamp($thread) { |
924 | 924 | $posts = BoincPost::enum("thread=$thread->id and hidden=0 order by timestamp desc limit 1"); |
925 | - if (count($posts)>0) { |
|
925 | + if (count($posts) > 0) { |
|
926 | 926 | $post = $posts[0]; |
927 | 927 | $thread->update("timestamp=$post->timestamp"); |
928 | 928 | } |
@@ -930,7 +930,7 @@ discard block |
||
930 | 930 | |
931 | 931 | function update_forum_timestamp($forum) { |
932 | 932 | $threads = BoincThread::enum("forum=$forum->id and hidden=0 order by timestamp desc limit 1"); |
933 | - if (count($threads)>0) { |
|
933 | + if (count($threads) > 0) { |
|
934 | 934 | $thread = $threads[0]; |
935 | 935 | $forum->update("timestamp=$thread->timestamp"); |
936 | 936 | } |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | if (is_news_forum($forum) && !$export) { |
954 | 954 | $status = 1; |
955 | 955 | } |
956 | - $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 | + $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)"); |
|
957 | 957 | if (!$id) { |
958 | 958 | $forum_error = "Failed to add thread to DB."; |
959 | 959 | return null; |
@@ -1081,22 +1081,22 @@ discard block |
||
1081 | 1081 | // $sticky - bool (not directly passed to SQL) |
1082 | 1082 | // |
1083 | 1083 | function get_forum_threads( |
1084 | - $forumID, $start=-1, $nRec=-1, $sort_style=MODIFIED_NEW, |
|
1084 | + $forumID, $start = -1, $nRec = -1, $sort_style = MODIFIED_NEW, |
|
1085 | 1085 | $show_hidden = 0, $sticky = 1 |
1086 | 1086 | ) { |
1087 | 1087 | //if (! (is_numeric($forumID) && is_numeric($min) && is_numeric($nRec))) { |
1088 | 1088 | // return NULL; // Something is wrong here. |
1089 | 1089 | //} |
1090 | 1090 | |
1091 | - $sql = 'forum = ' . $forumID ; |
|
1091 | + $sql = 'forum = '.$forumID; |
|
1092 | 1092 | $stickysql = ""; |
1093 | - if ($sticky){ |
|
1093 | + if ($sticky) { |
|
1094 | 1094 | $stickysql = "sticky DESC, "; |
1095 | 1095 | } |
1096 | 1096 | if (!$show_hidden) { |
1097 | 1097 | $sql .= ' AND hidden = 0'; |
1098 | 1098 | } |
1099 | - switch($sort_style) { |
|
1099 | + switch ($sort_style) { |
|
1100 | 1100 | case MODIFIED_NEW: |
1101 | 1101 | $sql .= ' ORDER BY '.$stickysql.'timestamp DESC'; |
1102 | 1102 | break; |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | if (!$show_hidden) { |
1150 | 1150 | $sql .= ' AND hidden = 0'; |
1151 | 1151 | } |
1152 | - switch($sort_style) { |
|
1152 | + switch ($sort_style) { |
|
1153 | 1153 | case CREATE_TIME_NEW: |
1154 | 1154 | $sql .= ' ORDER BY timestamp desc'; |
1155 | 1155 | break; |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | // |
1172 | 1172 | function show_post_moderation_links( |
1173 | 1173 | $config, $logged_in_user, $post, $forum, $tokens |
1174 | -){ |
|
1174 | +) { |
|
1175 | 1175 | $moderators_allowed_to_ban = parse_bool($config, "moderators_allowed_to_ban"); |
1176 | 1176 | $moderators_vote_to_ban = parse_bool($config, "moderators_vote_to_ban"); |
1177 | 1177 | |
@@ -1258,14 +1258,14 @@ discard block |
||
1258 | 1258 | // We do not tell the (ab)user how much this is - |
1259 | 1259 | // no need to make it easy for them to break the system. |
1260 | 1260 | // |
1261 | - if ($user->total_credit<$forum->post_min_total_credit || $user->expavg_credit<$forum->post_min_expavg_credit) { |
|
1261 | + if ($user->total_credit < $forum->post_min_total_credit || $user->expavg_credit < $forum->post_min_expavg_credit) { |
|
1262 | 1262 | 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)); |
1263 | 1263 | } |
1264 | 1264 | |
1265 | 1265 | // If the user is posting faster than forum regulations allow |
1266 | 1266 | // Tell the user to wait a while before creating any more posts |
1267 | 1267 | // |
1268 | - if (time()-$user->prefs->last_post <$forum->post_min_interval) { |
|
1268 | + if (time() - $user->prefs->last_post < $forum->post_min_interval) { |
|
1269 | 1269 | error_page(tra("You cannot create threads right now. Please wait before trying again. This is to protect against abuse of the system.")); |
1270 | 1270 | } |
1271 | 1271 | } |
@@ -1291,10 +1291,10 @@ discard block |
||
1291 | 1291 | // - edit their posts at any time |
1292 | 1292 | // - hide/unhide/move threads and posts |
1293 | 1293 | |
1294 | -function is_moderator($user, $forum=null) { |
|
1294 | +function is_moderator($user, $forum = null) { |
|
1295 | 1295 | if (!$user) return false; |
1296 | 1296 | BoincForumPrefs::lookup($user); |
1297 | - $type = $forum?$forum->parent_type:0; |
|
1297 | + $type = $forum ? $forum->parent_type : 0; |
|
1298 | 1298 | switch ($type) { |
1299 | 1299 | case 0: |
1300 | 1300 | if ($user->prefs->privilege(S_MODERATOR)) return true; |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | $owner = BoincUser::lookup_id($thread->owner); |
1333 | 1333 | if (!$owner) return; |
1334 | 1334 | echo "<tr><td>\n"; |
1335 | - switch($thread_forum->parent_type) { |
|
1335 | + switch ($thread_forum->parent_type) { |
|
1336 | 1336 | case 0: |
1337 | 1337 | $category = BoincCategory::lookup_id($thread_forum->category); |
1338 | 1338 | show_forum_title($category, $thread_forum, $thread, true); |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | break; |
1343 | 1343 | } |
1344 | 1344 | echo ' |
1345 | - </td><td class="numbers">'.($thread->replies+1).'</td> |
|
1345 | + </td><td class="numbers">'.($thread->replies + 1).'</td> |
|
1346 | 1346 | <td>'.user_links($owner).'</td> |
1347 | 1347 | <td class="numbers">'.$thread->views.'</td> |
1348 | 1348 | <td class="lastpost">'.time_diff_str($thread->timestamp, time()).'</td> |
@@ -1376,13 +1376,13 @@ discard block |
||
1376 | 1376 | |
1377 | 1377 | function subscribed_post_web_line($notify) { |
1378 | 1378 | $thread = BoincThread::lookup_id($notify->opaque); |
1379 | - return tra("New posts in the thread %1","<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1379 | + return tra("New posts in the thread %1", "<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1380 | 1380 | } |
1381 | 1381 | |
1382 | 1382 | function subscribe_rss($notify, &$title, &$msg, &$url) { |
1383 | 1383 | $thread = BoincThread::lookup_id($notify->opaque); |
1384 | 1384 | $title = tra("New posts in subscribed thread"); |
1385 | - $msg = tra("There are new posts in the thread '%1'",$thread->title); |
|
1385 | + $msg = tra("There are new posts in the thread '%1'", $thread->title); |
|
1386 | 1386 | $url = secure_url_base()."forum_thread.php?id=$thread->id"; |
1387 | 1387 | } |
1388 | 1388 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | return $x; |
50 | 50 | } |
51 | 51 | |
52 | -function pm_team_form($user, $teamid, $error=null) { |
|
52 | +function pm_team_form($user, $teamid, $error = null) { |
|
53 | 53 | global $bbcode_html, $bbcode_js; |
54 | 54 | $team = BoincTeam::lookup_id($teamid); |
55 | 55 | if (!$team) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | error_page("not admin"); |
60 | 60 | } |
61 | 61 | |
62 | - page_head(tra("Send message to team"),'','','', $bbcode_js); |
|
62 | + page_head(tra("Send message to team"), '', '', '', $bbcode_js); |
|
63 | 63 | |
64 | 64 | $subject = post_str("subject", true); |
65 | 65 | $content = post_str("content", true); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | function pm_form_page($replyto, $userid, $error = null) { |
112 | 112 | global $bbcode_html, $bbcode_js; |
113 | 113 | global $g_logged_in_user; |
114 | - page_head(tra("Send private message"),'','','', $bbcode_js); |
|
114 | + page_head(tra("Send private message"), '', '', '', $bbcode_js); |
|
115 | 115 | |
116 | 116 | if (post_str("preview", true) == tra("Preview")) { |
117 | 117 | $content = post_str("content", true); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | if (!$user) { |
136 | 136 | error_page("Sender no longer exists"); |
137 | 137 | } |
138 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
138 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
139 | 139 | $subject = $message->subject; |
140 | 140 | if (substr($subject, 0, 3) != "re:") { |
141 | 141 | $subject = "re: ".$subject; |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | if (!$user) { |
146 | 146 | error_page("Sender no longer exists"); |
147 | 147 | } |
148 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
148 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
149 | 149 | } else { |
150 | 150 | $writeto = sanitize_tags(post_str("to", true)); |
151 | 151 | $subject = post_str("subject", true); |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | function send_pm_notification_email( |
201 | 201 | $logged_in_user, $to_user, $subject, $content |
202 | 202 | ) { |
203 | - $message = " |
|
203 | + $message = " |
|
204 | 204 | You have received a new private message at ".PROJECT.". |
205 | 205 | |
206 | 206 | From: $logged_in_user->name (ID $logged_in_user->id) |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $pm = BoincPrivateMessage::lookup_id($notify->opaque); |
231 | 231 | $from_user = BoincUser::lookup_id($pm->senderid); |
232 | 232 | if (!$pm || !$from_user) return null; |
233 | - return "<a href=pm.php>".tra("Private message%1 from %2, subject:" , "</a>", $from_user->name )." $pm->subject"; |
|
233 | + return "<a href=pm.php>".tra("Private message%1 from %2, subject:", "</a>", $from_user->name)." $pm->subject"; |
|
234 | 234 | } |
235 | 235 | |
236 | 236 | function pm_send_msg($from_user, $to_user, $subject, $content, $send_email) { |
@@ -294,11 +294,11 @@ discard block |
||
294 | 294 | |
295 | 295 | function pm_email_remind($user) { |
296 | 296 | if (!$user->prefs->pm_notification) { |
297 | - return "<br><small>" . |
|
297 | + return "<br><small>". |
|
298 | 298 | tra( |
299 | 299 | "For email notification, %1 edit community prefs %2", |
300 | 300 | '<a href="edit_forum_preferences_form.php">', '</a>' |
301 | - ) . |
|
301 | + ). |
|
302 | 302 | "</small>" |
303 | 303 | ; |
304 | 304 | } |
@@ -324,5 +324,5 @@ discard block |
||
324 | 324 | } |
325 | 325 | } |
326 | 326 | |
327 | -$cvs_version_tracker[]="\$Id: pm.inc 14019 2007-11-01 23:04:39Z davea $"; |
|
327 | +$cvs_version_tracker[] = "\$Id: pm.inc 14019 2007-11-01 23:04:39Z davea $"; |
|
328 | 328 | ?> |