@@ -53,8 +53,9 @@ 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") { |
|
58 | +// Gravatar |
|
58 | 59 | $select_1 = "checked=\"true\""; |
59 | 60 | } else { |
60 | 61 | $select_2 = "checked=\"true\""; |
@@ -73,7 +74,7 @@ discard block |
||
73 | 74 | <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2."> |
74 | 75 | <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">" |
75 | 76 | ); |
76 | -if (strlen($user->prefs->avatar)){ |
|
77 | +if (strlen($user->prefs->avatar)) { |
|
77 | 78 | row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>", |
78 | 79 | "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">"); |
79 | 80 | } |
@@ -103,7 +104,7 @@ discard block |
||
103 | 104 | tra("Attach signature by default") |
104 | 105 | ) |
105 | 106 | ); |
106 | -if ($user->prefs->signature!=""){ |
|
107 | +if ($user->prefs->signature!="") { |
|
107 | 108 | row2(tra("Signature preview"). |
108 | 109 | "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>", |
109 | 110 | output_transform($user->prefs->signature) |
@@ -407,7 +407,7 @@ 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) { |
@@ -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; |
@@ -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"); |
@@ -285,7 +285,8 @@ discard block |
||
285 | 285 | // (PM reply fills in the latter) |
286 | 286 | // |
287 | 287 | $x = explode(' ', $username); |
288 | - if (is_numeric($x[0])) { // user ID |
|
288 | + if (is_numeric($x[0])) { |
|
289 | +// user ID |
|
289 | 290 | $userid = (int)$x[0]; |
290 | 291 | $user = BoincUser::lookup_id($userid); |
291 | 292 | if ($user == null) { |
@@ -303,7 +304,8 @@ discard block |
||
303 | 304 | tra("Could not find user with username %1", $username) |
304 | 305 | ); |
305 | 306 | return; |
306 | - } elseif (count($users) > 1) { // Non-unique username |
|
307 | + } elseif (count($users) > 1) { |
|
308 | +// Non-unique username |
|
307 | 309 | pm_form_page( |
308 | 310 | $replyto, $userid, |
309 | 311 | tra("%1 is not a unique username; you will have to use user ID", $username) |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | // There's a new post in the thread, which the user is subscribed to. |
127 | 127 | // send them an email notifying them. |
128 | 128 | // |
129 | -function send_thread_notification_email($thread, $user){ |
|
129 | +function send_thread_notification_email($thread, $user) { |
|
130 | 130 | $title = PROJECT . ": there is a new post in '". $thread->title ."'"; |
131 | 131 | $link = secure_url_base() . "forum_thread.php?id=" . $thread->id; |
132 | 132 | $body = "A " . PROJECT . " user has posted to the thread |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | // There's a new thread in the forum, which the user is subscribed to. |
145 | 145 | // send them an email notifying them. |
146 | 146 | // |
147 | -function send_forum_notification_email($forum, $user){ |
|
147 | +function send_forum_notification_email($forum, $user) { |
|
148 | 148 | $title = PROJECT . ": there is a new thread in '". $forum->title ."'"; |
149 | 149 | $link = secure_url_base() . "forum_forum.php?id=" . $forum->id; |
150 | 150 | $body = "A " . PROJECT . " user has added a thread to the forum |
@@ -46,14 +46,14 @@ |
||
46 | 46 | |
47 | 47 | if (!$sort_style) { |
48 | 48 | // get the sort style either from the logged in user or a cookie |
49 | - if ($user){ |
|
49 | + if ($user) { |
|
50 | 50 | $sort_style = $user->prefs->forum_sorting; |
51 | 51 | } else { |
52 | 52 | list($sort_style, $thread_style) = parse_forum_cookie(); |
53 | 53 | } |
54 | 54 | } else { |
55 | 55 | // set the sort style |
56 | - if ($user){ |
|
56 | + if ($user) { |
|
57 | 57 | $user->prefs->forum_sorting = $sort_style; |
58 | 58 | $user->prefs->update("forum_sorting=$sort_style"); |
59 | 59 | } else { |
@@ -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 | |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | $i=0; |
296 | 296 | $linkpos=true; |
297 | 297 | $out = ""; |
298 | - while (true){ |
|
298 | + while (true) { |
|
299 | 299 | // Find a link |
300 | 300 | // |
301 | 301 | $linkpos=strpos($text, "<a ", $i); |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | |
313 | 313 | // Converts image tags to links to the images. |
314 | 314 | // |
315 | -function image_as_link($text){ |
|
315 | +function image_as_link($text) { |
|
316 | 316 | $pattern = '@<img([\S\s]+?)src=([^>]+?)>@si'; |
317 | 317 | $replacement = '<a href=${2}>[Image link]</a>'; |
318 | 318 | return preg_replace($pattern, $replacement, $text); |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | $parent_post_id = 0; |
57 | 57 | } |
58 | 58 | |
59 | -if ($filter != "false"){ |
|
59 | +if ($filter != "false") { |
|
60 | 60 | $filter = true; |
61 | 61 | } else { |
62 | 62 | $filter = false; |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | } |
72 | 72 | |
73 | 73 | $warning = null; |
74 | -if ($content && (!$preview)){ |
|
74 | +if ($content && (!$preview)) { |
|
75 | 75 | check_tokens($logged_in_user->authenticator); |
76 | 76 | if (!akismet_check($logged_in_user, $content)) { |
77 | 77 | $warning = tra("Your post has been flagged as spam by the Akismet anti-spam system. Please modify your text and try again."); |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | function search_thread_titles( |
34 | 34 | $keyword_list, $forum="", $user="", $time="", $limit=200, |
35 | 35 | $sort_style=CREATE_TIME_NEW, $show_hidden = false |
36 | -){ |
|
36 | +) { |
|
37 | 37 | $search_string="%"; |
38 | 38 | foreach ($keyword_list as $key => $word) { |
39 | 39 | $search_string .= BoincDb::escape_string($word)."%"; |
@@ -84,11 +84,11 @@ discard block |
||
84 | 84 | // |
85 | 85 | function search_post_content( |
86 | 86 | $keyword_list, $forum, $user, $time, $limit, $sort_style, $show_hidden |
87 | -){ |
|
87 | +) { |
|
88 | 88 | $db = BoincDb::get(); |
89 | 89 | |
90 | 90 | $search_string="%"; |
91 | - foreach ($keyword_list as $key => $word){ |
|
91 | + foreach ($keyword_list as $key => $word) { |
|
92 | 92 | $search_string .= BoincDb::escape_string($word)."%"; |
93 | 93 | } |
94 | 94 | $optional_join = ""; |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | |
135 | 135 | $logged_in_user = get_logged_in_user(false); |
136 | 136 | BoincForumPrefs::lookup($logged_in_user); |
137 | -if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)){ |
|
137 | +if ($logged_in_user && $logged_in_user->prefs->privilege(S_MODERATOR)) { |
|
138 | 138 | $show_hidden_posts = true; |
139 | 139 | } else { |
140 | 140 | $show_hidden_posts = false; |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | $limit = 100; |
158 | 158 | |
159 | -if ($search_forum==-1){ |
|
159 | +if ($search_forum==-1) { |
|
160 | 160 | $forum = null; |
161 | 161 | } else if ($search_forum) { |
162 | 162 | $forum = BoincForum::lookup_id($search_forum); |
@@ -173,11 +173,11 @@ discard block |
||
173 | 173 | |
174 | 174 | // Display the threads while we search for posts |
175 | 175 | // |
176 | -if (count($threads)){ |
|
176 | +if (count($threads)) { |
|
177 | 177 | echo "<h3>" . tra("Thread titles matching your query:") . "</h3>"; |
178 | 178 | start_table('table-striped'); |
179 | 179 | thread_list_header(); |
180 | - foreach ($threads as $thread){ |
|
180 | + foreach ($threads as $thread) { |
|
181 | 181 | if ($thread->hidden) continue; |
182 | 182 | thread_list_item($thread, $logged_in_user); |
183 | 183 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | $show_hidden_posts |
194 | 194 | ); |
195 | 195 | |
196 | -if (count($posts)){ |
|
196 | +if (count($posts)) { |
|
197 | 197 | echo "<h3>" . tra("Messages matching your query:") . "</h3>"; |
198 | 198 | start_table('table-striped'); |
199 | 199 | row_heading_array(['Info', 'Post'], ['', 'width=70%']); |
@@ -217,7 +217,7 @@ discard block |
||
217 | 217 | end_table(); |
218 | 218 | } |
219 | 219 | |
220 | -if (!count($threads) && !count($posts)){ |
|
220 | +if (!count($threads) && !count($posts)) { |
|
221 | 221 | echo "<p>".tra("Sorry, couldn't find anything matching your search query. You can try to broaden your search by using less words (or less specific words).")."</p> |
222 | 222 | <p>" |
223 | 223 | .tra("You can also %1 try the same search on Google. %2", |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | $preview = post_str("preview", true); |
57 | 57 | $warning = null; |
58 | 58 | |
59 | -if ($content && $title && (!$preview)){ |
|
59 | +if ($content && $title && (!$preview)) { |
|
60 | 60 | if (post_str('add_signature', true)) { |
61 | 61 | $add_signature = true; // set a flag and concatenate later |
62 | - } else { |
|
62 | + } else { |
|
63 | 63 | $add_signature = false; |
64 | 64 | } |
65 | 65 | check_tokens($logged_in_user->authenticator); |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $submit_help = "<br /><font color=\"red\">".tra("Remember to add a title")."</font>"; |
123 | 123 | } |
124 | 124 | |
125 | -if ($force_title && $title){ |
|
125 | +if ($force_title && $title) { |
|
126 | 126 | row2( |
127 | 127 | tra("Title"), |
128 | 128 | sprintf( |