@@ -19,6 +19,9 @@ |
||
19 | 19 | // express a time difference in readable form, e.g. "7 days ago". |
20 | 20 | // If it's more than 30 days, just show the date |
21 | 21 | // |
22 | +/** |
|
23 | + * @param integer $t2 |
|
24 | + */ |
|
22 | 25 | function time_diff_str($t1, $t2) { |
23 | 26 | if (!$t1 || !$t2) return "---"; |
24 | 27 | $diff = $t2 - $t1; |
@@ -22,21 +22,21 @@ discard block |
||
22 | 22 | function time_diff_str($t1, $t2) { |
23 | 23 | if (!$t1 || !$t2) return "---"; |
24 | 24 | $diff = $t2 - $t1; |
25 | - if ($diff<0){ |
|
26 | - $pre="In "; |
|
27 | - $post=""; |
|
28 | - $diff=-$diff; |
|
25 | + if ($diff < 0) { |
|
26 | + $pre = "In "; |
|
27 | + $post = ""; |
|
28 | + $diff = -$diff; |
|
29 | 29 | } else { |
30 | 30 | if ($diff > 86400*30) { |
31 | 31 | return date_str($t1); |
32 | 32 | } |
33 | - $pre=""; |
|
34 | - $post=" ago"; |
|
33 | + $pre = ""; |
|
34 | + $post = " ago"; |
|
35 | 35 | } |
36 | 36 | $x = ""; |
37 | 37 | |
38 | 38 | if ($diff >= 3600*24) { |
39 | - $n = (int) ($diff/(3600*24)); |
|
39 | + $n = (int)($diff/(3600*24)); |
|
40 | 40 | if ($n == 1) { |
41 | 41 | $x .= "1 day "; |
42 | 42 | } else { |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | return $pre.$x.$post; |
46 | 46 | //$diff -= $n*3600*24; |
47 | 47 | } elseif ($diff >= 3600) { |
48 | - $n = (int) ($diff/3600); |
|
48 | + $n = (int)($diff/3600); |
|
49 | 49 | if ($n == 1) { |
50 | 50 | $x .= "1 hour "; |
51 | 51 | } else { |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | return $pre.$x.$post; |
55 | 55 | //$diff -= $n*3600; |
56 | 56 | } elseif ($diff >= 60) { |
57 | - $n = (int) ($diff/60); |
|
57 | + $n = (int)($diff/60); |
|
58 | 58 | if ($n == 1) { |
59 | 59 | $x .= "1 minute "; |
60 | 60 | } else { |
61 | 61 | $x .= $n." minutes "; |
62 | 62 | } |
63 | 63 | return $pre.$x.$post; |
64 | - } elseif($diff > 1 || $diff==0) { |
|
64 | + } elseif ($diff > 1 || $diff == 0) { |
|
65 | 65 | return $pre."$diff seconds".$post; |
66 | - } elseif($diff == 1){ |
|
66 | + } elseif ($diff == 1) { |
|
67 | 67 | return $pre."$diff seconds".$post; |
68 | 68 | } |
69 | 69 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | function time_diff_str($t1, $t2) { |
23 | 23 | if (!$t1 || !$t2) return "---"; |
24 | 24 | $diff = $t2 - $t1; |
25 | - if ($diff<0){ |
|
25 | + if ($diff<0) { |
|
26 | 26 | $pre="In "; |
27 | 27 | $post=""; |
28 | 28 | $diff=-$diff; |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return $pre.$x.$post; |
64 | 64 | } elseif($diff > 1 || $diff==0) { |
65 | 65 | return $pre."$diff seconds".$post; |
66 | - } elseif($diff == 1){ |
|
66 | + } elseif($diff == 1) { |
|
67 | 67 | return $pre."$diff seconds".$post; |
68 | 68 | } |
69 | 69 | } |
@@ -112,6 +112,9 @@ discard block |
||
112 | 112 | // @param file The file to parse |
113 | 113 | // checking for inconsistencies if needed. |
114 | 114 | // |
115 | +/** |
|
116 | + * @param string $file |
|
117 | + */ |
|
115 | 118 | function parse_po_file($file) { |
116 | 119 | $translation_file = file($file); |
117 | 120 | $first_entry = true; |
@@ -157,6 +160,9 @@ discard block |
||
157 | 160 | |
158 | 161 | // Returns the contents of a line (ie removes "" from start and end) |
159 | 162 | // |
163 | +/** |
|
164 | + * @param string $line |
|
165 | + */ |
|
160 | 166 | function get_po_line($line, $file) { |
161 | 167 | $start = strpos($line, '"')+1; |
162 | 168 | $stop = strrpos($line, '"'); |
@@ -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,26 +115,26 @@ 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 | $output = array(); |
123 | - for ($i=0; $i<sizeof($translation_file); $i++){ |
|
123 | + for ($i = 0; $i < sizeof($translation_file); $i++) { |
|
124 | 124 | $entry = trim($translation_file[$i]); |
125 | 125 | //echo "line $i: $entry\n"; |
126 | - if (substr($entry, 0, 1)=="#") { |
|
126 | + if (substr($entry, 0, 1) == "#") { |
|
127 | 127 | continue; |
128 | 128 | } elseif (strpos($entry, "msgid") !== false) { |
129 | - if (!$first_entry){ |
|
129 | + if (!$first_entry) { |
|
130 | 130 | //If this is not the first, save the previous entry |
131 | - $output[$current_token]=$current_token_text; |
|
131 | + $output[$current_token] = $current_token_text; |
|
132 | 132 | } |
133 | 133 | $current_token = get_po_line($entry, $file); |
134 | - $current_token_text=""; |
|
134 | + $current_token_text = ""; |
|
135 | 135 | $parsing_token = true; |
136 | 136 | $parsing_text = false; |
137 | - $first_entry=false; |
|
137 | + $first_entry = false; |
|
138 | 138 | } elseif (strpos($entry, "msgstr") !== false) { |
139 | 139 | $current_token_text = get_po_line($entry, $file); |
140 | 140 | $parsing_token = false; |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | // Get the last token |
150 | 150 | // |
151 | - if ($current_token && $current_token_text){ |
|
151 | + if ($current_token && $current_token_text) { |
|
152 | 152 | $output[$current_token] = $current_token_text; |
153 | 153 | } |
154 | 154 | return $output; |
@@ -158,9 +158,9 @@ discard block |
||
158 | 158 | // Returns the contents of a line (ie removes "" from start and end) |
159 | 159 | // |
160 | 160 | function get_po_line($line, $file) { |
161 | - $start = strpos($line, '"')+1; |
|
161 | + $start = strpos($line, '"') + 1; |
|
162 | 162 | $stop = strrpos($line, '"'); |
163 | - $x = substr($line, $start, $stop-$start); |
|
163 | + $x = substr($line, $start, $stop - $start); |
|
164 | 164 | $n = preg_match("/[^\\\\]\"/", $x); |
165 | 165 | if ($n) { |
166 | 166 | echo "ERROR - MISMATCHED QUOTES IN $file: $line\n"; |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | |
180 | 180 | // Find the string in the user's language |
181 | 181 | // |
182 | - foreach ($languages_in_use as $language){ |
|
182 | + foreach ($languages_in_use as $language) { |
|
183 | 183 | if (isset($language_lookup_array[$language][$text])) { |
184 | 184 | $text = $language_lookup_array[$language][$text]; |
185 | 185 | break; |
186 | - } else if ($language=="en"){ |
|
186 | + } else if ($language == "en") { |
|
187 | 187 | // This language is defined in the code and is always available |
188 | 188 | break; |
189 | 189 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | // Replace relevant substrings with given arguments. |
193 | 193 | // Use strtr to avoid problems if an argument contains %n. |
194 | 194 | $replacements = array(); |
195 | - for ($i=1; $i<func_num_args(); $i++){ |
|
195 | + for ($i = 1; $i < func_num_args(); $i++) { |
|
196 | 196 | $replacements["%".$i] = func_get_arg($i); |
197 | 197 | } |
198 | 198 | $text = strtr($text, $replacements); |
@@ -210,13 +210,13 @@ 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 | - if ($loglevel==0) $msg = "[ Debug ]"; |
|
216 | - if ($loglevel==1) $msg = "[ Warning ]"; |
|
217 | - if ($loglevel==2) $msg = "[ CRITICAL ]"; |
|
215 | + if ($loglevel == 0) $msg = "[ Debug ]"; |
|
216 | + if ($loglevel == 1) $msg = "[ Warning ]"; |
|
217 | + if ($loglevel == 2) $msg = "[ CRITICAL ]"; |
|
218 | 218 | |
219 | - if ($loglevel >= $lang_log_level){ |
|
219 | + if ($loglevel >= $lang_log_level) { |
|
220 | 220 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
221 | 221 | } |
222 | 222 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | // (by looking at cookies and browser settings) |
226 | 226 | // cookies have highest priority. |
227 | 227 | |
228 | -if (isset($_COOKIE['lang'])){ |
|
228 | +if (isset($_COOKIE['lang'])) { |
|
229 | 229 | $language_string = $_COOKIE['lang'].","; |
230 | 230 | } else { |
231 | 231 | $language_string = ''; |
@@ -255,10 +255,10 @@ discard block |
||
255 | 255 | |
256 | 256 | // Loop over languages that the client requests |
257 | 257 | // |
258 | -for ($i=0; $i<sizeof($client_languages); $i++) { |
|
259 | - if ((strlen($client_languages[$i])>2) |
|
258 | +for ($i = 0; $i < sizeof($client_languages); $i++) { |
|
259 | + if ((strlen($client_languages[$i]) > 2) |
|
260 | 260 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
261 | - ){ |
|
261 | + ) { |
|
262 | 262 | // If this is defined as primary-secondary, represent it as xx_YY |
263 | 263 | // |
264 | 264 | $language = substr( |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | |
278 | 278 | // if main language is english, look no further |
279 | 279 | // |
280 | - if ((count($languages_in_use)==0) && ($language == 'en' || $language2 == 'en')) { |
|
280 | + if ((count($languages_in_use) == 0) && ($language == 'en' || $language2 == 'en')) { |
|
281 | 281 | break; |
282 | 282 | } |
283 | 283 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | // |
286 | 286 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
287 | 287 | if (file_exists($file_name)) { |
288 | - if (!in_array($language, $languages_in_use)){ |
|
288 | + if (!in_array($language, $languages_in_use)) { |
|
289 | 289 | require_once($file_name); |
290 | 290 | $languages_in_use[] = $language; |
291 | 291 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | if ($language2) { |
294 | 294 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
295 | 295 | if (file_exists($file_name)) { |
296 | - if (!in_array($language2, $languages_in_use)){ |
|
296 | + if (!in_array($language2, $languages_in_use)) { |
|
297 | 297 | require_once($file_name); |
298 | 298 | $languages_in_use[] = $language2; |
299 | 299 | } |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | } |
302 | 302 | } |
303 | 303 | |
304 | -$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
304 | +$GLOBALS['languages_in_use'] = $languages_in_use; // for Drupal |
|
305 | 305 | |
306 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
306 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
307 | 307 | ?> |
@@ -68,7 +68,7 @@ discard block |
||
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,7 +95,7 @@ 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 | 101 | fwrite($fh, "\$language_lookup_array[\"".str_replace("\"", "\\\"", substr($file,0,-3))."\"][\"".$key."\"] = \"".$value."\";\n"); |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | $parsing_token = false; |
121 | 121 | $parsing_text = false; |
122 | 122 | $output = array(); |
123 | - for ($i=0; $i<sizeof($translation_file); $i++){ |
|
123 | + for ($i=0; $i<sizeof($translation_file); $i++) { |
|
124 | 124 | $entry = trim($translation_file[$i]); |
125 | 125 | //echo "line $i: $entry\n"; |
126 | 126 | if (substr($entry, 0, 1)=="#") { |
127 | 127 | continue; |
128 | 128 | } elseif (strpos($entry, "msgid") !== false) { |
129 | - if (!$first_entry){ |
|
129 | + if (!$first_entry) { |
|
130 | 130 | //If this is not the first, save the previous entry |
131 | 131 | $output[$current_token]=$current_token_text; |
132 | 132 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | |
149 | 149 | // Get the last token |
150 | 150 | // |
151 | - if ($current_token && $current_token_text){ |
|
151 | + if ($current_token && $current_token_text) { |
|
152 | 152 | $output[$current_token] = $current_token_text; |
153 | 153 | } |
154 | 154 | return $output; |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | |
180 | 180 | // Find the string in the user's language |
181 | 181 | // |
182 | - foreach ($languages_in_use as $language){ |
|
182 | + foreach ($languages_in_use as $language) { |
|
183 | 183 | if (isset($language_lookup_array[$language][$text])) { |
184 | 184 | $text = $language_lookup_array[$language][$text]; |
185 | 185 | break; |
186 | - } else if ($language=="en"){ |
|
186 | + } else if ($language=="en") { |
|
187 | 187 | // This language is defined in the code and is always available |
188 | 188 | break; |
189 | 189 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | // Replace relevant substrings with given arguments. |
193 | 193 | // Use strtr to avoid problems if an argument contains %n. |
194 | 194 | $replacements = array(); |
195 | - for ($i=1; $i<func_num_args(); $i++){ |
|
195 | + for ($i=1; $i<func_num_args(); $i++) { |
|
196 | 196 | $replacements["%".$i] = func_get_arg($i); |
197 | 197 | } |
198 | 198 | $text = strtr($text, $replacements); |
@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | if ($loglevel==1) $msg = "[ Warning ]"; |
217 | 217 | if ($loglevel==2) $msg = "[ CRITICAL ]"; |
218 | 218 | |
219 | - if ($loglevel >= $lang_log_level){ |
|
219 | + if ($loglevel >= $lang_log_level) { |
|
220 | 220 | echo gmdate("Y-m-d H:i:s", time())." ".$msg." ".$message."\n"; |
221 | 221 | } |
222 | 222 | } |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | // (by looking at cookies and browser settings) |
226 | 226 | // cookies have highest priority. |
227 | 227 | |
228 | -if (isset($_COOKIE['lang'])){ |
|
228 | +if (isset($_COOKIE['lang'])) { |
|
229 | 229 | $language_string = $_COOKIE['lang'].","; |
230 | 230 | } else { |
231 | 231 | $language_string = ''; |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | for ($i=0; $i<sizeof($client_languages); $i++) { |
259 | 259 | if ((strlen($client_languages[$i])>2) |
260 | 260 | && (substr($client_languages[$i], 2, 1) == "_" || substr($client_languages[$i], 2, 1) == "-") |
261 | - ){ |
|
261 | + ) { |
|
262 | 262 | // If this is defined as primary-secondary, represent it as xx_YY |
263 | 263 | // |
264 | 264 | $language = substr( |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | // |
286 | 286 | $file_name = $lang_language_dir.$lang_compiled_dir.$language.".po.inc"; |
287 | 287 | if (file_exists($file_name)) { |
288 | - if (!in_array($language, $languages_in_use)){ |
|
288 | + if (!in_array($language, $languages_in_use)) { |
|
289 | 289 | require_once($file_name); |
290 | 290 | $languages_in_use[] = $language; |
291 | 291 | } |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | if ($language2) { |
294 | 294 | $file_name = $lang_language_dir.$lang_compiled_dir.$language2.".po.inc"; |
295 | 295 | if (file_exists($file_name)) { |
296 | - if (!in_array($language2, $languages_in_use)){ |
|
296 | + if (!in_array($language2, $languages_in_use)) { |
|
297 | 297 | require_once($file_name); |
298 | 298 | $languages_in_use[] = $language2; |
299 | 299 | } |
@@ -113,6 +113,9 @@ |
||
113 | 113 | return ($a->expavg_credit < $b->expavg_credit)? 1 : -1; |
114 | 114 | } |
115 | 115 | |
116 | +/** |
|
117 | + * @param boolean $personal |
|
118 | + */ |
|
116 | 119 | function show_other_projects($user, $personal) { |
117 | 120 | if (!isset($user->projects)) return; |
118 | 121 | if (count($user->projects) < 2) return; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | // Check the cache for that URL |
40 | 40 | // |
41 | 41 | $cacheddata = get_cached_data(REMOTE_PROJECTS_TTL, $url); |
42 | - if ($cacheddata){ |
|
42 | + if ($cacheddata) { |
|
43 | 43 | $remote = unserialize($cacheddata); |
44 | 44 | } else { |
45 | 45 | // Fetch the XML, use curl if fopen() is disallowed |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | if ($badge_height) { |
331 | 331 | $x .= badges_string(true, $user, $badge_height); |
332 | 332 | } |
333 | - if (function_exists("project_user_links")){ |
|
333 | + if (function_exists("project_user_links")) { |
|
334 | 334 | $x .= project_user_links($user); |
335 | 335 | } |
336 | 336 | return $x; |
@@ -444,7 +444,7 @@ discard block |
||
444 | 444 | row2(tra("Computers"), tra("hidden")); |
445 | 445 | } |
446 | 446 | } |
447 | - if ($user->donated == 1) { |
|
447 | + if ($user->donated == 1) { |
|
448 | 448 | if (file_exists("../project/donations.inc")) { |
449 | 449 | require_once("../project/donations.inc"); |
450 | 450 | row2(tra("Donor"), DONATION_LINK); |
@@ -461,7 +461,7 @@ discard block |
||
461 | 461 | // Returns a cacheable community links data object |
462 | 462 | // @param user The user to produce a community links object for |
463 | 463 | |
464 | -function get_community_links_object($user){ |
|
464 | +function get_community_links_object($user) { |
|
465 | 465 | $cache_object = new StdClass; |
466 | 466 | $cache_object->post_count = total_posts($user); |
467 | 467 | $cache_object->user = $user; |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | return $cache_object; |
478 | 478 | } |
479 | 479 | |
480 | -function community_links($clo, $logged_in_user){ |
|
480 | +function community_links($clo, $logged_in_user) { |
|
481 | 481 | $user = $clo->user; |
482 | 482 | $team = $clo->team; |
483 | 483 | $friends = $clo->friends; |
@@ -33,13 +33,13 @@ 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 |
40 | 40 | // |
41 | 41 | $cacheddata = get_cached_data(REMOTE_PROJECTS_TTL, $url); |
42 | - if ($cacheddata){ |
|
42 | + if ($cacheddata) { |
|
43 | 43 | $remote = unserialize($cacheddata); |
44 | 44 | } else { |
45 | 45 | // Fetch the XML, use curl if fopen() is disallowed |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | |
111 | 111 | function cmp($a, $b) { |
112 | 112 | if ($a->expavg_credit == $b->expavg_credit) return 0; |
113 | - return ($a->expavg_credit < $b->expavg_credit)? 1 : -1; |
|
113 | + return ($a->expavg_credit < $b->expavg_credit) ? 1 : -1; |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | function show_other_projects($user, $personal) { |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | ), |
134 | 134 | array("", ALIGN_RIGHT, ALIGN_RIGHT, ALIGN_RIGHT) |
135 | 135 | ); |
136 | - foreach($user->projects as $project) { |
|
136 | + foreach ($user->projects as $project) { |
|
137 | 137 | show_project($project); |
138 | 138 | } |
139 | 139 | end_table(); |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $config = get_config(); |
162 | 162 | row2(tra("Computers on this account"), "<a href=\"hosts_user.php\">".tra("View")."</a>"); |
163 | 163 | row2(tra("Tasks"), "<a href=\"results.php?userid=$user->id\">".tra("View")."</a>"); |
164 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
164 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
165 | 165 | $x = ""; |
166 | 166 | shuffle($cpid_stats_sites); |
167 | 167 | foreach ($cpid_stats_sites as $site) { |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | // show user name, with links to profile if present. |
311 | 311 | // if $badge_height is > 0, show badges |
312 | 312 | // |
313 | -function user_links($user, $badge_height=0) { |
|
313 | +function user_links($user, $badge_height = 0) { |
|
314 | 314 | BoincForumPrefs::lookup($user); |
315 | 315 | if (is_banished($user)) { |
316 | 316 | return "(banished: ID $user->id)"; |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | if ($badge_height) { |
333 | 333 | $x .= badges_string(true, $user, $badge_height); |
334 | 334 | } |
335 | - if (function_exists("project_user_links")){ |
|
335 | + if (function_exists("project_user_links")) { |
|
336 | 336 | $x .= project_user_links($user); |
337 | 337 | } |
338 | 338 | return $x; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | |
386 | 386 | // if there's a foundership request, notify the founder |
387 | 387 | // |
388 | - if ($user->id==$team->userid && $team->ping_user >0) { |
|
388 | + if ($user->id == $team->userid && $team->ping_user > 0) { |
|
389 | 389 | $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>"; |
390 | 390 | } |
391 | 391 | row2(tra("Member of team"), $x); |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | $x = "<a href=\"user_search.php\">".tra("Find friends")."</a><br/>\n"; |
411 | 411 | $n = count($friends); |
412 | 412 | if ($n) { |
413 | - foreach($friends as $friend) { |
|
413 | + foreach ($friends as $friend) { |
|
414 | 414 | $fuser = BoincUser::lookup_id($friend->user_dest); |
415 | 415 | if (!$fuser) continue; |
416 | 416 | $x .= friend_links($fuser); |
@@ -463,7 +463,7 @@ discard block |
||
463 | 463 | // Returns a cacheable community links data object |
464 | 464 | // @param user The user to produce a community links object for |
465 | 465 | |
466 | -function get_community_links_object($user){ |
|
466 | +function get_community_links_object($user) { |
|
467 | 467 | $cache_object = new StdClass; |
468 | 468 | $cache_object->post_count = total_posts($user); |
469 | 469 | $cache_object->user = $user; |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | $cache_object->friends = array(); |
472 | 472 | |
473 | 473 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
474 | - foreach($friends as $friend) { |
|
474 | + foreach ($friends as $friend) { |
|
475 | 475 | $fuser = BoincUser::lookup_id($friend->user_dest); |
476 | 476 | if (!$fuser) continue; |
477 | 477 | $cache_object->friends[] = $fuser; |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | return $cache_object; |
480 | 480 | } |
481 | 481 | |
482 | -function community_links($clo, $logged_in_user){ |
|
482 | +function community_links($clo, $logged_in_user) { |
|
483 | 483 | $user = $clo->user; |
484 | 484 | $team = $clo->team; |
485 | 485 | $friends = $clo->friends; |
@@ -505,15 +505,15 @@ discard block |
||
505 | 505 | "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>" |
506 | 506 | ); |
507 | 507 | } else if ($friend) { |
508 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
508 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
509 | 509 | } else { |
510 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
510 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
514 | 514 | if ($friends) { |
515 | 515 | $x = ""; |
516 | - foreach($friends as $friend) { |
|
516 | + foreach ($friends as $friend) { |
|
517 | 517 | $x .= friend_links($friend); |
518 | 518 | } |
519 | 519 | row2(tra("Friends")." (".sizeof($friends).")", $x); |
@@ -553,6 +553,6 @@ discard block |
||
553 | 553 | ); |
554 | 554 | } |
555 | 555 | |
556 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
556 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
557 | 557 | |
558 | 558 | ?> |
@@ -65,10 +65,17 @@ discard block |
||
65 | 65 | . "<p>\n"; |
66 | 66 | } |
67 | 67 | |
68 | +/** |
|
69 | + * @param string $x |
|
70 | + */ |
|
68 | 71 | function row($x, $y) { |
69 | 72 | echo "<tr><td valign=\"top\" align=\"right\">$x</td>\n<td>$y</td>\n</tr>\n"; |
70 | 73 | } |
71 | 74 | |
75 | +/** |
|
76 | + * @param string $color |
|
77 | + * @param string $x |
|
78 | + */ |
|
72 | 79 | function c_row2($color, $x, $y) { |
73 | 80 | echo "<tr bgcolor=\"$color\"><td align=\"right\">$x</td><td>$y</td></tr>\n"; |
74 | 81 | } |
@@ -134,6 +141,9 @@ discard block |
||
134 | 141 | |
135 | 142 | // allow access only if logged in as user in a given set |
136 | 143 | // |
144 | +/** |
|
145 | + * @param integer[] $admin_user_ids |
|
146 | + */ |
|
137 | 147 | function auth_ops_userid($admin_user_ids) { |
138 | 148 | $user = get_logged_in_user_ops(); |
139 | 149 | if (!$user) { |
@@ -288,6 +298,10 @@ discard block |
||
288 | 298 | |
289 | 299 | ////// badge-related stuff |
290 | 300 | |
301 | +/** |
|
302 | + * @param string $name |
|
303 | + * @param string $title |
|
304 | + */ |
|
291 | 305 | function get_badge($name, $title, $image_url) { |
292 | 306 | $b = BoincBadge::lookup("name='$name'"); |
293 | 307 | if ($b) return $b; |
@@ -319,6 +333,9 @@ discard block |
||
319 | 333 | |
320 | 334 | // unassign all badges except the given one |
321 | 335 | // |
336 | +/** |
|
337 | + * @param integer $k |
|
338 | + */ |
|
322 | 339 | function unassign_badges($is_user, $item, $badges, $k) { |
323 | 340 | $list = null; |
324 | 341 | for ($i=0; $i<count($badges); $i++) { |
@@ -62,7 +62,7 @@ discard block |
||
62 | 62 | |
63 | 63 | function print_text_field($text,$name,$value) { |
64 | 64 | echo "$text <input type=\"text\" size=\"10\" name=\"$name\" value=\"$value\">\n" |
65 | - . "<p>\n"; |
|
65 | + . "<p>\n"; |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | function row($x, $y) { |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | $db->do_query($q4); |
379 | 379 | return 2; |
380 | 380 | } else if (!$db->do_query($q3)) { |
381 | - echo "MySQL command '$q3' failed:<br/>unable to cancel workunits and trigger transitioner.<br>\n"; |
|
381 | + echo "MySQL command '$q3' failed:<br/>unable to cancel workunits and trigger transitioner.<br>\n"; |
|
382 | 382 | $db->do_query($q4); |
383 | 383 | return 3; |
384 | 384 | } |
@@ -46,21 +46,21 @@ discard block |
||
46 | 46 | |
47 | 47 | // TODO: get rid of all the following |
48 | 48 | |
49 | -function print_checkbox($text,$name,$checked) { |
|
49 | +function print_checkbox($text, $name, $checked) { |
|
50 | 50 | echo "<input type=\"checkbox\" name=\"$name\"" |
51 | - . (strlen($checked) ? " checked=\"checked\"" : "") . ">" |
|
51 | + . (strlen($checked) ? " checked=\"checked\"" : "").">" |
|
52 | 52 | . "$text\n" |
53 | 53 | . "<p>\n"; |
54 | 54 | } |
55 | 55 | |
56 | -function print_radio_button($text,$name,$value,$checked) { |
|
56 | +function print_radio_button($text, $name, $value, $checked) { |
|
57 | 57 | echo "<input type=\"radio\" name=\"$name\" value=\"$value\"" |
58 | - . (strlen($checked) ? " checked=\"checked\"" : "") . ">" |
|
58 | + . (strlen($checked) ? " checked=\"checked\"" : "").">" |
|
59 | 59 | . "$text\n" |
60 | 60 | . "<br>\n"; |
61 | 61 | } |
62 | 62 | |
63 | -function print_text_field($text,$name,$value) { |
|
63 | +function print_text_field($text, $name, $value) { |
|
64 | 64 | echo "$text <input type=\"text\" size=\"10\" name=\"$name\" value=\"$value\">\n" |
65 | 65 | . "<p>\n"; |
66 | 66 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | if ($host == null) { |
92 | 92 | $host = "localhost"; |
93 | 93 | } |
94 | - $in = fopen("php://stdin","r"); |
|
94 | + $in = fopen("php://stdin", "r"); |
|
95 | 95 | print "Database username (default: owner of mysqld process): "; |
96 | 96 | $user = rtrim(fgets($in, 80)); |
97 | 97 | print "Database password (if any): "; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | } |
104 | 104 | } |
105 | 105 | |
106 | -function print_login_form_ops($next_url='') { |
|
106 | +function print_login_form_ops($next_url = '') { |
|
107 | 107 | if ($next_url == '') $next_url = $_SERVER['REQUEST_URI']; |
108 | 108 | start_table(); |
109 | 109 | echo " |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | // return a list of the current, non-deprecated ones |
201 | 201 | // |
202 | 202 | function current_versions($avs) { |
203 | - foreach($avs as $av) { |
|
203 | + foreach ($avs as $av) { |
|
204 | 204 | foreach ($avs as $av2) { |
205 | 205 | if ($av->id == $av2->id) continue; |
206 | 206 | if ($av->platformid == $av2->platformid && $av->plan_class == $av2->plan_class && $av->version_num > $av2->version_num) { |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | } |
210 | 210 | } |
211 | 211 | $x = array(); |
212 | - foreach($avs as $av) { |
|
212 | + foreach ($avs as $av) { |
|
213 | 213 | if (!$av->deprecated) $x[] = $av; |
214 | 214 | } |
215 | 215 | return $x; |
@@ -321,7 +321,7 @@ discard block |
||
321 | 321 | // |
322 | 322 | function unassign_badges($is_user, $item, $badges, $k) { |
323 | 323 | $list = null; |
324 | - for ($i=0; $i<count($badges); $i++) { |
|
324 | + for ($i = 0; $i < count($badges); $i++) { |
|
325 | 325 | if ($i == $k) continue; |
326 | 326 | $badge = $badges[$i]; |
327 | 327 | if ($list) { |
@@ -74,7 +74,7 @@ |
||
74 | 74 | } |
75 | 75 | |
76 | 76 | function show_profile_link_ops($user) { |
77 | - if ($user->has_profile) { |
|
77 | + if ($user->has_profile) { |
|
78 | 78 | row2("Profile", |
79 | 79 | "<a href=\"".url_base()."view_profile.php?userid=$user->id\">View</a>" |
80 | 80 | ); |
@@ -21,6 +21,9 @@ discard block |
||
21 | 21 | // my PHP currently doesn't support file_get_contents(https://...) |
22 | 22 | // so do it with Curl |
23 | 23 | // |
24 | +/** |
|
25 | + * @param string $url |
|
26 | + */ |
|
24 | 27 | function fetch_url($url) { |
25 | 28 | if (0) { |
26 | 29 | return file_get_contents($url); |
@@ -35,6 +38,11 @@ discard block |
||
35 | 38 | } |
36 | 39 | } |
37 | 40 | |
41 | +/** |
|
42 | + * @param string $project_url |
|
43 | + * @param string $email_addr |
|
44 | + * @param string $passwd_hash |
|
45 | + */ |
|
38 | 46 | function lookup_account( |
39 | 47 | $project_url, |
40 | 48 | $email_addr, |
@@ -57,6 +65,12 @@ discard block |
||
57 | 65 | |
58 | 66 | // return (authenticator, errmsg) |
59 | 67 | // |
68 | +/** |
|
69 | + * @param string $project_url |
|
70 | + * @param string $email_addr |
|
71 | + * @param string $passwd_hash |
|
72 | + * @param string $user_name |
|
73 | + */ |
|
60 | 74 | function create_account( |
61 | 75 | $project_url, |
62 | 76 | $email_addr, |
@@ -57,6 +57,9 @@ |
||
57 | 57 | |
58 | 58 | $xml_outer_tag = ""; |
59 | 59 | |
60 | +/** |
|
61 | + * @param string $tag |
|
62 | + */ |
|
60 | 63 | function xml_start_tag($tag) { |
61 | 64 | global $xml_outer_tag; |
62 | 65 | echo "<$tag>\n"; |
@@ -72,6 +72,9 @@ discard block |
||
72 | 72 | // badge_name_prefix should be user or team |
73 | 73 | // sub_project is an array with name and short_name as in $sub_projects |
74 | 74 | // |
75 | +/** |
|
76 | + * @param string $badge_name_prefix |
|
77 | + */ |
|
75 | 78 | function get_badges( |
76 | 79 | $badge_name_prefix, $badge_level_names, $badge_images, $sub_project |
77 | 80 | ) { |
@@ -105,6 +108,9 @@ discard block |
||
105 | 108 | // decide which subproject badge to assign, if any. |
106 | 109 | // Unassign other badges. |
107 | 110 | // |
111 | +/** |
|
112 | + * @param string $where_clause |
|
113 | + */ |
|
108 | 114 | function assign_sub_badge($is_user, $item, $levels, $badges, $where_clause) { |
109 | 115 | if ($is_user) { |
110 | 116 | $sub_total = BoincCreditUser::sum('total', "where userid=".$item->id." and ($where_clause)"); |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | ) { |
78 | 78 | $badges = array(); |
79 | 79 | $limit = count($badge_level_names); |
80 | - for ($i=0; $i < $limit; $i++) { |
|
80 | + for ($i = 0; $i < $limit; $i++) { |
|
81 | 81 | $badges[$i] = get_badge($badge_name_prefix."_".$sub_project["short_name"]."_".$i, "$badge_level_names[$i] in ".$sub_project["name"]." credit", $sub_project["short_name"].$badge_images[$i]); |
82 | 82 | } |
83 | 83 | return $badges; |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | // count from highest to lowest level, so the user get's assigned the |
91 | 91 | // highest possible level and the lower levels get removed |
92 | 92 | // |
93 | - for ($i=count($levels)-1; $i>=0; $i--) { |
|
93 | + for ($i = count($levels) - 1; $i >= 0; $i--) { |
|
94 | 94 | if ($item->total_credit >= $levels[$i]) { |
95 | 95 | assign_badge($is_user, $item, $badges[$i]); |
96 | 96 | unassign_badges($is_user, $item, $badges, $i); |
@@ -114,7 +114,7 @@ discard block |
||
114 | 114 | // count from highest to lowest level, so the user get's assigned the |
115 | 115 | // highest possible level and the lower levels get removed |
116 | 116 | // |
117 | - for ($i=count($levels)-1; $i>=0; $i--) { |
|
117 | + for ($i = count($levels) - 1; $i >= 0; $i--) { |
|
118 | 118 | if ($sub_total >= $levels[$i]) { |
119 | 119 | assign_badge($is_user, $item, $badges[$i]); |
120 | 120 | unassign_badges($is_user, $item, $badges, $i); |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | $is_user, $badge_levels, $badge_level_names, $badge_images, |
135 | 135 | $subprojects_list |
136 | 136 | ) { |
137 | - $kind = $is_user?"user":"team"; |
|
137 | + $kind = $is_user ? "user" : "team"; |
|
138 | 138 | |
139 | 139 | // get badges for all subprojects including total |
140 | 140 | // |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | $n = 0; |
146 | - $maxid = $is_user?BoincUser::max("id"):BoincTeam::max("id"); |
|
146 | + $maxid = $is_user ? BoincUser::max("id") : BoincTeam::max("id"); |
|
147 | 147 | while ($n <= $maxid) { |
148 | 148 | $m = $n + 1000; |
149 | 149 | if ($is_user) { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | assign_tot_badge($is_user, $item, $badge_levels, $badges["total"]); |
162 | 162 | } else { |
163 | 163 | // appids come from project/project.inc |
164 | - $where_clause = "appid in (". implode(',', $sp["appids"]) .")"; |
|
164 | + $where_clause = "appid in (".implode(',', $sp["appids"]).")"; |
|
165 | 165 | assign_sub_badge( |
166 | 166 | $is_user, $item, $badge_levels, $badges[$sp["short_name"]], |
167 | 167 | $where_clause |
@@ -173,6 +173,9 @@ discard block |
||
173 | 173 | return $x; |
174 | 174 | } |
175 | 175 | |
176 | +/** |
|
177 | + * @param integer $mode |
|
178 | + */ |
|
176 | 179 | function get_nquestions($unit, $mode) { |
177 | 180 | global $snap; |
178 | 181 | |
@@ -187,6 +190,9 @@ discard block |
||
187 | 190 | return 0; |
188 | 191 | } |
189 | 192 | |
193 | +/** |
|
194 | + * @param integer $mode |
|
195 | + */ |
|
190 | 196 | function get_views($unit, $mode) { |
191 | 197 | global $snap; |
192 | 198 | |
@@ -231,6 +237,10 @@ discard block |
||
231 | 237 | |
232 | 238 | $rownum = 0; |
233 | 239 | |
240 | +/** |
|
241 | + * @param string $class |
|
242 | + * @param boolean $is_answer |
|
243 | + */ |
|
234 | 244 | function show_unit_row($unit, $class, $level, $is_answer) { |
235 | 245 | global $breakdown, $breakdown_cat; |
236 | 246 | global $rownum, $course_id; |
@@ -319,6 +329,9 @@ discard block |
||
319 | 329 | echo "</tr>\n"; |
320 | 330 | } |
321 | 331 | |
332 | +/** |
|
333 | + * @param string $class |
|
334 | + */ |
|
322 | 335 | function breakdown_class($class) { |
323 | 336 | switch ($class) { |
324 | 337 | case "BoltLesson": |
@@ -356,6 +369,9 @@ discard block |
||
356 | 369 | } |
357 | 370 | } |
358 | 371 | |
372 | +/** |
|
373 | + * @param integer $level |
|
374 | + */ |
|
359 | 375 | function show_unit_recurse($unit, $level) { |
360 | 376 | show_unit($unit, $level); |
361 | 377 | if ($unit->is_item) return; |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | function spaces($level) { |
105 | 105 | $x = ""; |
106 | - for ($i=0; $i<$level; $i++) { |
|
106 | + for ($i = 0; $i < $level; $i++) { |
|
107 | 107 | $x .= " "; |
108 | 108 | } |
109 | 109 | return $x; |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | function avg_score($array) { |
137 | 137 | $sum = 0; |
138 | 138 | $n = count($array); |
139 | - if ($n ==0) return 0; |
|
139 | + if ($n == 0) return 0; |
|
140 | 140 | foreach ($array as $a) { |
141 | 141 | $sum += $a->score; |
142 | 142 | } |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | $n++; |
153 | 153 | } |
154 | 154 | } |
155 | - if ($n ==0) return 0; |
|
155 | + if ($n == 0) return 0; |
|
156 | 156 | return $sum/$n; |
157 | 157 | } |
158 | 158 | |
@@ -235,7 +235,7 @@ discard block |
||
235 | 235 | global $breakdown, $breakdown_cat; |
236 | 236 | global $rownum, $course_id; |
237 | 237 | |
238 | - $a = $is_answer?" (answer)":""; |
|
238 | + $a = $is_answer ? " (answer)" : ""; |
|
239 | 239 | $j = ($rownum++)%2; |
240 | 240 | echo "<tr class=row$j>"; |
241 | 241 | if ($breakdown && $breakdown_cat) { |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | <td><br></td> |
244 | 244 | <td><br></td> |
245 | 245 | "; |
246 | - } else { |
|
246 | + } else { |
|
247 | 247 | $c = class_name($class); |
248 | 248 | echo " |
249 | 249 | <td><b>".spaces($level)."$unit->name</b></td> |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | echo time_graph($t, 200); |
278 | 278 | break; |
279 | 279 | case "BoltExercise": |
280 | - $mode = $is_answer?BOLT_MODE_ANSWER:BOLT_MODE_SHOW; |
|
280 | + $mode = $is_answer ? BOLT_MODE_ANSWER : BOLT_MODE_SHOW; |
|
281 | 281 | $views = get_views($unit, $mode); |
282 | 282 | $n = count($views); |
283 | 283 | $out = outcomes($views); |
@@ -360,7 +360,7 @@ discard block |
||
360 | 360 | show_unit($unit, $level); |
361 | 361 | if ($unit->is_item) return; |
362 | 362 | foreach ($unit->units as $u) { |
363 | - show_unit_recurse($u, $level+1); |
|
363 | + show_unit_recurse($u, $level + 1); |
|
364 | 364 | } |
365 | 365 | } |
366 | 366 | |
@@ -402,9 +402,9 @@ discard block |
||
402 | 402 | <input type=hidden name=course_id value=$course_id> |
403 | 403 | <table width=600><tr><td valign=top> |
404 | 404 | "; |
405 | - filter_form($filter?$filter->name():"", $filter_cat); |
|
405 | + filter_form($filter ? $filter->name() : "", $filter_cat); |
|
406 | 406 | echo "</td><td valign=top>"; |
407 | - breakdown_form($breakdown?$breakdown->name():""); |
|
407 | + breakdown_form($breakdown ? $breakdown->name() : ""); |
|
408 | 408 | echo " |
409 | 409 | </td></tr></table> |
410 | 410 | <p> |
@@ -243,7 +243,7 @@ |
||
243 | 243 | <td><br></td> |
244 | 244 | <td><br></td> |
245 | 245 | "; |
246 | - } else { |
|
246 | + } else { |
|
247 | 247 | $c = class_name($class); |
248 | 248 | echo " |
249 | 249 | <td><b>".spaces($level)."$unit->name</b></td> |
@@ -34,6 +34,9 @@ |
||
34 | 34 | require_once($file); |
35 | 35 | } |
36 | 36 | |
37 | +/** |
|
38 | + * @param integer $i |
|
39 | + */ |
|
37 | 40 | function show_bossa_app($app, $i) { |
38 | 41 | $j = $i%2; |
39 | 42 | echo "<tr class=row$j> |
@@ -101,9 +101,9 @@ discard block |
||
101 | 101 | "; |
102 | 102 | start_table(); |
103 | 103 | row1("User settings"); |
104 | - $x = ($flags&BOLT_FLAGS_SHOW_ALL)?"checked":""; |
|
104 | + $x = ($flags&BOLT_FLAGS_SHOW_ALL) ? "checked" : ""; |
|
105 | 105 | row2("Show hidden apps?", "<input type=checkbox name=show_all $x>"); |
106 | - $x = ($flags&BOLT_FLAGS_DEBUG)?"checked":""; |
|
106 | + $x = ($flags&BOLT_FLAGS_DEBUG) ? "checked" : ""; |
|
107 | 107 | row2("Show debugging output?", "<input type=checkbox name=debug $x>"); |
108 | 108 | row2("", "<input class=\"btn btn-default\" type=submit value=\"Update user\">"); |
109 | 109 | end_table(); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | foreach ($jobs as $job) { |
172 | 172 | $t = time_str($job->create_time); |
173 | 173 | $s = job_state_string($job->state); |
174 | - $j = $i++ % 2; |
|
174 | + $j = $i++%2; |
|
175 | 175 | echo "<tr class=row$j> |
176 | 176 | <td> |
177 | 177 | $job->id <a href=bossa_admin.php?action=job_show_insts&job_id=$job->id>(details)</a><br> |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | table_row( |
204 | 204 | "$batch->id | <a href=bossa_admin.php?action=show_batch&batch_id=$batch->id>show jobs</a> | <a href=bossa_admin.php?action=clear_batch_confirm&batch_id=$batch->id>delete instances</a>", |
205 | 205 | "$batch->name", |
206 | - $batch->calibration?"yes":"no", |
|
206 | + $batch->calibration ? "yes" : "no", |
|
207 | 207 | time_str($batch->create_time), |
208 | 208 | BossaJob::count("batch_id=$batch->id"), |
209 | 209 | BossaJob::count("batch_id=$batch->id and state=2") |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | if (!$time_estimate) $time_estimate = 60; |
334 | 334 | $time_limit = get_str('time_limit'); |
335 | 335 | if (!$time_limit) $time_limit = 3600; |
336 | - $calibration_frac = get_str('calibration_frac' , true); |
|
336 | + $calibration_frac = get_str('calibration_frac', true); |
|
337 | 337 | if (!$calibration_frac) $calibration_frac = 0; |
338 | 338 | $now = time(); |
339 | 339 | $app_id = BossaApp::insert("(create_time, name, short_name, description, bolt_course_id, time_estimate, time_limit, calibration_frac) values ($now, '$name', '$short_name', '$description', $courseid, $time_estimate, $time_limit, $calibration_frac)"); |