@@ -25,6 +25,9 @@ |
||
25 | 25 | |
26 | 26 | check_get_args(array("mode")); |
27 | 27 | |
28 | +/** |
|
29 | + * @param string $mode |
|
30 | + */ |
|
28 | 31 | function filename($mode) { |
29 | 32 | switch ($mode) { |
30 | 33 | case 'host': return "cuda_hosts.dat"; |
@@ -37,6 +37,9 @@ discard block |
||
37 | 37 | return $n; |
38 | 38 | } |
39 | 39 | |
40 | +/** |
|
41 | + * @param integer $state |
|
42 | + */ |
|
40 | 43 | function show_all_link($batches, $state, $limit, $user, $app) { |
41 | 44 | $n = state_count($batches, $state); |
42 | 45 | if ($n > $limit) { |
@@ -269,6 +272,9 @@ discard block |
||
269 | 272 | page_tail(); |
270 | 273 | } |
271 | 274 | |
275 | +/** |
|
276 | + * @param null|integer $app_id |
|
277 | + */ |
|
272 | 278 | function check_admin_access($user, $app_id) { |
273 | 279 | $user_submit = BoincUserSubmit::lookup_userid($user->id); |
274 | 280 | if (!$user_submit) error_page("no access"); |
@@ -523,6 +529,9 @@ discard block |
||
523 | 529 | page_tail(); |
524 | 530 | } |
525 | 531 | |
532 | +/** |
|
533 | + * @param null|integer $state |
|
534 | + */ |
|
526 | 535 | function show_batches_in_state($batches, $state) { |
527 | 536 | switch ($state) { |
528 | 537 | case BATCH_STATE_IN_PROGRESS: |
@@ -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,10 @@ 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 | + */ |
|
194 | 210 | function submit_jobs( |
195 | 211 | $jobs, $template, $app, $batch_id, $priority, |
196 | 212 | $result_template_file, // batch-level; can also specify per job |
@@ -267,6 +283,9 @@ discard block |
||
267 | 283 | // Check whether the template is already in our map. |
268 | 284 | // If not, write it to a temp file. |
269 | 285 | // |
286 | +/** |
|
287 | + * @param stdClass $job |
|
288 | + */ |
|
270 | 289 | function make_wu_template($job) { |
271 | 290 | global $wu_templates; |
272 | 291 | if (!array_key_exists($job->wu_template, $wu_templates)) { |
@@ -283,6 +302,9 @@ discard block |
||
283 | 302 | // A little different because these have to exist for life of job. |
284 | 303 | // Store them in templates/tmp/, with content-based filenames |
285 | 304 | // |
305 | +/** |
|
306 | + * @param stdClass $job |
|
307 | + */ |
|
286 | 308 | function make_result_template($job) { |
287 | 309 | global $result_templates; |
288 | 310 | if (!array_key_exists($job->result_template, $result_templates)) { |
@@ -468,6 +490,9 @@ discard block |
||
468 | 490 | "; |
469 | 491 | } |
470 | 492 | |
493 | +/** |
|
494 | + * @param integer $get_cpu_time |
|
495 | + */ |
|
471 | 496 | function print_batch_params($batch, $get_cpu_time) { |
472 | 497 | $app = BoincApp::lookup_id($batch->app_id); |
473 | 498 | if (!$app) $app->name = "none"; |
@@ -57,6 +57,9 @@ |
||
57 | 57 | edit_form($user, $team, $forum, true); |
58 | 58 | } |
59 | 59 | |
60 | +/** |
|
61 | + * @param boolean $first |
|
62 | + */ |
|
60 | 63 | function edit_form($user, $team, $forum, $first) { |
61 | 64 | page_head(tra("Team Message Board")); |
62 | 65 | echo " |
@@ -30,6 +30,9 @@ |
||
30 | 30 | // list entries are of the form id => team, |
31 | 31 | // where team includes a field "refcnt". |
32 | 32 | // |
33 | +/** |
|
34 | + * @param integer $weight |
|
35 | + */ |
|
33 | 36 | function merge_lists($list1, &$list2, $weight) { |
34 | 37 | foreach($list1 as $team) { |
35 | 38 | $id = $team->id; |
@@ -106,6 +106,9 @@ discard block |
||
106 | 106 | return secure_url_base(); |
107 | 107 | } |
108 | 108 | |
109 | +/** |
|
110 | + * @param string $name |
|
111 | + */ |
|
109 | 112 | function send_cookie($name, $value, $permanent, $ops=false) { |
110 | 113 | global $master_url; |
111 | 114 | |
@@ -188,6 +191,9 @@ discard block |
||
188 | 191 | // To do so, define page_head() in the project include file. |
189 | 192 | // |
190 | 193 | if (!function_exists("page_head")){ |
194 | +/** |
|
195 | + * @param string $body_attrs |
|
196 | + */ |
|
191 | 197 | function page_head( |
192 | 198 | $title, |
193 | 199 | // page title. Put in <title>, used as title for browser tab. |
@@ -455,6 +461,9 @@ discard block |
||
455 | 461 | "; |
456 | 462 | } |
457 | 463 | |
464 | +/** |
|
465 | + * @param string $x |
|
466 | + */ |
|
458 | 467 | function row2_init($x, $y, $lwidth='40%') { |
459 | 468 | echo '<tr> |
460 | 469 | <td class="text-right " width="'.$lwidth.'" style="padding-right: 20px;">'.$x.'</td> |
@@ -466,6 +475,9 @@ discard block |
||
466 | 475 | echo "<tr><td>$x</td><td>$y</td></tr>\n"; |
467 | 476 | } |
468 | 477 | |
478 | +/** |
|
479 | + * @param string $string |
|
480 | + */ |
|
469 | 481 | function rowify($string) { |
470 | 482 | echo "<tr><td>$string</td></tr>"; |
471 | 483 | } |
@@ -491,6 +503,9 @@ discard block |
||
491 | 503 | echo "</tr>\n"; |
492 | 504 | } |
493 | 505 | |
506 | +/** |
|
507 | + * @param string $x |
|
508 | + */ |
|
494 | 509 | function row_heading($x) { |
495 | 510 | echo '<tr><th class="bg-primary" colspan=99>'.$x.'</th></tr> |
496 | 511 | '; |
@@ -555,6 +570,11 @@ discard block |
||
555 | 570 | // If $ellipsis is true, then an ellipsis is added to any sentence which |
556 | 571 | // is cut short. |
557 | 572 | |
573 | +/** |
|
574 | + * @param string $sentence |
|
575 | + * @param string $delimiter |
|
576 | + * @param integer $max_chars |
|
577 | + */ |
|
558 | 578 | function sub_sentence($sentence, $delimiter, $max_chars, $ellipsis=false) { |
559 | 579 | $words = explode($delimiter, $sentence); |
560 | 580 | $total_chars = 0; |
@@ -605,6 +625,9 @@ discard block |
||
605 | 625 | ob_implicit_flush(0); |
606 | 626 | } |
607 | 627 | |
628 | +/** |
|
629 | + * @param string $filename |
|
630 | + */ |
|
608 | 631 | function close_output_buffer($filename) { |
609 | 632 | $fh = fopen($filename, "w"); |
610 | 633 | $page = ob_get_contents(); |
@@ -673,6 +696,9 @@ discard block |
||
673 | 696 | |
674 | 697 | // returns null if the arg is optional and missing |
675 | 698 | // |
699 | +/** |
|
700 | + * @param string $name |
|
701 | + */ |
|
676 | 702 | function post_int($name, $optional=false) { |
677 | 703 | $x = post_num($name, $optional); |
678 | 704 | if (is_null($x)) return null; |
@@ -772,6 +798,9 @@ discard block |
||
772 | 798 | |
773 | 799 | // Generate a "select" element from an array of values |
774 | 800 | // |
801 | +/** |
|
802 | + * @param string $name |
|
803 | + */ |
|
775 | 804 | function select_from_array($name, $array, $selection=null, $width=240) { |
776 | 805 | $out = '<select style="color:#000;"class="form-control input-sm" style="width:'.$width.'px" name="'.$name.'">"'; |
777 | 806 | |
@@ -833,6 +862,9 @@ discard block |
||
833 | 862 | "; |
834 | 863 | } |
835 | 864 | |
865 | +/** |
|
866 | + * @param string $text |
|
867 | + */ |
|
836 | 868 | function button_text($url, $text, $desc=null, $class="btn btn-default") { |
837 | 869 | if (!$desc) $desc = $text; |
838 | 870 | return "<a href=\"".$url."\" title=\"$desc\" class=\"".$class."\">".$text."</a> |
@@ -854,6 +886,12 @@ discard block |
||
854 | 886 | |
855 | 887 | // used for showing icons |
856 | 888 | // |
889 | +/** |
|
890 | + * @param string $src |
|
891 | + * @param string $title |
|
892 | + * @param string $alt |
|
893 | + * @param string $height |
|
894 | + */ |
|
857 | 895 | function show_image($src, $title, $alt, $height=null) { |
858 | 896 | $h = ""; |
859 | 897 | if ($height) { |
@@ -969,6 +1007,9 @@ discard block |
||
969 | 1007 | } |
970 | 1008 | } |
971 | 1009 | |
1010 | +/** |
|
1011 | + * @param integer $f |
|
1012 | + */ |
|
972 | 1013 | function flops_to_credit($f) { |
973 | 1014 | return $f*(200/86400e9); |
974 | 1015 | } |
@@ -1004,6 +1045,9 @@ discard block |
||
1004 | 1045 | } |
1005 | 1046 | } |
1006 | 1047 | |
1048 | +/** |
|
1049 | + * @param integer $height |
|
1050 | + */ |
|
1007 | 1051 | function badges_string($is_user, $item, $height) { |
1008 | 1052 | if (DISABLE_BADGES) return null; |
1009 | 1053 | if ($is_user) { |
@@ -1020,6 +1064,9 @@ discard block |
||
1020 | 1064 | return $x; |
1021 | 1065 | } |
1022 | 1066 | |
1067 | +/** |
|
1068 | + * @param boolean $is_user |
|
1069 | + */ |
|
1023 | 1070 | function show_badges_row($is_user, $item) { |
1024 | 1071 | if (BADGE_HEIGHT_LARGE == 0) return; |
1025 | 1072 | $x = badges_string($is_user, $item, BADGE_HEIGHT_LARGE); |
@@ -1064,6 +1111,11 @@ discard block |
||
1064 | 1111 | // return HTML for a textarea with chars-remaining counter. |
1065 | 1112 | // Call text_counter_script() before using this. |
1066 | 1113 | // |
1114 | +/** |
|
1115 | + * @param string $name |
|
1116 | + * @param integer $maxlen |
|
1117 | + * @param string $text |
|
1118 | + */ |
|
1067 | 1119 | function textarea_with_counter($name, $maxlen, $text) { |
1068 | 1120 | $rem_name = $name."_remaining"; |
1069 | 1121 | return "<textarea name=\"$name\" class=\"form-control\" rows=3 id=\"$name\" onkeydown=\"text_counter(this.form.$name, this.form.$rem_name, $maxlen);\" |
@@ -36,6 +36,10 @@ discard block |
||
36 | 36 | return file_exists("$d/stop_sched"); |
37 | 37 | } |
38 | 38 | |
39 | +/** |
|
40 | + * @param string $x |
|
41 | + * @param string $y |
|
42 | + */ |
|
39 | 43 | function show_page($x, $y) { |
40 | 44 | echo " |
41 | 45 | <title>$x</title> |
@@ -44,6 +48,9 @@ discard block |
||
44 | 48 | "; |
45 | 49 | } |
46 | 50 | |
51 | +/** |
|
52 | + * @param integer $num |
|
53 | + */ |
|
47 | 54 | function xml_error($num, $msg=null, $file=null, $line=null) { |
48 | 55 | global $xml_outer_tag; |
49 | 56 | if (!$msg) { |
@@ -92,6 +99,9 @@ discard block |
||
92 | 99 | // Look for an element in a line of XML text |
93 | 100 | // If it's a single-tag element, and it's present, just return the tag |
94 | 101 | // |
102 | +/** |
|
103 | + * @return string |
|
104 | + */ |
|
95 | 105 | function parse_element($xml, $tag) { |
96 | 106 | $element = null; |
97 | 107 | $closetag = "</" . substr($tag,1); |
@@ -107,6 +117,9 @@ discard block |
||
107 | 117 | return trim($element); |
108 | 118 | } |
109 | 119 | |
120 | +/** |
|
121 | + * @param string $tag |
|
122 | + */ |
|
110 | 123 | function parse_next_element($xml, $tag, &$cursor) { |
111 | 124 | $element = null; |
112 | 125 | $closetag = "</" . substr($tag,1); |
@@ -137,6 +150,9 @@ discard block |
||
137 | 150 | |
138 | 151 | // look for a particular element in the config file |
139 | 152 | // |
153 | +/** |
|
154 | + * @param string $tag |
|
155 | + */ |
|
140 | 156 | function parse_config($config, $tag) { |
141 | 157 | $element = parse_element($config, $tag); |
142 | 158 | return $element; |
@@ -31,6 +31,9 @@ discard block |
||
31 | 31 | // return a column title (Average or Total), |
32 | 32 | // hyperlinked if this is not the current sort column |
33 | 33 | // |
34 | +/** |
|
35 | + * @param integer $i |
|
36 | + */ |
|
34 | 37 | function col_title($is_team, $app, $appid, $is_total, $i) { |
35 | 38 | $x = $i?"Total":"Average"; |
36 | 39 | if ($app->id == $appid && ($is_total?$i:!$i)) { |
@@ -64,6 +67,9 @@ discard block |
||
64 | 67 | |
65 | 68 | // show a user or team, with their credit for each app |
66 | 69 | // |
70 | +/** |
|
71 | + * @param integer $i |
|
72 | + */ |
|
67 | 73 | function show_row($item, $apps, $is_team, $i) { |
68 | 74 | if ($is_team) { |
69 | 75 | $team = BoincTeam::lookup_id($item->teamid); |
@@ -98,6 +104,9 @@ discard block |
||
98 | 104 | echo "</tr>\n"; |
99 | 105 | } |
100 | 106 | |
107 | +/** |
|
108 | + * @param string $appid |
|
109 | + */ |
|
101 | 110 | function show_list($is_team, $appid, $is_total, $offset) { |
102 | 111 | global $items_per_page; |
103 | 112 | $x = $is_team?"teams":"participants"; |