@@ -107,10 +107,18 @@ |
||
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
110 | +/** |
|
111 | + * @param integer $i |
|
112 | + * |
|
113 | + * @return string |
|
114 | + */ |
|
110 | 115 | function app_version_dir($app_name, $i, $platform) { |
111 | 116 | return "apps/$app_name/1.$i/$platform"; |
112 | 117 | } |
113 | 118 | |
119 | +/** |
|
120 | + * @param integer $i |
|
121 | + */ |
|
114 | 122 | function make_app_version_dir($app_name, $i, $platform) { |
115 | 123 | @mkdir("apps/$app_name"); |
116 | 124 | @mkdir("apps/$app_name/1.$i"); |
@@ -58,6 +58,9 @@ |
||
58 | 58 | return $x; |
59 | 59 | } |
60 | 60 | |
61 | +/** |
|
62 | + * @param resource $f |
|
63 | + */ |
|
61 | 64 | function handle_team($team, $f) { |
62 | 65 | echo "Team: $team->name\n"; |
63 | 66 | $user = BoincUser::lookup_id($team->userid); |
@@ -100,7 +100,7 @@ |
||
100 | 100 | $f = fopen("temp.xml", "w"); |
101 | 101 | $teams = BoincTeam::enum(null); |
102 | 102 | fwrite($f, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<teams>\n"); |
103 | - foreach($teams as $team) { |
|
103 | + foreach ($teams as $team) { |
|
104 | 104 | handle_team($team, $f); |
105 | 105 | } |
106 | 106 | fwrite($f, "</teams>\n"); |
@@ -88,6 +88,9 @@ discard block |
||
88 | 88 | return null; |
89 | 89 | } |
90 | 90 | |
91 | +/** |
|
92 | + * @param stdClass $t |
|
93 | + */ |
|
91 | 94 | function valid_team($t) { |
92 | 95 | if (!$t->id) return false; |
93 | 96 | if (!$t->name) return false; |
@@ -96,6 +99,9 @@ discard block |
||
96 | 99 | return true; |
97 | 100 | } |
98 | 101 | |
102 | +/** |
|
103 | + * @param stdClass $t |
|
104 | + */ |
|
99 | 105 | function update_team($t, $team, $user) { |
100 | 106 | global $dry_run; |
101 | 107 | if ( |
@@ -126,6 +132,9 @@ discard block |
||
126 | 132 | } |
127 | 133 | } |
128 | 134 | |
135 | +/** |
|
136 | + * @param stdClass $t |
|
137 | + */ |
|
129 | 138 | function insert_case($t, $user) { |
130 | 139 | global $master_url; |
131 | 140 | global $dry_run; |
@@ -227,7 +227,7 @@ |
||
227 | 227 | if ($team->seti_id) { |
228 | 228 | if ($team->seti_id == $t->id) { |
229 | 229 | echo " case 1\n"; |
230 | - update_team($t, $team, $user); // update1 case |
|
230 | + update_team($t, $team, $user); // update1 case |
|
231 | 231 | } else { |
232 | 232 | echo " team exists but has wrong seti_id\n"; |
233 | 233 | } |
@@ -63,8 +63,7 @@ discard block |
||
63 | 63 | $t->user_postal_code = decode($t->user_postal_code); |
64 | 64 | $t->user_url = decode($t->user_url); |
65 | 65 | return $t; |
66 | - } |
|
67 | - else if (strstr($s, '<name>')) $t->name = parse_element($s, '<name>'); |
|
66 | + } else if (strstr($s, '<name>')) $t->name = parse_element($s, '<name>'); |
|
68 | 67 | else if (strstr($s, '<url>')) $t->url = parse_element($s, '<url>'); |
69 | 68 | else if (strstr($s, '<type>')) $t->type = parse_element($s, '<type>'); |
70 | 69 | else if (strstr($s, '<name_html>')) $t->name_html = parse_element($s, '<name_html>'); |
@@ -73,14 +72,12 @@ discard block |
||
73 | 72 | if (strstr($s, '</description>')) break; |
74 | 73 | $t->description .= $s; |
75 | 74 | } |
76 | - } |
|
77 | - else if (strstr($s, '<country>')) $t->country = parse_element($s, '<country>'); |
|
75 | + } else if (strstr($s, '<country>')) $t->country = parse_element($s, '<country>'); |
|
78 | 76 | else if (strstr($s, '<id>')) $t->id = parse_element($s, '<id>'); |
79 | 77 | else if (strstr($s, '<user_email_munged>')) { |
80 | 78 | $user_email_munged = parse_element($s, '<user_email_munged>'); |
81 | 79 | $t->user_email = str_rot13($user_email_munged); |
82 | - } |
|
83 | - else if (strstr($s, '<user_name>')) $t->user_name = parse_element($s, '<user_name>'); |
|
80 | + } else if (strstr($s, '<user_name>')) $t->user_name = parse_element($s, '<user_name>'); |
|
84 | 81 | else if (strstr($s, '<user_country>')) $t->user_country = parse_element($s, '<user_country>'); |
85 | 82 | else if (strstr($s, '<user_postal_code>')) $t->user_postal_code = parse_element($s, '<user_postal_code>'); |
86 | 83 | else if (strstr($s, '<user_url>')) $t->user_url = parse_element($s, '<user_url>'); |
@@ -212,7 +212,7 @@ |
||
212 | 212 | return; |
213 | 213 | } |
214 | 214 | |
215 | - echo "Processing $t->name $t->user_email\n"; |
|
215 | + echo "processing $t->name $t->user_email\n"; |
|
216 | 216 | $user = BoincUser::lookup_email_addr($t->user_email); |
217 | 217 | $team = BoincTeam::lookup_name($t->name); |
218 | 218 | if ($team) { |
@@ -98,6 +98,9 @@ discard block |
||
98 | 98 | // Generates a standard set of links between associated multi-page documents. |
99 | 99 | // All linked files must be of the form "$filename_<page number>.html". |
100 | 100 | |
101 | +/** |
|
102 | + * @param integer $currPageNum |
|
103 | + */ |
|
101 | 104 | function write_page_links($filename, $currPageNum, $numPages) { |
102 | 105 | echo "<p>Page $currPageNum of $numPages</p>"; |
103 | 106 | |
@@ -332,6 +335,11 @@ discard block |
||
332 | 335 | // A generalized function to produce some number of pages summarizing a |
333 | 336 | // set of user profiles. |
334 | 337 | |
338 | +/** |
|
339 | + * @param integer $rowsPerPage |
|
340 | + * @param integer $colsPerPage |
|
341 | + * @param string $dir |
|
342 | + */ |
|
335 | 343 | function build_profile_pages( |
336 | 344 | $members, $title, $rowsPerPage, $colsPerPage, $dir, $base_filename |
337 | 345 | ) { |
@@ -200,7 +200,7 @@ |
||
200 | 200 | for ($row = 0; $row < $height; $row++) { |
201 | 201 | echo "<tr>"; |
202 | 202 | for ($col = 0; $col < $width; $col++) { |
203 | - if ($count < $numIds) { |
|
203 | + if ($count < $numIds) { |
|
204 | 204 | echo "<td class=\"bordered\" align=\"center\"> |
205 | 205 | <a href=\"".secure_url_base()."view_profile.php?userid=".$userIds[$count]."\"><img src=\"".secure_url_base().IMAGE_URL.$userIds[$count]."_sm.jpg\"></a> |
206 | 206 | </td>"; |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | // TODO: convert to new DB interface |
41 | 41 | |
42 | -$alphabet = array('A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4','5','6','7','8','9'); |
|
42 | +$alphabet = array('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); |
|
43 | 43 | |
44 | 44 | |
45 | 45 | // Builds a summary table of user profiles. |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | function show_user_table($members, $offset, $numToDisplay, $cols) { |
54 | 54 | start_table(); |
55 | 55 | |
56 | - $rows = ceil($numToDisplay / $cols); |
|
56 | + $rows = ceil($numToDisplay/$cols); |
|
57 | 57 | $count = $offset; |
58 | 58 | $numMembers = count($members); |
59 | 59 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | // Build an array of IDs of all users with pictures in their profiles. |
152 | 152 | $userIds = array(); |
153 | 153 | $numIds = 0; |
154 | - foreach($profiles as $profile) { |
|
154 | + foreach ($profiles as $profile) { |
|
155 | 155 | $user = BoincUser::lookup_id($profile->userid); |
156 | 156 | if (!$user) continue; // maybe we should delete the profile if user is non-existent anymore? |
157 | 157 | if ($user->name) { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | // shuffle($userIds); |
172 | 172 | // } |
173 | 173 | |
174 | - $numPages = ceil(count($userIds)/($width * $height)); |
|
174 | + $numPages = ceil(count($userIds)/($width*$height)); |
|
175 | 175 | |
176 | 176 | // Make sure that a page is generated even when no profiles with pictures |
177 | 177 | // exist in order to avoid 404 errors from the profile_menu page. |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $count = 0; |
186 | 186 | |
187 | 187 | for ($page = 1; $page <= $numPages; $page++) { |
188 | - $filename = PROFILE_PATH . "user_gallery_" . $page . ".html"; |
|
188 | + $filename = PROFILE_PATH."user_gallery_".$page.".html"; |
|
189 | 189 | open_output_buffer(); |
190 | 190 | |
191 | 191 | page_head("Profile gallery: page $page of $numPages", null, false, "../"); |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | // of the userids who belong to those countries. |
245 | 245 | // Format: array[country][index] = userid. |
246 | 246 | |
247 | - foreach($profiles as $profile) { |
|
247 | + foreach ($profiles as $profile) { |
|
248 | 248 | $user = BoincUser::lookup_id($profile->userid); |
249 | 249 | if (!$user) continue; // maybe we should delete the profile if user is non-existent anymore? |
250 | 250 | if ($user->country) { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | // TODO: Define a constant for the desired number of rows per page. |
265 | 265 | |
266 | 266 | foreach ($countries as $country) { |
267 | - $baseFileName = "profile_country_" . get_legal_filename($country); |
|
267 | + $baseFileName = "profile_country_".get_legal_filename($country); |
|
268 | 268 | build_profile_pages( |
269 | 269 | $countryMembers[$country], |
270 | 270 | "User Profiles from $country", 5, 2, |
@@ -290,7 +290,7 @@ discard block |
||
290 | 290 | $numIds = 0; |
291 | 291 | $members = array(); |
292 | 292 | |
293 | - foreach($profiles as $profile) { |
|
293 | + foreach ($profiles as $profile) { |
|
294 | 294 | $user = BoincUser::lookup_id($profile->userid); |
295 | 295 | if (!$user) continue; // maybe we should delete the profile if user is non-existent anymore? |
296 | 296 | if ($user->name) { |
@@ -335,11 +335,11 @@ discard block |
||
335 | 335 | function build_profile_pages( |
336 | 336 | $members, $title, $rowsPerPage, $colsPerPage, $dir, $base_filename |
337 | 337 | ) { |
338 | - $numPerPage = $rowsPerPage * $colsPerPage; |
|
339 | - $numPages = ceil(count($members) / $numPerPage); |
|
338 | + $numPerPage = $rowsPerPage*$colsPerPage; |
|
339 | + $numPages = ceil(count($members)/$numPerPage); |
|
340 | 340 | |
341 | 341 | for ($page = 1; $page <= $numPages; $page++) { |
342 | - $filename = $dir . $base_filename . "_" . $page . ".html"; |
|
342 | + $filename = $dir.$base_filename."_".$page.".html"; |
|
343 | 343 | open_output_buffer(); |
344 | 344 | |
345 | 345 | $pagetitle = $title.": Page $page of $numPages"; |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | |
348 | 348 | echo "Last updated ", pretty_time_str(time()), "<p>\n"; |
349 | 349 | |
350 | - $offset = (($page-1) * $rowsPerPage * $colsPerPage); |
|
350 | + $offset = (($page - 1)*$rowsPerPage*$colsPerPage); |
|
351 | 351 | |
352 | 352 | show_user_table($members, $offset, $numPerPage, $colsPerPage); |
353 | 353 | |
@@ -364,11 +364,11 @@ discard block |
||
364 | 364 | print_debug_msg("Beginning to build country summary page..."); |
365 | 365 | $countries = array_keys($countryMembers); |
366 | 366 | |
367 | - $filename = PROFILE_PATH . "profile_country.html"; |
|
367 | + $filename = PROFILE_PATH."profile_country.html"; |
|
368 | 368 | open_output_buffer(); |
369 | 369 | |
370 | 370 | page_head("User Profiles by Country", null, null, "../"); |
371 | - echo "Last updated " . pretty_time_str(time()) . "<p>"; |
|
371 | + echo "Last updated ".pretty_time_str(time())."<p>"; |
|
372 | 372 | |
373 | 373 | start_table(); |
374 | 374 | row_heading_array(array("Country", "Profiles")); |
@@ -413,7 +413,7 @@ discard block |
||
413 | 413 | |
414 | 414 | $caching = true; |
415 | 415 | |
416 | -if (@$argv[1]=="-d") $debug=true; |
|
416 | +if (@$argv[1] == "-d") $debug = true; |
|
417 | 417 | |
418 | 418 | build_country_pages(); |
419 | 419 | build_alpha_pages(); |
@@ -180,7 +180,7 @@ |
||
180 | 180 | $numPages = 1; |
181 | 181 | } |
182 | 182 | |
183 | - print_debug_msg("Generating $numPages pages"); |
|
183 | + print_debug_msg("generating $numPages pages"); |
|
184 | 184 | |
185 | 185 | $count = 0; |
186 | 186 |
@@ -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 | ?> |
@@ -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"]); |
@@ -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 | ?> |
@@ -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 |
@@ -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 { |