@@ -30,6 +30,11 @@ discard block |
||
30 | 30 | // $brand: the text or image to show at left of navbar |
31 | 31 | // If text, put it in <a class="navbar-brand" ... |
32 | 32 | // |
33 | +/** |
|
34 | + * @param string $brand |
|
35 | + * @param boolean $fixed |
|
36 | + * @param boolean $inverse |
|
37 | + */ |
|
33 | 38 | function navbar_start($brand, $fixed, $inverse) { |
34 | 39 | global $fixed_navbar; |
35 | 40 | $class = "navbar"; |
@@ -99,6 +104,9 @@ discard block |
||
99 | 104 | |
100 | 105 | // add a dropdown menu |
101 | 106 | // |
107 | +/** |
|
108 | + * @param string $name |
|
109 | + */ |
|
102 | 110 | function navbar_menu($name, $items) { |
103 | 111 | echo ' |
104 | 112 | <li class="dropdown"> |
@@ -218,6 +226,10 @@ discard block |
||
218 | 226 | // output a panel. |
219 | 227 | // $content_func is a function that generates the panel contents |
220 | 228 | // |
229 | +/** |
|
230 | + * @param string|null $title |
|
231 | + * @param Closure $content_func |
|
232 | + */ |
|
221 | 233 | function panel($title, $content_func, $class="panel-primary") { |
222 | 234 | echo sprintf('<div class="panel %s"> |
223 | 235 | ', $class |
@@ -244,6 +256,11 @@ discard block |
||
244 | 256 | // are functions that generate the top, left, and right content |
245 | 257 | // $left_width is the width of left column in 1/12 units. |
246 | 258 | // |
259 | +/** |
|
260 | + * @param boolean $top_func |
|
261 | + * @param Closure $left_func |
|
262 | + * @param Closure $right_func |
|
263 | + */ |
|
247 | 264 | function grid($top_func, $left_func, $right_func, $left_width=6) { |
248 | 265 | echo ' |
249 | 266 | <div class="container-fluid"> |
@@ -277,6 +294,9 @@ discard block |
||
277 | 294 | '; |
278 | 295 | } |
279 | 296 | |
297 | +/** |
|
298 | + * @param string $action |
|
299 | + */ |
|
280 | 300 | function form_start($action, $method='get') { |
281 | 301 | echo sprintf( |
282 | 302 | '<div class="container"> |
@@ -286,6 +306,9 @@ discard block |
||
286 | 306 | ); |
287 | 307 | } |
288 | 308 | |
309 | +/** |
|
310 | + * @param string $name |
|
311 | + */ |
|
289 | 312 | function form_input_hidden($name, $value) { |
290 | 313 | echo '<input type="hidden" name="'.$name.'" value="'.$value.'"> |
291 | 314 | '; |
@@ -301,6 +324,10 @@ discard block |
||
301 | 324 | define('FORM_LEFT_OFFSET', 'col-sm-offset-4'); |
302 | 325 | define('FORM_RIGHT_CLASS', 'col-sm-8'); |
303 | 326 | |
327 | +/** |
|
328 | + * @param string $label |
|
329 | + * @param string $name |
|
330 | + */ |
|
304 | 331 | function form_input_text($label, $name, $value='', $type='text', $attrs='', $extra='') { |
305 | 332 | echo sprintf(' |
306 | 333 | <div class="form-group"> |
@@ -343,6 +370,11 @@ discard block |
||
343 | 370 | |
344 | 371 | // $items is either a string of <option> elements, or an array |
345 | 372 | // |
373 | +/** |
|
374 | + * @param string $label |
|
375 | + * @param string $name |
|
376 | + * @param string $items |
|
377 | + */ |
|
346 | 378 | function form_select($label, $name, $items) { |
347 | 379 | echo sprintf(' |
348 | 380 | <div class="form-group"> |
@@ -387,6 +419,9 @@ discard block |
||
387 | 419 | |
388 | 420 | // $items is list of (name, label, checked) |
389 | 421 | // |
422 | +/** |
|
423 | + * @param string $label |
|
424 | + */ |
|
390 | 425 | function form_checkboxes($label, $items, $attrs='') { |
391 | 426 | echo sprintf(' |
392 | 427 | <div class="form-group"> |
@@ -414,6 +449,11 @@ discard block |
||
414 | 449 | |
415 | 450 | // $items is list of (value, label) |
416 | 451 | // |
452 | +/** |
|
453 | + * @param string $label |
|
454 | + * @param string $name |
|
455 | + * @param string $selected |
|
456 | + */ |
|
417 | 457 | function form_radio_buttons($label, $name, $items, $selected) { |
418 | 458 | echo sprintf(' |
419 | 459 | <div class="form-group"> |
@@ -434,6 +474,10 @@ discard block |
||
434 | 474 | '; |
435 | 475 | } |
436 | 476 | |
477 | +/** |
|
478 | + * @param string $label |
|
479 | + * @param string $item |
|
480 | + */ |
|
437 | 481 | function form_general($label, $item) { |
438 | 482 | echo ' |
439 | 483 | <div class="form-group"> |
@@ -456,6 +500,9 @@ discard block |
||
456 | 500 | '; |
457 | 501 | } |
458 | 502 | |
503 | +/** |
|
504 | + * @param string $text |
|
505 | + */ |
|
459 | 506 | function form_submit($text, $attrs='') { |
460 | 507 | form_general( |
461 | 508 | "", |
@@ -26,6 +26,8 @@ discard block |
||
26 | 26 | |
27 | 27 | /** |
28 | 28 | * Get an image object from a given file and cck field |
29 | + * @param string $field_name |
|
30 | + * @param string $content_type |
|
29 | 31 | */ |
30 | 32 | function get_cck_image_object($image_path, $field_name, $content_type, $ignore_resolution = FALSE) { |
31 | 33 | $field = content_fields($field_name, $content_type); |
@@ -277,6 +279,7 @@ discard block |
||
277 | 279 | /** |
278 | 280 | * Ignore certain paths. Returns true of path is in the |
279 | 281 | * paths_to_ignore array of regular expressions patterns. |
282 | + * @param string[] $paths_to_ignore |
|
280 | 283 | */ |
281 | 284 | function _boincuser_ignore_paths($path, $paths_to_ignore) { |
282 | 285 | |
@@ -317,6 +320,7 @@ discard block |
||
317 | 320 | /** |
318 | 321 | * Include BOINC code |
319 | 322 | * The path from the BOINC html root must be included (e.g. user/file.php) |
323 | + * @param string $file |
|
320 | 324 | */ |
321 | 325 | function include_boinc($file) { |
322 | 326 | if ($include_dir = boinc_get_path()) { |
@@ -332,6 +336,7 @@ discard block |
||
332 | 336 | |
333 | 337 | /** |
334 | 338 | * Get the BOINC include path |
339 | + * @return string |
|
335 | 340 | */ |
336 | 341 | function boinc_get_path($type = 'root') { |
337 | 342 | $dir = "boinc_{$type}_dir"; |
@@ -116,6 +116,10 @@ discard block |
||
116 | 116 | // If you include any links, prepend URL with $prefix |
117 | 117 | // if you need to open divs here close them in project_footer() |
118 | 118 | // |
119 | +/** |
|
120 | + * @param string $prefix |
|
121 | + * @param boolean $is_main |
|
122 | + */ |
|
119 | 123 | function project_banner($title, $prefix, $is_main) { |
120 | 124 | if ($is_main) { |
121 | 125 | echo '<img class="img-responsive" style="width:100%" src="img/water.jpg">'; |
@@ -127,6 +131,11 @@ discard block |
||
127 | 131 | } |
128 | 132 | //$fixed_navbar = true; |
129 | 133 | |
134 | +/** |
|
135 | + * @param boolean $show_return |
|
136 | + * @param boolean $show_date |
|
137 | + * @param string $prefix |
|
138 | + */ |
|
130 | 139 | function project_footer($show_return, $show_date, $prefix) { |
131 | 140 | // If you include any links, prepend URL with $prefix |
132 | 141 | // |
@@ -27,6 +27,10 @@ discard block |
||
27 | 27 | define("TOKEN_DURATION_ONE_DAY", 86400); |
28 | 28 | define("TOKEN_DURATION_ONE_WEEK", 604800); |
29 | 29 | |
30 | +/** |
|
31 | + * @param string $type |
|
32 | + * @param integer $duration |
|
33 | + */ |
|
30 | 34 | function create_token($userid, $type, $duration) { |
31 | 35 | $token = random_string(); |
32 | 36 | $now = time(); |
@@ -39,6 +43,9 @@ discard block |
||
39 | 43 | return $token; |
40 | 44 | } |
41 | 45 | |
46 | +/** |
|
47 | + * @param string $type |
|
48 | + */ |
|
42 | 49 | function delete_token($userid, $token, $type) { |
43 | 50 | $token = BoincDb::escape_string($token); |
44 | 51 | $type = BoincDb::escape_string($type); |
@@ -46,6 +53,9 @@ discard block |
||
46 | 53 | return $result; |
47 | 54 | } |
48 | 55 | |
56 | +/** |
|
57 | + * @param string $type |
|
58 | + */ |
|
49 | 59 | function is_valid_token($userid, $token, $type) { |
50 | 60 | $boincToken = BoincToken::lookup_valid_token($userid, $token, $type); |
51 | 61 | if ( $boincToken == null ) { |