@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | return $x; |
49 | 49 | } |
50 | 50 | |
51 | -function pm_team_form($user, $teamid, $error=null) { |
|
51 | +function pm_team_form($user, $teamid, $error = null) { |
|
52 | 52 | global $bbcode_html, $bbcode_js; |
53 | 53 | $team = BoincTeam::lookup_id($teamid); |
54 | 54 | if (!$team) { |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | error_page("not admin"); |
59 | 59 | } |
60 | 60 | |
61 | - page_head(tra("Send message to team"),'','','', $bbcode_js); |
|
61 | + page_head(tra("Send message to team"), '', '', '', $bbcode_js); |
|
62 | 62 | |
63 | 63 | $subject = post_str("subject", true); |
64 | 64 | $content = post_str("content", true); |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | function pm_form($replyto, $userid, $error = null) { |
103 | 103 | global $bbcode_html, $bbcode_js; |
104 | 104 | global $g_logged_in_user; |
105 | - page_head(tra("Send private message"),'','','', $bbcode_js); |
|
105 | + page_head(tra("Send private message"), '', '', '', $bbcode_js); |
|
106 | 106 | |
107 | 107 | if (post_str("preview", true) == tra("Preview")) { |
108 | 108 | $content = post_str("content", true); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | if (!$user) { |
127 | 127 | error_page("Sender no longer exists"); |
128 | 128 | } |
129 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
129 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
130 | 130 | $subject = $message->subject; |
131 | 131 | if (substr($subject, 0, 3) != "re:") { |
132 | 132 | $subject = "re: ".$subject; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | if (!$user) { |
137 | 137 | error_page("Sender no longer exists"); |
138 | 138 | } |
139 | - $writeto = UNIQUE_USER_NAME?$user->name:$userid." (".$user->name.")"; |
|
139 | + $writeto = UNIQUE_USER_NAME ? $user->name : $userid." (".$user->name.")"; |
|
140 | 140 | } else { |
141 | 141 | $writeto = sanitize_tags(post_str("to", true)); |
142 | 142 | $subject = post_str("subject", true); |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | function send_pm_notification_email( |
190 | 190 | $logged_in_user, $to_user, $subject, $content |
191 | 191 | ) { |
192 | - $message = " |
|
192 | + $message = " |
|
193 | 193 | You have received a new private message at ".PROJECT.". |
194 | 194 | |
195 | 195 | From: $logged_in_user->name (ID $logged_in_user->id) |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $pm = BoincPrivateMessage::lookup_id($notify->opaque); |
220 | 220 | $from_user = BoincUser::lookup_id($pm->senderid); |
221 | 221 | if (!$pm || !$from_user) return null; |
222 | - return "<a href=pm.php>".tra("Private message%1 from %2, subject:" , "</a>", $from_user->name )." $pm->subject"; |
|
222 | + return "<a href=pm.php>".tra("Private message%1 from %2, subject:", "</a>", $from_user->name)." $pm->subject"; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | function pm_send_msg($from_user, $to_user, $subject, $content, $send_email) { |
@@ -283,11 +283,11 @@ discard block |
||
283 | 283 | |
284 | 284 | function pm_email_remind($user) { |
285 | 285 | if (!$user->prefs->pm_notification) { |
286 | - return "<br><small>" . |
|
286 | + return "<br><small>". |
|
287 | 287 | tra( |
288 | 288 | "For email notification, %1 edit community prefs %2", |
289 | 289 | '<a href="edit_forum_preferences_form.php">', '</a>' |
290 | - ) . |
|
290 | + ). |
|
291 | 291 | "</small>" |
292 | 292 | ; |
293 | 293 | } |
@@ -313,5 +313,5 @@ discard block |
||
313 | 313 | } |
314 | 314 | } |
315 | 315 | |
316 | -$cvs_version_tracker[]="\$Id: pm.inc 14019 2007-11-01 23:04:39Z davea $"; |
|
316 | +$cvs_version_tracker[] = "\$Id: pm.inc 14019 2007-11-01 23:04:39Z davea $"; |
|
317 | 317 | ?> |
@@ -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 | } |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | |
1294 | 1294 | function is_moderator($user, $forum) { |
1295 | 1295 | if (!$user) return false; |
1296 | - $type = $forum?$forum->parent_type:0; |
|
1296 | + $type = $forum ? $forum->parent_type : 0; |
|
1297 | 1297 | switch ($type) { |
1298 | 1298 | case 0: |
1299 | 1299 | if ($user->prefs->privilege(S_MODERATOR)) return true; |
@@ -1331,7 +1331,7 @@ discard block |
||
1331 | 1331 | $owner = BoincUser::lookup_id($thread->owner); |
1332 | 1332 | if (!$owner) return; |
1333 | 1333 | echo "<tr><td>\n"; |
1334 | - switch($thread_forum->parent_type) { |
|
1334 | + switch ($thread_forum->parent_type) { |
|
1335 | 1335 | case 0: |
1336 | 1336 | $category = BoincCategory::lookup_id($thread_forum->category); |
1337 | 1337 | show_forum_title($category, $thread_forum, $thread, true); |
@@ -1341,7 +1341,7 @@ discard block |
||
1341 | 1341 | break; |
1342 | 1342 | } |
1343 | 1343 | echo ' |
1344 | - </td><td class="numbers">'.($thread->replies+1).'</td> |
|
1344 | + </td><td class="numbers">'.($thread->replies + 1).'</td> |
|
1345 | 1345 | <td>'.user_links($owner).'</td> |
1346 | 1346 | <td class="numbers">'.$thread->views.'</td> |
1347 | 1347 | <td class="lastpost">'.time_diff_str($thread->timestamp, time()).'</td> |
@@ -1375,13 +1375,13 @@ discard block |
||
1375 | 1375 | |
1376 | 1376 | function subscribed_post_web_line($notify) { |
1377 | 1377 | $thread = BoincThread::lookup_id($notify->opaque); |
1378 | - return tra("New posts in the thread %1","<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1378 | + return tra("New posts in the thread %1", "<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1379 | 1379 | } |
1380 | 1380 | |
1381 | 1381 | function subscribe_rss($notify, &$title, &$msg, &$url) { |
1382 | 1382 | $thread = BoincThread::lookup_id($notify->opaque); |
1383 | 1383 | $title = tra("New posts in subscribed thread"); |
1384 | - $msg = tra("There are new posts in the thread '%1'",$thread->title); |
|
1384 | + $msg = tra("There are new posts in the thread '%1'", $thread->title); |
|
1385 | 1385 | $url = secure_url_base()."forum_thread.php?id=$thread->id"; |
1386 | 1386 | } |
1387 | 1387 |
@@ -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 |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | if (!NO_STATS) { |
174 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
174 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
175 | 175 | $x = ""; |
176 | 176 | shuffle($cpid_stats_sites); |
177 | 177 | foreach ($cpid_stats_sites as $site) { |
@@ -255,7 +255,7 @@ discard block |
||
255 | 255 | $u = normalize_user_url($user->url); |
256 | 256 | row2( |
257 | 257 | tra("URL"), |
258 | - $u?sprintf('<a href="%s">%s</a>', $u, $u):tra('Invalid URL') |
|
258 | + $u ?sprintf('<a href="%s">%s</a>', $u, $u) : tra('Invalid URL') |
|
259 | 259 | ); |
260 | 260 | } |
261 | 261 | if (USER_COUNTRY) { |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | // if $badge_height is > 0, show badges |
368 | 368 | // if $name_limit, limit name to N chars |
369 | 369 | // |
370 | -function user_links($user, $badge_height=0, $name_limit=0) { |
|
370 | +function user_links($user, $badge_height = 0, $name_limit = 0) { |
|
371 | 371 | BoincForumPrefs::lookup($user); |
372 | 372 | if (is_banished($user)) { |
373 | 373 | return "(banished: ID $user->id)"; |
@@ -395,13 +395,13 @@ discard block |
||
395 | 395 | $user->id, |
396 | 396 | $name |
397 | 397 | ); |
398 | - if (function_exists("project_user_links")){ |
|
398 | + if (function_exists("project_user_links")) { |
|
399 | 399 | $x .= project_user_links($user); |
400 | 400 | } |
401 | 401 | if ($badge_height) { |
402 | 402 | $x .= badges_string(true, $user, $badge_height); |
403 | 403 | } |
404 | - return $name_limit?"<nobr>$x</nobr>":$x; |
|
404 | + return $name_limit ? "<nobr>$x</nobr>" : $x; |
|
405 | 405 | } |
406 | 406 | |
407 | 407 | function show_community_private($user) { |
@@ -448,7 +448,7 @@ discard block |
||
448 | 448 | |
449 | 449 | // if there's a foundership request, notify the founder |
450 | 450 | // |
451 | - if ($user->id==$team->userid && $team->ping_user >0) { |
|
451 | + if ($user->id == $team->userid && $team->ping_user > 0) { |
|
452 | 452 | $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>"; |
453 | 453 | } |
454 | 454 | row2(tra("Member of team"), $x); |
@@ -472,7 +472,7 @@ discard block |
||
472 | 472 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
473 | 473 | $x = ''; |
474 | 474 | if ($friends) { |
475 | - foreach($friends as $friend) { |
|
475 | + foreach ($friends as $friend) { |
|
476 | 476 | $fuser = BoincUser::lookup_id($friend->user_dest); |
477 | 477 | if (!$fuser) continue; |
478 | 478 | $x .= friend_links($fuser); |
@@ -519,7 +519,7 @@ discard block |
||
519 | 519 | // Returns a cacheable community links data object |
520 | 520 | // @param user The user to produce a community links object for |
521 | 521 | |
522 | -function get_community_links_object($user){ |
|
522 | +function get_community_links_object($user) { |
|
523 | 523 | $cache_object = new StdClass; |
524 | 524 | $cache_object->post_count = total_posts($user); |
525 | 525 | $cache_object->user = $user; |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | $cache_object->friends = array(); |
528 | 528 | |
529 | 529 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
530 | - foreach($friends as $friend) { |
|
530 | + foreach ($friends as $friend) { |
|
531 | 531 | $fuser = BoincUser::lookup_id($friend->user_dest); |
532 | 532 | if (!$fuser) continue; |
533 | 533 | $cache_object->friends[] = $fuser; |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | |
538 | 538 | // show community links of another user (described by $clo) |
539 | 539 | // |
540 | -function community_links($clo, $logged_in_user){ |
|
540 | +function community_links($clo, $logged_in_user) { |
|
541 | 541 | $user = $clo->user; |
542 | 542 | $team = $clo->team; |
543 | 543 | $friends = $clo->friends; |
@@ -563,15 +563,15 @@ discard block |
||
563 | 563 | "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>" |
564 | 564 | ); |
565 | 565 | } else if ($friend) { |
566 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
566 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
567 | 567 | } else { |
568 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
568 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
572 | 572 | if ($friends) { |
573 | 573 | $x = ''; |
574 | - foreach($friends as $friend) { |
|
574 | + foreach ($friends as $friend) { |
|
575 | 575 | $x .= friend_links($friend); |
576 | 576 | } |
577 | 577 | row2(tra('Friends'), $x); |
@@ -615,6 +615,6 @@ discard block |
||
615 | 615 | } |
616 | 616 | |
617 | 617 | |
618 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
618 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
619 | 619 | |
620 | 620 | ?> |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | if ($notify) { |
39 | 39 | page_head(tra("Request pending")); |
40 | 40 | $t = date_str($friend->create_time); |
41 | - echo tra("You requested friendship with %1 on %2.", $destuser->name,$t) . " |
|
41 | + echo tra("You requested friendship with %1 on %2.", $destuser->name, $t)." |
|
42 | 42 | <p>" . |
43 | 43 | tra("This request is still pending confirmation."); |
44 | 44 | page_tail(); |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | function check_ignoring($srcuser, $destuser) { |
52 | 52 | BoincForumPrefs::lookup($destuser); |
53 | 53 | if (is_ignoring($destuser, $srcuser)) { |
54 | - error_page(tra("%1 is not accepting friendship requests from you",$destuser->name)); |
|
54 | + error_page(tra("%1 is not accepting friendship requests from you", $destuser->name)); |
|
55 | 55 | } |
56 | 56 | } |
57 | 57 | |
@@ -72,11 +72,11 @@ discard block |
||
72 | 72 | echo " |
73 | 73 | <form method=post action=friend.php> |
74 | 74 | <input type=hidden name=userid value=$destid> |
75 | - <input type=hidden name=action value=add_confirm>" . |
|
75 | + <input type=hidden name=action value=add_confirm>". |
|
76 | 76 | tra("You have asked to add %1 as a friend. We will notify %1 and will ask him/her to confirm that you are friends.", |
77 | - "<b>".$destuser->name."</b>") ." |
|
77 | + "<b>".$destuser->name."</b>")." |
|
78 | 78 | <p>" . |
79 | - tra("Add an optional message here:") ." |
|
79 | + tra("Add an optional message here:")." |
|
80 | 80 | <br> |
81 | 81 | ".textarea_with_counter("message", 250, "")." |
82 | 82 | <p> |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | send_friend_request_email($user, $destuser, $msg); |
116 | 116 | } |
117 | 117 | page_head(tra("Friend request sent")); |
118 | - echo tra("We have notified %1 of your request.","<b>".$destuser->name."</b>"); |
|
118 | + echo tra("We have notified %1 of your request.", "<b>".$destuser->name."</b>"); |
|
119 | 119 | page_tail(); |
120 | 120 | } |
121 | 121 | |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | } |
197 | 197 | |
198 | 198 | page_head(tra("Friendship confirmed")); |
199 | - echo tra("Your friendship with %1 has been confirmed.","<b>" . $srcuser->name ."</b>"); |
|
199 | + echo tra("Your friendship with %1 has been confirmed.", "<b>".$srcuser->name."</b>"); |
|
200 | 200 | page_tail(); |
201 | 201 | } |
202 | 202 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | $notify->delete(); |
216 | 216 | } |
217 | 217 | page_head(tra("Friendship declined")); |
218 | - echo tra("You have declined friendship with %1","<b>".$srcuser->name."</b>"); |
|
218 | + echo tra("You have declined friendship with %1", "<b>".$srcuser->name."</b>"); |
|
219 | 219 | page_tail(); |
220 | 220 | } |
221 | 221 | |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | echo tra("Notification not found"); |
234 | 234 | } |
235 | 235 | page_head(tra("Friend confirmed")); |
236 | - echo tra("You are now friends with %1.",$destuser->name); |
|
236 | + echo tra("You are now friends with %1.", $destuser->name); |
|
237 | 237 | page_tail(); |
238 | 238 | } |
239 | 239 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | echo |
246 | 246 | tra("Are you sure you want to cancel your friendship with %1?", |
247 | 247 | $destuser->name |
248 | - ) ."<p>\n" |
|
248 | + )."<p>\n" |
|
249 | 249 | ; |
250 | 250 | show_button("friend.php?action=cancel&userid=$destid", tra("Yes"), tra("Cancel friendship")); |
251 | 251 | show_button(HOME_PAGE, tra("No"), tra("Stay friends")); |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | if (!$destuser) error_page("No such user"); |
260 | 260 | BoincFriend::delete($user->id, $destid); |
261 | 261 | page_head(tra("Friendship cancelled")); |
262 | - echo tra("Your friendship with %1 has been cancelled.",$destuser->name); |
|
262 | + echo tra("Your friendship with %1 has been cancelled.", $destuser->name); |
|
263 | 263 | page_tail(); |
264 | 264 | } |
265 | 265 |
@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | // ------------ Notification ----------- |
39 | 39 | |
40 | 40 | row1(tra("Notifications")); |
41 | -$ch0 = $user->prefs->pm_notification==0?"checked":""; |
|
42 | -$ch1 = $user->prefs->pm_notification==1?"checked":""; |
|
43 | -$ch2 = $user->prefs->pm_notification==2?"checked":""; |
|
41 | +$ch0 = $user->prefs->pm_notification == 0 ? "checked" : ""; |
|
42 | +$ch1 = $user->prefs->pm_notification == 1 ? "checked" : ""; |
|
43 | +$ch2 = $user->prefs->pm_notification == 2 ? "checked" : ""; |
|
44 | 44 | row2( |
45 | 45 | tra("How should we notify you of new private messages, friend requests, posts in subscribed threads, and other events?"), |
46 | 46 | "<input type=radio name=pm_notification value=0 $ch0> ".tra("On my Account page (no email)")." |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | // ------------ Forum identity ----------- |
54 | 54 | |
55 | 55 | $select_0 = $select_1 = $select_2 = ""; |
56 | -if (strlen($user->prefs->avatar)){ |
|
57 | - if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar |
|
56 | +if (strlen($user->prefs->avatar)) { |
|
57 | + if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18) == "//www.gravatar.com") { // Gravatar |
|
58 | 58 | $select_1 = "checked=\"true\""; |
59 | 59 | } else { |
60 | 60 | $select_2 = "checked=\"true\""; |
@@ -73,15 +73,15 @@ discard block |
||
73 | 73 | <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2."> |
74 | 74 | <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">" |
75 | 75 | ); |
76 | -if (strlen($user->prefs->avatar)){ |
|
76 | +if (strlen($user->prefs->avatar)) { |
|
77 | 77 | row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>", |
78 | 78 | "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">"); |
79 | 79 | } |
80 | 80 | |
81 | -$signature_by_default = $user->prefs->no_signature_by_default==false?"checked=\"checked\"":""; |
|
81 | +$signature_by_default = $user->prefs->no_signature_by_default == false ? "checked=\"checked\"" : ""; |
|
82 | 82 | |
83 | -$signature=$user->prefs->signature; |
|
84 | -$maxlen=250; |
|
83 | +$signature = $user->prefs->signature; |
|
84 | +$maxlen = 250; |
|
85 | 85 | $x = ''; |
86 | 86 | if (!NO_COMPUTING) { |
87 | 87 | $x = tra( |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | tra("Attach signature by default") |
104 | 104 | ) |
105 | 105 | ); |
106 | -if ($user->prefs->signature!=""){ |
|
106 | +if ($user->prefs->signature != "") { |
|
107 | 107 | row2(tra("Signature preview"). |
108 | 108 | "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>", |
109 | 109 | output_transform($user->prefs->signature) |
@@ -112,13 +112,13 @@ discard block |
||
112 | 112 | |
113 | 113 | // ------------ Message display ----------- |
114 | 114 | |
115 | -$forum_hide_avatars = $user->prefs->hide_avatars?"checked=\"checked\"":""; |
|
116 | -$forum_hide_signatures = $user->prefs->hide_signatures?"checked=\"checked\"":""; |
|
117 | -$forum_link_popup = $user->prefs->link_popup?"checked=\"checked\"":""; |
|
118 | -$forum_image_as_link = $user->prefs->images_as_links?"checked=\"checked\"":""; |
|
119 | -$forum_jump_to_unread = $user->prefs->jump_to_unread?"checked=\"checked\"":""; |
|
120 | -$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts?"checked=\"checked\"":""; |
|
121 | -$forum_highlight_special = $user->prefs->highlight_special?"checked=\"checked\"":""; |
|
115 | +$forum_hide_avatars = $user->prefs->hide_avatars ? "checked=\"checked\"" : ""; |
|
116 | +$forum_hide_signatures = $user->prefs->hide_signatures ? "checked=\"checked\"" : ""; |
|
117 | +$forum_link_popup = $user->prefs->link_popup ? "checked=\"checked\"" : ""; |
|
118 | +$forum_image_as_link = $user->prefs->images_as_links ? "checked=\"checked\"" : ""; |
|
119 | +$forum_jump_to_unread = $user->prefs->jump_to_unread ? "checked=\"checked\"" : ""; |
|
120 | +$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts ? "checked=\"checked\"" : ""; |
|
121 | +$forum_highlight_special = $user->prefs->highlight_special ? "checked=\"checked\"" : ""; |
|
122 | 122 | |
123 | 123 | $forum_minimum_wrap_postcount = intval($user->prefs->minimum_wrap_postcount); |
124 | 124 | $forum_display_wrap_postcount = intval($user->prefs->display_wrap_postcount); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | <input class="btn btn-default" type="submit" name="remove%d" value="%s"> |
165 | 165 | <br> |
166 | 166 | ', |
167 | - UNIQUE_USER_NAME?'':"$blocked_user->id -", |
|
167 | + UNIQUE_USER_NAME ? '' : "$blocked_user->id -", |
|
168 | 168 | user_links($blocked_user), |
169 | 169 | $blocked_user->id, |
170 | 170 | tra("Unblock") |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | tra("Blocked users"), |
179 | 179 | tra('Ignore message board posts and private messages from these users.') |
180 | 180 | ), |
181 | - $blocked_str?$blocked_str:'---' |
|
181 | + $blocked_str ? $blocked_str : '---' |
|
182 | 182 | ); |
183 | 183 | row2( |
184 | 184 | tra('Block user'), |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | <input type="text" name="forum_filter_user" size=12> |
189 | 189 | <input class="btn btn-default" type="submit" name="add_user_to_filter" value="%s"> |
190 | 190 | ', |
191 | - UNIQUE_USER_NAME?tra('User name'):tra('User ID (For instance: 123456789)'), |
|
191 | + UNIQUE_USER_NAME ?tra('User name') : tra('User ID (For instance: 123456789)'), |
|
192 | 192 | tra("Block") |
193 | 193 | ) |
194 | 194 | ); |
@@ -206,5 +206,5 @@ discard block |
||
206 | 206 | end_table(); |
207 | 207 | page_tail(); |
208 | 208 | |
209 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
209 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
210 | 210 | ?> |
@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | mkdir("../cache", 0770); |
33 | 33 | chmod("../cache", 0770); |
34 | 34 | } |
35 | - for ($i=0;$i<256;$i++) { |
|
36 | - $j=sprintf("%02x",$i); |
|
35 | + for ($i = 0; $i < 256; $i++) { |
|
36 | + $j = sprintf("%02x", $i); |
|
37 | 37 | if (!@filemtime("../cache/$j")) { |
38 | 38 | mkdir("../cache/$j", 0770); |
39 | 39 | chmod("../cache/$j", 0770); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | -function get_path($params, $phpfile=null) { |
|
44 | +function get_path($params, $phpfile = null) { |
|
45 | 45 | if (!@filemtime("../cache/00")) make_cache_dirs(); |
46 | 46 | if ($phpfile) { |
47 | 47 | $z = $phpfile; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | // add a layer of subdirectories for reducing file lookup time |
54 | - $sz = substr(md5($z."_".urlencode($params)),1,2); |
|
54 | + $sz = substr(md5($z."_".urlencode($params)), 1, 2); |
|
55 | 55 | $path = "../cache/".$sz."/".$z; |
56 | 56 | if ($params) { |
57 | 57 | $path = $path."_".urlencode($params); |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | function disk_usage($dir) { |
63 | - $usage=0; |
|
64 | - if ($handle=@opendir($dir)) { |
|
65 | - while ($file=readdir($handle)) { |
|
63 | + $usage = 0; |
|
64 | + if ($handle = @opendir($dir)) { |
|
65 | + while ($file = readdir($handle)) { |
|
66 | 66 | if (($file != ".") && ($file != "..")) { |
67 | 67 | if (@is_dir($dir."/".$file)) { |
68 | - $usage+=disk_usage($dir."/".$file); |
|
68 | + $usage += disk_usage($dir."/".$file); |
|
69 | 69 | } else { |
70 | - $usage+=@filesize($dir."/".$file); |
|
70 | + $usage += @filesize($dir."/".$file); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | if (!chdir($dir)) { |
82 | 82 | return; |
83 | 83 | } |
84 | - if ($handle=@opendir(".")) { |
|
85 | - while ($file=readdir($handle)) { |
|
84 | + if ($handle = @opendir(".")) { |
|
85 | + while ($file = readdir($handle)) { |
|
86 | 86 | if ($file == ".") continue; |
87 | 87 | if ($file == "..") continue; |
88 | 88 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if (@is_dir($file)) { |
94 | 94 | clean_cache($max_age, $file); |
95 | 95 | } else { |
96 | - if ((time()-@filemtime($file))>$max_age) { |
|
96 | + if ((time() - @filemtime($file)) > $max_age) { |
|
97 | 97 | //echo "unlinking ".getcwd()."/$file\n"; |
98 | 98 | @unlink($file); |
99 | 99 | } |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | |
108 | 108 | // check cache size every once in a while, purge if too big |
109 | 109 | // |
110 | -function cache_check_diskspace(){ |
|
111 | - if ((rand() % CACHE_SIZE_CHECK_FREQ)) return; |
|
110 | +function cache_check_diskspace() { |
|
111 | + if ((rand()%CACHE_SIZE_CHECK_FREQ)) return; |
|
112 | 112 | if (disk_usage("../cache") < MAX_CACHE_USAGE) return; |
113 | 113 | $x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL, |
114 | 114 | USER_PROFILE_TTL, TOP_PAGES_TTL, INDEX_PAGE_TTL |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | clean_cache($x, "../cache"); |
117 | 117 | } |
118 | 118 | |
119 | -function cache_need_to_regenerate($path, $max_age){ |
|
119 | +function cache_need_to_regenerate($path, $max_age) { |
|
120 | 120 | $regenerate = false; |
121 | 121 | $request = apache_request_headers(); |
122 | 122 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | // and touch the cached copy so other processes |
129 | 129 | // don't regenerate at the same time |
130 | 130 | // |
131 | - if ($lastmodified<time()-$max_age) { |
|
131 | + if ($lastmodified < time() - $max_age) { |
|
132 | 132 | $regenerate = true; |
133 | 133 | @touch($path); |
134 | 134 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | // Returns cached data or false if nothing was found |
142 | -function get_cached_data($max_age, $params=""){ |
|
142 | +function get_cached_data($max_age, $params = "") { |
|
143 | 143 | global $no_cache; |
144 | 144 | |
145 | 145 | if ($no_cache) return; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | } else { |
157 | 157 | cache_check_diskspace(); |
158 | - $regenerate=cache_need_to_regenerate($path, $max_age); |
|
158 | + $regenerate = cache_need_to_regenerate($path, $max_age); |
|
159 | 159 | if (!$regenerate) { |
160 | 160 | return file_get_contents($path); |
161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | // DEPRECATED |
168 | -function start_cache($max_age, $params=""){ |
|
168 | +function start_cache($max_age, $params = "") { |
|
169 | 169 | global $no_cache, $caching, $memcache; |
170 | 170 | |
171 | 171 | if ($no_cache) return; |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | $regenerate = cache_need_to_regenerate($path, $max_age); |
189 | 189 | } |
190 | 190 | //Is the stored version too old, do we need to regenerate it? |
191 | - if ($regenerate){ |
|
191 | + if ($regenerate) { |
|
192 | 192 | // If cached version is too old (or non-existent) |
193 | 193 | // generate the page and write to cache |
194 | 194 | // |
195 | 195 | ob_start(); |
196 | 196 | ob_implicit_flush(0); |
197 | - Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
198 | - Header("Expires: " . gmdate("D, d M Y H:i:s",time()+$max_age) . " GMT"); |
|
199 | - Header("Cache-Control: public, max-age=" . $max_age); |
|
197 | + Header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
198 | + Header("Expires: ".gmdate("D, d M Y H:i:s", time() + $max_age)." GMT"); |
|
199 | + Header("Cache-Control: public, max-age=".$max_age); |
|
200 | 200 | |
201 | 201 | // allow the calling page to see cache period |
202 | 202 | // |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | if (strstr($params, "format=xml")) { |
209 | 209 | header('Content-type: text/xml'); |
210 | 210 | } |
211 | - Header("Last-Modified: " . gmdate("D, d M Y H:i:s",$lastmodified) . " GMT"); |
|
212 | - Header("Expires: " . gmdate("D, d M Y H:i:s",$lastmodified+$max_age) . " GMT"); |
|
213 | - Header("Cache-Control: public, max-age=" . $max_age ); |
|
211 | + Header("Last-Modified: ".gmdate("D, d M Y H:i:s", $lastmodified)." GMT"); |
|
212 | + Header("Expires: ".gmdate("D, d M Y H:i:s", $lastmodified + $max_age)." GMT"); |
|
213 | + Header("Cache-Control: public, max-age=".$max_age); |
|
214 | 214 | if ($cache && $cache->content) { |
215 | 215 | echo $cache->content; |
216 | 216 | exit; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | // write output buffer both to client and to cache |
230 | 230 | // DEPRECATED |
231 | -function end_cache($max_age,$params=""){ |
|
231 | +function end_cache($max_age, $params = "") { |
|
232 | 232 | global $no_cache; |
233 | 233 | if ($no_cache) return; |
234 | 234 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | -function set_cached_data($max_age, $data, $params=""){ |
|
256 | +function set_cached_data($max_age, $data, $params = "") { |
|
257 | 257 | // for the benefit of hackers |
258 | 258 | if (strstr($params, "..")) { |
259 | 259 | return "bad params"; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | $server_arr = array(); |
297 | 297 | $servers = explode('|', MEMCACHE_SERVERS); |
298 | - foreach($servers as &$server) { |
|
298 | + foreach ($servers as &$server) { |
|
299 | 299 | list($ip, $port, $weight) = explode(':', $server); |
300 | 300 | if (!$port) { $port = 11211; } |
301 | 301 | $server_arr[] = array($ip, $port, $weight); |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | if ($offset === false) $offset = 0; |
85 | 85 | if ($offset >= $nmsgs) $offset = 0; |
86 | 86 | echo sprintf('Showing messages %d to %d of %d', |
87 | - $offset+1, |
|
88 | - min($offset+$nshow, $nmsgs), |
|
87 | + $offset + 1, |
|
88 | + min($offset + $nshow, $nmsgs), |
|
89 | 89 | $nmsgs |
90 | 90 | ); |
91 | 91 | if ($offset) { |
92 | 92 | echo sprintf( |
93 | 93 | ' · <a href=pm.php?action=inbox&offset=%d>Previous %d</a>', |
94 | - max(0, $offset-$nshow), $nshow |
|
94 | + max(0, $offset - $nshow), $nshow |
|
95 | 95 | ); |
96 | 96 | } |
97 | - if ($offset+$nshow < $nmsgs) { |
|
97 | + if ($offset + $nshow < $nmsgs) { |
|
98 | 98 | echo sprintf( |
99 | 99 | ' · <a href=pm.php?action=inbox&offset=%d>Next %d</a>', |
100 | - $offset+$nshow, $nshow |
|
100 | + $offset + $nshow, $nshow |
|
101 | 101 | ); |
102 | 102 | } |
103 | 103 | } |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | array('style="width: 12em;"', 'style="width: 10em;"', "") |
113 | 113 | ); |
114 | 114 | $i = 0; |
115 | - foreach($msgs as $msg) { |
|
116 | - if ($i<$offset) { |
|
115 | + foreach ($msgs as $msg) { |
|
116 | + if ($i < $offset) { |
|
117 | 117 | $i++; |
118 | 118 | continue; |
119 | 119 | } |
120 | - if ($i>=$offset+$nshow) break; |
|
120 | + if ($i >= $offset + $nshow) break; |
|
121 | 121 | $i++; |
122 | 122 | $sender = BoincUser::lookup_id($msg->senderid); |
123 | 123 | if (!$sender) { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $msgs = BoincPrivateMessage::enum( |
366 | 366 | "userid=$logged_in_user->id" |
367 | 367 | ); |
368 | - foreach($msgs as $msg) { |
|
368 | + foreach ($msgs as $msg) { |
|
369 | 369 | $x = "pm_select_$msg->id"; |
370 | 370 | if (post_str($x, true)) { |
371 | 371 | $msg = BoincPrivateMessage::lookup_id($msg->id); |
@@ -420,5 +420,5 @@ discard block |
||
420 | 420 | error_page(tra("Unknown action")); |
421 | 421 | } |
422 | 422 | |
423 | -$cvs_version_tracker[]="\$Id: pm.php 14077 2007-11-03 04:26:47Z davea $"; |
|
423 | +$cvs_version_tracker[] = "\$Id: pm.php 14077 2007-11-03 04:26:47Z davea $"; |
|
424 | 424 | ?> |