@@ -258,6 +258,7 @@ |
||
258 | 258 | * |
259 | 259 | * This function is used to select the desired flag when setting up flag |
260 | 260 | * relationships and fields. |
261 | + * @param string $form_type |
|
261 | 262 | */ |
262 | 263 | function flag_views_flag_config_form($form_type, $content_type, $current_flag) { |
263 | 264 | $flags = flag_get_flags($content_type); |
@@ -116,6 +116,8 @@ |
||
116 | 116 | * Returns an option's value. |
117 | 117 | * |
118 | 118 | * Purpose: insulate us from the difference between Views 3 and Views 2. |
119 | + * @param string $option |
|
120 | + * @param string $default |
|
119 | 121 | */ |
120 | 122 | function _get_option($option, $default) { |
121 | 123 | if (_flag_is_views3()) { |
@@ -30,6 +30,7 @@ discard block |
||
30 | 30 | * |
31 | 31 | * This will also attempt to include all parents, though we're maxing the |
32 | 32 | * parent chain to 10 to prevent infinite loops. |
33 | + * @param string $type |
|
33 | 34 | */ |
34 | 35 | function views_include_handler($definition, $type, $count = 0) { |
35 | 36 | // Do not proceed if the class already exists. |
@@ -912,7 +913,7 @@ discard block |
||
912 | 913 | /** |
913 | 914 | * Helper function to create cross-database SQL date formatting. |
914 | 915 | * |
915 | - * @param $format |
|
916 | + * @param string $format |
|
916 | 917 | * A format string for the result, like 'Y-m-d H:i:s'. |
917 | 918 | * @param $field |
918 | 919 | * The real table and field name, like 'tablename.fieldname'. |
@@ -978,7 +979,7 @@ discard block |
||
978 | 979 | /** |
979 | 980 | * Helper function to create cross-database SQL date extraction. |
980 | 981 | * |
981 | - * @param $extract_type |
|
982 | + * @param string $extract_type |
|
982 | 983 | * The type of value to extract from the date, like 'MONTH'. |
983 | 984 | * @param $field |
984 | 985 | * The real table and field name, like 'tablename.fieldname'. |
@@ -1246,6 +1247,8 @@ discard block |
||
1246 | 1247 | class views_join { |
1247 | 1248 | /** |
1248 | 1249 | * Construct the views_join object. |
1250 | + * @param string $table |
|
1251 | + * @param string $field |
|
1249 | 1252 | */ |
1250 | 1253 | function construct($table = NULL, $left_table = NULL, $left_field = NULL, $field = NULL, $extra = array(), $type = 'LEFT') { |
1251 | 1254 | $this->extra_type = 'AND'; |
@@ -18,6 +18,10 @@ discard block |
||
18 | 18 | |
19 | 19 | // forms for account creation and login |
20 | 20 | |
21 | +/** |
|
22 | + * @param integer $teamid |
|
23 | + * @param string $next_url |
|
24 | + */ |
|
21 | 25 | function create_account_form($teamid, $next_url) { |
22 | 26 | global $recaptcha_public_key; |
23 | 27 | form_input_hidden('next_url', $next_url); |
@@ -67,6 +71,9 @@ discard block |
||
67 | 71 | } |
68 | 72 | } |
69 | 73 | |
74 | +/** |
|
75 | + * @param string $next_url |
|
76 | + */ |
|
70 | 77 | function login_form($next_url) { |
71 | 78 | echo " |
72 | 79 | <form name=\"f\" method=\"post\" action=\"".secure_url_base()."/login_action.php\"> |
@@ -977,6 +977,7 @@ discard block |
||
977 | 977 | |
978 | 978 | /** |
979 | 979 | * Format a number to be displayed using a maximum number of digits |
980 | + * @param double $number |
|
980 | 981 | */ |
981 | 982 | function boincwork_format_stats($number, $max_digits = 4) { |
982 | 983 | $suffix = array( |
@@ -1187,6 +1188,9 @@ discard block |
||
1187 | 1188 | // xml_to_array(): Convert an XML DOM object to array format |
1188 | 1189 | //------------------------------------------------------------------------------------------------ |
1189 | 1190 | |
1191 | + /** |
|
1192 | + * @param DOMDocument $xml |
|
1193 | + */ |
|
1190 | 1194 | function xml_to_array($xml) { |
1191 | 1195 | $node = $xml->firstChild; //$xml->first_child(); |
1192 | 1196 | $result = ''; |
@@ -1269,6 +1273,7 @@ discard block |
||
1269 | 1273 | |
1270 | 1274 | /** |
1271 | 1275 | * Determine output for host list views when no hosts are found. |
1276 | + * @param string $context |
|
1272 | 1277 | */ |
1273 | 1278 | function boincwork_views_host_list_empty_text($context = NULL) { |
1274 | 1279 | |
@@ -1818,6 +1823,7 @@ discard block |
||
1818 | 1823 | |
1819 | 1824 | /** |
1820 | 1825 | * Function to delete a column from an array. |
1826 | + * @param integer $offset |
|
1821 | 1827 | */ |
1822 | 1828 | function delete_col(&$array, $offset) { |
1823 | 1829 | return array_walk($array, function (&$v) use ($offset) { |
@@ -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"> |
@@ -286,6 +303,9 @@ discard block |
||
286 | 303 | ); |
287 | 304 | } |
288 | 305 | |
306 | +/** |
|
307 | + * @param string $name |
|
308 | + */ |
|
289 | 309 | function form_input_hidden($name, $value) { |
290 | 310 | echo '<input type="hidden" name="'.$name.'" value="'.$value.'"> |
291 | 311 | '; |
@@ -301,6 +321,10 @@ discard block |
||
301 | 321 | define('FORM_LEFT_OFFSET', 'col-sm-offset-5'); |
302 | 322 | define('FORM_RIGHT_CLASS', 'col-sm-7'); |
303 | 323 | |
324 | +/** |
|
325 | + * @param string $label |
|
326 | + * @param string $name |
|
327 | + */ |
|
304 | 328 | function form_input_text($label, $name, $value='', $type='text', $attrs='') { |
305 | 329 | echo sprintf(' |
306 | 330 | <div class="form-group"> |
@@ -343,6 +367,11 @@ discard block |
||
343 | 367 | |
344 | 368 | // $items is either a string of <option> elements, or an array |
345 | 369 | // |
370 | +/** |
|
371 | + * @param string $label |
|
372 | + * @param string $name |
|
373 | + * @param string $items |
|
374 | + */ |
|
346 | 375 | function form_select($label, $name, $items) { |
347 | 376 | echo sprintf(' |
348 | 377 | <div class="form-group"> |
@@ -428,6 +457,10 @@ discard block |
||
428 | 457 | '; |
429 | 458 | } |
430 | 459 | |
460 | +/** |
|
461 | + * @param string $label |
|
462 | + * @param string $item |
|
463 | + */ |
|
431 | 464 | function form_general($label, $item) { |
432 | 465 | echo ' |
433 | 466 | <div class="form-group"> |
@@ -48,6 +48,10 @@ discard block |
||
48 | 48 | return $x; |
49 | 49 | } |
50 | 50 | |
51 | +/** |
|
52 | + * @param null|integer $teamid |
|
53 | + * @param string $error |
|
54 | + */ |
|
51 | 55 | function pm_team_form($user, $teamid, $error=null) { |
52 | 56 | global $bbcode_html, $bbcode_js; |
53 | 57 | $team = BoincTeam::lookup_id($teamid); |
@@ -99,6 +103,9 @@ discard block |
||
99 | 103 | page_tail(); |
100 | 104 | } |
101 | 105 | |
106 | +/** |
|
107 | + * @param string $error |
|
108 | + */ |
|
102 | 109 | function pm_form($replyto, $userid, $error = null) { |
103 | 110 | global $bbcode_html, $bbcode_js; |
104 | 111 | global $g_logged_in_user; |
@@ -217,6 +224,9 @@ discard block |
||
217 | 224 | return "<a href=pm.php>".tra("Private message%1 from %2, subject:" , "</a>", $from_user->name )." $pm->subject"; |
218 | 225 | } |
219 | 226 | |
227 | +/** |
|
228 | + * @param boolean $send_email |
|
229 | + */ |
|
220 | 230 | function pm_send_msg($from_user, $to_user, $subject, $content, $send_email) { |
221 | 231 | $sql_subject = BoincDb::escape_string(sanitize_tags($subject)); |
222 | 232 | $sql_content = BoincDb::escape_string($content); |
@@ -245,6 +255,9 @@ discard block |
||
245 | 255 | BoincNotify::insert("(userid, create_time, type, opaque) values ($to_user->id, ".time().", ".NOTIFY_PM.", $mid)"); |
246 | 256 | } |
247 | 257 | |
258 | +/** |
|
259 | + * @param integer $duration |
|
260 | + */ |
|
248 | 261 | function pm_count($userid, $duration) { |
249 | 262 | $time = time() - $duration; |
250 | 263 |
@@ -111,6 +111,9 @@ discard block |
||
111 | 111 | return secure_url_base(); |
112 | 112 | } |
113 | 113 | |
114 | +/** |
|
115 | + * @param string $name |
|
116 | + */ |
|
114 | 117 | function send_cookie($name, $value, $permanent, $ops=false) { |
115 | 118 | global $master_url; |
116 | 119 | |
@@ -193,6 +196,9 @@ discard block |
||
193 | 196 | // To do so, define page_head() in the project include file. |
194 | 197 | // |
195 | 198 | if (!function_exists("page_head")){ |
199 | +/** |
|
200 | + * @param string $body_attrs |
|
201 | + */ |
|
196 | 202 | function page_head( |
197 | 203 | $title, |
198 | 204 | // page title. Put in <title>, used as title for browser tab. |
@@ -460,6 +466,9 @@ discard block |
||
460 | 466 | "; |
461 | 467 | } |
462 | 468 | |
469 | +/** |
|
470 | + * @param string $x |
|
471 | + */ |
|
463 | 472 | function row2_init($x, $y, $lwidth='40%') { |
464 | 473 | echo '<tr> |
465 | 474 | <td class="text-right " width="'.$lwidth.'" style="padding-right: 20px;">'.$x.'</td> |
@@ -471,6 +480,9 @@ discard block |
||
471 | 480 | echo "<tr><td>$x</td><td>$y</td></tr>\n"; |
472 | 481 | } |
473 | 482 | |
483 | +/** |
|
484 | + * @param string $string |
|
485 | + */ |
|
474 | 486 | function rowify($string) { |
475 | 487 | echo "<tr><td>$string</td></tr>"; |
476 | 488 | } |
@@ -496,6 +508,9 @@ discard block |
||
496 | 508 | echo "</tr>\n"; |
497 | 509 | } |
498 | 510 | |
511 | +/** |
|
512 | + * @param string $x |
|
513 | + */ |
|
499 | 514 | function row_heading($x, $class='bg-primary') { |
500 | 515 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
501 | 516 | ', $class, $x |
@@ -556,6 +571,11 @@ discard block |
||
556 | 571 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
557 | 572 | // is cut short. |
558 | 573 | |
574 | +/** |
|
575 | + * @param string $sentence |
|
576 | + * @param string $delimiter |
|
577 | + * @param integer $max_chars |
|
578 | + */ |
|
559 | 579 | function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
560 | 580 | $words = explode($delimiter, $sentence); |
561 | 581 | $total_chars = 0; |
@@ -606,6 +626,9 @@ discard block |
||
606 | 626 | ob_implicit_flush(0); |
607 | 627 | } |
608 | 628 | |
629 | +/** |
|
630 | + * @param string $filename |
|
631 | + */ |
|
609 | 632 | function close_output_buffer($filename) { |
610 | 633 | $fh = fopen($filename, "w"); |
611 | 634 | $page = ob_get_contents(); |
@@ -674,6 +697,9 @@ discard block |
||
674 | 697 | |
675 | 698 | // returns null if the arg is optional and missing |
676 | 699 | // |
700 | +/** |
|
701 | + * @param string $name |
|
702 | + */ |
|
677 | 703 | function post_int($name, $optional=false) { |
678 | 704 | $x = post_num($name, $optional); |
679 | 705 | if (is_null($x)) return null; |
@@ -773,6 +799,9 @@ discard block |
||
773 | 799 | |
774 | 800 | // Generate a "select" element from an array of values |
775 | 801 | // |
802 | +/** |
|
803 | + * @param string $name |
|
804 | + */ |
|
776 | 805 | function select_from_array($name, $array, $selection=null, $width=240) { |
777 | 806 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
778 | 807 | |
@@ -834,6 +863,9 @@ discard block |
||
834 | 863 | "; |
835 | 864 | } |
836 | 865 | |
866 | +/** |
|
867 | + * @param string $text |
|
868 | + */ |
|
837 | 869 | function button_text($url, $text, $desc=null, $class="btn btn-default") { |
838 | 870 | if (!$desc) $desc = $text; |
839 | 871 | return "<a href=\"".$url."\" title=\"$desc\" class=\"".$class."\">".$text."</a> |
@@ -855,6 +887,12 @@ discard block |
||
855 | 887 | |
856 | 888 | // used for showing icons |
857 | 889 | // |
890 | +/** |
|
891 | + * @param string $src |
|
892 | + * @param string $title |
|
893 | + * @param string $alt |
|
894 | + * @param string $height |
|
895 | + */ |
|
858 | 896 | function show_image($src, $title, $alt, $height=null) { |
859 | 897 | $h = ""; |
860 | 898 | if ($height) { |
@@ -970,6 +1008,9 @@ discard block |
||
970 | 1008 | } |
971 | 1009 | } |
972 | 1010 | |
1011 | +/** |
|
1012 | + * @param integer $f |
|
1013 | + */ |
|
973 | 1014 | function flops_to_credit($f) { |
974 | 1015 | return $f*(200/86400e9); |
975 | 1016 | } |
@@ -1005,6 +1046,9 @@ discard block |
||
1005 | 1046 | } |
1006 | 1047 | } |
1007 | 1048 | |
1049 | +/** |
|
1050 | + * @param integer $height |
|
1051 | + */ |
|
1008 | 1052 | function badges_string($is_user, $item, $height) { |
1009 | 1053 | if (DISABLE_BADGES) return null; |
1010 | 1054 | if ($is_user) { |
@@ -1021,6 +1065,9 @@ discard block |
||
1021 | 1065 | return $x; |
1022 | 1066 | } |
1023 | 1067 | |
1068 | +/** |
|
1069 | + * @param boolean $is_user |
|
1070 | + */ |
|
1024 | 1071 | function show_badges_row($is_user, $item) { |
1025 | 1072 | if (BADGE_HEIGHT_LARGE == 0) return; |
1026 | 1073 | $x = badges_string($is_user, $item, BADGE_HEIGHT_LARGE); |
@@ -1065,6 +1112,11 @@ discard block |
||
1065 | 1112 | // return HTML for a textarea with chars-remaining counter. |
1066 | 1113 | // Call text_counter_script() before using this. |
1067 | 1114 | // |
1115 | +/** |
|
1116 | + * @param string $name |
|
1117 | + * @param integer $maxlen |
|
1118 | + * @param string $text |
|
1119 | + */ |
|
1068 | 1120 | function textarea_with_counter($name, $maxlen, $text) { |
1069 | 1121 | $rem_name = $name."_remaining"; |
1070 | 1122 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |