@@ -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 |
@@ -220,6 +220,9 @@ discard block |
||
220 | 220 | // (to accommodate long [pre] lines) |
221 | 221 | // and the left column (author info) has fixed size |
222 | 222 | // |
223 | +/** |
|
224 | + * @param string[] $headings |
|
225 | + */ |
|
223 | 226 | function start_forum_table($headings) { |
224 | 227 | $a = array(); |
225 | 228 | foreach ($headings as $h) { |
@@ -500,6 +503,9 @@ discard block |
||
500 | 503 | // Display an individual post. |
501 | 504 | // Generates a table row with two cells: author and message |
502 | 505 | // |
506 | +/** |
|
507 | + * @param integer $controls |
|
508 | + */ |
|
503 | 509 | function show_post( |
504 | 510 | $post, $thread, $forum, $logged_in_user, $start=0, |
505 | 511 | $latest_viewed=0, $controls=FORUM_CONTROLS, $filter=true |
@@ -875,6 +881,9 @@ discard block |
||
875 | 881 | // These take care of counts and timestamps. |
876 | 882 | // Don't do these things directly - use these functions |
877 | 883 | // |
884 | +/** |
|
885 | + * @param integer $parent_id |
|
886 | + */ |
|
878 | 887 | function create_post($content, $parent_id, $user, $forum, $thread, $signature) { |
879 | 888 | if (POST_MAX_LINKS |
880 | 889 | && link_count($content) > POST_MAX_LINKS |
@@ -1119,6 +1128,9 @@ discard block |
||
1119 | 1128 | // $sort_style - string (checked by switch statement) |
1120 | 1129 | // $show_hidden - bool (not directly passed to SQL) |
1121 | 1130 | // |
1131 | +/** |
|
1132 | + * @param boolean $show_hidden |
|
1133 | + */ |
|
1122 | 1134 | function get_thread_posts($threadid, $sort_style, $show_hidden) { |
1123 | 1135 | $sql = "thread=$threadid"; |
1124 | 1136 | if (!$show_hidden) { |
@@ -1144,6 +1156,9 @@ discard block |
||
1144 | 1156 | // Show links for post moderation actions; |
1145 | 1157 | // logged in user has moderation rights. |
1146 | 1158 | // |
1159 | +/** |
|
1160 | + * @param string $config |
|
1161 | + */ |
|
1147 | 1162 | function show_post_moderation_links( |
1148 | 1163 | $config, $logged_in_user, $post, $forum, $tokens |
1149 | 1164 | ){ |
@@ -882,6 +882,7 @@ |
||
882 | 882 | /** |
883 | 883 | * Private function, based on ignore_user ignore_user_link() |
884 | 884 | * function. Modified for boinc functionality. |
885 | + * @param string $type |
|
885 | 886 | */ |
886 | 887 | function _boinc_ignore_user_link($type, $object = NULL, $teaser = FALSE) { |
887 | 888 | global $user; |
@@ -40,6 +40,10 @@ discard block |
||
40 | 40 | // 2: only use replica_db_user, only try replica_db_host |
41 | 41 | // can be set projectwide using <replica_fallback_mode> |
42 | 42 | // |
43 | + |
|
44 | + /** |
|
45 | + * @param boolean $readonly |
|
46 | + */ |
|
43 | 47 | static function get_aux($readonly, $fallback_mode = 0) { |
44 | 48 | $config = get_config(); |
45 | 49 | $user = parse_config($config, '<db_user>'); |
@@ -204,6 +208,10 @@ discard block |
||
204 | 208 | $db = BoincDb::get(); |
205 | 209 | return $db->count('user', $clause); |
206 | 210 | } |
211 | + |
|
212 | + /** |
|
213 | + * @param string $field |
|
214 | + */ |
|
207 | 215 | static function max($field) { |
208 | 216 | $db = BoincDb::get(); |
209 | 217 | return $db->max('user', $field); |
@@ -216,6 +224,10 @@ discard block |
||
216 | 224 | $db = BoincDb::get(); |
217 | 225 | return $db->enum('user', 'BoincUser', $where_clause, $order_clause); |
218 | 226 | } |
227 | + |
|
228 | + /** |
|
229 | + * @param string $fields |
|
230 | + */ |
|
219 | 231 | static function enum_fields($fields, $where_clause, $order_clause=null) { |
220 | 232 | $db = BoincDb::get(); |
221 | 233 | return $db->enum_fields( |
@@ -233,10 +245,19 @@ discard block |
||
233 | 245 | $db->delete_aux('profile', "userid=$this->id"); |
234 | 246 | return $db->delete($this, 'user'); |
235 | 247 | } |
248 | + |
|
249 | + /** |
|
250 | + * @param string $field |
|
251 | + */ |
|
236 | 252 | static function sum($field) { |
237 | 253 | $db = BoincDb::get(); |
238 | 254 | return $db->sum('user', $field); |
239 | 255 | } |
256 | + |
|
257 | + /** |
|
258 | + * @param string $field |
|
259 | + * @param string $clause |
|
260 | + */ |
|
240 | 261 | static function percentile($field, $clause, $pct) { |
241 | 262 | $db = BoincDb::get(); |
242 | 263 | return $db->percentile('user', $field, $clause, $pct); |
@@ -245,6 +266,10 @@ discard block |
||
245 | 266 | |
246 | 267 | class BoincTeam { |
247 | 268 | static $cache; |
269 | + |
|
270 | + /** |
|
271 | + * @param string $clause |
|
272 | + */ |
|
248 | 273 | static function insert($clause) { |
249 | 274 | $db = BoincDb::get(); |
250 | 275 | $ret = $db->insert('team', $clause); |
@@ -282,14 +307,27 @@ discard block |
||
282 | 307 | $db = BoincDb::get(); |
283 | 308 | return $db->delete($this, 'team'); |
284 | 309 | } |
310 | + |
|
311 | + /** |
|
312 | + * @param string $field |
|
313 | + * @param string $clause |
|
314 | + */ |
|
285 | 315 | static function percentile($field, $clause, $pct) { |
286 | 316 | $db = BoincDb::get(); |
287 | 317 | return $db->percentile('team', $field, $clause, $pct); |
288 | 318 | } |
319 | + |
|
320 | + /** |
|
321 | + * @param string $field |
|
322 | + */ |
|
289 | 323 | static function max($field) { |
290 | 324 | $db = BoincDb::get(); |
291 | 325 | return $db->max('team', $field); |
292 | 326 | } |
327 | + |
|
328 | + /** |
|
329 | + * @param string $fields |
|
330 | + */ |
|
293 | 331 | static function enum_fields($fields, $where_clause, $order_clause=null) { |
294 | 332 | $db = BoincDb::get(); |
295 | 333 | return $db->enum_fields( |
@@ -326,6 +364,12 @@ discard block |
||
326 | 364 | $db = BoincDb::get(); |
327 | 365 | return $db->enum('host', 'BoincHost', $where_clause, $order_clause); |
328 | 366 | } |
367 | + |
|
368 | + /** |
|
369 | + * @param string $fields |
|
370 | + * @param string $where_clause |
|
371 | + * @param string $order_clause |
|
372 | + */ |
|
329 | 373 | static function enum_fields($fields, $where_clause, $order_clause=null) { |
330 | 374 | $db = BoincDb::get(); |
331 | 375 | return $db->enum_fields( |
@@ -358,6 +402,11 @@ discard block |
||
358 | 402 | $db = BoincDb::get(); |
359 | 403 | return $db->enum('result', 'BoincResult', $where_clause); |
360 | 404 | } |
405 | + |
|
406 | + /** |
|
407 | + * @param string $fields |
|
408 | + * @param string $where_clause |
|
409 | + */ |
|
361 | 410 | static function enum_fields($fields, $where_clause, $order_clause) { |
362 | 411 | $db = BoincDb::get(); |
363 | 412 | return $db->enum_fields('result', 'BoincResult', $fields, $where_clause, $order_clause); |
@@ -412,6 +461,10 @@ discard block |
||
412 | 461 | $db = BoincDb::get(); |
413 | 462 | return $db->update_aux('workunit', $clause); |
414 | 463 | } |
464 | + |
|
465 | + /** |
|
466 | + * @param string $clause |
|
467 | + */ |
|
415 | 468 | static function count($clause) { |
416 | 469 | $db = BoincDb::get(); |
417 | 470 | return $db->count('workunit', $clause); |
@@ -427,6 +480,10 @@ discard block |
||
427 | 480 | $db = BoincDb::get(); |
428 | 481 | return $db->lookup('app', 'BoincApp', $clause); |
429 | 482 | } |
483 | + |
|
484 | + /** |
|
485 | + * @param string $where_clause |
|
486 | + */ |
|
430 | 487 | static function enum($where_clause) { |
431 | 488 | $db = BoincDb::get(); |
432 | 489 | return $db->enum('app', 'BoincApp', $where_clause); |
@@ -441,6 +498,11 @@ discard block |
||
441 | 498 | $db = BoincDb::get(); |
442 | 499 | return $db->update($this, 'app', $clause); |
443 | 500 | } |
501 | + |
|
502 | + /** |
|
503 | + * @param string $field |
|
504 | + * @param string $clause |
|
505 | + */ |
|
444 | 506 | static function sum($field, $clause=null) { |
445 | 507 | $db = BoincDb::get(); |
446 | 508 | return $db->sum('app', $field, $clause); |
@@ -473,6 +535,10 @@ discard block |
||
473 | 535 | } |
474 | 536 | |
475 | 537 | class BoincProfile { |
538 | + |
|
539 | + /** |
|
540 | + * @param string $fields |
|
541 | + */ |
|
476 | 542 | static function lookup_fields($fields, $clause) { |
477 | 543 | $db = BoincDb::get(); |
478 | 544 | return $db->lookup_fields('profile', 'BoincProfile', $fields, $clause); |
@@ -489,18 +555,37 @@ discard block |
||
489 | 555 | $db = BoincDb::get(); |
490 | 556 | return $db->update_aux('profile', $clause.' where userid='.$this->userid); |
491 | 557 | } |
558 | + |
|
559 | + /** |
|
560 | + * @param string $clause |
|
561 | + */ |
|
492 | 562 | static function update_aux($clause) { |
493 | 563 | $db = BoincDb::get(); |
494 | 564 | return $db->update_aux('profile', $clause); |
495 | 565 | } |
566 | + |
|
567 | + /** |
|
568 | + * @param string $clause |
|
569 | + */ |
|
496 | 570 | static function insert($clause) { |
497 | 571 | $db = BoincDb::get(); |
498 | 572 | return $db->insert('profile', $clause); |
499 | 573 | } |
574 | + |
|
575 | + /** |
|
576 | + * @param string $where_clause |
|
577 | + * @param string $order_clause |
|
578 | + */ |
|
500 | 579 | static function enum($where_clause=null, $order_clause=null) { |
501 | 580 | $db = BoincDb::get(); |
502 | 581 | return $db->enum('profile', 'BoincProfile', $where_clause, $order_clause); |
503 | 582 | } |
583 | + |
|
584 | + /** |
|
585 | + * @param string $fields |
|
586 | + * @param string $where_clause |
|
587 | + * @param string $order_clause |
|
588 | + */ |
|
504 | 589 | static function enum_fields($fields, $where_clause=null, $order_clause=null) { |
505 | 590 | $db = BoincDb::get(); |
506 | 591 | return $db->enum_fields('profile', 'BoincProfile', $fields, $where_clause, $order_clause); |
@@ -568,6 +653,10 @@ discard block |
||
568 | 653 | } |
569 | 654 | |
570 | 655 | class BoincPlatform { |
656 | + |
|
657 | + /** |
|
658 | + * @param string $where_clause |
|
659 | + */ |
|
571 | 660 | static function enum($where_clause) { |
572 | 661 | $db = BoincDb::get(); |
573 | 662 | return $db->enum('platform', 'BoincPlatform', $where_clause); |
@@ -648,6 +737,10 @@ discard block |
||
648 | 737 | } |
649 | 738 | |
650 | 739 | class BoincBadge { |
740 | + |
|
741 | + /** |
|
742 | + * @param string $where_clause |
|
743 | + */ |
|
651 | 744 | static function enum($where_clause) { |
652 | 745 | $db = BoincDb::get(); |
653 | 746 | return $db->enum('badge', 'BoincBadge', $where_clause); |
@@ -743,6 +836,11 @@ discard block |
||
743 | 836 | $db = BoincDb::get(); |
744 | 837 | return $db->enum('credit_user', 'BoincCreditUser', $where_clause); |
745 | 838 | } |
839 | + |
|
840 | + /** |
|
841 | + * @param string $field |
|
842 | + * @param string $clause |
|
843 | + */ |
|
746 | 844 | static function sum($field, $clause) { |
747 | 845 | $db = BoincDb::get(); |
748 | 846 | return $db->sum('credit_user', $field, $clause); |
@@ -755,6 +853,11 @@ discard block |
||
755 | 853 | $db = BoincDb::get(); |
756 | 854 | $db->delete_aux('credit_user', "userid=$user->id"); |
757 | 855 | } |
856 | + |
|
857 | + /** |
|
858 | + * @param string $order_clause |
|
859 | + * @param string $limit |
|
860 | + */ |
|
758 | 861 | static function get_list($where_clause, $order_clause, $limit) { |
759 | 862 | $db = BoincDB::get(); |
760 | 863 | return $db->get_list('user', 'credit_user', 'id', 'userid', 'BoincCreditUser', '*', $where_clause, $order_clause, $limit); |
@@ -770,6 +873,11 @@ discard block |
||
770 | 873 | $db = BoincDb::get(); |
771 | 874 | return $db->enum('credit_team', 'BoincCreditTeam', $where_clause); |
772 | 875 | } |
876 | + |
|
877 | + /** |
|
878 | + * @param string $field |
|
879 | + * @param string $clause |
|
880 | + */ |
|
773 | 881 | static function sum($field, $clause) { |
774 | 882 | $db = BoincDb::get(); |
775 | 883 | return $db->sum('credit_team', $field, $clause); |
@@ -778,6 +886,11 @@ discard block |
||
778 | 886 | $db = BoincDb::get(); |
779 | 887 | return $db->update_aux('credit_team', $clause); |
780 | 888 | } |
889 | + |
|
890 | + /** |
|
891 | + * @param string $order_clause |
|
892 | + * @param string $limit |
|
893 | + */ |
|
781 | 894 | static function get_list($where_clause, $order_clause, $limit) { |
782 | 895 | $db = BoincDB::get(); |
783 | 896 | return $db->get_list('team', 'credit_team', 'id', 'teamid', 'BoincCreditTeam', '*', $where_clause, $order_clause, $limit); |
@@ -788,6 +901,11 @@ discard block |
||
788 | 901 | // |
789 | 902 | // apply this to any user-supplied strings used in queries |
790 | 903 | // |
904 | +/** |
|
905 | + * @param string $x |
|
906 | + * |
|
907 | + * @return string |
|
908 | + */ |
|
791 | 909 | function boinc_real_escape_string($x) { |
792 | 910 | if (version_compare(phpversion(),"4.3.0")>=0) { |
793 | 911 | return BoincDb::escape_string($x); |
@@ -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,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"> |
@@ -434,6 +469,10 @@ discard block |
||
434 | 469 | '; |
435 | 470 | } |
436 | 471 | |
472 | +/** |
|
473 | + * @param string $label |
|
474 | + * @param string $item |
|
475 | + */ |
|
437 | 476 | function form_general($label, $item) { |
438 | 477 | echo ' |
439 | 478 | <div class="form-group"> |
@@ -456,6 +495,9 @@ discard block |
||
456 | 495 | '; |
457 | 496 | } |
458 | 497 | |
498 | +/** |
|
499 | + * @param string $text |
|
500 | + */ |
|
459 | 501 | function form_submit($text, $attrs='') { |
460 | 502 | form_general( |
461 | 503 | "", |
@@ -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"; |