@@ -53,6 +53,9 @@ discard block |
||
53 | 53 | return $platforms[$id]; |
54 | 54 | } |
55 | 55 | |
56 | +/** |
|
57 | + * @param string $rsc_name |
|
58 | + */ |
|
56 | 59 | function anon_platform_string($result, $rsc_name=null) { |
57 | 60 | $app = get_app($result->appid); |
58 | 61 | $n = $app->user_friendly_name."<br>". tra("Anonymous platform"); |
@@ -92,6 +95,9 @@ discard block |
||
92 | 95 | return "$n v$v $c<br>$platform->name"; |
93 | 96 | } |
94 | 97 | |
98 | +/** |
|
99 | + * @param string $string_to_show |
|
100 | + */ |
|
95 | 101 | function result_granted_credit_string($result, $string_to_show) { |
96 | 102 | if ($result->server_state == RESULT_SERVER_STATE_IN_PROGRESS && $result->granted_credit > 0) { |
97 | 103 | return $string_to_show; |
@@ -356,6 +362,10 @@ discard block |
||
356 | 362 | return "results.php?$c&offset=$o&show_names=$sn&state=$st&appid=$appid"; |
357 | 363 | } |
358 | 364 | |
365 | +/** |
|
366 | + * @param boolean $show_wu_link |
|
367 | + * @param boolean $show_host_link |
|
368 | + */ |
|
359 | 369 | function result_table_start($show_wu_link, $show_host_link, $info) { |
360 | 370 | start_table('table-striped'); |
361 | 371 | $x = array(); |
@@ -417,6 +427,11 @@ discard block |
||
417 | 427 | return false; |
418 | 428 | } |
419 | 429 | |
430 | +/** |
|
431 | + * @param boolean $show_wu_link |
|
432 | + * @param boolean $show_host_link |
|
433 | + * @param boolean $show_name |
|
434 | + */ |
|
420 | 435 | function show_result_row($result, $show_wu_link, $show_host_link, $show_name) { |
421 | 436 | $s = time_str($result->sent_time); |
422 | 437 | // if result has been reported, show the received time, |
@@ -26,6 +26,9 @@ discard block |
||
26 | 26 | // Create dir if not present. |
27 | 27 | // |
28 | 28 | if (!function_exists("sandbox_dir")){ |
29 | +/** |
|
30 | + * @return string |
|
31 | + */ |
|
29 | 32 | function sandbox_dir($user) { |
30 | 33 | $dir = parse_config(get_config(), "<sandbox_dir>"); |
31 | 34 | if (!$dir) { $dir = "../../sandbox/"; } |
@@ -40,12 +43,18 @@ discard block |
||
40 | 43 | } |
41 | 44 | } |
42 | 45 | |
46 | +/** |
|
47 | + * @param string $md5 |
|
48 | + */ |
|
43 | 49 | function sandbox_write_link_file($path, $size, $md5) { |
44 | 50 | file_put_contents($path, "sb $size $md5"); |
45 | 51 | } |
46 | 52 | |
47 | 53 | // check if a newly update files already exists in sandbox via its md5 sum |
48 | 54 | // |
55 | +/** |
|
56 | + * @param string $md5 |
|
57 | + */ |
|
49 | 58 | function sandbox_lf_exist($user, $md5) { |
50 | 59 | $exist = 0; |
51 | 60 | $elf = ""; |
@@ -115,6 +124,9 @@ discard block |
||
115 | 124 | // return a <select> for files in sandbox |
116 | 125 | // |
117 | 126 | if (!function_exists('sandbox_file_select')) { |
127 | +/** |
|
128 | + * @param string $select_name |
|
129 | + */ |
|
118 | 130 | function sandbox_file_select($user, $select_name, $regexp = null, $allow_none = false) { |
119 | 131 | if ($regexp === null) { |
120 | 132 | $regexp = $select_name; |
@@ -145,6 +145,9 @@ discard block |
||
145 | 145 | } |
146 | 146 | } |
147 | 147 | |
148 | +/** |
|
149 | + * @param string $op |
|
150 | + */ |
|
148 | 151 | function do_batch_op($req, $op) { |
149 | 152 | $retval = validate_request($req); |
150 | 153 | if ($retval) return array(null, $retval); |
@@ -172,6 +175,9 @@ discard block |
||
172 | 175 | |
173 | 176 | // if RPC had a fatal error, return the message |
174 | 177 | // |
178 | +/** |
|
179 | + * @param string $outer_tag |
|
180 | + */ |
|
175 | 181 | function get_error($reply, $outer_tag) { |
176 | 182 | $name = $reply->getName(); |
177 | 183 | if ($name != $outer_tag) { |
@@ -187,6 +193,9 @@ discard block |
||
187 | 193 | |
188 | 194 | //// API functions follow |
189 | 195 | |
196 | +/** |
|
197 | + * @param stdClass $req |
|
198 | + */ |
|
190 | 199 | function boinc_estimate_batch($req) { |
191 | 200 | list($reply, $errmsg) = do_batch_op($req, "estimate_batch"); |
192 | 201 | if ($errmsg) return array(0, $errmsg); |
@@ -205,6 +214,9 @@ discard block |
||
205 | 214 | return array((int)$reply->batch_id, null); |
206 | 215 | } |
207 | 216 | |
217 | +/** |
|
218 | + * @param stdClass $req |
|
219 | + */ |
|
208 | 220 | function boinc_query_batches($req) { |
209 | 221 | $req_xml = "<query_batches> |
210 | 222 | <authenticator>$req->authenticator</authenticator> |
@@ -255,6 +267,9 @@ discard block |
||
255 | 267 | return array($r, null); |
256 | 268 | } |
257 | 269 | |
270 | +/** |
|
271 | + * @param stdClass $req |
|
272 | + */ |
|
258 | 273 | function boinc_query_job($req) { |
259 | 274 | $req_xml = "<query_job> |
260 | 275 | <authenticator>$req->authenticator</authenticator> |
@@ -285,6 +300,9 @@ discard block |
||
285 | 300 | return array($r, null); |
286 | 301 | } |
287 | 302 | |
303 | +/** |
|
304 | + * @return string |
|
305 | + */ |
|
288 | 306 | function boinc_abort_batch($req) { |
289 | 307 | $req_xml = "<abort_batch> |
290 | 308 | <authenticator>$req->authenticator</authenticator> |
@@ -299,6 +317,9 @@ discard block |
||
299 | 317 | return array(true, null); |
300 | 318 | } |
301 | 319 | |
320 | +/** |
|
321 | + * @param stdClass $req |
|
322 | + */ |
|
302 | 323 | function boinc_get_output_file($req) { |
303 | 324 | $auth_str = md5($req->authenticator.$req->instance_name); |
304 | 325 | $name = $req->instance_name; |
@@ -312,6 +333,9 @@ discard block |
||
312 | 333 | return $req->project."/get_output.php?cmd=batch_files&batch_id=$batch_id&auth_str=$auth_str"; |
313 | 334 | } |
314 | 335 | |
336 | +/** |
|
337 | + * @return string |
|
338 | + */ |
|
315 | 339 | function boinc_retire_batch($req) { |
316 | 340 | $req_xml = "<retire_batch> |
317 | 341 | <authenticator>$req->authenticator</authenticator> |
@@ -34,6 +34,10 @@ discard block |
||
34 | 34 | $db = BoincDb::get(); |
35 | 35 | return $db->enum('batch', 'BoincBatch', $clause); |
36 | 36 | } |
37 | + |
|
38 | + /** |
|
39 | + * @param string $clause |
|
40 | + */ |
|
37 | 41 | static function insert($clause) { |
38 | 42 | $db = BoincDb::get(); |
39 | 43 | $ret = $db->insert('batch', $clause); |
@@ -44,6 +48,10 @@ discard block |
||
44 | 48 | $db = BoincDb::get(); |
45 | 49 | return $db->update($this, 'batch', $clause); |
46 | 50 | } |
51 | + |
|
52 | + /** |
|
53 | + * @param string $clause |
|
54 | + */ |
|
47 | 55 | static function update_aux($clause) { |
48 | 56 | $db = BoincDb::get(); |
49 | 57 | return $db->update_aux('batch', $clause); |
@@ -59,6 +67,10 @@ discard block |
||
59 | 67 | } |
60 | 68 | |
61 | 69 | class BoincUserSubmit { |
70 | + |
|
71 | + /** |
|
72 | + * @param string $clause |
|
73 | + */ |
|
62 | 74 | static function enum($clause) { |
63 | 75 | $db = BoincDb::get(); |
64 | 76 | return $db->enum('user_submit', 'BoincUserSubmit', $clause); |
@@ -77,6 +89,10 @@ discard block |
||
77 | 89 | $db = BoincDb::get(); |
78 | 90 | return $db->update_aux('user_submit', "$clause where user_id=$this->user_id"); |
79 | 91 | } |
92 | + |
|
93 | + /** |
|
94 | + * @param string $clause |
|
95 | + */ |
|
80 | 96 | static function update_aux($clause) { |
81 | 97 | $db = BoincDb::get(); |
82 | 98 | return $db->update_aux('user_submit', $clause); |
@@ -26,6 +26,9 @@ discard block |
||
26 | 26 | // we need to give a unique physical name based on its content. |
27 | 27 | // Prepend the jf_ to make the origin of the file clear |
28 | 28 | // |
29 | +/** |
|
30 | + * @param string $md5 |
|
31 | + */ |
|
29 | 32 | function job_file_name($md5) { |
30 | 33 | return "jf_$md5"; |
31 | 34 | } |
@@ -179,12 +182,20 @@ discard block |
||
179 | 182 | return $batch_td_size; |
180 | 183 | } |
181 | 184 | |
185 | +/** |
|
186 | + * @param integer $i |
|
187 | + * |
|
188 | + * @return double |
|
189 | + */ |
|
182 | 190 | function boinc_get_output_file_url($user, $result, $i) { |
183 | 191 | $name = $result->name; |
184 | 192 | $auth_str = md5($user->authenticator.$name); |
185 | 193 | return "get_output.php?cmd=result_file&result_name=$name&file_num=$i&auth_str=$auth_str"; |
186 | 194 | } |
187 | 195 | |
196 | +/** |
|
197 | + * @param null|integer $batch_id |
|
198 | + */ |
|
188 | 199 | function boinc_get_output_files_url($user, $batch_id) { |
189 | 200 | $auth_str = md5($user->authenticator.$batch_id); |
190 | 201 | return "get_output.php?cmd=batch_files&batch_id=$batch_id&auth_str=$auth_str"; |
@@ -524,6 +524,9 @@ discard block |
||
524 | 524 | // an active request, i.e. after the 60 days elapse X has another |
525 | 525 | // 30 days to assume foundership before someone elase can request it |
526 | 526 | // |
527 | +/** |
|
528 | + * @param integer $now |
|
529 | + */ |
|
527 | 530 | function new_transfer_request_ok($team, $now) { |
528 | 531 | if ($team->ping_user <= 0) { |
529 | 532 | if ($team->ping_time < $now - 60 * 86400) { |
@@ -544,6 +547,9 @@ discard block |
||
544 | 547 | return $team->ping_time + 60*86400; |
545 | 548 | } |
546 | 549 | |
550 | +/** |
|
551 | + * @param integer $now |
|
552 | + */ |
|
547 | 553 | function transfer_ok($team, $now) { |
548 | 554 | if ($now > transfer_ok_time($team)) return true; |
549 | 555 | return false; |
@@ -105,6 +105,9 @@ discard block |
||
105 | 105 | |
106 | 106 | // handle [pre] and [code] separately because we need to remove <br />s |
107 | 107 | // |
108 | +/** |
|
109 | + * @param boolean $export |
|
110 | + */ |
|
108 | 111 | function replace_pre_code($text, $export) { |
109 | 112 | if ($export) { |
110 | 113 | $text = preg_replace_callback( |
@@ -272,6 +275,11 @@ discard block |
||
272 | 275 | // for example inside <pre> containers |
273 | 276 | // The original \n was retained after the br when it was added |
274 | 277 | // |
278 | +/** |
|
279 | + * @param string $text |
|
280 | + * |
|
281 | + * @return string |
|
282 | + */ |
|
275 | 283 | function remove_br($text){ |
276 | 284 | return str_replace("<br />", "", $text); |
277 | 285 | } |
@@ -19,6 +19,9 @@ |
||
19 | 19 | // express a time difference in readable form, e.g. "7 days ago". |
20 | 20 | // If it's more than 30 days, just show the date |
21 | 21 | // |
22 | +/** |
|
23 | + * @param integer $t2 |
|
24 | + */ |
|
22 | 25 | function time_diff_str($t1, $t2) { |
23 | 26 | if (!$t1 || !$t2) return "---"; |
24 | 27 | $diff = $t2 - $t1; |
@@ -112,6 +112,9 @@ discard block |
||
112 | 112 | // @param file The file to parse |
113 | 113 | // checking for inconsistencies if needed. |
114 | 114 | // |
115 | +/** |
|
116 | + * @param string $file |
|
117 | + */ |
|
115 | 118 | function parse_po_file($file) { |
116 | 119 | $translation_file = file($file); |
117 | 120 | $first_entry = true; |
@@ -157,6 +160,9 @@ discard block |
||
157 | 160 | |
158 | 161 | // Returns the contents of a line (ie removes "" from start and end) |
159 | 162 | // |
163 | +/** |
|
164 | + * @param string $line |
|
165 | + */ |
|
160 | 166 | function get_po_line($line, $file) { |
161 | 167 | $start = strpos($line, '"')+1; |
162 | 168 | $stop = strrpos($line, '"'); |