@@ -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"; |
@@ -92,7 +92,7 @@ |
||
92 | 92 | echo $x; |
93 | 93 | break; |
94 | 94 | } |
95 | - echo "</td><td align=right>".format_credit_large($y->credit),"</td><td align=right>$y->nresults</td></tr>\n"; |
|
95 | + echo "</td><td align=right>".format_credit_large($y->credit), "</td><td align=right>$y->nresults</td></tr>\n"; |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | $mode = get_str('mode', true); |
@@ -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: |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | } |
324 | 324 | row2("GFLOP/hours, estimated", number_format(credit_to_gflop_hours($batch->credit_estimate), 2)); |
325 | 325 | row2("GFLOP/hours, actual", number_format(credit_to_gflop_hours($batch->credit_canonical), 2)); |
326 | - row2("Output File Size (MB)", number_format(batch_output_file_size($batch->id)/1e6,2)); |
|
326 | + row2("Output File Size (MB)", number_format(batch_output_file_size($batch->id)/1e6, 2)); |
|
327 | 327 | end_table(); |
328 | 328 | if (batch_output_file_size($batch->id) <= 1e8) { |
329 | 329 | $url = boinc_get_output_files_url($user, $batch_id); |
@@ -357,9 +357,9 @@ discard block |
||
357 | 357 | "Canonical instance<br><p class=\"text-muted\">click to see result page on BOINC server</p>", |
358 | 358 | "Download Results" |
359 | 359 | ); |
360 | - foreach($wus as $wu) { |
|
360 | + foreach ($wus as $wu) { |
|
361 | 361 | $resultid = $wu->canonical_resultid; |
362 | - $durl = boinc_get_wu_output_files_url($user,$wu->id); |
|
362 | + $durl = boinc_get_wu_output_files_url($user, $wu->id); |
|
363 | 363 | if ($resultid) { |
364 | 364 | $x = "<a href=result.php?resultid=$resultid>$resultid</a>"; |
365 | 365 | $y = '<font color="green">completed</font>'; |
@@ -369,7 +369,7 @@ discard block |
||
369 | 369 | $text = "---"; |
370 | 370 | if ($batch->state == BATCH_STATE_COMPLETE) { |
371 | 371 | $y = '<font color="red">failed</font>'; |
372 | - } else { |
|
372 | + } else { |
|
373 | 373 | $y = "in progress"; |
374 | 374 | } |
375 | 375 | } |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | $results = BoincResult::enum("workunitid=$wuid"); |
435 | 435 | $upload_dir = parse_config(get_config(), "<upload_dir>"); |
436 | 436 | $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); |
437 | - foreach($results as $result) { |
|
437 | + foreach ($results as $result) { |
|
438 | 438 | echo "<tr> |
439 | 439 | <td><a href=result.php?resultid=$result->id>$result->id · $result->name </a></td> |
440 | 440 | <td>".state_string($result)."</td> |
@@ -369,7 +369,7 @@ |
||
369 | 369 | $text = "---"; |
370 | 370 | if ($batch->state == BATCH_STATE_COMPLETE) { |
371 | 371 | $y = '<font color="red">failed</font>'; |
372 | - } else { |
|
372 | + } else { |
|
373 | 373 | $y = "in progress"; |
374 | 374 | } |
375 | 375 | } |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | $wus = BoincWorkunit::enum("batch = $batch->id"); |
309 | 309 | $batch = get_batch_params($batch, $wus); |
310 | 310 | |
311 | - page_head("Batch $batch_id"); |
|
311 | + page_head("batch $batch_id"); |
|
312 | 312 | start_table(); |
313 | 313 | row2("name", $batch->name); |
314 | 314 | row2("application", $app->name); |
@@ -393,7 +393,7 @@ discard block |
||
393 | 393 | $wu = BoincWorkunit::lookup_id($wuid); |
394 | 394 | if (!$wu) error_page("no such job"); |
395 | 395 | |
396 | - page_head("Job $wuid"); |
|
396 | + page_head("job $wuid"); |
|
397 | 397 | |
398 | 398 | echo " |
399 | 399 | <a href=workunit.php?wuid=$wuid>Workunit details</a> · |
@@ -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"; |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | if ($template) { |
55 | 55 | $t = (double)$template->workunit->rsc_fpops_est; |
56 | 56 | } |
57 | - foreach($r->batch->job as $job) { |
|
57 | + foreach ($r->batch->job as $job) { |
|
58 | 58 | $y = (double)$job->rsc_fpops_est; |
59 | 59 | if ($y) { |
60 | 60 | $x += $y; |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | function est_elapsed_time($r, $template) { |
80 | 80 | // crude estimate: batch FLOPs / project FLOPS |
81 | 81 | // |
82 | - return batch_flop_count($r, $template) / project_flops(); |
|
82 | + return batch_flop_count($r, $template)/project_flops(); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | function read_input_template($app, $r) { |
86 | 86 | if ((isset($r->batch)) && (isset($r->batch->workunit_template_file)) && ($r->batch->workunit_template_file)) { |
87 | - $path = project_dir() . "/templates/".$r->batch->workunit_template_file; |
|
87 | + $path = project_dir()."/templates/".$r->batch->workunit_template_file; |
|
88 | 88 | } else { |
89 | - $path = project_dir() . "/templates/$app->name"."_in"; |
|
89 | + $path = project_dir()."/templates/$app->name"."_in"; |
|
90 | 90 | } |
91 | 91 | if (file_exists($path)) { |
92 | 92 | $x = simplexml_load_file($path); |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | function validate_batch($jobs, $template) { |
126 | 126 | $i = 0; |
127 | 127 | $n = count($template->file_info); |
128 | - foreach($jobs as $job) { |
|
128 | + foreach ($jobs as $job) { |
|
129 | 129 | $m = count($job->input_files); |
130 | 130 | if ($n != $m) { |
131 | 131 | xml_error(-1, "BOINC server: wrong # of input files for job $i: need $n, got $m"); |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | // stage all the files |
181 | 181 | // |
182 | 182 | function stage_files(&$jobs) { |
183 | - foreach($jobs as $job) { |
|
183 | + foreach ($jobs as $job) { |
|
184 | 184 | foreach ($job->input_files as $file) { |
185 | 185 | if ($file->mode != "remote") { |
186 | 186 | $file->name = stage_file($file); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | // |
194 | 194 | function submit_jobs( |
195 | 195 | $jobs, $template, $app, $batch_id, $priority, |
196 | - $result_template_file, // batch-level; can also specify per job |
|
196 | + $result_template_file, // batch-level; can also specify per job |
|
197 | 197 | $workunit_template_file |
198 | 198 | ) { |
199 | 199 | global $wu_templates, $result_templates; |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | // one line per job |
203 | 203 | // |
204 | 204 | $x = ""; |
205 | - foreach($jobs as $job) { |
|
205 | + foreach ($jobs as $job) { |
|
206 | 206 | if ($job->name) { |
207 | 207 | $x .= " --wu_name $job->name"; |
208 | 208 | } |
@@ -234,8 +234,8 @@ discard block |
||
234 | 234 | $x .= "\n"; |
235 | 235 | } |
236 | 236 | |
237 | - $errfile = "/tmp/create_work_" . getmypid() . ".err"; |
|
238 | - $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id --priority $priority"; |
|
237 | + $errfile = "/tmp/create_work_".getmypid().".err"; |
|
238 | + $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id --priority $priority"; |
|
239 | 239 | if ($result_template_file) { |
240 | 240 | $cmd .= " --result_template templates/$result_template_file"; |
241 | 241 | } |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | // |
314 | 314 | function xml_get_jobs($r) { |
315 | 315 | $jobs = array(); |
316 | - foreach($r->batch->job as $j) { |
|
316 | + foreach ($r->batch->job as $j) { |
|
317 | 317 | $job = new StdClass; |
318 | 318 | $job->input_files = array(); |
319 | 319 | $job->command_line = (string)$j->command_line; |
@@ -384,11 +384,11 @@ discard block |
||
384 | 384 | // - use that for batch logical end time and job priority |
385 | 385 | // |
386 | 386 | $total_flops = 0; |
387 | - foreach($jobs as $job) { |
|
387 | + foreach ($jobs as $job) { |
|
388 | 388 | if ($job->rsc_fpops_est) { |
389 | 389 | $total_flops += $job->rsc_fpops_est; |
390 | 390 | } else { |
391 | - $x = (double) $template->workunit->rsc_fpops_est; |
|
391 | + $x = (double)$template->workunit->rsc_fpops_est; |
|
392 | 392 | if ($x) { |
393 | 393 | $total_flops += $x; |
394 | 394 | } else { |
@@ -396,7 +396,7 @@ discard block |
||
396 | 396 | } |
397 | 397 | } |
398 | 398 | } |
399 | - $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
399 | + $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
400 | 400 | $x = exec($cmd); |
401 | 401 | if (!is_numeric($x) || (double)$x == 0) { |
402 | 402 | xml_error(-1, "BOINC server: $cmd returned $x"); |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | } |
511 | 511 | |
512 | 512 | function n_outfiles($wu) { |
513 | - $path = project_dir() . "/$wu->result_template_file"; |
|
513 | + $path = project_dir()."/$wu->result_template_file"; |
|
514 | 514 | $r = simplexml_load_file($path); |
515 | 515 | return count($r->file_info); |
516 | 516 | } |
@@ -693,7 +693,7 @@ discard block |
||
693 | 693 | "; |
694 | 694 | if ($result->server_state == 5) { // over? |
695 | 695 | $paths = get_outfile_paths($result); |
696 | - foreach($paths as $path) { |
|
696 | + foreach ($paths as $path) { |
|
697 | 697 | if (is_file($path)) { |
698 | 698 | $size = filesize($path); |
699 | 699 | echo " <outfile> |
@@ -733,7 +733,7 @@ discard block |
||
733 | 733 | } else { |
734 | 734 | $results = BoincResult::enum("workunitid=$job_id"); |
735 | 735 | foreach ($results as $r) { |
736 | - switch($r->outcome) { |
|
736 | + switch ($r->outcome) { |
|
737 | 737 | case 1: |
738 | 738 | case 3: |
739 | 739 | case 6: |
@@ -841,8 +841,8 @@ discard block |
||
841 | 841 | } |
842 | 842 | |
843 | 843 | list($user, $user_submit) = authenticate_user($r, $app); |
844 | - $in = file_get_contents(project_dir() . "/templates/".$app->name."_in"); |
|
845 | - $out = file_get_contents(project_dir() . "/templates/".$app->name."_out"); |
|
844 | + $in = file_get_contents(project_dir()."/templates/".$app->name."_in"); |
|
845 | + $out = file_get_contents(project_dir()."/templates/".$app->name."_out"); |
|
846 | 846 | if ($in === false || $out === false) { |
847 | 847 | xml_error(-1, "template file missing"); |
848 | 848 | } |
@@ -853,7 +853,7 @@ discard block |
||
853 | 853 | |
854 | 854 | function ping($r) { |
855 | 855 | xml_start_tag("ping"); |
856 | - BoincDb::get(); // errors out if DB down or web disabled |
|
856 | + BoincDb::get(); // errors out if DB down or web disabled |
|
857 | 857 | echo "<success>1</success> |
858 | 858 | </ping> |
859 | 859 | "; |
@@ -907,10 +907,10 @@ discard block |
||
907 | 907 | if ($request_log) { |
908 | 908 | $request_log_dir = parse_config(get_config(), "<log_dir>"); |
909 | 909 | if ($request_log_dir) { |
910 | - $request_log = $request_log_dir . "/" . $request_log; |
|
910 | + $request_log = $request_log_dir."/".$request_log; |
|
911 | 911 | } |
912 | 912 | if ($file = fopen($request_log, "a+")) { |
913 | - fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n"); |
|
913 | + fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n"); |
|
914 | 914 | fclose($file); |
915 | 915 | } |
916 | 916 | } |
@@ -691,7 +691,8 @@ |
||
691 | 691 | <id>$result->id</id> |
692 | 692 | <state>".state_string($result)."</state> |
693 | 693 | "; |
694 | - if ($result->server_state == 5) { // over? |
|
694 | + if ($result->server_state == 5) { |
|
695 | +// over? |
|
695 | 696 | $paths = get_outfile_paths($result); |
696 | 697 | foreach($paths as $path) { |
697 | 698 | if (is_file($path)) { |
@@ -784,7 +784,7 @@ |
||
784 | 784 | xml_error(-1, "No job $job_name"); |
785 | 785 | } |
786 | 786 | if (!$wu->batch) { |
787 | - xml_error(-1, "Job $job_name is not part of a batch"); |
|
787 | + xml_error(-1, "job $job_name is not part of a batch"); |
|
788 | 788 | } |
789 | 789 | if (!$batch || $wu->batch != $batch->id) { |
790 | 790 | $batch = BoincBatch::lookup_id($wu->batch); |
@@ -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; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | // where team includes a field "refcnt". |
32 | 32 | // |
33 | 33 | function merge_lists($list1, &$list2, $weight) { |
34 | - foreach($list1 as $team) { |
|
34 | + foreach ($list1 as $team) { |
|
35 | 35 | $id = $team->id; |
36 | 36 | if (array_key_exists($id, $list2)) { |
37 | 37 | $list2[$id]->refcnt += $weight; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | if (defined("SHOW_NONVALIDATED_TEAMS")) { |
98 | 98 | $user = BoincUser::lookup_id($team->userid); |
99 | 99 | echo "<td>"; |
100 | - echo $user->email_validated?"Yes":"No"; |
|
100 | + echo $user->email_validated ? "Yes" : "No"; |
|
101 | 101 | echo "</td>\n"; |
102 | 102 | } |
103 | 103 | echo " |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | xml_header(); |
138 | 138 | echo "<teams>\n"; |
139 | 139 | sort_list($list); |
140 | - foreach($list as $team) { |
|
140 | + foreach ($list as $team) { |
|
141 | 141 | show_team_xml($team); |
142 | 142 | } |
143 | 143 | echo "</teams>\n"; |
@@ -164,14 +164,14 @@ discard block |
||
164 | 164 | merge_lists($list2, $list, 3); |
165 | 165 | $tried = true; |
166 | 166 | } |
167 | - if (strlen($params->country) && $params->country!='None') { |
|
167 | + if (strlen($params->country) && $params->country != 'None') { |
|
168 | 168 | $country = BoincDb::escape_string($params->country); |
169 | 169 | $list2 = get_teams("country = '$country'", $params->active); |
170 | 170 | //echo "<br>country matches: ",sizeof($list2); |
171 | 171 | merge_lists($list2, $list, 1); |
172 | 172 | $tried = true; |
173 | 173 | } |
174 | - if ($params->type and $params->type>1) { |
|
174 | + if ($params->type and $params->type > 1) { |
|
175 | 175 | $list2 = get_teams("type=$params->type", $params->active); |
176 | 176 | //echo "<br>type matches: ",sizeof($list2); |
177 | 177 | merge_lists($list2, $list, 2); |
@@ -92,10 +92,10 @@ discard block |
||
92 | 92 | */ |
93 | 93 | require_once('dbconfig.php'); |
94 | 94 | if (!isset($dbserver) || empty($dbserver)) |
95 | - $dbserver='localhost'; |
|
95 | + $dbserver='localhost'; |
|
96 | 96 | $db_url = array( |
97 | - 'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}", |
|
98 | - 'boinc' => "{$boinc_dbtype}://{$boinc_dbuser}:".urlencode($boinc_dbpass)."@{$boinc_dbserver}/{$boinc_dbname}" |
|
97 | + 'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}", |
|
98 | + 'boinc' => "{$boinc_dbtype}://{$boinc_dbuser}:".urlencode($boinc_dbpass)."@{$boinc_dbserver}/{$boinc_dbname}" |
|
99 | 99 | ); |
100 | 100 | $db_prefix = ''; |
101 | 101 | |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | */ |
121 | 121 | # $base_url = 'http://www.example.com'; // NO trailing slash! |
122 | 122 | if (stream_resolve_include_path('baseurl.php')) { |
123 | - include_once('baseurl.php'); |
|
123 | + include_once('baseurl.php'); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | /** |
@@ -175,5 +175,5 @@ discard block |
||
175 | 175 | # 'anonymous' => 'Visitor', |
176 | 176 | # ); |
177 | 177 | $conf = array( |
178 | - 'maintenance_theme' => 'einstein', |
|
178 | + 'maintenance_theme' => 'einstein', |
|
179 | 179 | ); |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | require_once('dbconfig.php'); |
94 | 94 | if (!isset($dbserver) || empty($dbserver)) |
95 | - $dbserver='localhost'; |
|
95 | + $dbserver = 'localhost'; |
|
96 | 96 | $db_url = array( |
97 | 97 | 'default' => "{$dbtype}://{$dbuser}:".urlencode($dbpass)."@{$dbserver}/{$dbname}", |
98 | 98 | 'boinc' => "{$boinc_dbtype}://{$boinc_dbuser}:".urlencode($boinc_dbpass)."@{$boinc_dbserver}/{$boinc_dbname}" |
@@ -133,17 +133,17 @@ discard block |
||
133 | 133 | * settings are used there. Settings defined here should not be |
134 | 134 | * duplicated there so as to avoid conflict issues. |
135 | 135 | */ |
136 | -ini_set('arg_separator.output', '&'); |
|
137 | -ini_set('magic_quotes_runtime', 0); |
|
138 | -ini_set('magic_quotes_sybase', 0); |
|
139 | -ini_set('session.cache_expire', 200000); |
|
140 | -ini_set('session.cache_limiter', 'none'); |
|
141 | -ini_set('session.cookie_lifetime', 2000000); |
|
142 | -ini_set('session.gc_maxlifetime', 200000); |
|
143 | -ini_set('session.save_handler', 'user'); |
|
136 | +ini_set('arg_separator.output', '&'); |
|
137 | +ini_set('magic_quotes_runtime', 0); |
|
138 | +ini_set('magic_quotes_sybase', 0); |
|
139 | +ini_set('session.cache_expire', 200000); |
|
140 | +ini_set('session.cache_limiter', 'none'); |
|
141 | +ini_set('session.cookie_lifetime', 2000000); |
|
142 | +ini_set('session.gc_maxlifetime', 200000); |
|
143 | +ini_set('session.save_handler', 'user'); |
|
144 | 144 | ini_set('session.use_only_cookies', 1); |
145 | -ini_set('session.use_trans_sid', 0); |
|
146 | -ini_set('url_rewriter.tags', ''); |
|
145 | +ini_set('session.use_trans_sid', 0); |
|
146 | +ini_set('url_rewriter.tags', ''); |
|
147 | 147 | ini_set('memory_limit', '128M'); |
148 | 148 | ini_set('post_max_size', '8MB'); |
149 | 149 | ini_set('upload_max_filesize', '8MB'); |
@@ -9,9 +9,9 @@ discard block |
||
9 | 9 | * Implementation of hook_views_plugins(). |
10 | 10 | */ |
11 | 11 | function jump_views_plugins() { |
12 | - return array( |
|
12 | + return array( |
|
13 | 13 | 'style' => array( |
14 | - 'jump_views' => array( |
|
14 | + 'jump_views' => array( |
|
15 | 15 | 'title' => t('Jump menu'), |
16 | 16 | 'theme' => 'jump_views_plugin_style', |
17 | 17 | 'help' => t('Displays items as a select list jump menu.'), |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | 'uses fields' => TRUE, |
21 | 21 | 'uses options' => TRUE, |
22 | 22 | 'type' => 'normal', |
23 | - ), |
|
23 | + ), |
|
24 | 24 | ), |
25 | - ); |
|
25 | + ); |
|
26 | 26 | } |
@@ -16,9 +16,9 @@ |
||
16 | 16 | 'theme' => 'jump_views_plugin_style', |
17 | 17 | 'help' => t('Displays items as a select list jump menu.'), |
18 | 18 | 'handler' => 'jump_views_plugin_style', |
19 | - 'uses row plugin' => TRUE, |
|
20 | - 'uses fields' => TRUE, |
|
21 | - 'uses options' => TRUE, |
|
19 | + 'uses row plugin' => true, |
|
20 | + 'uses fields' => true, |
|
21 | + 'uses options' => true, |
|
22 | 22 | 'type' => 'normal', |
23 | 23 | ), |
24 | 24 | ), |
@@ -9,20 +9,20 @@ discard block |
||
9 | 9 | * Implementation of hook_views_default_views(). |
10 | 10 | */ |
11 | 11 | function jump_views_default_views() { |
12 | - $view = new view; |
|
13 | - $view->name = 'recent_nodes_jump_menu'; |
|
14 | - $view->description = 'Recent nodes in a jump menu.'; |
|
15 | - $view->tag = ''; |
|
16 | - $view->view_php = ''; |
|
17 | - $view->base_table = 'node'; |
|
18 | - $view->is_cacheable = FALSE; |
|
19 | - $view->api_version = 2; |
|
20 | - $view->disabled = TRUE; |
|
21 | - $handler = $view->new_display('default', 'Defaults', 'default'); |
|
22 | - $handler->override_option('fields', array( |
|
12 | + $view = new view; |
|
13 | + $view->name = 'recent_nodes_jump_menu'; |
|
14 | + $view->description = 'Recent nodes in a jump menu.'; |
|
15 | + $view->tag = ''; |
|
16 | + $view->view_php = ''; |
|
17 | + $view->base_table = 'node'; |
|
18 | + $view->is_cacheable = FALSE; |
|
19 | + $view->api_version = 2; |
|
20 | + $view->disabled = TRUE; |
|
21 | + $handler = $view->new_display('default', 'Defaults', 'default'); |
|
22 | + $handler->override_option('fields', array( |
|
23 | 23 | 'nid' => array( |
24 | - 'label' => 'Nid', |
|
25 | - 'alter' => array( |
|
24 | + 'label' => 'Nid', |
|
25 | + 'alter' => array( |
|
26 | 26 | 'alter_text' => 1, |
27 | 27 | 'text' => 'node/[nid]', |
28 | 28 | 'make_link' => 0, |
@@ -38,17 +38,17 @@ discard block |
||
38 | 38 | 'ellipsis' => 1, |
39 | 39 | 'strip_tags' => 0, |
40 | 40 | 'html' => 0, |
41 | - ), |
|
42 | - 'link_to_node' => 0, |
|
43 | - 'exclude' => 1, |
|
44 | - 'id' => 'nid', |
|
45 | - 'table' => 'node', |
|
46 | - 'field' => 'nid', |
|
47 | - 'relationship' => 'none', |
|
41 | + ), |
|
42 | + 'link_to_node' => 0, |
|
43 | + 'exclude' => 1, |
|
44 | + 'id' => 'nid', |
|
45 | + 'table' => 'node', |
|
46 | + 'field' => 'nid', |
|
47 | + 'relationship' => 'none', |
|
48 | 48 | ), |
49 | 49 | 'title' => array( |
50 | - 'label' => '', |
|
51 | - 'alter' => array( |
|
50 | + 'label' => '', |
|
51 | + 'alter' => array( |
|
52 | 52 | 'alter_text' => 0, |
53 | 53 | 'text' => '', |
54 | 54 | 'make_link' => 0, |
@@ -64,60 +64,60 @@ discard block |
||
64 | 64 | 'ellipsis' => 1, |
65 | 65 | 'strip_tags' => 0, |
66 | 66 | 'html' => 0, |
67 | - ), |
|
68 | - 'link_to_node' => 0, |
|
69 | - 'exclude' => 0, |
|
70 | - 'id' => 'title', |
|
71 | - 'table' => 'node', |
|
72 | - 'field' => 'title', |
|
73 | - 'relationship' => 'none', |
|
67 | + ), |
|
68 | + 'link_to_node' => 0, |
|
69 | + 'exclude' => 0, |
|
70 | + 'id' => 'title', |
|
71 | + 'table' => 'node', |
|
72 | + 'field' => 'title', |
|
73 | + 'relationship' => 'none', |
|
74 | 74 | ), |
75 | - )); |
|
76 | - $handler->override_option('sorts', array( |
|
75 | + )); |
|
76 | + $handler->override_option('sorts', array( |
|
77 | 77 | 'changed' => array( |
78 | - 'order' => 'DESC', |
|
79 | - 'granularity' => 'second', |
|
80 | - 'id' => 'changed', |
|
81 | - 'table' => 'node', |
|
82 | - 'field' => 'changed', |
|
83 | - 'relationship' => 'none', |
|
78 | + 'order' => 'DESC', |
|
79 | + 'granularity' => 'second', |
|
80 | + 'id' => 'changed', |
|
81 | + 'table' => 'node', |
|
82 | + 'field' => 'changed', |
|
83 | + 'relationship' => 'none', |
|
84 | 84 | ), |
85 | - )); |
|
86 | - $handler->override_option('filters', array( |
|
85 | + )); |
|
86 | + $handler->override_option('filters', array( |
|
87 | 87 | 'status_extra' => array( |
88 | - 'operator' => '=', |
|
89 | - 'value' => '', |
|
90 | - 'group' => '0', |
|
91 | - 'exposed' => FALSE, |
|
92 | - 'expose' => array( |
|
88 | + 'operator' => '=', |
|
89 | + 'value' => '', |
|
90 | + 'group' => '0', |
|
91 | + 'exposed' => FALSE, |
|
92 | + 'expose' => array( |
|
93 | 93 | 'operator' => FALSE, |
94 | 94 | 'label' => '', |
95 | - ), |
|
96 | - 'id' => 'status_extra', |
|
97 | - 'table' => 'node', |
|
98 | - 'field' => 'status_extra', |
|
99 | - 'relationship' => 'none', |
|
95 | + ), |
|
96 | + 'id' => 'status_extra', |
|
97 | + 'table' => 'node', |
|
98 | + 'field' => 'status_extra', |
|
99 | + 'relationship' => 'none', |
|
100 | 100 | ), |
101 | - )); |
|
102 | - $handler->override_option('access', array( |
|
101 | + )); |
|
102 | + $handler->override_option('access', array( |
|
103 | 103 | 'type' => 'none', |
104 | - )); |
|
105 | - $handler->override_option('cache', array( |
|
104 | + )); |
|
105 | + $handler->override_option('cache', array( |
|
106 | 106 | 'type' => 'none', |
107 | - )); |
|
108 | - $handler->override_option('style_plugin', 'jump_views'); |
|
109 | - $handler->override_option('style_options', array( |
|
107 | + )); |
|
108 | + $handler->override_option('style_plugin', 'jump_views'); |
|
109 | + $handler->override_option('style_options', array( |
|
110 | 110 | 'grouping' => '', |
111 | 111 | 'keys' => array( |
112 | - 'nid' => 'nid', |
|
113 | - 'title' => 0, |
|
112 | + 'nid' => 'nid', |
|
113 | + 'title' => 0, |
|
114 | 114 | ), |
115 | 115 | 'first_item' => 'Recent nodes', |
116 | - )); |
|
117 | - $handler = $view->new_display('block', 'Block', 'block_1'); |
|
118 | - $handler->override_option('block_description', ''); |
|
119 | - $handler->override_option('block_caching', -1); |
|
116 | + )); |
|
117 | + $handler = $view->new_display('block', 'Block', 'block_1'); |
|
118 | + $handler->override_option('block_description', ''); |
|
119 | + $handler->override_option('block_caching', -1); |
|
120 | 120 | |
121 | - $views[$view->name] = $view; |
|
122 | - return $views; |
|
121 | + $views[$view->name] = $view; |
|
122 | + return $views; |
|
123 | 123 | } |
@@ -15,9 +15,9 @@ discard block |
||
15 | 15 | $view->tag = ''; |
16 | 16 | $view->view_php = ''; |
17 | 17 | $view->base_table = 'node'; |
18 | - $view->is_cacheable = FALSE; |
|
18 | + $view->is_cacheable = false; |
|
19 | 19 | $view->api_version = 2; |
20 | - $view->disabled = TRUE; |
|
20 | + $view->disabled = true; |
|
21 | 21 | $handler = $view->new_display('default', 'Defaults', 'default'); |
22 | 22 | $handler->override_option('fields', array( |
23 | 23 | 'nid' => array( |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | 'operator' => '=', |
89 | 89 | 'value' => '', |
90 | 90 | 'group' => '0', |
91 | - 'exposed' => FALSE, |
|
91 | + 'exposed' => false, |
|
92 | 92 | 'expose' => array( |
93 | - 'operator' => FALSE, |
|
93 | + 'operator' => false, |
|
94 | 94 | 'label' => '', |
95 | 95 | ), |
96 | 96 | 'id' => 'status_extra', |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | |
8 | 8 | class jump_views_plugin_style extends views_plugin_style { |
9 | 9 | |
10 | - function render() { |
|
10 | + function render() { |
|
11 | 11 | // Build an array of field / field_alias pairs. |
12 | 12 | $this->field_map = array(); |
13 | 13 | foreach ($this->view->field as $field_name => $object) { |
14 | - $this-> field_map[$object->field_alias] = $field_name; |
|
14 | + $this-> field_map[$object->field_alias] = $field_name; |
|
15 | 15 | } |
16 | 16 | |
17 | 17 | // $keys contains the fields used to build up the path. |
@@ -21,116 +21,116 @@ discard block |
||
21 | 21 | // callback. |
22 | 22 | $select = array(); |
23 | 23 | if (!empty($this->options['first_item'])) { |
24 | - $select[0] = $this->options['first_item']; |
|
24 | + $select[0] = $this->options['first_item']; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | foreach ($this->view->result as $row) { |
28 | - $select_key = array(); |
|
29 | - // For each field in the row, we first check if it's to be used |
|
30 | - // as part of the select key, then run views token replacement |
|
31 | - // on it. This allows for paths like node/n/revisions/6 to be built |
|
32 | - // easily. |
|
33 | - foreach ($row as $field => $value) { |
|
28 | + $select_key = array(); |
|
29 | + // For each field in the row, we first check if it's to be used |
|
30 | + // as part of the select key, then run views token replacement |
|
31 | + // on it. This allows for paths like node/n/revisions/6 to be built |
|
32 | + // easily. |
|
33 | + foreach ($row as $field => $value) { |
|
34 | 34 | if (in_array($this->field_map[$field], $keys)) { |
35 | - $field_object = $this->view->field[$this->field_map[$field]]; |
|
36 | - // Re-implementing some of the code from views_handler_field.inc |
|
37 | - // since we need to operate on $result, and to avoid using |
|
38 | - // a row style or templates. |
|
39 | - if (!empty($field_object->options['alter']['alter_text']) && !empty($field_object->options['alter']['text'])) { |
|
35 | + $field_object = $this->view->field[$this->field_map[$field]]; |
|
36 | + // Re-implementing some of the code from views_handler_field.inc |
|
37 | + // since we need to operate on $result, and to avoid using |
|
38 | + // a row style or templates. |
|
39 | + if (!empty($field_object->options['alter']['alter_text']) && !empty($field_object->options['alter']['text'])) { |
|
40 | 40 | $tokens = $this->get_render_tokens($this->field_map[$field], $row); |
41 | 41 | $value = $field_object->render_altered($tokens); |
42 | - } |
|
43 | - $select_key[] = $value; |
|
42 | + } |
|
43 | + $select_key[] = $value; |
|
44 | 44 | } |
45 | - } |
|
46 | - // For the value of the select, just use the output of the row, but strip |
|
47 | - // all markup first. |
|
48 | - $select_key = implode('/', $select_key); |
|
49 | - $raw_select_value = $this->row_plugin->render($row); |
|
50 | - $select_value = trim(html_entity_decode(strip_tags($raw_select_value), ENT_QUOTES)); |
|
51 | - $select[$select_key] = $select_value; |
|
45 | + } |
|
46 | + // For the value of the select, just use the output of the row, but strip |
|
47 | + // all markup first. |
|
48 | + $select_key = implode('/', $select_key); |
|
49 | + $raw_select_value = $this->row_plugin->render($row); |
|
50 | + $select_value = trim(html_entity_decode(strip_tags($raw_select_value), ENT_QUOTES)); |
|
51 | + $select[$select_key] = $select_value; |
|
52 | 52 | } |
53 | 53 | |
54 | 54 | return jump_quickly($select); |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | - function option_definition() { |
|
57 | + function option_definition() { |
|
58 | 58 | $options = parent::option_definition(); |
59 | 59 | $options['keys'] = array('default' => array()); |
60 | 60 | $options['first_item'] = array('default' => ''); |
61 | 61 | return $options; |
62 | - } |
|
62 | + } |
|
63 | 63 | |
64 | - function options_form(&$form, $form_state) { |
|
64 | + function options_form(&$form, $form_state) { |
|
65 | 65 | parent::options_form($form, $form_state); |
66 | 66 | $handlers = $this->display->handler->get_handlers('field'); |
67 | 67 | if (empty($handlers)) { |
68 | - $form['error_markup'] = array( |
|
68 | + $form['error_markup'] = array( |
|
69 | 69 | '#value' => t('You need at least one field before you can configure your jump menu settings'), |
70 | 70 | '#prefix' => '<div class="error form-item description">', |
71 | 71 | '#suffix' => '</div>', |
72 | - ); |
|
73 | - return; |
|
72 | + ); |
|
73 | + return; |
|
74 | 74 | } |
75 | 75 | // Create an array of fields from the data we know. |
76 | 76 | foreach ($handlers as $field => $handler) { |
77 | - if ($label = $handler->label()) { |
|
77 | + if ($label = $handler->label()) { |
|
78 | 78 | $field_names[$field] = $label; |
79 | - } |
|
80 | - else { |
|
79 | + } |
|
80 | + else { |
|
81 | 81 | $field_names[$field] = $handler->ui_name(); |
82 | - } |
|
82 | + } |
|
83 | 83 | } |
84 | 84 | $form['keys'] = array( |
85 | - '#type' => 'checkboxes', |
|
86 | - '#title' => t('Select keys'), |
|
87 | - '#default_value' => $this->options['keys'], |
|
88 | - '#description' => t("These fields will be used to build the path for each row, used as the 'key' in the select options, and will be automatically separated by '/'"), |
|
89 | - '#options' => $field_names, |
|
85 | + '#type' => 'checkboxes', |
|
86 | + '#title' => t('Select keys'), |
|
87 | + '#default_value' => $this->options['keys'], |
|
88 | + '#description' => t("These fields will be used to build the path for each row, used as the 'key' in the select options, and will be automatically separated by '/'"), |
|
89 | + '#options' => $field_names, |
|
90 | 90 | ); |
91 | 91 | $form['first_item'] = array( |
92 | - '#type' => 'textfield', |
|
93 | - '#title' => 'First item', |
|
94 | - '#default_value' => $this->options['first_item'], |
|
95 | - '#description' => t('This will be used as the first item in your select list, for example <em>Choose one</em>'), |
|
92 | + '#type' => 'textfield', |
|
93 | + '#title' => 'First item', |
|
94 | + '#default_value' => $this->options['first_item'], |
|
95 | + '#description' => t('This will be used as the first item in your select list, for example <em>Choose one</em>'), |
|
96 | 96 | ); |
97 | - } |
|
97 | + } |
|
98 | 98 | |
99 | - /** |
|
100 | - * Get the 'render' tokens to use for advanced rendering. |
|
101 | - * |
|
102 | - * This runs through all of the fields and arguments that |
|
103 | - * are available and gets their values. This will then be |
|
104 | - * used in one giant str_replace(). |
|
105 | - * Slightly modified from views_handler_field.inc |
|
106 | - */ |
|
107 | - function get_render_tokens($field_name, $row) { |
|
99 | + /** |
|
100 | + * Get the 'render' tokens to use for advanced rendering. |
|
101 | + * |
|
102 | + * This runs through all of the fields and arguments that |
|
103 | + * are available and gets their values. This will then be |
|
104 | + * used in one giant str_replace(). |
|
105 | + * Slightly modified from views_handler_field.inc |
|
106 | + */ |
|
107 | + function get_render_tokens($field_name, $row) { |
|
108 | 108 | $tokens = array(); |
109 | 109 | if (!empty($this->view->build_info['substitutions'])) { |
110 | - $tokens = $this->view->build_info['substitutions']; |
|
110 | + $tokens = $this->view->build_info['substitutions']; |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | $count = 0; |
114 | 114 | foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) { |
115 | - $token = '%'. ++$count; |
|
116 | - if (!isset($tokens[$token])) { |
|
115 | + $token = '%'. ++$count; |
|
116 | + if (!isset($tokens[$token])) { |
|
117 | 117 | $tokens[$token] = ''; |
118 | - } |
|
118 | + } |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | // Now add replacements for our fields. |
122 | 122 | $options = array(); |
123 | 123 | $map = array_flip($this->field_map); |
124 | 124 | foreach ($this->view->display_handler->get_handlers('field') as $field => $handler) { |
125 | - $map = array_flip($this->field_map); |
|
126 | - if (isset($row->$map[$field])) { |
|
125 | + $map = array_flip($this->field_map); |
|
126 | + if (isset($row->$map[$field])) { |
|
127 | 127 | $tokens["[$field]"] = $row->$map[$field]; |
128 | - } |
|
129 | - else { |
|
128 | + } |
|
129 | + else { |
|
130 | 130 | $tokens["[$field]"] = ''; |
131 | - } |
|
131 | + } |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return $tokens; |
135 | - } |
|
135 | + } |
|
136 | 136 | } |
@@ -112,7 +112,7 @@ |
||
112 | 112 | |
113 | 113 | $count = 0; |
114 | 114 | foreach ($this->view->display_handler->get_handlers('argument') as $arg => $handler) { |
115 | - $token = '%'. ++$count; |
|
115 | + $token = '%'.++$count; |
|
116 | 116 | if (!isset($tokens[$token])) { |
117 | 117 | $tokens[$token] = ''; |
118 | 118 | } |
@@ -76,8 +76,7 @@ discard block |
||
76 | 76 | foreach ($handlers as $field => $handler) { |
77 | 77 | if ($label = $handler->label()) { |
78 | 78 | $field_names[$field] = $label; |
79 | - } |
|
80 | - else { |
|
79 | + } else { |
|
81 | 80 | $field_names[$field] = $handler->ui_name(); |
82 | 81 | } |
83 | 82 | } |
@@ -125,8 +124,7 @@ discard block |
||
125 | 124 | $map = array_flip($this->field_map); |
126 | 125 | if (isset($row->$map[$field])) { |
127 | 126 | $tokens["[$field]"] = $row->$map[$field]; |
128 | - } |
|
129 | - else { |
|
127 | + } else { |
|
130 | 128 | $tokens["[$field]"] = ''; |
131 | 129 | } |
132 | 130 | } |