@@ -92,6 +92,9 @@ discard block |
||
92 | 92 | // Look for an element in a line of XML text |
93 | 93 | // If it's a single-tag element, and it's present, just return the tag |
94 | 94 | // |
95 | +/** |
|
96 | + * @return string |
|
97 | + */ |
|
95 | 98 | function parse_element($xml, $tag) { |
96 | 99 | $element = null; |
97 | 100 | $closetag = "</" . substr($tag,1); |
@@ -107,6 +110,9 @@ discard block |
||
107 | 110 | return trim($element); |
108 | 111 | } |
109 | 112 | |
113 | +/** |
|
114 | + * @param string $tag |
|
115 | + */ |
|
110 | 116 | function parse_next_element($xml, $tag, &$cursor) { |
111 | 117 | $element = null; |
112 | 118 | $closetag = "</" . substr($tag,1); |
@@ -137,6 +143,9 @@ discard block |
||
137 | 143 | |
138 | 144 | // look for a particular element in the config file |
139 | 145 | // |
146 | +/** |
|
147 | + * @param string $tag |
|
148 | + */ |
|
140 | 149 | function parse_config($config, $tag) { |
141 | 150 | $element = parse_element($config, $tag); |
142 | 151 | return $element; |
@@ -126,6 +126,9 @@ discard block |
||
126 | 126 | return is_https()?secure_url_base():URL_BASE; |
127 | 127 | } |
128 | 128 | |
129 | +/** |
|
130 | + * @param string $name |
|
131 | + */ |
|
129 | 132 | function send_cookie($name, $value, $permanent, $ops=false) { |
130 | 133 | global $master_url; |
131 | 134 | |
@@ -208,6 +211,9 @@ discard block |
||
208 | 211 | // To do so, define page_head() in the project include file. |
209 | 212 | // |
210 | 213 | if (!function_exists("page_head")){ |
214 | +/** |
|
215 | + * @param string $body_attrs |
|
216 | + */ |
|
211 | 217 | function page_head( |
212 | 218 | $title, |
213 | 219 | // page title. Put in <title>, used as title for browser tab. |
@@ -476,6 +482,9 @@ discard block |
||
476 | 482 | "; |
477 | 483 | } |
478 | 484 | |
485 | +/** |
|
486 | + * @param string $x |
|
487 | + */ |
|
479 | 488 | function row2_init($x, $y, $lwidth='40%') { |
480 | 489 | echo '<tr> |
481 | 490 | <td class="text-right " width="'.$lwidth.'" style="padding-right: 20px;">'.$x.'</td> |
@@ -487,6 +496,9 @@ discard block |
||
487 | 496 | echo "<tr><td>$x</td><td>$y</td></tr>\n"; |
488 | 497 | } |
489 | 498 | |
499 | +/** |
|
500 | + * @param string $string |
|
501 | + */ |
|
490 | 502 | function rowify($string) { |
491 | 503 | echo "<tr><td>$string</td></tr>"; |
492 | 504 | } |
@@ -512,6 +524,9 @@ discard block |
||
512 | 524 | echo "</tr>\n"; |
513 | 525 | } |
514 | 526 | |
527 | +/** |
|
528 | + * @param string $x |
|
529 | + */ |
|
515 | 530 | function row_heading($x, $class='bg-primary') { |
516 | 531 | echo sprintf('<tr><th class="%s" colspan=99>%s</th></tr> |
517 | 532 | ', $class, $x |
@@ -574,6 +589,11 @@ discard block |
||
574 | 589 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
575 | 590 | // is cut short. |
576 | 591 | |
592 | +/** |
|
593 | + * @param string $sentence |
|
594 | + * @param string $delimiter |
|
595 | + * @param integer $max_chars |
|
596 | + */ |
|
577 | 597 | function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
578 | 598 | $words = explode($delimiter, $sentence); |
579 | 599 | $total_chars = 0; |
@@ -624,6 +644,9 @@ discard block |
||
624 | 644 | ob_implicit_flush(0); |
625 | 645 | } |
626 | 646 | |
647 | +/** |
|
648 | + * @param string $filename |
|
649 | + */ |
|
627 | 650 | function close_output_buffer($filename) { |
628 | 651 | $fh = fopen($filename, "w"); |
629 | 652 | $page = ob_get_contents(); |
@@ -692,6 +715,9 @@ discard block |
||
692 | 715 | |
693 | 716 | // returns null if the arg is optional and missing |
694 | 717 | // |
718 | +/** |
|
719 | + * @param string $name |
|
720 | + */ |
|
695 | 721 | function post_int($name, $optional=false) { |
696 | 722 | $x = post_num($name, $optional); |
697 | 723 | if (is_null($x)) return null; |
@@ -791,6 +817,9 @@ discard block |
||
791 | 817 | |
792 | 818 | // Generate a "select" element from an array of values |
793 | 819 | // |
820 | +/** |
|
821 | + * @param string $name |
|
822 | + */ |
|
794 | 823 | function select_from_array($name, $array, $selection=null, $width=240) { |
795 | 824 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
796 | 825 | |
@@ -854,18 +883,33 @@ discard block |
||
854 | 883 | ); |
855 | 884 | } |
856 | 885 | |
886 | +/** |
|
887 | + * @param string $text |
|
888 | + * @param string $desc |
|
889 | + */ |
|
857 | 890 | function show_button($url, $text, $desc=null, $class="btn-success btn-sm") { |
858 | 891 | echo button_text($url, $text, $desc=null, $class); |
859 | 892 | } |
860 | 893 | |
861 | 894 | // for places with a bunch of buttons, like forum posts |
862 | 895 | // |
896 | +/** |
|
897 | + * @param string $url |
|
898 | + * @param string $text |
|
899 | + * @param string $desc |
|
900 | + */ |
|
863 | 901 | function show_button_small($url, $text, $desc=null) { |
864 | 902 | echo button_text($url, $text, $desc, "btn-primary btn-xs"); |
865 | 903 | } |
866 | 904 | |
867 | 905 | // used for showing icons |
868 | 906 | // |
907 | +/** |
|
908 | + * @param string $src |
|
909 | + * @param string $title |
|
910 | + * @param string $alt |
|
911 | + * @param string $height |
|
912 | + */ |
|
869 | 913 | function show_image($src, $title, $alt, $height=null) { |
870 | 914 | $h = ""; |
871 | 915 | if ($height) { |
@@ -986,6 +1030,9 @@ discard block |
||
986 | 1030 | } |
987 | 1031 | } |
988 | 1032 | |
1033 | +/** |
|
1034 | + * @param integer $f |
|
1035 | + */ |
|
989 | 1036 | function flops_to_credit($f) { |
990 | 1037 | return $f*(200/86400e9); |
991 | 1038 | } |
@@ -1020,6 +1067,9 @@ discard block |
||
1020 | 1067 | } |
1021 | 1068 | } |
1022 | 1069 | |
1070 | +/** |
|
1071 | + * @param integer $height |
|
1072 | + */ |
|
1023 | 1073 | function badges_string($is_user, $item, $height) { |
1024 | 1074 | if (DISABLE_BADGES) return null; |
1025 | 1075 | if ($is_user) { |
@@ -1036,6 +1086,9 @@ discard block |
||
1036 | 1086 | return $x; |
1037 | 1087 | } |
1038 | 1088 | |
1089 | +/** |
|
1090 | + * @param boolean $is_user |
|
1091 | + */ |
|
1039 | 1092 | function show_badges_row($is_user, $item) { |
1040 | 1093 | if (BADGE_HEIGHT_LARGE == 0) return; |
1041 | 1094 | $x = badges_string($is_user, $item, BADGE_HEIGHT_LARGE); |
@@ -1080,6 +1133,11 @@ discard block |
||
1080 | 1133 | // return HTML for a textarea with chars-remaining counter. |
1081 | 1134 | // Call text_counter_script() before using this. |
1082 | 1135 | // |
1136 | +/** |
|
1137 | + * @param string $name |
|
1138 | + * @param integer $maxlen |
|
1139 | + * @param string $text |
|
1140 | + */ |
|
1083 | 1141 | function textarea_with_counter($name, $maxlen, $text) { |
1084 | 1142 | $rem_name = $name."_remaining"; |
1085 | 1143 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |
@@ -31,6 +31,9 @@ discard block |
||
31 | 31 | |
32 | 32 | // return HTML string for a checkbox for toggling password visibility |
33 | 33 | // |
34 | +/** |
|
35 | + * @param string $name |
|
36 | + */ |
|
34 | 37 | function passwd_visible_checkbox($name) { |
35 | 38 | return sprintf(' |
36 | 39 | <script> |
@@ -48,6 +51,10 @@ discard block |
||
48 | 51 | ); |
49 | 52 | } |
50 | 53 | |
54 | +/** |
|
55 | + * @param integer $teamid |
|
56 | + * @param string $next_url |
|
57 | + */ |
|
51 | 58 | function create_account_form($teamid, $next_url) { |
52 | 59 | global $recaptcha_public_key; |
53 | 60 | form_input_hidden('next_url', $next_url); |
@@ -111,6 +118,9 @@ discard block |
||
111 | 118 | } |
112 | 119 | } |
113 | 120 | |
121 | +/** |
|
122 | + * @param string $next_url |
|
123 | + */ |
|
114 | 124 | function login_form($next_url) { |
115 | 125 | form_start(secure_url_base()."/login_action.php", "post"); |
116 | 126 | form_input_hidden("next_url", $next_url); |
@@ -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 | // |
@@ -131,6 +140,9 @@ discard block |
||
131 | 140 | // The arg is the batch-level template, if any. |
132 | 141 | // Jobs may have their own templates. |
133 | 142 | // |
143 | +/** |
|
144 | + * @param SimpleXMLElement $template |
|
145 | + */ |
|
134 | 146 | function validate_batch($jobs, $template) { |
135 | 147 | $i = 0; |
136 | 148 | $n = count($template->file_info); |
@@ -200,6 +212,13 @@ discard block |
||
200 | 212 | |
201 | 213 | // submit a list of jobs with a single create_work command. |
202 | 214 | // |
215 | +/** |
|
216 | + * @param stdClass $job_params |
|
217 | + * @param double $priority |
|
218 | + * @param integer $app_version_num |
|
219 | + * @param string $input_template_filename |
|
220 | + * @param string $output_template_filename |
|
221 | + */ |
|
203 | 222 | function submit_jobs( |
204 | 223 | $jobs, $job_params, $app, $batch_id, $priority, $app_version_num, |
205 | 224 | $input_template_filename, // batch-level; can also specify per job |
@@ -294,6 +313,9 @@ discard block |
||
294 | 313 | // Check whether the template is already in our map. |
295 | 314 | // If not, write it to a temp file. |
296 | 315 | // |
316 | +/** |
|
317 | + * @param stdClass $job |
|
318 | + */ |
|
297 | 319 | function make_input_template($job) { |
298 | 320 | global $input_templates; |
299 | 321 | if (!array_key_exists($job->input_template_xml, $input_templates)) { |
@@ -310,6 +332,9 @@ discard block |
||
310 | 332 | // A little different because these have to exist for life of job. |
311 | 333 | // Store them in templates/tmp/, with content-based filenames |
312 | 334 | // |
335 | +/** |
|
336 | + * @param stdClass $job |
|
337 | + */ |
|
313 | 338 | function make_output_template($job) { |
314 | 339 | global $output_templates; |
315 | 340 | if (!array_key_exists($job->output_template_xml, $output_templates)) { |
@@ -508,6 +533,9 @@ discard block |
||
508 | 533 | "; |
509 | 534 | } |
510 | 535 | |
536 | +/** |
|
537 | + * @param integer $get_cpu_time |
|
538 | + */ |
|
511 | 539 | function print_batch_params($batch, $get_cpu_time) { |
512 | 540 | $app = BoincApp::lookup_id($batch->app_id); |
513 | 541 | if (!$app) $app->name = "none"; |
@@ -202,7 +202,7 @@ |
||
202 | 202 | * We don't have any more options, so let's throw an exception right now |
203 | 203 | * and hope the developer won't let it fail silently. |
204 | 204 | * |
205 | - * @param mixed $length |
|
205 | + * @param integer $length |
|
206 | 206 | * @psalm-suppress MissingReturnType |
207 | 207 | * @throws Exception |
208 | 208 | * @return string |
@@ -540,7 +540,7 @@ |
||
540 | 540 | * @param $file |
541 | 541 | * A file object. |
542 | 542 | * @return |
543 | - * The URL of the icon image file, or FALSE if no icon could be found. |
|
543 | + string|false The URL of the icon image file, or FALSE if no icon could be found. |
|
544 | 544 | */ |
545 | 545 | function filefield_icon_url($file) { |
546 | 546 | module_load_include('inc', 'filefield', 'filefield.theme'); |
@@ -151,7 +151,7 @@ |
||
151 | 151 | * @param $account |
152 | 152 | * The user account object to calculate the file path for. |
153 | 153 | * @return |
154 | - * The files directory path, with any tokens replaced. |
|
154 | + string The files directory path, with any tokens replaced. |
|
155 | 155 | */ |
156 | 156 | function filefield_widget_file_path($field, $account = NULL) { |
157 | 157 | $account = isset($account) ? $account : $GLOBALS['user']; |
@@ -36,6 +36,9 @@ |
||
36 | 36 | // return true if the passwd hash (old format) |
37 | 37 | // matches the user's passwd hash (possibly new format) |
38 | 38 | // |
39 | +/** |
|
40 | + * @param string $passwd_hash |
|
41 | + */ |
|
39 | 42 | function check_passwd_hash($user, $passwd_hash) { |
40 | 43 | if (password_verify($passwd_hash, $user->passwd_hash)) { |
41 | 44 | // on valid login, rehash password to upgrade hash overtime |
@@ -113,6 +113,9 @@ |
||
113 | 113 | return ($a->expavg_credit < $b->expavg_credit) ? 1 : -1; |
114 | 114 | } |
115 | 115 | |
116 | +/** |
|
117 | + * @param boolean $personal |
|
118 | + */ |
|
116 | 119 | function show_other_projects($user, $personal) { |
117 | 120 | if (!isset($user->projects)) return; |
118 | 121 | if (count($user->projects) < 2) return; |