@@ -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 |
@@ -179,6 +179,7 @@ |
||
179 | 179 | /** |
180 | 180 | * Implementation of hook_node_view(); add custom actions when a node |
181 | 181 | * is viewed (forward compatible to Drupal 7) |
182 | + * @param string $view_mode |
|
182 | 183 | */ |
183 | 184 | function boinctranslate_node_view($node, $view_mode, $langcode) { |
184 | 185 | switch($node->type) { |
@@ -512,6 +512,7 @@ discard block |
||
512 | 512 | |
513 | 513 | /** |
514 | 514 | * |
515 | + * @param string $type |
|
515 | 516 | */ |
516 | 517 | function boinctranslate_export_po_generate($language = NULL, $strings = array(), $header = NULL, $type = NULL) { |
517 | 518 | |
@@ -886,6 +887,7 @@ discard block |
||
886 | 887 | |
887 | 888 | /** |
888 | 889 | * |
890 | + * @param stdClass $file |
|
889 | 891 | */ |
890 | 892 | function _boinctranslate_locale_import_po($file, $langcode, $mode, $group = NULL) { |
891 | 893 | // Try to allocate enough time to parse and import the data. |
@@ -932,6 +934,7 @@ discard block |
||
932 | 934 | |
933 | 935 | /** |
934 | 936 | * |
937 | + * @param string $op |
|
935 | 938 | */ |
936 | 939 | function _boinctranslate_locale_import_read_po($op, $file, $mode = NULL, $lang = NULL, $group = 'default') { |
937 | 940 | |
@@ -1283,6 +1286,7 @@ discard block |
||
1283 | 1286 | * |
1284 | 1287 | * Textgroups 'boinc' and 'project' use the location string to |
1285 | 1288 | * uniquely identify rows in the locales_source database. |
1289 | + * @param string $textgroup |
|
1286 | 1290 | */ |
1287 | 1291 | function _boinctranslate_locale_import_one_string_db(&$report, $langcode, $source, $translation, $textgroup, $location, $mode, $plid = NULL, $plural = NULL) { |
1288 | 1292 |
@@ -30,6 +30,9 @@ discard block |
||
30 | 30 | ini_set('display_errors', true); |
31 | 31 | ini_set('display_startup_errors', true); |
32 | 32 | |
33 | +/** |
|
34 | + * @param string $name |
|
35 | + */ |
|
33 | 36 | function get_wu($name) { |
34 | 37 | $name = BoincDb::escape_string($name); |
35 | 38 | $wu = BoincWorkunit::lookup("name='$name'"); |
@@ -37,6 +40,9 @@ discard block |
||
37 | 40 | return $wu; |
38 | 41 | } |
39 | 42 | |
43 | +/** |
|
44 | + * @param string $name |
|
45 | + */ |
|
40 | 46 | function get_submit_app($name) { |
41 | 47 | $name = BoincDb::escape_string($name); |
42 | 48 | $app = BoincApp::lookup("name='$name'"); |
@@ -76,6 +82,9 @@ discard block |
||
76 | 82 | return $y; |
77 | 83 | } |
78 | 84 | |
85 | +/** |
|
86 | + * @param SimpleXMLElement|null $template |
|
87 | + */ |
|
79 | 88 | function est_elapsed_time($r, $template) { |
80 | 89 | // crude estimate: batch FLOPs / project FLOPS |
81 | 90 | // |
@@ -122,6 +131,9 @@ discard block |
||
122 | 131 | "; |
123 | 132 | } |
124 | 133 | |
134 | +/** |
|
135 | + * @param SimpleXMLElement $template |
|
136 | + */ |
|
125 | 137 | function validate_batch($jobs, $template) { |
126 | 138 | $i = 0; |
127 | 139 | $n = count($template->file_info); |
@@ -191,6 +203,11 @@ discard block |
||
191 | 203 | |
192 | 204 | // submit a list of jobs with a single create_work command. |
193 | 205 | // |
206 | +/** |
|
207 | + * @param SimpleXMLElement|null $template |
|
208 | + * @param double $priority |
|
209 | + * @param integer $app_version_num |
|
210 | + */ |
|
194 | 211 | function submit_jobs( |
195 | 212 | $jobs, $template, $app, $batch_id, $priority, $app_version_num, |
196 | 213 | $result_template_file, // batch-level; can also specify per job |
@@ -270,6 +287,9 @@ discard block |
||
270 | 287 | // Check whether the template is already in our map. |
271 | 288 | // If not, write it to a temp file. |
272 | 289 | // |
290 | +/** |
|
291 | + * @param stdClass $job |
|
292 | + */ |
|
273 | 293 | function make_wu_template($job) { |
274 | 294 | global $wu_templates; |
275 | 295 | if (!array_key_exists($job->wu_template, $wu_templates)) { |
@@ -286,6 +306,9 @@ discard block |
||
286 | 306 | // A little different because these have to exist for life of job. |
287 | 307 | // Store them in templates/tmp/, with content-based filenames |
288 | 308 | // |
309 | +/** |
|
310 | + * @param stdClass $job |
|
311 | + */ |
|
289 | 312 | function make_result_template($job) { |
290 | 313 | global $result_templates; |
291 | 314 | if (!array_key_exists($job->result_template, $result_templates)) { |
@@ -474,6 +497,9 @@ discard block |
||
474 | 497 | "; |
475 | 498 | } |
476 | 499 | |
500 | +/** |
|
501 | + * @param integer $get_cpu_time |
|
502 | + */ |
|
477 | 503 | function print_batch_params($batch, $get_cpu_time) { |
478 | 504 | $app = BoincApp::lookup_id($batch->app_id); |
479 | 505 | if (!$app) $app->name = "none"; |
@@ -123,6 +123,9 @@ discard block |
||
123 | 123 | return secure_url_base(); |
124 | 124 | } |
125 | 125 | |
126 | +/** |
|
127 | + * @param string $name |
|
128 | + */ |
|
126 | 129 | function send_cookie($name, $value, $permanent, $ops=false) { |
127 | 130 | global $master_url; |
128 | 131 | |
@@ -205,6 +208,9 @@ discard block |
||
205 | 208 | // To do so, define page_head() in the project include file. |
206 | 209 | // |
207 | 210 | if (!function_exists("page_head")){ |
211 | +/** |
|
212 | + * @param string $body_attrs |
|
213 | + */ |
|
208 | 214 | function page_head( |
209 | 215 | $title, |
210 | 216 | // page title. Put in <title>, used as title for browser tab. |
@@ -472,6 +478,9 @@ discard block |
||
472 | 478 | "; |
473 | 479 | } |
474 | 480 | |
481 | +/** |
|
482 | + * @param string $x |
|
483 | + */ |
|
475 | 484 | function row2_init($x, $y, $lwidth='40%') { |
476 | 485 | echo '<tr> |
477 | 486 | <td class="text-right " width="'.$lwidth.'" style="padding-right: 20px;">'.$x.'</td> |
@@ -483,6 +492,9 @@ discard block |
||
483 | 492 | echo "<tr><td>$x</td><td>$y</td></tr>\n"; |
484 | 493 | } |
485 | 494 | |
495 | +/** |
|
496 | + * @param string $string |
|
497 | + */ |
|
486 | 498 | function rowify($string) { |
487 | 499 | echo "<tr><td>$string</td></tr>"; |
488 | 500 | } |
@@ -508,6 +520,9 @@ discard block |
||
508 | 520 | echo "</tr>\n"; |
509 | 521 | } |
510 | 522 | |
523 | +/** |
|
524 | + * @param string $x |
|
525 | + */ |
|
511 | 526 | function row_heading($x, $class='bg-primary') { |
512 | 527 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
513 | 528 | ', $class, $x |
@@ -568,6 +583,11 @@ discard block |
||
568 | 583 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
569 | 584 | // is cut short. |
570 | 585 | |
586 | +/** |
|
587 | + * @param string $sentence |
|
588 | + * @param string $delimiter |
|
589 | + * @param integer $max_chars |
|
590 | + */ |
|
571 | 591 | function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
572 | 592 | $words = explode($delimiter, $sentence); |
573 | 593 | $total_chars = 0; |
@@ -618,6 +638,9 @@ discard block |
||
618 | 638 | ob_implicit_flush(0); |
619 | 639 | } |
620 | 640 | |
641 | +/** |
|
642 | + * @param string $filename |
|
643 | + */ |
|
621 | 644 | function close_output_buffer($filename) { |
622 | 645 | $fh = fopen($filename, "w"); |
623 | 646 | $page = ob_get_contents(); |
@@ -686,6 +709,9 @@ discard block |
||
686 | 709 | |
687 | 710 | // returns null if the arg is optional and missing |
688 | 711 | // |
712 | +/** |
|
713 | + * @param string $name |
|
714 | + */ |
|
689 | 715 | function post_int($name, $optional=false) { |
690 | 716 | $x = post_num($name, $optional); |
691 | 717 | if (is_null($x)) return null; |
@@ -785,6 +811,9 @@ discard block |
||
785 | 811 | |
786 | 812 | // Generate a "select" element from an array of values |
787 | 813 | // |
814 | +/** |
|
815 | + * @param string $name |
|
816 | + */ |
|
788 | 817 | function select_from_array($name, $array, $selection=null, $width=240) { |
789 | 818 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
790 | 819 | |
@@ -854,6 +883,11 @@ discard block |
||
854 | 883 | |
855 | 884 | // for places with a bunch of buttons, like forum posts |
856 | 885 | // |
886 | +/** |
|
887 | + * @param string $url |
|
888 | + * @param string $text |
|
889 | + * @param string $desc |
|
890 | + */ |
|
857 | 891 | function show_button_small($url, $text, $desc=null) { |
858 | 892 | echo button_text($url, $text, $desc, "btn-primary btn-xs"); |
859 | 893 | } |
@@ -873,6 +907,12 @@ discard block |
||
873 | 907 | |
874 | 908 | // used for showing icons |
875 | 909 | // |
910 | +/** |
|
911 | + * @param string $src |
|
912 | + * @param string $title |
|
913 | + * @param string $alt |
|
914 | + * @param string $height |
|
915 | + */ |
|
876 | 916 | function show_image($src, $title, $alt, $height=null) { |
877 | 917 | $h = ""; |
878 | 918 | if ($height) { |
@@ -988,6 +1028,9 @@ discard block |
||
988 | 1028 | } |
989 | 1029 | } |
990 | 1030 | |
1031 | +/** |
|
1032 | + * @param integer $f |
|
1033 | + */ |
|
991 | 1034 | function flops_to_credit($f) { |
992 | 1035 | return $f*(200/86400e9); |
993 | 1036 | } |
@@ -1022,6 +1065,9 @@ discard block |
||
1022 | 1065 | } |
1023 | 1066 | } |
1024 | 1067 | |
1068 | +/** |
|
1069 | + * @param integer $height |
|
1070 | + */ |
|
1025 | 1071 | function badges_string($is_user, $item, $height) { |
1026 | 1072 | if (DISABLE_BADGES) return null; |
1027 | 1073 | if ($is_user) { |
@@ -1038,6 +1084,9 @@ discard block |
||
1038 | 1084 | return $x; |
1039 | 1085 | } |
1040 | 1086 | |
1087 | +/** |
|
1088 | + * @param boolean $is_user |
|
1089 | + */ |
|
1041 | 1090 | function show_badges_row($is_user, $item) { |
1042 | 1091 | if (BADGE_HEIGHT_LARGE == 0) return; |
1043 | 1092 | $x = badges_string($is_user, $item, BADGE_HEIGHT_LARGE); |
@@ -1082,6 +1131,11 @@ discard block |
||
1082 | 1131 | // return HTML for a textarea with chars-remaining counter. |
1083 | 1132 | // Call text_counter_script() before using this. |
1084 | 1133 | // |
1134 | +/** |
|
1135 | + * @param string $name |
|
1136 | + * @param integer $maxlen |
|
1137 | + * @param string $text |
|
1138 | + */ |
|
1085 | 1139 | function textarea_with_counter($name, $maxlen, $text) { |
1086 | 1140 | $rem_name = $name."_remaining"; |
1087 | 1141 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |