@@ -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>" |
@@ -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"); |
@@ -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); |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | // Display the threads |
| 178 | 178 | // |
| 179 | -if (count($threads)){ |
|
| 179 | +if (count($threads)) { |
|
| 180 | 180 | echo "<h3>" . tra("Thread titles matching your query:") . "</h3>"; |
| 181 | 181 | start_table('table-striped'); |
| 182 | 182 | thread_list_header(); |
| 183 | - foreach ($threads as $thread){ |
|
| 183 | + foreach ($threads as $thread) { |
|
| 184 | 184 | if (!$show_hidden_posts) { |
| 185 | 185 | $u = BoincUser::lookup_id($thread->owner); |
| 186 | 186 | if ($u && is_banished($u)) continue; |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | $show_hidden_posts |
| 201 | 201 | ); |
| 202 | 202 | |
| 203 | -if (count($posts)){ |
|
| 203 | +if (count($posts)) { |
|
| 204 | 204 | echo "<h3>" . tra("Messages matching your query:") . "</h3>"; |
| 205 | 205 | start_table('table-striped'); |
| 206 | 206 | row_heading_array(['Info', 'Post'], ['', 'width=70%']); |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | end_table(); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | -if (!count($threads) && !count($posts)){ |
|
| 231 | +if (!count($threads) && !count($posts)) { |
|
| 232 | 232 | 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> |
| 233 | 233 | <p>" |
| 234 | 234 | .tra("You can also %1 try the same search on Google. %2", |
@@ -379,7 +379,8 @@ 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)) { |
@@ -395,7 +396,7 @@ discard block |
||
| 395 | 396 | // @return String A human readable string if error otherwise FALSE |
| 396 | 397 | // @param String $stderr_out the stderr_out value to parse |
| 397 | 398 | // |
| 398 | -function stderr_error_string($stderr_out){ |
|
| 399 | +function stderr_error_string($stderr_out) { |
|
| 399 | 400 | $y = parse_element($stderr_out, "<error_code>"); |
| 400 | 401 | $x = 0; |
| 401 | 402 | if ($y) { |
@@ -1206,7 +1207,7 @@ discard block |
||
| 1206 | 1207 | // result has not been received yet, so show report deadline either |
| 1207 | 1208 | // in green if in the future or in red if in the past. |
| 1208 | 1209 | $timenow=time(); |
| 1209 | - if ($result->report_deadline==0) { |
|
| 1210 | + if ($result->report_deadline==0) { |
|
| 1210 | 1211 | // not sent -- show create time in purple |
| 1211 | 1212 | $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>"; |
| 1212 | 1213 | } else if ($result->report_deadline>=$timenow) { |
@@ -293,13 +293,13 @@ |
||
| 293 | 293 | // Older clients may have the old-style serialnum in the DB |
| 294 | 294 | // despite the server being upgraded. |
| 295 | 295 | // |
| 296 | -function vbox_desc($parsed_ser){ |
|
| 296 | +function vbox_desc($parsed_ser) { |
|
| 297 | 297 | if (empty($parsed_ser['vbox'])) return '---'; |
| 298 | 298 | $f = $parsed_ser['vbox']; |
| 299 | 299 | $desc = sprintf('Virtualbox (%s) %s', |
| 300 | 300 | $f[1], tra("installed") |
| 301 | 301 | ); |
| 302 | - if (sizeof($f)<=2){ |
|
| 302 | + if (sizeof($f)<=2) { |
|
| 303 | 303 | return $desc; |
| 304 | 304 | } |
| 305 | 305 | if ($f[2]=="1" and $f[3]=="1") { |
@@ -254,7 +254,7 @@ discard block |
||
| 254 | 254 | // with an existing web framework can more easily do so. |
| 255 | 255 | // To do so, define page_head() in html/project/project.inc |
| 256 | 256 | // |
| 257 | -if (!function_exists("page_head")){ |
|
| 257 | +if (!function_exists("page_head")) { |
|
| 258 | 258 | function page_head( |
| 259 | 259 | $title, |
| 260 | 260 | // page title. Put in <title>, used as title for browser tab. |
@@ -375,7 +375,8 @@ discard block |
||
| 375 | 375 | echo '<div class="container-fluid"> |
| 376 | 376 | '; |
| 377 | 377 | |
| 378 | - switch($title) { //kludge |
|
| 378 | + switch($title) { |
|
| 379 | +//kludge |
|
| 379 | 380 | case tra("Log in"): |
| 380 | 381 | case tra("Create an account"): |
| 381 | 382 | case tra("Server status page"): |
@@ -390,7 +391,7 @@ discard block |
||
| 390 | 391 | |
| 391 | 392 | // See the comments for page_head() |
| 392 | 393 | // |
| 393 | -if (!function_exists("page_tail")){ |
|
| 394 | +if (!function_exists("page_tail")) { |
|
| 394 | 395 | function page_tail( |
| 395 | 396 | $show_date=false, |
| 396 | 397 | // true for pages that are generated periodically rather than on the fly |
@@ -895,7 +896,7 @@ discard block |
||
| 895 | 896 | return $str; |
| 896 | 897 | } |
| 897 | 898 | |
| 898 | -function strip_bbcode($string){ |
|
| 899 | +function strip_bbcode($string) { |
|
| 899 | 900 | return preg_replace("/((\[.+\])+?)(.+?)((\[\/.+\])+?)/","",$string); |
| 900 | 901 | } |
| 901 | 902 | |
@@ -1156,7 +1157,7 @@ discard block |
||
| 1156 | 1157 | // Otherwise return 0. |
| 1157 | 1158 | // Format of user agent string is "BOINC client (windows_x86_64 7.3.17)" |
| 1158 | 1159 | // |
| 1159 | -function boinc_client_version(){ |
|
| 1160 | +function boinc_client_version() { |
|
| 1160 | 1161 | if (!array_key_exists('HTTP_USER_AGENT', $_SERVER)) return 0; |
| 1161 | 1162 | $x = $_SERVER['HTTP_USER_AGENT']; |
| 1162 | 1163 | $e = "/BOINC client [^ ]* (\d+).(\d+).(\d+)\)/"; |
@@ -58,7 +58,7 @@ |
||
| 58 | 58 | //panel(null, 'panel_contents'); |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | -function left(){ |
|
| 61 | +function left() { |
|
| 62 | 62 | global $user, $no_web_account_creation, $project_id; |
| 63 | 63 | panel( |
| 64 | 64 | $user?tra("Welcome, %1", $user->name):tra("What is %1?", PROJECT), |
@@ -107,7 +107,7 @@ 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(){ |
|
| 110 | +function cache_check_diskspace() { |
|
| 111 | 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, |
@@ -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 | |
@@ -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 false; |
@@ -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,7 +188,7 @@ 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 | // |
@@ -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"; |