@@ -46,10 +46,10 @@ discard block |
||
46 | 46 | "; |
47 | 47 | } |
48 | 48 | |
49 | -function xml_error($num=-1, $msg=null, $file=null, $line=null) { |
|
49 | +function xml_error($num = -1, $msg = null, $file = null, $line = null) { |
|
50 | 50 | global $xml_outer_tag; |
51 | 51 | if (!$msg) { |
52 | - switch($num) { |
|
52 | + switch ($num) { |
|
53 | 53 | case -112: $msg = "Invalid XML"; break; |
54 | 54 | case -136: $msg = "Not found"; break; |
55 | 55 | case -137: $msg = "Name or email address is not unique"; break; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | // If it's a single-tag element, and it's present, just return the tag |
96 | 96 | // |
97 | 97 | function parse_element($xml, $tag) { |
98 | - $closetag = "</" . substr($tag,1); |
|
98 | + $closetag = "</".substr($tag, 1); |
|
99 | 99 | $x = strstr($xml, $tag); |
100 | 100 | if ($x) { |
101 | 101 | if (strstr($tag, "/>")) return $tag; |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | |
112 | 112 | function parse_next_element($xml, $tag, &$cursor) { |
113 | 113 | $element = null; |
114 | - $closetag = "</" . substr($tag,1); |
|
115 | - $pos = substr($xml,$cursor); |
|
114 | + $closetag = "</".substr($tag, 1); |
|
115 | + $pos = substr($xml, $cursor); |
|
116 | 116 | $x = strstr($pos, $tag); |
117 | 117 | if ($x) { |
118 | 118 | if (strstr($tag, "/>")) return $tag; |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | $avg = round($app->info->avg, 2); |
181 | 181 | $min = round($app->info->min, 2); |
182 | 182 | $max = round($app->info->max, 2); |
183 | - $x = $max?"$avg ($min - $max)":"---"; |
|
183 | + $x = $max ? "$avg ($min - $max)" : "---"; |
|
184 | 184 | $u = $app->info->users; |
185 | 185 | } else { |
186 | 186 | $x = '---'; |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $cmd = trim($cmd); |
274 | 274 | $x = explode(" ", $cmd); |
275 | 275 | $prog = $x[0]; |
276 | - $pidname = $prog . '.pid'; |
|
276 | + $pidname = $prog.'.pid'; |
|
277 | 277 | } |
278 | 278 | $path = "../../pid_$host/$pidname"; |
279 | 279 | if (is_file($path)) { |
@@ -314,12 +314,12 @@ discard block |
||
314 | 314 | } |
315 | 315 | $master_host = $u["host"]; |
316 | 316 | if ($config->www_host) { |
317 | - $web_host = trim((string) $config->www_host); |
|
317 | + $web_host = trim((string)$config->www_host); |
|
318 | 318 | } else { |
319 | 319 | $web_host = $main_host; |
320 | 320 | } |
321 | 321 | if ($config->sched_host) { |
322 | - $sched_host = trim((string) $config->sched_host); |
|
322 | + $sched_host = trim((string)$config->sched_host); |
|
323 | 323 | } else { |
324 | 324 | $sched_host = $main_host; |
325 | 325 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | |
330 | 330 | // the upload and download servers are sort of daemons too |
331 | 331 | // |
332 | - $url = trim((string) $config->download_url); |
|
332 | + $url = trim((string)$config->download_url); |
|
333 | 333 | $u = parse_url($url); |
334 | 334 | $h = $u["host"]; |
335 | 335 | if ($h == $master_host) { |
@@ -341,14 +341,14 @@ discard block |
||
341 | 341 | } else { |
342 | 342 | $have_remote = true; |
343 | 343 | } |
344 | - $url = trim((string) $config->upload_url); |
|
344 | + $url = trim((string)$config->upload_url); |
|
345 | 345 | $u = parse_url($url); |
346 | 346 | $h = $u["host"]; |
347 | 347 | if ($h == $master_host) { |
348 | 348 | $y = new StdClass; |
349 | 349 | $y->cmd = "Upload server"; |
350 | 350 | $y->host = $h; |
351 | - $y->status = !file_exists("../../stop_upload");; |
|
351 | + $y->status = !file_exists("../../stop_upload"); ; |
|
352 | 352 | $local_daemons[] = $y; |
353 | 353 | } else { |
354 | 354 | $have_remote = true; |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | $y = new StdClass; |
361 | 361 | $y->cmd = "Scheduler"; |
362 | 362 | $y->host = $sched_host; |
363 | - $y->status = !file_exists("../../stop_sched");; |
|
363 | + $y->status = !file_exists("../../stop_sched"); ; |
|
364 | 364 | $local_daemons[] = $y; |
365 | 365 | } else { |
366 | 366 | $have_remote = true; |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | $disabled_daemons[] = $x; |
377 | 377 | continue; |
378 | 378 | } |
379 | - $host = $d->host?(string)$d->host:$main_host; |
|
379 | + $host = $d->host ? (string)$d->host : $main_host; |
|
380 | 380 | if ($host != $web_host) { |
381 | 381 | $have_remote = true; |
382 | 382 | continue; |
@@ -56,10 +56,10 @@ discard block |
||
56 | 56 | $preview = post_str("preview", true); |
57 | 57 | $warning = null; |
58 | 58 | |
59 | -if ($content && $title && (!$preview)){ |
|
60 | - if (post_str('add_signature', true) == "add_it"){ |
|
61 | - $add_signature = true; // set a flag and concatenate later |
|
62 | - } else { |
|
59 | +if ($content && $title && (!$preview)) { |
|
60 | + if (post_str('add_signature', true) == "add_it") { |
|
61 | + $add_signature = true; // set a flag and concatenate later |
|
62 | + } else { |
|
63 | 63 | $add_signature = false; |
64 | 64 | } |
65 | 65 | check_tokens($logged_in_user->authenticator); |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | $title, $content, $logged_in_user, $forum, $add_signature, $export |
72 | 72 | ); |
73 | 73 | if ($thread) { |
74 | - header('Location: forum_thread.php?id=' . $thread->id); |
|
74 | + header('Location: forum_thread.php?id='.$thread->id); |
|
75 | 75 | } else { |
76 | 76 | error_page("Can't create thread. $forum_error"); |
77 | 77 | } |
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
81 | -page_head(tra("Create new thread"),'','','', $bbcode_js); |
|
81 | +page_head(tra("Create new thread"), '', '', '', $bbcode_js); |
|
82 | 82 | show_forum_header($logged_in_user); |
83 | 83 | |
84 | 84 | if ($warning) { |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | $submit_help = "<br /><font color=\"red\">".tra("Remember to add a title")."</font>"; |
120 | 120 | } |
121 | 121 | |
122 | -if ($force_title && $title){ |
|
122 | +if ($force_title && $title) { |
|
123 | 123 | row2(tra("Title"), htmlspecialchars($title)."<input type=\"hidden\" name=\"title\" value=\"".htmlspecialchars($title)."\">"); |
124 | 124 | } else { |
125 | 125 | row2(tra("Title").$submit_help, |
126 | 126 | sprintf('<input type="text" class="form-control" name="title" value="%s">', |
127 | - $title?htmlspecialchars($title):'' |
|
127 | + $title ?htmlspecialchars($title) : '' |
|
128 | 128 | ) |
129 | 129 | ); |
130 | 130 | } |
@@ -134,14 +134,14 @@ discard block |
||
134 | 134 | echo $bbcode_html; |
135 | 135 | end_table(); |
136 | 136 | echo sprintf('<textarea class="form-control" name="content" rows="12" cols="80">%s</textarea>', |
137 | - $content?htmlspecialchars($content):'' |
|
137 | + $content ?htmlspecialchars($content) : '' |
|
138 | 138 | ); |
139 | 139 | echo "</td></tr>"; |
140 | 140 | |
141 | 141 | if (!$logged_in_user->prefs->no_signature_by_default) { |
142 | - $enable_signature="checked=\"true\""; |
|
142 | + $enable_signature = "checked=\"true\""; |
|
143 | 143 | } else { |
144 | - $enable_signature=""; |
|
144 | + $enable_signature = ""; |
|
145 | 145 | } |
146 | 146 | |
147 | 147 | if (is_news_forum($forum)) { |
@@ -157,5 +157,5 @@ discard block |
||
157 | 157 | |
158 | 158 | page_tail(); |
159 | 159 | |
160 | -$cvs_version_tracker[]="\$Id$"; |
|
160 | +$cvs_version_tracker[] = "\$Id$"; |
|
161 | 161 | ?> |
@@ -32,7 +32,7 @@ |
||
32 | 32 | } |
33 | 33 | |
34 | 34 | $offset = get_int("offset", true); |
35 | -if (!$offset) $offset=0; |
|
35 | +if (!$offset) $offset = 0; |
|
36 | 36 | |
37 | 37 | if ($offset > 1000) { |
38 | 38 | error_page(tra("Limit exceeded: Can only display the first 1000 members.")); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | } |
31 | 31 | |
32 | 32 | function show_forum_rss_item($thread, $userid, $threads_only, $no_images) { |
33 | - $unique_url=secure_url_base()."forum_thread.php?id=".$thread->id; |
|
33 | + $unique_url = secure_url_base()."forum_thread.php?id=".$thread->id; |
|
34 | 34 | |
35 | 35 | $clause2 = " and hidden=0 "; |
36 | 36 | if ($userid) $clause2 .= "and user=$userid"; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | if (!count($posts)) return; |
43 | 43 | $post = $posts[0]; |
44 | - $post_date = gmdate('D, d M Y H:i:s',$post->timestamp).' GMT'; |
|
44 | + $post_date = gmdate('D, d M Y H:i:s', $post->timestamp).' GMT'; |
|
45 | 45 | $post_user = BOincUser::lookup_id($post->user); |
46 | 46 | BoincForumPrefs::lookup($post_user); |
47 | 47 | $options = new output_options(); |
@@ -84,25 +84,25 @@ discard block |
||
84 | 84 | |
85 | 85 | // Now construct header |
86 | 86 | // |
87 | - header ("Expires: " . gmdate('D, d M Y H:i:s', time()+86400) . " GMT"); |
|
87 | + header("Expires: ".gmdate('D, d M Y H:i:s', time() + 86400)." GMT"); |
|
88 | 88 | if (sizeof($threads)) { |
89 | 89 | $t = $threads[0]; |
90 | - $last_mod_time = $threads_only?$t->create_time:$t->timestamp; |
|
91 | - $create_date = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT'; |
|
92 | - header ("Last-Modified: " . $create_date); |
|
90 | + $last_mod_time = $threads_only ? $t->create_time : $t->timestamp; |
|
91 | + $create_date = gmdate('D, d M Y H:i:s', $last_mod_time).' GMT'; |
|
92 | + header("Last-Modified: ".$create_date); |
|
93 | 93 | } else { |
94 | - $create_date = gmdate('D, d M Y H:i:s') . ' GMT'; |
|
94 | + $create_date = gmdate('D, d M Y H:i:s').' GMT'; |
|
95 | 95 | } |
96 | - header ("Content-Type: application/xml"); |
|
96 | + header("Content-Type: application/xml"); |
|
97 | 97 | |
98 | - $forum=BoincForum::lookup_id($forumid); |
|
98 | + $forum = BoincForum::lookup_id($forumid); |
|
99 | 99 | // Create channel header and open XML content |
100 | 100 | // |
101 | 101 | $description = PROJECT.": $forum->title"; |
102 | 102 | if ($userid) { |
103 | 103 | $description .= " (posts by $user->name)"; |
104 | 104 | } |
105 | - $channel_image = secure_url_base() . "rss_image.gif"; |
|
105 | + $channel_image = secure_url_base()."rss_image.gif"; |
|
106 | 106 | $language = "en-us"; |
107 | 107 | echo "<?xml version=\"1.0\" encoding=\"UTF-8\" ?> |
108 | 108 | <rss version=\"2.0\"> |
@@ -64,11 +64,11 @@ discard block |
||
64 | 64 | $dh = opendir($langdir.$transdir); |
65 | 65 | if (!$dh) die("can't open translation dir"); |
66 | 66 | while (($file = readdir($dh)) !== false) { |
67 | - if ($file==".." || $file==".") { |
|
67 | + if ($file == ".." || $file == ".") { |
|
68 | 68 | continue; |
69 | 69 | } |
70 | 70 | // only do files ending in .po |
71 | - if (substr($file,-3) != ".po"){ |
|
71 | + if (substr($file, -3) != ".po") { |
|
72 | 72 | //debug("File $file with unknown extension found in $info_dir"); |
73 | 73 | continue; |
74 | 74 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | "-------------Compiling $transdir$file------------", 0 |
77 | 77 | ); |
78 | 78 | $language = parse_po_file($langdir.$transdir.$file); |
79 | - if (!$language){ |
|
79 | + if (!$language) { |
|
80 | 80 | language_log( |
81 | 81 | "WARNING: Could not parse language ".$file |
82 | 82 | ); |
@@ -95,10 +95,10 @@ discard block |
||
95 | 95 | ); |
96 | 96 | exit; |
97 | 97 | } |
98 | - foreach ($language as $key => $value){ |
|
98 | + foreach ($language as $key => $value) { |
|
99 | 99 | if ($value !== "") { |
100 | 100 | // Skip if the msgstr is empty |
101 | - fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
101 | + fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file, 0, -3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | // don't write \?\> - may append |
@@ -115,27 +115,27 @@ discard block |
||
115 | 115 | function parse_po_file($file) { |
116 | 116 | $translation_file = file($file); |
117 | 117 | $first_entry = true; |
118 | - $current_token_text=""; |
|
119 | - $current_token =""; |
|
118 | + $current_token_text = ""; |
|
119 | + $current_token = ""; |
|
120 | 120 | $parsing_token = false; |
121 | 121 | $parsing_text = false; |
122 | 122 | $size = sizeof($translation_file); |
123 | 123 | $output = array(); |
124 | - for ($i=0; $i<$size; $i++){ |
|
124 | + for ($i = 0; $i < $size; $i++) { |
|
125 | 125 | $entry = trim($translation_file[$i]); |
126 | 126 | //echo "line $i: $entry\n"; |
127 | - if (substr($entry, 0, 1)=="#") { |
|
127 | + if (substr($entry, 0, 1) == "#") { |
|
128 | 128 | continue; |
129 | 129 | } elseif (strpos($entry, "msgid") !== false) { |
130 | - if (!$first_entry){ |
|
130 | + if (!$first_entry) { |
|
131 | 131 | //If this is not the first, save the previous entry |
132 | - $output[$current_token]=$current_token_text; |
|
132 | + $output[$current_token] = $current_token_text; |
|
133 | 133 | } |
134 | 134 | $current_token = get_po_line($entry, $file); |
135 | - $current_token_text=""; |
|
135 | + $current_token_text = ""; |
|
136 | 136 | $parsing_token = true; |
137 | 137 | $parsing_text = false; |
138 | - $first_entry=false; |
|
138 | + $first_entry = false; |
|
139 | 139 | } elseif (strpos($entry, "msgstr") !== false) { |
140 | 140 | $current_token_text = get_po_line($entry, $file); |
141 | 141 | $parsing_token = false; |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | |
150 | 150 | // Get the last token |
151 | 151 | // |
152 | - if ($current_token && $current_token_text){ |
|
152 | + if ($current_token && $current_token_text) { |
|
153 | 153 | $output[$current_token] = $current_token_text; |
154 | 154 | } |
155 | 155 | return $output; |
@@ -159,9 +159,9 @@ discard block |
||
159 | 159 | // Returns the contents of a line (ie removes "" from start and end) |
160 | 160 | // |
161 | 161 | function get_po_line($line, $file) { |
162 | - $start = strpos($line, '"')+1; |
|
162 | + $start = strpos($line, '"') + 1; |
|
163 | 163 | $stop = strrpos($line, '"'); |
164 | - $x = substr($line, $start, $stop-$start); |
|
164 | + $x = substr($line, $start, $stop - $start); |
|
165 | 165 | $n = preg_match("/[^\\\\]\"/", $x); |
166 | 166 | if ($n) { |
167 | 167 | echo "ERROR - MISMATCHED QUOTES IN $file: $line\n"; |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | |
181 | 181 | // Find the string in the user's language |
182 | 182 | // |
183 | - foreach ($languages_in_use as $language){ |
|
183 | + foreach ($languages_in_use as $language) { |
|
184 | 184 | if (isset($language_lookup_array[$language][$text])) { |
185 | 185 | $text = $language_lookup_array[$language][$text]; |
186 | 186 | break; |
187 | - } else if ($language=="en"){ |
|
187 | + } else if ($language == "en") { |
|
188 | 188 | // This language is defined in the code and is always available |
189 | 189 | break; |
190 | 190 | } |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // Replace relevant substrings with given arguments. |
194 | 194 | // Use strtr to avoid problems if an argument contains %n. |
195 | 195 | $replacements = array(); |
196 | - for ($i=1; $i<func_num_args(); $i++){ |
|
196 | + for ($i = 1; $i < func_num_args(); $i++) { |
|
197 | 197 | $replacements["%".$i] = func_get_arg($i); |
198 | 198 | } |
199 | 199 | |
@@ -210,14 +210,14 @@ discard block |
||
210 | 210 | return $text; |
211 | 211 | } |
212 | 212 | |
213 | -function language_log($message, $loglevel=0) { |
|
213 | +function language_log($message, $loglevel = 0) { |
|
214 | 214 | global $lang_log_level; |
215 | 215 | $msg = ""; |
216 | - if ($loglevel==0) $msg = "[ Debug ]"; |
|
217 | - if ($loglevel==1) $msg = "[ Warning ]"; |
|
218 | - if ($loglevel==2) $msg = "[ CRITICAL ]"; |
|
216 | + if ($loglevel == 0) $msg = "[ Debug ]"; |
|
217 | + if ($loglevel == 1) $msg = "[ Warning ]"; |
|
218 | + if ($loglevel == 2) $msg = "[ CRITICAL ]"; |
|
219 | 219 | |
220 | - if ($loglevel >= $lang_log_level){ |
|
220 | + if ($loglevel >= $lang_log_level) { |
|
221 | 221 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
222 | 222 | } |
223 | 223 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // (by looking at cookies and browser settings) |
227 | 227 | // cookies have highest priority. |
228 | 228 | |
229 | -if (isset($_COOKIE['lang'])){ |
|
229 | +if (isset($_COOKIE['lang'])) { |
|
230 | 230 | $language_string = $_COOKIE['lang'].","; |
231 | 231 | } else { |
232 | 232 | $language_string = ''; |
@@ -257,10 +257,10 @@ discard block |
||
257 | 257 | // Loop over languages that the client requests |
258 | 258 | // |
259 | 259 | $size = sizeof($client_languages); |
260 | -for ($i=0; $i<$size; $i++) { |
|
261 | - if ((strlen($client_languages[$i])>2) |
|
260 | +for ($i = 0; $i < $size; $i++) { |
|
261 | + if ((strlen($client_languages[$i]) > 2) |
|
262 | 262 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
263 | - ){ |
|
263 | + ) { |
|
264 | 264 | // If this is defined as primary-secondary, represent it as xx_YY |
265 | 265 | // |
266 | 266 | $language = substr( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | |
280 | 280 | // if main language is english, look no further |
281 | 281 | // |
282 | - if ((count($languages_in_use)==0) && ($language == 'en' || $language2 == 'en')) { |
|
282 | + if ((count($languages_in_use) == 0) && ($language == 'en' || $language2 == 'en')) { |
|
283 | 283 | break; |
284 | 284 | } |
285 | 285 | |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | // |
288 | 288 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
289 | 289 | if (file_exists($file_name)) { |
290 | - if (!in_array($language, $languages_in_use)){ |
|
290 | + if (!in_array($language, $languages_in_use)) { |
|
291 | 291 | require_once($file_name); |
292 | 292 | $languages_in_use[] = $language; |
293 | 293 | } |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | if ($language2) { |
296 | 296 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
297 | 297 | if (file_exists($file_name)) { |
298 | - if (!in_array($language2, $languages_in_use)){ |
|
298 | + if (!in_array($language2, $languages_in_use)) { |
|
299 | 299 | require_once($file_name); |
300 | 300 | $languages_in_use[] = $language2; |
301 | 301 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | } |
304 | 304 | } |
305 | 305 | |
306 | -$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
306 | +$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
307 | 307 | |
308 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
308 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
309 | 309 | ?> |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | "Zimbabwe" |
258 | 258 | ); |
259 | 259 | |
260 | -$country_to_iso3166_2 = array ( |
|
260 | +$country_to_iso3166_2 = array( |
|
261 | 261 | "Afghanistan" => "af", |
262 | 262 | "Albania" => "al", |
263 | 263 | "Algeria" => "dz", |
@@ -493,25 +493,25 @@ discard block |
||
493 | 493 | |
494 | 494 | // return a list of country options for a <select> |
495 | 495 | // |
496 | -function country_select_options($selected_country="None") { |
|
496 | +function country_select_options($selected_country = "None") { |
|
497 | 497 | global $countries; |
498 | 498 | |
499 | 499 | require_once("../inc/geoip.inc"); |
500 | 500 | |
501 | 501 | // See if we can find the user's country and select it as default: |
502 | 502 | // |
503 | - $gi = geoip_open("../inc/GeoIP.dat",GEOIP_STANDARD); |
|
504 | - $geoip_country = geoip_country_name_by_addr($gi,$_SERVER["REMOTE_ADDR"]); |
|
503 | + $gi = geoip_open("../inc/GeoIP.dat", GEOIP_STANDARD); |
|
504 | + $geoip_country = geoip_country_name_by_addr($gi, $_SERVER["REMOTE_ADDR"]); |
|
505 | 505 | geoip_close($gi); |
506 | 506 | |
507 | - if ($selected_country=="") $selected_country="None"; |
|
508 | - if ($selected_country=="None" and $geoip_country!=""){ |
|
509 | - $selected_country=$geoip_country; |
|
507 | + if ($selected_country == "") $selected_country = "None"; |
|
508 | + if ($selected_country == "None" and $geoip_country != "") { |
|
509 | + $selected_country = $geoip_country; |
|
510 | 510 | } |
511 | 511 | |
512 | 512 | $x = ""; |
513 | 513 | foreach ($countries as $country) { |
514 | - $selected = ($selected_country == $country ? "selected":""); |
|
514 | + $selected = ($selected_country == $country ? "selected" : ""); |
|
515 | 515 | $x .= "<option value=\"$country\" $selected>$country</option>\n"; |
516 | 516 | } |
517 | 517 | return $x; |
@@ -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 | |
@@ -810,9 +810,9 @@ discard block |
||
810 | 810 | |
811 | 811 | function post_rules() { |
812 | 812 | if (function_exists("project_forum_post_rules")) { |
813 | - $project_rules=project_forum_post_rules(); |
|
813 | + $project_rules = project_forum_post_rules(); |
|
814 | 814 | } else { |
815 | - $project_rules=""; |
|
815 | + $project_rules = ""; |
|
816 | 816 | } |
817 | 817 | return sprintf(" |
818 | 818 | <ul> |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | ); |
842 | 842 | } |
843 | 843 | |
844 | -function post_warning($forum=null) { |
|
844 | +function post_warning($forum = null) { |
|
845 | 845 | $x = "<br><br> |
846 | 846 | <table><tr><td align=left> |
847 | 847 | "; |
@@ -901,7 +901,7 @@ discard block |
||
901 | 901 | $content = substr($content, 0, 64000); |
902 | 902 | $content = BoincDb::escape_string($content); |
903 | 903 | $now = time(); |
904 | - $sig = $signature?1:0; |
|
904 | + $sig = $signature ? 1 : 0; |
|
905 | 905 | $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)"); |
906 | 906 | if (!$id) { |
907 | 907 | $forum_error = "Failed to add post to DB."; |
@@ -921,7 +921,7 @@ discard block |
||
921 | 921 | // |
922 | 922 | function update_thread_timestamp($thread) { |
923 | 923 | $posts = BoincPost::enum("thread=$thread->id and hidden=0 order by timestamp desc limit 1"); |
924 | - if (count($posts)>0) { |
|
924 | + if (count($posts) > 0) { |
|
925 | 925 | $post = $posts[0]; |
926 | 926 | $thread->update("timestamp=$post->timestamp"); |
927 | 927 | } |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | |
930 | 930 | function update_forum_timestamp($forum) { |
931 | 931 | $threads = BoincThread::enum("forum=$forum->id and hidden=0 order by timestamp desc limit 1"); |
932 | - if (count($threads)>0) { |
|
932 | + if (count($threads) > 0) { |
|
933 | 933 | $thread = $threads[0]; |
934 | 934 | $forum->update("timestamp=$thread->timestamp"); |
935 | 935 | } |
@@ -952,7 +952,7 @@ discard block |
||
952 | 952 | if (is_news_forum($forum) && !$export) { |
953 | 953 | $status = 1; |
954 | 954 | } |
955 | - $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)"); |
|
955 | + $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 | 956 | if (!$id) { |
957 | 957 | $forum_error = "Failed to add thread to DB."; |
958 | 958 | return null; |
@@ -1080,22 +1080,22 @@ discard block |
||
1080 | 1080 | // $sticky - bool (not directly passed to SQL) |
1081 | 1081 | // |
1082 | 1082 | function get_forum_threads( |
1083 | - $forumID, $start=-1, $nRec=-1, $sort_style=MODIFIED_NEW, |
|
1083 | + $forumID, $start = -1, $nRec = -1, $sort_style = MODIFIED_NEW, |
|
1084 | 1084 | $show_hidden = 0, $sticky = 1 |
1085 | 1085 | ) { |
1086 | 1086 | //if (! (is_numeric($forumID) && is_numeric($min) && is_numeric($nRec))) { |
1087 | 1087 | // return NULL; // Something is wrong here. |
1088 | 1088 | //} |
1089 | 1089 | |
1090 | - $sql = 'forum = ' . $forumID ; |
|
1090 | + $sql = 'forum = '.$forumID; |
|
1091 | 1091 | $stickysql = ""; |
1092 | - if ($sticky){ |
|
1092 | + if ($sticky) { |
|
1093 | 1093 | $stickysql = "sticky DESC, "; |
1094 | 1094 | } |
1095 | 1095 | if (!$show_hidden) { |
1096 | 1096 | $sql .= ' AND hidden = 0'; |
1097 | 1097 | } |
1098 | - switch($sort_style) { |
|
1098 | + switch ($sort_style) { |
|
1099 | 1099 | case MODIFIED_NEW: |
1100 | 1100 | $sql .= ' ORDER BY '.$stickysql.'timestamp DESC'; |
1101 | 1101 | break; |
@@ -1148,7 +1148,7 @@ discard block |
||
1148 | 1148 | if (!$show_hidden) { |
1149 | 1149 | $sql .= ' AND hidden = 0'; |
1150 | 1150 | } |
1151 | - switch($sort_style) { |
|
1151 | + switch ($sort_style) { |
|
1152 | 1152 | case CREATE_TIME_NEW: |
1153 | 1153 | $sql .= ' ORDER BY timestamp desc'; |
1154 | 1154 | break; |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | // |
1171 | 1171 | function show_post_moderation_links( |
1172 | 1172 | $config, $logged_in_user, $post, $forum, $tokens |
1173 | -){ |
|
1173 | +) { |
|
1174 | 1174 | $moderators_allowed_to_ban = parse_bool($config, "moderators_allowed_to_ban"); |
1175 | 1175 | $moderators_vote_to_ban = parse_bool($config, "moderators_vote_to_ban"); |
1176 | 1176 | |
@@ -1257,14 +1257,14 @@ discard block |
||
1257 | 1257 | // We do not tell the (ab)user how much this is - |
1258 | 1258 | // no need to make it easy for them to break the system. |
1259 | 1259 | // |
1260 | - if ($user->total_credit<$forum->post_min_total_credit || $user->expavg_credit<$forum->post_min_expavg_credit) { |
|
1260 | + if ($user->total_credit < $forum->post_min_total_credit || $user->expavg_credit < $forum->post_min_expavg_credit) { |
|
1261 | 1261 | 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)); |
1262 | 1262 | } |
1263 | 1263 | |
1264 | 1264 | // If the user is posting faster than forum regulations allow |
1265 | 1265 | // Tell the user to wait a while before creating any more posts |
1266 | 1266 | // |
1267 | - if (time()-$user->prefs->last_post <$forum->post_min_interval) { |
|
1267 | + if (time() - $user->prefs->last_post < $forum->post_min_interval) { |
|
1268 | 1268 | error_page(tra("You cannot create threads right now. Please wait before trying again. This is to protect against abuse of the system.")); |
1269 | 1269 | } |
1270 | 1270 | } |
@@ -1292,7 +1292,7 @@ discard block |
||
1292 | 1292 | |
1293 | 1293 | function is_moderator($user, $forum) { |
1294 | 1294 | if (!$user) return false; |
1295 | - $type = $forum?$forum->parent_type:0; |
|
1295 | + $type = $forum ? $forum->parent_type : 0; |
|
1296 | 1296 | switch ($type) { |
1297 | 1297 | case 0: |
1298 | 1298 | if ($user->prefs->privilege(S_MODERATOR)) return true; |
@@ -1330,7 +1330,7 @@ discard block |
||
1330 | 1330 | $owner = BoincUser::lookup_id($thread->owner); |
1331 | 1331 | if (!$owner) return; |
1332 | 1332 | echo "<tr><td>\n"; |
1333 | - switch($thread_forum->parent_type) { |
|
1333 | + switch ($thread_forum->parent_type) { |
|
1334 | 1334 | case 0: |
1335 | 1335 | $category = BoincCategory::lookup_id($thread_forum->category); |
1336 | 1336 | show_forum_title($category, $thread_forum, $thread, true); |
@@ -1340,7 +1340,7 @@ discard block |
||
1340 | 1340 | break; |
1341 | 1341 | } |
1342 | 1342 | echo ' |
1343 | - </td><td class="numbers">'.($thread->replies+1).'</td> |
|
1343 | + </td><td class="numbers">'.($thread->replies + 1).'</td> |
|
1344 | 1344 | <td>'.user_links($owner).'</td> |
1345 | 1345 | <td class="numbers">'.$thread->views.'</td> |
1346 | 1346 | <td class="lastpost">'.time_diff_str($thread->timestamp, time()).'</td> |
@@ -1374,13 +1374,13 @@ discard block |
||
1374 | 1374 | |
1375 | 1375 | function subscribed_post_web_line($notify) { |
1376 | 1376 | $thread = BoincThread::lookup_id($notify->opaque); |
1377 | - return tra("New posts in the thread %1","<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1377 | + return tra("New posts in the thread %1", "<a href=forum_thread.php?id=$thread->id>$thread->title</a>"); |
|
1378 | 1378 | } |
1379 | 1379 | |
1380 | 1380 | function subscribe_rss($notify, &$title, &$msg, &$url) { |
1381 | 1381 | $thread = BoincThread::lookup_id($notify->opaque); |
1382 | 1382 | $title = tra("New posts in subscribed thread"); |
1383 | - $msg = tra("There are new posts in the thread '%1'",$thread->title); |
|
1383 | + $msg = tra("There are new posts in the thread '%1'", $thread->title); |
|
1384 | 1384 | $url = secure_url_base()."forum_thread.php?id=$thread->id"; |
1385 | 1385 | } |
1386 | 1386 |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | new NUM_SPEC(tra("% of the CPUs"), 1, 100, 0) |
109 | 109 | ), |
110 | 110 | new PREF_NUM( |
111 | - tra("Use at most") ."<br><font size=-2>Requires BOINC 7.20.3+</font>", |
|
111 | + tra("Use at most")."<br><font size=-2>Requires BOINC 7.20.3+</font>", |
|
112 | 112 | // xgettext:no-php-format |
113 | 113 | tra("Suspend/resume computing every few seconds to reduce CPU temperature and energy usage. Example: 75% means compute for 3 seconds, wait for 1 second, and repeat."), |
114 | 114 | "niu_cpu_usage_limit", |
@@ -295,9 +295,9 @@ discard block |
||
295 | 295 | $dp->disk_max_used_pct = parse_config($config, "<default_disk_max_used_pct>"); |
296 | 296 | $dp->disk_min_free_gb = parse_config($config, "<default_disk_min_free_gb>"); |
297 | 297 | // set some defaults if not found |
298 | - if (!$dp->disk_max_used_gb) $dp->disk_max_used_gb = 0; // no limit |
|
298 | + if (!$dp->disk_max_used_gb) $dp->disk_max_used_gb = 0; // no limit |
|
299 | 299 | if (!$dp->disk_max_used_pct) $dp->disk_max_used_pct = 90; // 90 percent |
300 | - if (!$dp->disk_min_free_gb) $dp->disk_min_free_gb = 1; // 1 GB |
|
300 | + if (!$dp->disk_min_free_gb) $dp->disk_min_free_gb = 1; // 1 GB |
|
301 | 301 | // set mininimum free space scheduler allows |
302 | 302 | // - depends on which scheduler is running |
303 | 303 | $dp->new_sched_flag = 1; |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | global $text; |
324 | 324 | global $venue_name; |
325 | 325 | |
326 | - switch($name) { |
|
326 | + switch ($name) { |
|
327 | 327 | case "venue": |
328 | 328 | if (array_key_exists("name", $attrs)) { |
329 | 329 | $venue_name = $attrs["name"]; |
@@ -373,7 +373,7 @@ discard block |
||
373 | 373 | return; |
374 | 374 | } |
375 | 375 | } |
376 | - switch($name) { |
|
376 | + switch ($name) { |
|
377 | 377 | case "venue": |
378 | 378 | $top_parse_result->$venue_name = $parse_result; |
379 | 379 | $parse_result = $top_parse_result; |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | } |
548 | 548 | } |
549 | 549 | |
550 | -function print_prefs_display_global($user, $columns=false) { |
|
550 | +function print_prefs_display_global($user, $columns = false) { |
|
551 | 551 | $global_prefs = prefs_parse_global($user->global_prefs); |
552 | 552 | |
553 | 553 | echo tra("These settings apply to all computers using this account except") |
@@ -557,7 +557,7 @@ discard block |
||
557 | 557 | .tra("Android devices") |
558 | 558 | ."</ul> |
559 | 559 | "; |
560 | - $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=global&cols=". (int)!$columns .">".tra("(Switch view)")."</a></font>"; |
|
560 | + $switch_link = " <font size=\"-1\"><a href=prefs.php?subset=global&cols=".(int)!$columns.">".tra("(Switch view)")."</a></font>"; |
|
561 | 561 | if ($columns) { |
562 | 562 | echo "<h3>".tra("Combined preferences").$switch_link."</h3>"; |
563 | 563 | start_table(); |
@@ -594,9 +594,9 @@ discard block |
||
594 | 594 | // otherwise false |
595 | 595 | // |
596 | 596 | function print_prefs_form( |
597 | - $action, $subset, $venue, $user, $prefs, $cols, $error=false, |
|
598 | - $project_error=false |
|
599 | -){ |
|
597 | + $action, $subset, $venue, $user, $prefs, $cols, $error = false, |
|
598 | + $project_error = false |
|
599 | +) { |
|
600 | 600 | if ($action == "add") { |
601 | 601 | $script = "add_venue.php"; |
602 | 602 | $submit_value = tra("Add preferences"); |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | // |
637 | 637 | // Functions to display preference subsets as forms |
638 | 638 | // |
639 | -function prefs_form_global($user, $prefs, $error=false) { |
|
639 | +function prefs_form_global($user, $prefs, $error = false) { |
|
640 | 640 | global $in_use_prefs; |
641 | 641 | global $not_in_use_prefs; |
642 | 642 | global $job_prefs; |
@@ -673,9 +673,9 @@ discard block |
||
673 | 673 | // |
674 | 674 | function prefs_form_radio_buttons($name, $yesno) { |
675 | 675 | $rb = tra("yes")." <input type=radio name=$name value=yes " |
676 | - .($yesno?"checked":"") |
|
676 | + .($yesno ? "checked" : "") |
|
677 | 677 | ."> ".tra("no")." <input type=radio name=$name value=no " |
678 | - .($yesno?"":"checked") |
|
678 | + .($yesno ? "" : "checked") |
|
679 | 679 | .">\n"; |
680 | 680 | return $rb; |
681 | 681 | } |
@@ -694,12 +694,12 @@ discard block |
||
694 | 694 | } |
695 | 695 | function venue_show($user) { |
696 | 696 | $venue = $user->venue; |
697 | - if ($venue =='') $venue = '---'; |
|
697 | + if ($venue == '') $venue = '---'; |
|
698 | 698 | tooltip_row2(VENUE_TOOLTIP, VENUE_DESC, $venue); |
699 | 699 | } |
700 | 700 | |
701 | 701 | function venue_form($user) { |
702 | - $n=$h=$w=$s=$m=''; |
|
702 | + $n = $h = $w = $s = $m = ''; |
|
703 | 703 | if ($user->venue == '') $n = 'selected'; |
704 | 704 | if ($user->venue == 'home') $h = 'selected'; |
705 | 705 | if ($user->venue == 'work') $w = 'selected'; |
@@ -757,7 +757,7 @@ discard block |
||
757 | 757 | // |
758 | 758 | // convert prefs from structure to XML |
759 | 759 | // |
760 | -function global_prefs_make_xml($prefs, $primary=true) { |
|
760 | +function global_prefs_make_xml($prefs, $primary = true) { |
|
761 | 761 | global $in_use_prefs; |
762 | 762 | global $not_in_use_prefs; |
763 | 763 | global $job_prefs; |