@@ -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."); |
@@ -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( |
@@ -69,7 +69,7 @@ |
||
69 | 69 | project_forum_index_intro(); |
70 | 70 | } |
71 | 71 | |
72 | - if (defined('FORUM_QA_MERGED_MODE') && FORUM_QA_MERGED_MODE){ |
|
72 | + if (defined('FORUM_QA_MERGED_MODE') && FORUM_QA_MERGED_MODE) { |
|
73 | 73 | $categories = BoincCategory::enum("true order by orderID"); |
74 | 74 | } else { |
75 | 75 | echo "<p>" |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | // with an existing web framework can more easily do so. |
243 | 243 | // To do so, define page_head() in the project include file. |
244 | 244 | // |
245 | -if (!function_exists("page_head")){ |
|
245 | +if (!function_exists("page_head")) { |
|
246 | 246 | function page_head( |
247 | 247 | $title, |
248 | 248 | // page title. Put in <title>, used as title for browser tab. |
@@ -361,7 +361,8 @@ discard block |
||
361 | 361 | echo '<div class="container-fluid"> |
362 | 362 | '; |
363 | 363 | |
364 | - switch($title) { //kludge |
|
364 | + switch($title) { |
|
365 | +//kludge |
|
365 | 366 | case tra("Log in"): |
366 | 367 | case tra("Create an account"): |
367 | 368 | case tra("Server status page"): |
@@ -376,7 +377,7 @@ discard block |
||
376 | 377 | |
377 | 378 | // See the comments for page_head() |
378 | 379 | // |
379 | -if (!function_exists("page_tail")){ |
|
380 | +if (!function_exists("page_tail")) { |
|
380 | 381 | function page_tail( |
381 | 382 | $show_date=false, |
382 | 383 | // true for pages that are generated periodically rather than on the fly |
@@ -882,7 +883,7 @@ discard block |
||
882 | 883 | return $str; |
883 | 884 | } |
884 | 885 | |
885 | -function strip_bbcode($string){ |
|
886 | +function strip_bbcode($string) { |
|
886 | 887 | return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
887 | 888 | } |
888 | 889 | |
@@ -1186,7 +1187,7 @@ discard block |
||
1186 | 1187 | // Otherwise return 0. |
1187 | 1188 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
1188 | 1189 | // |
1189 | -function boinc_client_version(){ |
|
1190 | +function boinc_client_version() { |
|
1190 | 1191 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
1191 | 1192 | $x = $_SERVER['HTTP_USER_AGENT']; |
1192 | 1193 | $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | |
38 | 38 | // See if "action" is provided - either through post or get |
39 | 39 | if (!post_str('action', true)) { |
40 | - if (!get_str('action', true)){ |
|
40 | + if (!get_str('action', true)) { |
|
41 | 41 | error_page(tra("You must specify an action...")); |
42 | 42 | } else { |
43 | 43 | $action = get_str('action'); |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $user=BoincUser::lookup_id($userid); |
51 | 51 | if (!$user) error_page('No such user'); |
52 | 52 | |
53 | -if ($action!="start"){ |
|
53 | +if ($action!="start") { |
|
54 | 54 | error_page("Unknown action"); |
55 | 55 | } |
56 | 56 | |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | $mod_category = tra("Other"); |
67 | 67 | } |
68 | 68 | |
69 | -if (post_str('reason', true)){ |
|
69 | +if (post_str('reason', true)) { |
|
70 | 70 | start_vote($config,$logged_in_user,$user, $mod_category,post_str("reason")); |
71 | 71 | } else { |
72 | 72 | start_vote($config,$logged_in_user,$user, $mod_category,"None given"); |
@@ -379,13 +379,13 @@ discard block |
||
379 | 379 | |
380 | 380 | |
381 | 381 | function link_results($n, $mq, $query, $clauses) { |
382 | - if ($n == '0') { // intentional compare by string |
|
382 | + if ($n == '0') { |
|
383 | +// intentional compare by string |
|
383 | 384 | return "0"; |
384 | 385 | } else { |
385 | 386 | if(strlen($clauses)) { |
386 | 387 | return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>"; |
387 | - } |
|
388 | - else { |
|
388 | + } else { |
|
389 | 389 | return "<a href=\"db_action.php?table=result&query=$mq&$query&sort_by=mod_time&detail=low\">$n</a>"; |
390 | 390 | } |
391 | 391 | |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | // @return String A human readable string if error otherwise FALSE |
397 | 397 | // @param String $stderr_out the stderr_out value to parse |
398 | 398 | // |
399 | -function stderr_error_string($stderr_out){ |
|
399 | +function stderr_error_string($stderr_out) { |
|
400 | 400 | $y = parse_element($stderr_out, "<error_code>"); |
401 | 401 | $x = 0; |
402 | 402 | if ($y) { |
@@ -1174,7 +1174,7 @@ discard block |
||
1174 | 1174 | // result has not been received yet, so show report deadline either |
1175 | 1175 | // in green if in the future or in red if in the past. |
1176 | 1176 | $timenow=time(); |
1177 | - if ($result->report_deadline==0) { |
|
1177 | + if ($result->report_deadline==0) { |
|
1178 | 1178 | // not sent -- show create time in purple |
1179 | 1179 | $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>"; |
1180 | 1180 | } else if ($result->report_deadline>=$timenow) { |