@@ -23,6 +23,9 @@ |
||
23 | 23 | $cli_only = true; |
24 | 24 | include_once("util_ops.inc"); |
25 | 25 | |
26 | +/** |
|
27 | + * @param string $x |
|
28 | + */ |
|
26 | 29 | function fail($x) { |
27 | 30 | $f = fopen("error_log", "a"); |
28 | 31 | if (!$f) return false; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | return $lines; |
42 | 42 | } |
43 | 43 | |
44 | -function write_count_file($n,$m) { |
|
44 | +function write_count_file($n, $m) { |
|
45 | 45 | $f = fopen("nresults", "w"); |
46 | 46 | if (!$f) return false; |
47 | 47 | $x = sprintf("%d\n%d\n", $n, $m); |
@@ -80,12 +80,12 @@ discard block |
||
80 | 80 | } |
81 | 81 | $n = read_count_file(); |
82 | 82 | if ($n == false) { |
83 | - write_count_file($m,$p); |
|
83 | + write_count_file($m, $p); |
|
84 | 84 | exit(); |
85 | 85 | } |
86 | 86 | if (trim($n[0]) == $m && trim($n[1]) == $p) { |
87 | 87 | fail("Result count hasn't changed\n"); |
88 | 88 | } |
89 | - write_count_file($m,$p); |
|
89 | + write_count_file($m, $p); |
|
90 | 90 | |
91 | 91 | ?> |
@@ -25,7 +25,9 @@ discard block |
||
25 | 25 | |
26 | 26 | function fail($x) { |
27 | 27 | $f = fopen("error_log", "a"); |
28 | - if (!$f) return false; |
|
28 | + if (!$f) { |
|
29 | + return false; |
|
30 | + } |
|
29 | 31 | fputs($f, "[".strftime("%T %D")."] "); |
30 | 32 | fputs($f, $x); |
31 | 33 | fclose($f); |
@@ -37,13 +39,17 @@ discard block |
||
37 | 39 | return false; |
38 | 40 | } |
39 | 41 | $lines = file("nresults"); |
40 | - if (!$lines) return false; |
|
42 | + if (!$lines) { |
|
43 | + return false; |
|
44 | + } |
|
41 | 45 | return $lines; |
42 | 46 | } |
43 | 47 | |
44 | 48 | function write_count_file($n,$m) { |
45 | 49 | $f = fopen("nresults", "w"); |
46 | - if (!$f) return false; |
|
50 | + if (!$f) { |
|
51 | + return false; |
|
52 | + } |
|
47 | 53 | $x = sprintf("%d\n%d\n", $n, $m); |
48 | 54 | fwrite($f, $x); |
49 | 55 | fclose($f); |
@@ -52,7 +58,9 @@ discard block |
||
52 | 58 | |
53 | 59 | function get_working_count_from_db() { |
54 | 60 | $result = _mysql_query("select count(*) from result where server_state = 4"); |
55 | - if (!$result) return false; |
|
61 | + if (!$result) { |
|
62 | + return false; |
|
63 | + } |
|
56 | 64 | $count = _mysql_fetch_array($result); |
57 | 65 | _mysql_free_result($result); |
58 | 66 | return $count[0]; |
@@ -60,7 +68,9 @@ discard block |
||
60 | 68 | |
61 | 69 | function get_count_from_db() { |
62 | 70 | $result = _mysql_query("select count(*) from result"); |
63 | - if (!$result) return false; |
|
71 | + if (!$result) { |
|
72 | + return false; |
|
73 | + } |
|
64 | 74 | $count = _mysql_fetch_array($result); |
65 | 75 | _mysql_free_result($result); |
66 | 76 | return $count[0]; |
@@ -108,6 +108,10 @@ discard block |
||
108 | 108 | // If you include any links, prepend URL with $prefix |
109 | 109 | // if you need to open divs here close them in project_footer() |
110 | 110 | // |
111 | +/** |
|
112 | + * @param string $prefix |
|
113 | + * @param boolean $is_main |
|
114 | + */ |
|
111 | 115 | function project_banner($title, $prefix, $is_main) { |
112 | 116 | if ($is_main) { |
113 | 117 | echo '<img class="img-responsive" src="img/water.jpg">'; |
@@ -119,6 +123,11 @@ discard block |
||
119 | 123 | } |
120 | 124 | //$fixed_navbar = true; |
121 | 125 | |
126 | +/** |
|
127 | + * @param boolean $show_return |
|
128 | + * @param boolean $show_date |
|
129 | + * @param string $prefix |
|
130 | + */ |
|
122 | 131 | function project_footer($show_return, $show_date, $prefix) { |
123 | 132 | // If you include any links, prepend URL with $prefix |
124 | 133 | // |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | |
49 | 49 | define("FORUM_QA_MERGED_MODE", true); |
50 | 50 | // Set to true to merge Message boards and Q&A section |
51 | -define ("DISABLE_PROFILES", true); |
|
51 | +define("DISABLE_PROFILES", true); |
|
52 | 52 | // enable profiles only after enabling reCAPTCHA |
53 | 53 | // http://boinc.berkeley.edu/trac/wiki/ProtectionFromSpam |
54 | 54 | define("USE_STOPFORUMSPAM", true); |
@@ -183,15 +183,15 @@ discard block |
||
183 | 183 | </ol>", PROJECT); |
184 | 184 | } |
185 | 185 | |
186 | -function project_workunit($wu){ |
|
186 | +function project_workunit($wu) { |
|
187 | 187 | // shown in the workunit page |
188 | 188 | } |
189 | 189 | |
190 | -function project_user_summary($user){ |
|
190 | +function project_user_summary($user) { |
|
191 | 191 | // shown in the user summary page |
192 | 192 | } |
193 | 193 | |
194 | -function project_user_page_private($user){ |
|
194 | +function project_user_page_private($user) { |
|
195 | 195 | // shown in the private account page |
196 | 196 | } |
197 | 197 | |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | array("name" => "Uppercase", "short_name" => "UC", "appids" => array(1, 25)), |
259 | 259 | ); |
260 | 260 | |
261 | -function project_user_credit($user){ |
|
261 | +function project_user_credit($user) { |
|
262 | 262 | global $sub_projects; |
263 | 263 | foreach ($sub_projects as $sp) { |
264 | 264 | show_app_credit_user($user, $sp["name"], $sp["appids"]); |
@@ -32,6 +32,9 @@ discard block |
||
32 | 32 | // Parse form variables into XML, and return it. |
33 | 33 | // Also error-check values, and return errors in $errors->* |
34 | 34 | |
35 | +/** |
|
36 | + * @param string $name |
|
37 | + */ |
|
35 | 38 | function option($name, $val) { |
36 | 39 | $x = ($name == $val) ? "selected" : ""; |
37 | 40 | return "<option name='$name' $x>$name\n"; |
@@ -90,6 +93,10 @@ discard block |
||
90 | 93 | return $x; |
91 | 94 | } |
92 | 95 | |
96 | +/** |
|
97 | + * @param string $name |
|
98 | + * @param integer $max |
|
99 | + */ |
|
93 | 100 | function number_select($name, $max, $n) { |
94 | 101 | $sel = ($n == 0) ? "selected":""; |
95 | 102 | $x = "<select class=\"form-control input-sm\" name=$name> <option value=0 $sel>".tra("No limit")."</option>"; |
@@ -106,6 +113,9 @@ discard block |
||
106 | 113 | return tra("No limit"); |
107 | 114 | } |
108 | 115 | |
116 | +/** |
|
117 | + * @param stdClass $prefs |
|
118 | + */ |
|
109 | 119 | function project_specific_prefs_edit($prefs, $error=false) { |
110 | 120 | global $app_array; |
111 | 121 | if (COLOR_PREFS) { |
@@ -162,6 +172,9 @@ discard block |
||
162 | 172 | } |
163 | 173 | } |
164 | 174 | |
175 | +/** |
|
176 | + * @param boolean $error |
|
177 | + */ |
|
165 | 178 | function project_specific_prefs_parse_form(&$error) { |
166 | 179 | global $app_array; |
167 | 180 | $x = ""; |
@@ -216,6 +229,9 @@ discard block |
||
216 | 229 | return $x; |
217 | 230 | } |
218 | 231 | |
232 | +/** |
|
233 | + * @param stdClass $prefs |
|
234 | + */ |
|
219 | 235 | function project_specific_prefs_show($prefs, $columns=false) { |
220 | 236 | global $app_array; |
221 | 237 | if ($columns) { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // Also error-check values, and return errors in $errors->* |
34 | 34 | |
35 | 35 | function option($name, $val) { |
36 | - $x = ($name == $val) ? "selected" : ""; |
|
36 | + $x = ($name == $val) ? "selected" : ""; |
|
37 | 37 | return "<option name='$name' $x>$name\n"; |
38 | 38 | } |
39 | 39 | |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | if (APP_SELECT_PREFS) { |
54 | 54 | $app_array = array(); |
55 | 55 | $apps = BoincApp::enum("deprecated=0"); |
56 | - foreach($apps as $app) { |
|
56 | + foreach ($apps as $app) { |
|
57 | 57 | $app_array[] = array($app->id, $app->user_friendly_name); |
58 | 58 | } |
59 | 59 | } else { |
@@ -91,10 +91,10 @@ discard block |
||
91 | 91 | } |
92 | 92 | |
93 | 93 | function number_select($name, $max, $n) { |
94 | - $sel = ($n == 0) ? "selected":""; |
|
94 | + $sel = ($n == 0) ? "selected" : ""; |
|
95 | 95 | $x = "<select class=\"form-control input-sm\" name=$name> <option value=0 $sel>".tra("No limit")."</option>"; |
96 | - for ($i=1; $i<=$max; $i++) { |
|
97 | - $sel = ($n == $i) ? "selected":""; |
|
96 | + for ($i = 1; $i <= $max; $i++) { |
|
97 | + $sel = ($n == $i) ? "selected" : ""; |
|
98 | 98 | $x .= "<option value=$i $sel>$i</option>"; |
99 | 99 | } |
100 | 100 | $x .= "</select>"; |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | return tra("No limit"); |
107 | 107 | } |
108 | 108 | |
109 | -function project_specific_prefs_edit($prefs, $error=false) { |
|
109 | +function project_specific_prefs_edit($prefs, $error = false) { |
|
110 | 110 | global $app_array; |
111 | 111 | if (COLOR_PREFS) { |
112 | 112 | $x = $prefs->color_scheme; |
@@ -132,15 +132,15 @@ discard block |
||
132 | 132 | } else { |
133 | 133 | $present = true; |
134 | 134 | } |
135 | - $checked = $present?"checked":""; |
|
135 | + $checked = $present ? "checked" : ""; |
|
136 | 136 | $x .= "<input type=checkbox name=app_id_$app_id $checked> $app_name<br>"; |
137 | 137 | } |
138 | 138 | tooltip_row2(APP_SELECT_TOOLTIP, APP_SELECT_DESC, $x); |
139 | - $checked = $prefs->allow_non_preferred_apps?"checked":""; |
|
139 | + $checked = $prefs->allow_non_preferred_apps ? "checked" : ""; |
|
140 | 140 | row2(ACCEPT_ANY_DESC, "<input type=checkbox name=allow_non_preferred_apps $checked>"); |
141 | 141 | } |
142 | 142 | if (NON_GRAPHICAL_PREF) { |
143 | - $checked = $prefs->non_graphical?"checked":""; |
|
143 | + $checked = $prefs->non_graphical ? "checked" : ""; |
|
144 | 144 | row2( |
145 | 145 | NON_GRAPHICAL_DESC, |
146 | 146 | "<input type=checkbox name=non_graphical $checked>" |
@@ -216,11 +216,11 @@ discard block |
||
216 | 216 | return $x; |
217 | 217 | } |
218 | 218 | |
219 | -function project_specific_prefs_show($prefs, $columns=false) { |
|
219 | +function project_specific_prefs_show($prefs, $columns = false) { |
|
220 | 220 | global $app_array; |
221 | 221 | if ($columns) { |
222 | 222 | if (COLOR_PREFS) { |
223 | - row_defs(COLOR_DESC,"color_scheme", "", "", $prefs); |
|
223 | + row_defs(COLOR_DESC, "color_scheme", "", "", $prefs); |
|
224 | 224 | } |
225 | 225 | if (GFX_CPU_PREFS) { |
226 | 226 | row_defs(MAX_GFX_CPU_PCT_DESC, "max_gfx_cpu_pct", "", "", $prefs); |
@@ -254,7 +254,7 @@ discard block |
||
254 | 254 | row2(ACCEPT_ANY_DESC, $prefs->allow_non_preferred_apps_text); |
255 | 255 | } |
256 | 256 | if (NON_GRAPHICAL_PREF) { |
257 | - row2(NON_GRAPHICAL_DESC, $prefs->non_graphical?tra("yes"):tra("no")); |
|
257 | + row2(NON_GRAPHICAL_DESC, $prefs->non_graphical ? tra("yes") : tra("no")); |
|
258 | 258 | } |
259 | 259 | if (MAX_JOBS_PREF) { |
260 | 260 | row2(tra("Max # jobs"), limit_string($prefs->max_jobs)); |
@@ -277,12 +277,12 @@ discard block |
||
277 | 277 | $cursor = 0; |
278 | 278 | while ($thisxml = parse_next_element($prefs_xml, "<app_id>", $cursor)) { |
279 | 279 | if (is_numeric($thisxml)) { |
280 | - $n = (int) $thisxml; |
|
280 | + $n = (int)$thisxml; |
|
281 | 281 | $prefs->app_ids[] = $n; |
282 | 282 | } |
283 | 283 | } |
284 | 284 | $prefs->allow_non_preferred_apps = parse_element($prefs_xml, "<allow_non_preferred_apps>"); |
285 | - $prefs->allow_non_preferred_apps_text = $prefs->allow_non_preferred_apps?"yes":"no"; |
|
285 | + $prefs->allow_non_preferred_apps_text = $prefs->allow_non_preferred_apps ? "yes" : "no"; |
|
286 | 286 | } |
287 | 287 | if (NON_GRAPHICAL_PREF) { |
288 | 288 | $prefs->non_graphical = parse_bool($prefs_xml, "non_graphical"); |
@@ -296,6 +296,6 @@ discard block |
||
296 | 296 | return $prefs; |
297 | 297 | } |
298 | 298 | |
299 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
299 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
300 | 300 | |
301 | 301 | ?> |
@@ -102,7 +102,9 @@ discard block |
||
102 | 102 | } |
103 | 103 | |
104 | 104 | function limit_string($val) { |
105 | - if ($val) return $val; |
|
105 | + if ($val) { |
|
106 | + return $val; |
|
107 | + } |
|
106 | 108 | return tra("No limit"); |
107 | 109 | } |
108 | 110 | |
@@ -227,9 +229,15 @@ discard block |
||
227 | 229 | } |
228 | 230 | if (APP_SELECT_PREFS) { |
229 | 231 | $prefs->app_id_text = selected_app_text($prefs); |
230 | - if ($prefs->home) $prefs->home->app_id_text = selected_app_text($prefs->home); |
|
231 | - if ($prefs->school) $prefs->school->app_id_text = selected_app_text($prefs->school); |
|
232 | - if ($prefs->work) $prefs->work->app_id_text = selected_app_text($prefs->work); |
|
232 | + if ($prefs->home) { |
|
233 | + $prefs->home->app_id_text = selected_app_text($prefs->home); |
|
234 | + } |
|
235 | + if ($prefs->school) { |
|
236 | + $prefs->school->app_id_text = selected_app_text($prefs->school); |
|
237 | + } |
|
238 | + if ($prefs->work) { |
|
239 | + $prefs->work->app_id_text = selected_app_text($prefs->work); |
|
240 | + } |
|
233 | 241 | row_defs(APP_SELECT_DESC, "app_id_text", "", "", $prefs, APP_SELECT_TOOLTIP); |
234 | 242 | row_defs(ACCEPT_ANY_DESC, "allow_non_preferred_apps_text", "", "", $prefs); |
235 | 243 | } |
@@ -28,6 +28,9 @@ discard block |
||
28 | 28 | require_once("../inc/bolt_util.inc"); |
29 | 29 | require_once("../inc/util.inc"); |
30 | 30 | |
31 | +/** |
|
32 | + * @param string $tag |
|
33 | + */ |
|
31 | 34 | function debug_show_state($state, $tag) { |
32 | 35 | global $user; |
33 | 36 | global $refresh; |
@@ -82,6 +85,9 @@ discard block |
||
82 | 85 | |
83 | 86 | // A page is being shown to the user; make a record of it |
84 | 87 | // |
88 | +/** |
|
89 | + * @param integer $mode |
|
90 | + */ |
|
85 | 91 | function create_view($iter, $mode, $prev_view_id) { |
86 | 92 | global $user; |
87 | 93 | global $course; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | function default_mode($item) { |
80 | - return $item->is_exercise()?BOLT_MODE_SHOW:BOLT_MODE_LESSON; |
|
80 | + return $item->is_exercise() ? BOLT_MODE_SHOW : BOLT_MODE_LESSON; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | // A page is being shown to the user; make a record of it |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | |
171 | 171 | // show an item (lesson, exercise, answer page) |
172 | 172 | // |
173 | -function show_item($iter, $view_id, $prev_view_id, $mode, $repeat=null) { |
|
173 | +function show_item($iter, $view_id, $prev_view_id, $mode, $repeat = null) { |
|
174 | 174 | global $user; |
175 | 175 | global $course; |
176 | 176 | global $bolt_ex; |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | if ($repeat) { |
225 | 225 | $avg = number_format($repeat->avg_score*100, 0); |
226 | 226 | echo "<p>Score on this exercise set: $avg%"; |
227 | - if ($repeat->flags & REVIEW) { |
|
227 | + if ($repeat->flags&REVIEW) { |
|
228 | 228 | //echo "<pre>"; |
229 | 229 | //print_r($repeat); |
230 | 230 | //echo "</pre>"; |
@@ -232,11 +232,11 @@ discard block |
||
232 | 232 | $r = "<a href=bolt_sched.php?$url_args&action=review&view_id=$view_id&unit_name=$name>Review, then repeat exercises</a>"; |
233 | 233 | $links[] = $r; |
234 | 234 | } |
235 | - if ($repeat->flags & REPEAT) { |
|
235 | + if ($repeat->flags&REPEAT) { |
|
236 | 236 | $r = "<a href=bolt_sched.php?$url_args&action=repeat&view_id=$view_id>Repeat exercises</a>"; |
237 | 237 | $links[] = $r; |
238 | 238 | } |
239 | - if ($repeat->flags & NEXT) { |
|
239 | + if ($repeat->flags&NEXT) { |
|
240 | 240 | $links[] = $next; |
241 | 241 | } |
242 | 242 | } else { |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $bolt_ex->score = 0; |
463 | 463 | $bolt_query_string = $item->query_string; |
464 | 464 | srand($view_id); |
465 | - ob_start(); // buffer output to avoid showing exercise text |
|
465 | + ob_start(); // buffer output to avoid showing exercise text |
|
466 | 466 | require($item->filename); |
467 | 467 | ob_end_clean(); |
468 | 468 |
@@ -61,7 +61,9 @@ discard block |
||
61 | 61 | // |
62 | 62 | function finalize_view($view_id, $action) { |
63 | 63 | global $user; |
64 | - if (!$view_id) return null; |
|
64 | + if (!$view_id) { |
|
65 | + return null; |
|
66 | + } |
|
65 | 67 | $view = BoltView::lookup_id($view_id); |
66 | 68 | if (!$view) { |
67 | 69 | error_page("no view"); |
@@ -104,11 +106,15 @@ discard block |
||
104 | 106 | <link rel=stylesheet type=text/css href=bolt.css> |
105 | 107 | </head><body> |
106 | 108 | "; |
107 | - if (function_exists('bolt_header')) bolt_header(); |
|
108 | -} |
|
109 | + if (function_exists('bolt_header')) { |
|
110 | + bolt_header(); |
|
111 | + } |
|
112 | + } |
|
109 | 113 | |
110 | 114 | function page_footer() { |
111 | - if (function_exists('bolt_footer')) bolt_footer(); |
|
115 | + if (function_exists('bolt_footer')) { |
|
116 | + bolt_footer(); |
|
117 | + } |
|
112 | 118 | echo "</body></html>"; |
113 | 119 | } |
114 | 120 | |
@@ -206,19 +212,25 @@ discard block |
||
206 | 212 | } |
207 | 213 | srand($view_id); |
208 | 214 | require($item->filename); |
209 | - if (function_exists('bolt_divide')) bolt_divide(); |
|
215 | + if (function_exists('bolt_divide')) { |
|
216 | + bolt_divide(); |
|
217 | + } |
|
210 | 218 | $next = "<input type=image src=img/next.gif value=OK></form>"; |
211 | 219 | break; |
212 | 220 | case BOLT_MODE_ANSWER: |
213 | 221 | require($item->filename); |
214 | - if (function_exists('bolt_divide')) bolt_divide(); |
|
222 | + if (function_exists('bolt_divide')) { |
|
223 | + bolt_divide(); |
|
224 | + } |
|
215 | 225 | $score_pct = number_format($bolt_ex->score*100); |
216 | 226 | echo "Score: $score_pct%"; |
217 | 227 | break; |
218 | 228 | } |
219 | 229 | } else { |
220 | 230 | require_once($item->filename); |
221 | - if (function_exists('bolt_divide')) bolt_divide(); |
|
231 | + if (function_exists('bolt_divide')) { |
|
232 | + bolt_divide(); |
|
233 | + } |
|
222 | 234 | } |
223 | 235 | |
224 | 236 | if ($repeat) { |
@@ -270,7 +282,9 @@ discard block |
||
270 | 282 | page_header(); |
271 | 283 | $bolt_query_string = $item->query_string; |
272 | 284 | require_once($item->filename); |
273 | - if (function_exists('bolt_divide')) bolt_divide(); |
|
285 | + if (function_exists('bolt_divide')) { |
|
286 | + bolt_divide(); |
|
287 | + } |
|
274 | 288 | $score_pct = number_format($score*100); |
275 | 289 | echo "Score: $score_pct%"; |
276 | 290 | page_footer(); |
@@ -297,9 +311,13 @@ discard block |
||
297 | 311 | global $refresh; |
298 | 312 | |
299 | 313 | $xset_result = BoltXsetResult::lookup_id($refresh->xset_result_id); |
300 | - if (!$xset_result) error_page("Exercise set result not found"); |
|
314 | + if (!$xset_result) { |
|
315 | + error_page("Exercise set result not found"); |
|
316 | + } |
|
301 | 317 | $view = BoltView::lookup_id($xset_result->view_id); |
302 | - if (!$view) error_page("view not found"); |
|
318 | + if (!$view) { |
|
319 | + error_page("view not found"); |
|
320 | + } |
|
303 | 321 | $iter = new BoltIter($course_doc); |
304 | 322 | $iter->decode_state($view->state); |
305 | 323 | $iter->at(); |
@@ -355,9 +373,15 @@ discard block |
||
355 | 373 | $url_args = "course_id=$course_id"; |
356 | 374 | if ($refresh_id) { |
357 | 375 | $refresh = BoltRefreshRec::lookup_id($refresh_id); |
358 | - if (!$refresh) error_page("No such refresh"); |
|
359 | - if ($refresh->user_id != $user->id) error_page("Wrong user"); |
|
360 | - if ($refresh->course_id != $course_id) error_page("Wrong course"); |
|
376 | + if (!$refresh) { |
|
377 | + error_page("No such refresh"); |
|
378 | + } |
|
379 | + if ($refresh->user_id != $user->id) { |
|
380 | + error_page("Wrong user"); |
|
381 | + } |
|
382 | + if ($refresh->course_id != $course_id) { |
|
383 | + error_page("Wrong course"); |
|
384 | + } |
|
361 | 385 | $url_args .= "&refresh_id=$refresh_id"; |
362 | 386 | } |
363 | 387 | $course = BoltCourse::lookup_id($course_id); |
@@ -492,7 +516,9 @@ discard block |
||
492 | 516 | $is_last = $xset->xset_record_score( |
493 | 517 | $iter, $bolt_ex->score, $view->id, $avg_score, $repeat |
494 | 518 | ); |
495 | - if ($repeat) $repeat->avg_score = $avg_score; |
|
519 | + if ($repeat) { |
|
520 | + $repeat->avg_score = $avg_score; |
|
521 | + } |
|
496 | 522 | if ($is_last) { |
497 | 523 | // if the exercise set if finished, make or update DB records |
498 | 524 | // |
@@ -31,6 +31,10 @@ discard block |
||
31 | 31 | // If $selection is provided, and if it matches one of the entries in the file, |
32 | 32 | // it will be selected by default. |
33 | 33 | // |
34 | +/** |
|
35 | + * @param string $name |
|
36 | + * @param string $filename |
|
37 | + */ |
|
34 | 38 | function show_combo_box($name, $filename, $selection=null) { |
35 | 39 | echo "<select name=\"$name\" class=\"form-control\">\n"; |
36 | 40 | |
@@ -185,6 +189,9 @@ discard block |
||
185 | 189 | show_language_selection($profile); |
186 | 190 | } |
187 | 191 | |
192 | +/** |
|
193 | + * @param string $name |
|
194 | + */ |
|
188 | 195 | function show_textarea($name, $text) { |
189 | 196 | rowify("<textarea name=\"$name\" class=\"form-control\" rows=\"10\">" . $text . "</textarea>"); |
190 | 197 | } |
@@ -311,6 +318,9 @@ discard block |
||
311 | 318 | page_tail(); |
312 | 319 | } |
313 | 320 | |
321 | +/** |
|
322 | + * @param string $warning |
|
323 | + */ |
|
314 | 324 | function show_profile_form($profile, $warning=null) { |
315 | 325 | if ($profile) { |
316 | 326 | page_head(tra("Edit your profile"), null, null, null, boinc_recaptcha_get_head_extra()); |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // If $selection is provided, and if it matches one of the entries in the file, |
32 | 32 | // it will be selected by default. |
33 | 33 | // |
34 | -function show_combo_box($name, $filename, $selection=null) { |
|
34 | +function show_combo_box($name, $filename, $selection = null) { |
|
35 | 35 | echo "<select name=\"$name\" class=\"form-control\">\n"; |
36 | 36 | |
37 | 37 | $file = fopen($filename, "r"); |
@@ -62,14 +62,14 @@ discard block |
||
62 | 62 | <tr><td colspan=2> |
63 | 63 | <table border=0 cellpadding=5 |
64 | 64 | <tr> |
65 | -<td valign=top><a href=\"" . IMAGE_URL . $profile->userid . '.jpg' . "\"><img src=\"" . IMAGE_URL . $profile->userid . '_sm.jpg' . "\"></a> |
|
65 | +<td valign=top><a href=\"" . IMAGE_URL.$profile->userid.'.jpg'."\"><img src=\"".IMAGE_URL.$profile->userid.'_sm.jpg'."\"></a> |
|
66 | 66 | </td> |
67 | -<td valign=top>" .tra("%1 Your profile picture is shown to the left.", $warning) ." |
|
67 | +<td valign=top>" .tra("%1 Your profile picture is shown to the left.", $warning)." |
|
68 | 68 | <p>". |
69 | -tra("To replace it, click the \"Browse\" button and select a JPEG or PNG file (%1 or less).", "50KB") ."<br /> |
|
69 | +tra("To replace it, click the \"Browse\" button and select a JPEG or PNG file (%1 or less).", "50KB")."<br /> |
|
70 | 70 | <input name=picture type=file><br> |
71 | 71 | <p>". |
72 | -tra("To remove it from your profile, check this box:") . " |
|
72 | +tra("To remove it from your profile, check this box:")." |
|
73 | 73 | <input type=checkbox name=delete_pic> |
74 | 74 | <p> |
75 | 75 | </td></tr>"; |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | end_table(); |
78 | 78 | echo "</td></tr>"; |
79 | 79 | } else { |
80 | - rowify(tra("If you would like include a picture with your profile, click the \"Browse\" button and select a JPEG or PNG file. Please select images of %1 or less.", "50KB") . " |
|
80 | + rowify(tra("If you would like include a picture with your profile, click the \"Browse\" button and select a JPEG or PNG file. Please select images of %1 or less.", "50KB")." |
|
81 | 81 | <p> |
82 | 82 | <input name=picture type=file> |
83 | 83 | "); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | row1(tra("Language")); |
93 | 93 | echo "<tr><td> |
94 | 94 | <p>" . |
95 | - tra("Select the language in which your profile is written:") . " |
|
95 | + tra("Select the language in which your profile is written:")." |
|
96 | 96 | <p> |
97 | 97 | "; |
98 | 98 | if (isset($profile->language)) { |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | if ($publickey) { |
111 | 111 | table_row(boinc_recaptcha_get_html($publickey)); |
112 | 112 | } |
113 | - table_row("<p><input class=\"btn btn-default\" type=\"submit\" value=\"".tra("Create/edit profile") ."\" name=\"submit\">"); |
|
113 | + table_row("<p><input class=\"btn btn-default\" type=\"submit\" value=\"".tra("Create/edit profile")."\" name=\"submit\">"); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | // Returns an array containing: |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | |
125 | 125 | // Determine if the filetype uploaded is supported. |
126 | 126 | // TODO: Change these to constants. |
127 | - switch($size[2]) { |
|
127 | + switch ($size[2]) { |
|
128 | 128 | case '2': // JPEG |
129 | 129 | $image = imageCreateFromJPEG($fileName); |
130 | 130 | break; |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | |
162 | 162 | function show_description() { |
163 | 163 | echo " |
164 | - <p>" .tra("Your %1profile%2 lets you share your opinions and background with the %3 community.", "<b>", "</b>", PROJECT) . " |
|
164 | + <p>" .tra("Your %1profile%2 lets you share your opinions and background with the %3 community.", "<b>", "</b>", PROJECT)." |
|
165 | 165 | <p> |
166 | 166 | "; |
167 | 167 | } |
@@ -179,14 +179,14 @@ discard block |
||
179 | 179 | row1(show_profile_heading1()); |
180 | 180 | rowify(show_profile_question1().html_info()); |
181 | 181 | show_textarea("response1", $response1); |
182 | - row1( show_profile_heading2()); |
|
183 | - rowify( show_profile_question2().html_info()); |
|
182 | + row1(show_profile_heading2()); |
|
183 | + rowify(show_profile_question2().html_info()); |
|
184 | 184 | show_textarea("response2", $response2); |
185 | 185 | show_language_selection($profile); |
186 | 186 | } |
187 | 187 | |
188 | 188 | function show_textarea($name, $text) { |
189 | - rowify("<textarea name=\"$name\" class=\"form-control\" rows=\"10\">" . $text . "</textarea>"); |
|
189 | + rowify("<textarea name=\"$name\" class=\"form-control\" rows=\"10\">".$text."</textarea>"); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | // $profile is null if user doesn't already have a profile. |
@@ -233,8 +233,8 @@ discard block |
||
233 | 233 | $delete_pic = "off"; |
234 | 234 | } |
235 | 235 | |
236 | - if (strlen($response1)==0 && |
|
237 | - strlen($response2)==0 && |
|
236 | + if (strlen($response1) == 0 && |
|
237 | + strlen($response2) == 0 && |
|
238 | 238 | $delete_pic != "on" && |
239 | 239 | !is_uploaded_file($_FILES['picture']['tmp_name']) |
240 | 240 | ) { |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | $profile->verification = 0; |
249 | 249 | } |
250 | 250 | |
251 | - $profile ? $has_picture = $profile->has_picture: $has_picture = false; |
|
251 | + $profile ? $has_picture = $profile->has_picture : $has_picture = false; |
|
252 | 252 | |
253 | 253 | if (is_uploaded_file($_FILES['picture']['tmp_name'])) { |
254 | 254 | $has_picture = true; |
@@ -263,13 +263,13 @@ discard block |
||
263 | 263 | |
264 | 264 | // Write the original image file to disk. |
265 | 265 | // TODO: define a constant for image quality. |
266 | - ImageJPEG($images[0], IMAGE_PATH . $user->id . '.jpg'); |
|
267 | - ImageJPEG($images[1], IMAGE_PATH . $user->id . '_sm.jpg'); |
|
266 | + ImageJPEG($images[0], IMAGE_PATH.$user->id.'.jpg'); |
|
267 | + ImageJPEG($images[1], IMAGE_PATH.$user->id.'_sm.jpg'); |
|
268 | 268 | } |
269 | 269 | $response1 = sanitize_html($response1); |
270 | 270 | $response2 = sanitize_html($response2); |
271 | 271 | |
272 | - $has_picture = $has_picture?1:0; |
|
272 | + $has_picture = $has_picture ? 1 : 0; |
|
273 | 273 | if ($profile) { |
274 | 274 | $query = " response1 = '".BoincDb::escape_string($response1)."'," |
275 | 275 | ." response2 = '".BoincDb::escape_string($response2)."'," |
@@ -311,7 +311,7 @@ discard block |
||
311 | 311 | page_tail(); |
312 | 312 | } |
313 | 313 | |
314 | -function show_profile_form($profile, $warning=null) { |
|
314 | +function show_profile_form($profile, $warning = null) { |
|
315 | 315 | if ($profile) { |
316 | 316 | page_head(tra("Edit your profile"), null, null, null, boinc_recaptcha_get_head_extra()); |
317 | 317 | } else { |
@@ -22,7 +22,9 @@ discard block |
||
22 | 22 | require_once("../inc/akismet.inc"); |
23 | 23 | require_once("../inc/recaptchalib.php"); |
24 | 24 | |
25 | -if (DISABLE_PROFILES) error_page("Profiles are disabled"); |
|
25 | +if (DISABLE_PROFILES) { |
|
26 | + error_page("Profiles are disabled"); |
|
27 | +} |
|
26 | 28 | |
27 | 29 | check_get_args(array()); |
28 | 30 | |
@@ -252,7 +254,9 @@ discard block |
||
252 | 254 | |
253 | 255 | if (is_uploaded_file($_FILES['picture']['tmp_name'])) { |
254 | 256 | $has_picture = true; |
255 | - if ($profile) $profile->verification = 0; |
|
257 | + if ($profile) { |
|
258 | + $profile->verification = 0; |
|
259 | + } |
|
256 | 260 | |
257 | 261 | // echo "<br>Name: " . $_FILES['picture']['name']; |
258 | 262 | // echo "<br>Type: " . $_FILES['picture']['type']; |
@@ -26,6 +26,9 @@ |
||
26 | 26 | // that will send the needed cookies |
27 | 27 | // and optionally download the appropriate installer, |
28 | 28 | // |
29 | +/** |
|
30 | + * @param boolean $download |
|
31 | + */ |
|
29 | 32 | function concierge_url($user, $download) { |
30 | 33 | global $master_url; |
31 | 34 | $project_name = parse_config(get_config(), "<long_name>"); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | $project_desc = parse_config(get_config(), "<project_desc>"); |
33 | 33 | $project_inst = parse_config(get_config(), "<project_inst>"); |
34 | 34 | $user = get_logged_in_user(false); |
35 | - $x = "http://boinc.berkeley.edu/concierge.php"; |
|
35 | + $x = "http://boinc.berkeley.edu/concierge.php"; |
|
36 | 36 | $x .= "?master_url=".urlencode($master_url); |
37 | 37 | $x .= "&project_name=".urlencode($project_name); |
38 | 38 | if ($project_desc) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $dlv = "BOINC"; |
64 | 64 | $dl = "BOINC"; |
65 | 65 | if ($mcv) { |
66 | - $dlv .= " version " . version_string_maj_min_rel($mcv). " or later"; |
|
66 | + $dlv .= " version ".version_string_maj_min_rel($mcv)." or later"; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | $verb = "this is"; |
@@ -178,6 +178,9 @@ |
||
178 | 178 | row2($x1, $x2, false, "20%"); |
179 | 179 | } |
180 | 180 | |
181 | +/** |
|
182 | + * @param string $text |
|
183 | + */ |
|
181 | 184 | function quote_text($text) { |
182 | 185 | $text = "[quote]" . $text . "[/quote]"; |
183 | 186 | return $text; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | $parent_post_id = 0; |
51 | 51 | } |
52 | 52 | |
53 | -if ($filter != "false"){ |
|
53 | +if ($filter != "false") { |
|
54 | 54 | $filter = true; |
55 | 55 | } else { |
56 | 56 | $filter = false; |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | $warning = null; |
68 | -if ($content && (!$preview)){ |
|
69 | - if (post_str('add_signature',true)=="add_it"){ |
|
70 | - $add_signature=true; // set a flag and concatenate later |
|
71 | - } else { |
|
72 | - $add_signature=false; |
|
68 | +if ($content && (!$preview)) { |
|
69 | + if (post_str('add_signature', true) == "add_it") { |
|
70 | + $add_signature = true; // set a flag and concatenate later |
|
71 | + } else { |
|
72 | + $add_signature = false; |
|
73 | 73 | } |
74 | 74 | check_tokens($logged_in_user->authenticator); |
75 | 75 | if (!akismet_check($logged_in_user, $content)) { |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | -page_head(tra("Post to thread"),'','','', $bbcode_js); |
|
91 | +page_head(tra("Post to thread"), '', '', '', $bbcode_js); |
|
92 | 92 | |
93 | 93 | show_forum_header($logged_in_user); |
94 | 94 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | $x1 = tra("Message:").html_info().post_warning(); |
143 | 143 | $x2 = ""; |
144 | 144 | if ($parent_post) { |
145 | - $x2 .=" ".tra("reply to %1Message ID%2:", "<a href=#".$parent_post->id.">", " ".$parent_post->id."</a>"); |
|
145 | + $x2 .= " ".tra("reply to %1Message ID%2:", "<a href=#".$parent_post->id.">", " ".$parent_post->id."</a>"); |
|
146 | 146 | } |
147 | 147 | $x2 .= "<form action=forum_reply.php?thread=".$thread->id; |
148 | 148 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | $x2 .= " method=\"post\" name=\"post\" onsubmit=\"return checkForm(this)\">\n"; |
154 | 154 | $x2 .= form_tokens($logged_in_user->authenticator); |
155 | 155 | $x2 .= start_table_str().$bbcode_html.end_table_str()."<textarea class=\"form-control\" name=\"content\" rows=\"18\">"; |
156 | - $no_quote = get_int("no_quote", true)==1; |
|
156 | + $no_quote = get_int("no_quote", true) == 1; |
|
157 | 157 | if ($preview) { |
158 | 158 | $x2 .= htmlspecialchars($content); |
159 | 159 | } else if (!$no_quote) { |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | } |
163 | 163 | } |
164 | 164 | if (!$logged_in_user->prefs->no_signature_by_default) { |
165 | - $enable_signature="checked=\"true\""; |
|
165 | + $enable_signature = "checked=\"true\""; |
|
166 | 166 | } else { |
167 | - $enable_signature=""; |
|
167 | + $enable_signature = ""; |
|
168 | 168 | } |
169 | 169 | $x2 .= "</textarea><p> </p> |
170 | 170 | <input class=\"btn btn-default btn-sm \" type=\"submit\" name=\"preview\" value=\"".tra("Preview")."\"> |
@@ -179,9 +179,9 @@ discard block |
||
179 | 179 | } |
180 | 180 | |
181 | 181 | function quote_text($text) { |
182 | - $text = "[quote]" . $text . "[/quote]"; |
|
182 | + $text = "[quote]".$text."[/quote]"; |
|
183 | 183 | return $text; |
184 | 184 | } |
185 | 185 | |
186 | -$cvs_version_tracker[]="\$Id$"; |
|
186 | +$cvs_version_tracker[] = "\$Id$"; |
|
187 | 187 | ?> |
@@ -25,7 +25,9 @@ discard block |
||
25 | 25 | require_once('../inc/bbcode_html.inc'); |
26 | 26 | require_once('../inc/akismet.inc'); |
27 | 27 | |
28 | -if (DISABLE_FORUMS) error_page("Forums are disabled"); |
|
28 | +if (DISABLE_FORUMS) { |
|
29 | + error_page("Forums are disabled"); |
|
30 | +} |
|
29 | 31 | |
30 | 32 | $logged_in_user = get_logged_in_user(true); |
31 | 33 | BoincForumPrefs::lookup($logged_in_user); |
@@ -68,7 +70,7 @@ discard block |
||
68 | 70 | if ($content && (!$preview)){ |
69 | 71 | if (post_str('add_signature',true)=="add_it"){ |
70 | 72 | $add_signature=true; // set a flag and concatenate later |
71 | - } else { |
|
73 | + } else { |
|
72 | 74 | $add_signature=false; |
73 | 75 | } |
74 | 76 | check_tokens($logged_in_user->authenticator); |
@@ -29,6 +29,9 @@ discard block |
||
29 | 29 | // take a host.serialnum field (which may encode several GPUs) |
30 | 30 | // and extract the model name for the given vendor |
31 | 31 | // |
32 | +/** |
|
33 | + * @param string $vendor |
|
34 | + */ |
|
32 | 35 | function get_gpu_model($x, $vendor) { |
33 | 36 | $descs = explode("]", $x); |
34 | 37 | array_pop($descs); |
@@ -60,6 +63,10 @@ discard block |
||
60 | 63 | // $x->linux |
61 | 64 | // $x->mac |
62 | 65 | // |
66 | +/** |
|
67 | + * @param string $vendor |
|
68 | + * @param string $alt_vendor |
|
69 | + */ |
|
63 | 70 | function get_gpu_list($vendor, $alt_vendor=null) { |
64 | 71 | $clause = "plan_class like '%$vendor%'"; |
65 | 72 | if ($alt_vendor) { |
@@ -144,6 +151,9 @@ discard block |
||
144 | 151 | return $x1->avg_time > $x2->avg_time; |
145 | 152 | } |
146 | 153 | |
154 | +/** |
|
155 | + * @param string $name |
|
156 | + */ |
|
147 | 157 | function show_list($models, $name) { |
148 | 158 | echo "<td><h2>$name</h2>\n"; |
149 | 159 | if (!count($models)) { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | // $x->linux |
61 | 61 | // $x->mac |
62 | 62 | // |
63 | -function get_gpu_list($vendor, $alt_vendor=null) { |
|
63 | +function get_gpu_list($vendor, $alt_vendor = null) { |
|
64 | 64 | $clause = "plan_class like '%$vendor%'"; |
65 | 65 | if ($alt_vendor) { |
66 | 66 | $clause .= " or plan_class like '%$alt_vendor%'"; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | $av_ids = ""; |
76 | - foreach($avs as $av) { |
|
76 | + foreach ($avs as $av) { |
|
77 | 77 | $av_ids .= "$av->id, "; |
78 | 78 | } |
79 | 79 | if ($vendor == "cuda") { |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | echo tra("No GPU tasks reported"); |
177 | 177 | return; |
178 | 178 | } |
179 | - $have_win = count($x->win)>0; |
|
180 | - $have_mac = count($x->mac)>0; |
|
181 | - $have_linux = count($x->linux)>0; |
|
179 | + $have_win = count($x->win) > 0; |
|
180 | + $have_mac = count($x->mac) > 0; |
|
181 | + $have_linux = count($x->linux) > 0; |
|
182 | 182 | $n = 0; |
183 | 183 | if ($have_win) $n++; |
184 | 184 | if ($have_mac) $n++; |
185 | 185 | if ($have_linux) $n++; |
186 | - $show_total = $n>1; |
|
186 | + $show_total = $n > 1; |
|
187 | 187 | start_table(); |
188 | 188 | echo "<tr>"; |
189 | 189 | if ($show_total) { |
@@ -35,8 +35,12 @@ discard block |
||
35 | 35 | foreach ($descs as $desc) { |
36 | 36 | $desc = trim($desc, "["); |
37 | 37 | $d = explode("|", $desc); |
38 | - if ($d[0] == "BOINC") continue; |
|
39 | - if ($d[0] != $vendor) continue; |
|
38 | + if ($d[0] == "BOINC") { |
|
39 | + continue; |
|
40 | + } |
|
41 | + if ($d[0] != $vendor) { |
|
42 | + continue; |
|
43 | + } |
|
40 | 44 | return $d[1]; |
41 | 45 | } |
42 | 46 | return null; |
@@ -98,9 +102,13 @@ discard block |
||
98 | 102 | $mac = array(); |
99 | 103 | foreach ($results as $r) { |
100 | 104 | $h = BoincHost::lookup_id($r->hostid); |
101 | - if (!$h) continue; |
|
105 | + if (!$h) { |
|
106 | + continue; |
|
107 | + } |
|
102 | 108 | $wu = BoincWorkunit::lookup_id($r->workunitid); |
103 | - if (!$wu) continue; |
|
109 | + if (!$wu) { |
|
110 | + continue; |
|
111 | + } |
|
104 | 112 | $v = ""; |
105 | 113 | if ($vendor == "cuda") { |
106 | 114 | $v = "CUDA"; |
@@ -110,7 +118,9 @@ discard block |
||
110 | 118 | $v = "CAL"; |
111 | 119 | } |
112 | 120 | $model = get_gpu_model($h->serialnum, $v); |
113 | - if (!$model) continue; |
|
121 | + if (!$model) { |
|
122 | + continue; |
|
123 | + } |
|
114 | 124 | add_model($model, $r, $wu, $total); |
115 | 125 | if (strstr($h->os_name, "Windows")) { |
116 | 126 | add_model($model, $r, $wu, $win); |
@@ -152,18 +162,26 @@ discard block |
||
152 | 162 | } |
153 | 163 | $max_count = 0; |
154 | 164 | foreach ($models as $model=>$x) { |
155 | - if ($x->count > $max_count) $max_count = $x->count; |
|
165 | + if ($x->count > $max_count) { |
|
166 | + $max_count = $x->count; |
|
167 | + } |
|
156 | 168 | $x->avg_time = $x->time/$x->count; |
157 | 169 | } |
158 | 170 | $min_time = 1e9; |
159 | 171 | foreach ($models as $model=>$x) { |
160 | - if ($x->count < $max_count/10) continue; |
|
161 | - if ($x->avg_time < $min_time) $min_time = $x->avg_time; |
|
172 | + if ($x->count < $max_count/10) { |
|
173 | + continue; |
|
174 | + } |
|
175 | + if ($x->avg_time < $min_time) { |
|
176 | + $min_time = $x->avg_time; |
|
177 | + } |
|
162 | 178 | } |
163 | 179 | uasort($models, 'gpucmp'); |
164 | 180 | echo "<ol>\n"; |
165 | 181 | foreach ($models as $model=>$x) { |
166 | - if ($x->count < $max_count/10) continue; |
|
182 | + if ($x->count < $max_count/10) { |
|
183 | + continue; |
|
184 | + } |
|
167 | 185 | $s = number_format($min_time/$x->avg_time, 3); |
168 | 186 | echo "<li>($s) $model\n"; |
169 | 187 | } |
@@ -180,9 +198,15 @@ discard block |
||
180 | 198 | $have_mac = count($x->mac)>0; |
181 | 199 | $have_linux = count($x->linux)>0; |
182 | 200 | $n = 0; |
183 | - if ($have_win) $n++; |
|
184 | - if ($have_mac) $n++; |
|
185 | - if ($have_linux) $n++; |
|
201 | + if ($have_win) { |
|
202 | + $n++; |
|
203 | + } |
|
204 | + if ($have_mac) { |
|
205 | + $n++; |
|
206 | + } |
|
207 | + if ($have_linux) { |
|
208 | + $n++; |
|
209 | + } |
|
186 | 210 | $show_total = $n>1; |
187 | 211 | start_table(); |
188 | 212 | echo "<tr>"; |
@@ -18,6 +18,9 @@ |
||
18 | 18 | |
19 | 19 | require_once("../inc/util.inc"); |
20 | 20 | |
21 | +/** |
|
22 | + * @param integer $t |
|
23 | + */ |
|
21 | 24 | function rsc_name($t) { |
22 | 25 | switch ($t) { |
23 | 26 | case 2: return tra("CPU"); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | if (!$show_dep && $app->deprecated) { |
41 | 41 | return null; |
42 | 42 | } |
43 | - $rsc_type = $gavid % 1000000; |
|
43 | + $rsc_type = $gavid%1000000; |
|
44 | 44 | $r = rsc_name($rsc_type); |
45 | 45 | return "$app->user_friendly_name (".tra("anonymous platform").", $r)"; |
46 | 46 | } else { |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | } |
61 | 61 | $platform = BoincPlatform::lookup_id($av->platformid); |
62 | 62 | if (!$platform) return tra("Missing platform"); |
63 | - $pc = (strlen($av->plan_class))?"($av->plan_class)":""; |
|
63 | + $pc = (strlen($av->plan_class)) ? "($av->plan_class)" : ""; |
|
64 | 64 | $v = number_format($av->version_num/100, 2); |
65 | 65 | return "$app->user_friendly_name $v $platform->name $pc"; |
66 | 66 | } |
@@ -59,7 +59,9 @@ discard block |
||
59 | 59 | return null; |
60 | 60 | } |
61 | 61 | $platform = BoincPlatform::lookup_id($av->platformid); |
62 | - if (!$platform) return tra("Missing platform"); |
|
62 | + if (!$platform) { |
|
63 | + return tra("Missing platform"); |
|
64 | + } |
|
63 | 65 | $pc = (strlen($av->plan_class))?"($av->plan_class)":""; |
64 | 66 | $v = number_format($av->version_num/100, 2); |
65 | 67 | return "$app->user_friendly_name $v $platform->name $pc"; |
@@ -68,7 +70,9 @@ discard block |
||
68 | 70 | |
69 | 71 | function show_hav($hav, $show_dep) { |
70 | 72 | $desc = av_desc($hav->app_version_id, $show_dep); |
71 | - if (!$desc) return; |
|
73 | + if (!$desc) { |
|
74 | + return; |
|
75 | + } |
|
72 | 76 | row1($desc); |
73 | 77 | row2(tra("Number of tasks completed"), $hav->et_n); |
74 | 78 | row2(tra("Max tasks per day"), $hav->max_jobs_per_day); |