@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | global $app_name,$log; |
32 | 32 | |
33 | 33 | $timestamp = date("Y-m-d H:i",time()); |
34 | - // read the list of template filenames |
|
35 | - // |
|
36 | - $files = file("../../tree_threader_template_files"); |
|
37 | - if ($files === false) { |
|
34 | + // read the list of template filenames |
|
35 | + // |
|
36 | + $files = file("../../tree_threader_template_files"); |
|
37 | + if ($files === false) { |
|
38 | 38 | fwrite($log,"$timestamp\ttemplate file tree_threader_template_files\n"); |
39 | 39 | error("no templates file"); |
40 | 40 | |
41 | 41 | } |
42 | - $njobs = sizeof($files); |
|
43 | - $now = time(); |
|
42 | + $njobs = sizeof($files); |
|
43 | + $now = time(); |
|
44 | 44 | $batch_id = BoincBatch::insert( |
45 | - "(user_id, create_time, njobs, name, app_id, state) values ($user->id, $now, $njobs, 'tree_threader batch', $app->id, ".BATCH_STATE_IN_PROGRESS.")" |
|
45 | + "(user_id, create_time, njobs, name, app_id, state) values ($user->id, $now, $njobs, 'tree_threader batch', $app->id, ".BATCH_STATE_IN_PROGRESS.")" |
|
46 | 46 | ); |
47 | 47 | if (!$batch_id) { |
48 | 48 | $log_msg = "$timestamp\tfailed to create batch for user $user->id\n"; |
@@ -68,20 +68,20 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | $i = 1; |
71 | - foreach ($files as $file) { |
|
71 | + foreach ($files as $file) { |
|
72 | 72 | $file = trim($file); |
73 | 73 | $wu_name = "ICT_".$batch_id."_$i"; |
74 | 74 | |
75 | - $cmd = "cd ../..; ./bin/create_work --appname $app_name --batch $batch_id --wu_name $wu_name --wu_template templates/ICT_in --result_template templates/ICT_out $seq_fname $file"; |
|
75 | + $cmd = "cd ../..; ./bin/create_work --appname $app_name --batch $batch_id --wu_name $wu_name --wu_template templates/ICT_in --result_template templates/ICT_out $seq_fname $file"; |
|
76 | 76 | fwrite($log, "$timestamp\t$cmd\n"); |
77 | 77 | system($cmd, $ret); |
78 | - if ($ret != 0) { |
|
78 | + if ($ret != 0) { |
|
79 | 79 | fwrite($log, "can not creat job $wu_name\n"); |
80 | - error("can't create job"); |
|
80 | + error("can't create job"); |
|
81 | 81 | } |
82 | 82 | $i++; |
83 | - } |
|
84 | - echo "<tt_reply>\n<batch_id>$batch_id</batch_id>\n</tt_reply>\n"; |
|
83 | + } |
|
84 | + echo "<tt_reply>\n<batch_id>$batch_id</batch_id>\n</tt_reply>\n"; |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | // Enumerate all the successfully completed WUs for this batch. |
@@ -93,51 +93,51 @@ discard block |
||
93 | 93 | function handle_get_output($r, $batch) { |
94 | 94 | global $log; |
95 | 95 | $timestamp = date("Y-m-d H:i",time()); |
96 | - $wus = BoincWorkUnit::enum("batch=$batch->id"); |
|
97 | - $outdir = "/tmp/treeThreader_result_".$batch->id; |
|
96 | + $wus = BoincWorkUnit::enum("batch=$batch->id"); |
|
97 | + $outdir = "/tmp/treeThreader_result_".$batch->id; |
|
98 | 98 | @mkdir($outdir); |
99 | - foreach ($wus as $wu) { |
|
100 | - if (!$wu->canonical_resultid) continue; |
|
101 | - $result = BoincResult::lookup_id($wu->canonical_resultid); |
|
102 | - if (!$result) continue; |
|
103 | - $paths = get_outfile_paths($result); |
|
104 | - if (sizeof($paths) < 1) continue; |
|
105 | - |
|
106 | - // there's only one output file |
|
107 | - // |
|
108 | - $path = $paths[0]; |
|
109 | - |
|
110 | - // unzip it into a directory in /tmp |
|
111 | - // |
|
112 | - $dir = "/tmp/$wu->name"; |
|
99 | + foreach ($wus as $wu) { |
|
100 | + if (!$wu->canonical_resultid) continue; |
|
101 | + $result = BoincResult::lookup_id($wu->canonical_resultid); |
|
102 | + if (!$result) continue; |
|
103 | + $paths = get_outfile_paths($result); |
|
104 | + if (sizeof($paths) < 1) continue; |
|
105 | + |
|
106 | + // there's only one output file |
|
107 | + // |
|
108 | + $path = $paths[0]; |
|
109 | + |
|
110 | + // unzip it into a directory in /tmp |
|
111 | + // |
|
112 | + $dir = "/tmp/$wu->name"; |
|
113 | 113 | @mkdir($dir); |
114 | - $cmd = "cd $dir; unzip -q $path"; |
|
115 | - system($cmd, $ret); |
|
116 | - if ($ret != 0) { |
|
117 | - error("can't unzip output file"); |
|
118 | - } |
|
119 | - $cmd = "cp $dir/Aln/* $outdir"; |
|
120 | - system($cmd, $ret); |
|
121 | - if ($ret != 0) { |
|
122 | - error("can't copy output files"); |
|
123 | - } |
|
114 | + $cmd = "cd $dir; unzip -q $path"; |
|
115 | + system($cmd, $ret); |
|
116 | + if ($ret != 0) { |
|
117 | + error("can't unzip output file"); |
|
118 | + } |
|
119 | + $cmd = "cp $dir/Aln/* $outdir"; |
|
120 | + system($cmd, $ret); |
|
121 | + if ($ret != 0) { |
|
122 | + error("can't copy output files"); |
|
123 | + } |
|
124 | 124 | |
125 | 125 | system("rm -rf $dir"); |
126 | - } |
|
127 | - |
|
128 | - $cmd = "zip -r -q $outdir $outdir"; |
|
129 | - system($cmd, $ret); |
|
130 | - if ($ret != $ret) { |
|
131 | - error("can't zip output files"); |
|
132 | - } |
|
133 | - $fname = "treeThreader_result_".$batch->id.".zip"; |
|
126 | + } |
|
127 | + |
|
128 | + $cmd = "zip -r -q $outdir $outdir"; |
|
129 | + system($cmd, $ret); |
|
130 | + if ($ret != $ret) { |
|
131 | + error("can't zip output files"); |
|
132 | + } |
|
133 | + $fname = "treeThreader_result_".$batch->id.".zip"; |
|
134 | 134 | $treeThreader_dir="treeThreaderResult"; |
135 | 135 | if(!is_dir("../../download/$treeThreader_dir"))mkdir("../../download/$treeThreader_dir"); |
136 | - @symlink("/tmp/$fname", "../../download/$treeThreader_dir/$fname"); |
|
136 | + @symlink("/tmp/$fname", "../../download/$treeThreader_dir/$fname"); |
|
137 | 137 | system("rm -fr $outdir"); |
138 | 138 | $config = simplexml_load_string(file_get_contents("../../config.xml")); |
139 | 139 | $download_url = trim((string)$config->config->download_url); |
140 | - echo "<tt_reply>\n<url>$download_url/$treeThreader_dir/$fname</url>\n</tt_reply>\n"; |
|
140 | + echo "<tt_reply>\n<url>$download_url/$treeThreader_dir/$fname</url>\n</tt_reply>\n"; |
|
141 | 141 | $log_msg="$timestamp\tuser $batch->user_id downloads results for batch $batch->id : $download_url/$treeThreader_dir/$fname\n"; |
142 | 142 | fwrite($log, $log_msg); |
143 | 143 | } |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | handle_submit($r, $user, $app); |
178 | 178 | break; |
179 | 179 | case 'get_output': |
180 | - $batch_id = (int)$r->batch_id; |
|
181 | - $batch = BoincBatch::lookup_id($batch_id); |
|
182 | - if (!$batch) error("no such batch"); |
|
183 | - if ($batch->user_id != $user->id) error("not owner of batch"); |
|
184 | - handle_get_output($r, $batch); |
|
185 | - break; |
|
180 | + $batch_id = (int)$r->batch_id; |
|
181 | + $batch = BoincBatch::lookup_id($batch_id); |
|
182 | + if (!$batch) error("no such batch"); |
|
183 | + if ($batch->user_id != $user->id) error("not owner of batch"); |
|
184 | + handle_get_output($r, $batch); |
|
185 | + break; |
|
186 | 186 | default: error("bad command"); |
187 | 187 | } |
188 | 188 |
@@ -38,7 +38,7 @@ |
||
38 | 38 | // See if "action" is provided - either through post or get |
39 | 39 | if (!post_str('action', true)) { |
40 | 40 | if (!get_str('action', true)){ |
41 | - error_page(tra("You must specify an action...")); |
|
41 | + error_page(tra("You must specify an action...")); |
|
42 | 42 | } else { |
43 | 43 | $action = get_str('action'); |
44 | 44 | } |
@@ -89,9 +89,9 @@ discard block |
||
89 | 89 | if ($forum->parent_type == 1) { |
90 | 90 | // post to team msg board |
91 | 91 | if ($forum->category == $teamid) { |
92 | - if ($thread->hidden && !$show_team_hidden) { |
|
93 | - continue; |
|
94 | - } |
|
92 | + if ($thread->hidden && !$show_team_hidden) { |
|
93 | + continue; |
|
94 | + } |
|
95 | 95 | if ($post->hidden && !$show_team_hidden) { |
96 | 96 | continue; |
97 | 97 | } |
@@ -99,18 +99,18 @@ discard block |
||
99 | 99 | continue; |
100 | 100 | } |
101 | 101 | } else { |
102 | - if ($thread->hidden && !$show_hidden) { |
|
103 | - continue; |
|
104 | - } |
|
102 | + if ($thread->hidden && !$show_hidden) { |
|
103 | + continue; |
|
104 | + } |
|
105 | 105 | if ($post->hidden && !$show_hidden) { |
106 | 106 | continue; |
107 | 107 | } |
108 | 108 | } |
109 | 109 | } |
110 | - if ($n == $offset + $items_per_page) { |
|
111 | - $show_next = true; |
|
112 | - break; |
|
113 | - } |
|
110 | + if ($n == $offset + $items_per_page) { |
|
111 | + $show_next = true; |
|
112 | + break; |
|
113 | + } |
|
114 | 114 | if ($n >= $offset) { |
115 | 115 | show_post_and_context($post, $thread, $forum, $options, $n+1); |
116 | 116 | } |
@@ -119,12 +119,12 @@ discard block |
||
119 | 119 | echo "</table><br><br>\n"; |
120 | 120 | |
121 | 121 | if ($offset) { |
122 | - $x = $offset - $items_per_page; |
|
122 | + $x = $offset - $items_per_page; |
|
123 | 123 | echo "<a href=forum_user_posts.php?userid=$userid&offset=$x> |
124 | 124 | <b>".tra("Previous %1", $items_per_page)."</b> |
125 | 125 | </a> |
126 | 126 | "; |
127 | - if ($show_next) echo " · "; |
|
127 | + if ($show_next) echo " · "; |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | if ($show_next) { |
@@ -47,11 +47,11 @@ discard block |
||
47 | 47 | class LightOpenID |
48 | 48 | { |
49 | 49 | public $returnUrl |
50 | - , $required = array() |
|
51 | - , $optional = array() |
|
52 | - , $verify_peer = null |
|
53 | - , $capath = null |
|
54 | - , $cainfo = null; |
|
50 | + , $required = array() |
|
51 | + , $optional = array() |
|
52 | + , $verify_peer = null |
|
53 | + , $capath = null |
|
54 | + , $cainfo = null; |
|
55 | 55 | private $identity, $claimed_id; |
56 | 56 | protected $server, $version, $trustRoot, $aliases, $identifier_select = false |
57 | 57 | , $ax = false, $sreg = false, $data, $setup_url = null; |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | $parsed_url = parse_url($this->claimed_id); |
262 | 262 | $this->identity = |
263 | 263 | $this->claimed_id = $parsed_url['scheme'] . '://' |
264 | - . $parsed_url['host'] |
|
265 | - . $headers[$name]; |
|
264 | + . $parsed_url['host'] |
|
265 | + . $headers[$name]; |
|
266 | 266 | } |
267 | 267 | } |
268 | 268 | } |
@@ -301,14 +301,14 @@ discard block |
||
301 | 301 | |
302 | 302 | $url = $parts + $url; |
303 | 303 | $url = $url['scheme'] . '://' |
304 | - . (empty($url['username'])?'' |
|
304 | + . (empty($url['username'])?'' |
|
305 | 305 | :(empty($url['password'])? "{$url['username']}@" |
306 | 306 | :"{$url['username']}:{$url['password']}@")) |
307 | - . $url['host'] |
|
308 | - . (empty($url['port'])?'':":{$url['port']}") |
|
309 | - . (empty($url['path'])?'':$url['path']) |
|
310 | - . (empty($url['query'])?'':"?{$url['query']}") |
|
311 | - . (empty($url['fragment'])?'':"#{$url['fragment']}"); |
|
307 | + . $url['host'] |
|
308 | + . (empty($url['port'])?'':":{$url['port']}") |
|
309 | + . (empty($url['path'])?'':$url['path']) |
|
310 | + . (empty($url['query'])?'':"?{$url['query']}") |
|
311 | + . (empty($url['fragment'])?'':"#{$url['fragment']}"); |
|
312 | 312 | return $url; |
313 | 313 | } |
314 | 314 | |
@@ -533,7 +533,7 @@ discard block |
||
533 | 533 | |
534 | 534 | protected function authUrl_v1($immediate) |
535 | 535 | { |
536 | - $returnUrl = $this->returnUrl; |
|
536 | + $returnUrl = $this->returnUrl; |
|
537 | 537 | # If we have an openid.delegate that is different from our claimed id, |
538 | 538 | # we need to somehow preserve the claimed id between requests. |
539 | 539 | # The simplest way is to just send it along with the return_to url. |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | ) + $this->sregParams(); |
550 | 550 | |
551 | 551 | return $this->build_url(parse_url($this->server) |
552 | - , array('query' => http_build_query($params, '', '&'))); |
|
552 | + , array('query' => http_build_query($params, '', '&'))); |
|
553 | 553 | } |
554 | 554 | |
555 | 555 | protected function authUrl_v2($immediate) |
@@ -574,14 +574,14 @@ discard block |
||
574 | 574 | |
575 | 575 | if ($this->identifier_select) { |
576 | 576 | $params['openid.identity'] = $params['openid.claimed_id'] |
577 | - = 'http://specs.openid.net/auth/2.0/identifier_select'; |
|
577 | + = 'http://specs.openid.net/auth/2.0/identifier_select'; |
|
578 | 578 | } else { |
579 | 579 | $params['openid.identity'] = $this->identity; |
580 | 580 | $params['openid.claimed_id'] = $this->claimed_id; |
581 | 581 | } |
582 | 582 | |
583 | 583 | return $this->build_url(parse_url($this->server) |
584 | - , array('query' => http_build_query($params, '', '&'))); |
|
584 | + , array('query' => http_build_query($params, '', '&'))); |
|
585 | 585 | } |
586 | 586 | |
587 | 587 | /** |
@@ -638,7 +638,7 @@ discard block |
||
638 | 638 | # If it's an OpenID 1 provider, and we've got claimed_id, |
639 | 639 | # we have to append it to the returnUrl, like authUrl_v1 does. |
640 | 640 | $this->returnUrl .= (strpos($this->returnUrl, '?') ? '&' : '?') |
641 | - . 'openid.claimed_id=' . $this->claimed_id; |
|
641 | + . 'openid.claimed_id=' . $this->claimed_id; |
|
642 | 642 | } |
643 | 643 | |
644 | 644 | if ($this->data['openid_return_to'] != $this->returnUrl) { |
@@ -707,7 +707,7 @@ discard block |
||
707 | 707 | continue; |
708 | 708 | } |
709 | 709 | $key = substr($this->data['openid_' . $alias . '_type_' . $key], |
710 | - strlen('http://axschema.org/')); |
|
710 | + strlen('http://axschema.org/')); |
|
711 | 711 | $attributes[$key] = $value; |
712 | 712 | } |
713 | 713 | return $attributes; |
@@ -220,7 +220,7 @@ |
||
220 | 220 | } |
221 | 221 | } |
222 | 222 | if ($detail == "low" || $table == "profile") { |
223 | - end_table(); |
|
223 | + end_table(); |
|
224 | 224 | } |
225 | 225 | _mysql_free_result($result); |
226 | 226 | } else { |
@@ -116,14 +116,14 @@ |
||
116 | 116 | } else { |
117 | 117 | $host = BoincHost::lookup_id($hostid); |
118 | 118 | if (!$host) { |
119 | - echo "<h2>No host with that ID</h2> |
|
119 | + echo "<h2>No host with that ID</h2> |
|
120 | 120 | <center>Please <a href=\"problem_host.php\">try again</a></center>"; |
121 | 121 | } else { |
122 | 122 | $user = BoincUser::lookup_id($host->userid); |
123 | - echo "<a href=\"problem_host.php\">Do another?</a><br><br>"; |
|
124 | - send_problem_email($user, $host); |
|
125 | - echo "Email to ".$user->email_addr." has been sent.<br>"; |
|
126 | - } |
|
123 | + echo "<a href=\"problem_host.php\">Do another?</a><br><br>"; |
|
124 | + send_problem_email($user, $host); |
|
125 | + echo "Email to ".$user->email_addr." has been sent.<br>"; |
|
126 | + } |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | admin_page_tail(); |
@@ -24,17 +24,17 @@ |
||
24 | 24 | set_time_limit(0); |
25 | 25 | |
26 | 26 | function cache_check_diskspace2(){ |
27 | - $too_old = 86400; |
|
28 | - while (1) { |
|
29 | - $f = disk_free_space("../cache"); |
|
30 | - $u = disk_usage("../cache"); |
|
31 | - echo "free: $f used: $u\n"; |
|
32 | - if ($f > MIN_FREE_SPACE && $u < MAX_CACHE_USAGE) { |
|
33 | - break; |
|
34 | - } |
|
35 | - clean_cache($too_old, "../cache"); |
|
36 | - $too_old/=2; |
|
37 | - } |
|
27 | + $too_old = 86400; |
|
28 | + while (1) { |
|
29 | + $f = disk_free_space("../cache"); |
|
30 | + $u = disk_usage("../cache"); |
|
31 | + echo "free: $f used: $u\n"; |
|
32 | + if ($f > MIN_FREE_SPACE && $u < MAX_CACHE_USAGE) { |
|
33 | + break; |
|
34 | + } |
|
35 | + clean_cache($too_old, "../cache"); |
|
36 | + $too_old/=2; |
|
37 | + } |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | cache_check_diskspace2(); |
@@ -200,7 +200,7 @@ |
||
200 | 200 | for ($row = 0; $row < $height; $row++) { |
201 | 201 | echo "<tr>"; |
202 | 202 | for ($col = 0; $col < $width; $col++) { |
203 | - if ($count < $numIds) { |
|
203 | + if ($count < $numIds) { |
|
204 | 204 | echo "<td class=\"bordered\" align=\"center\"> |
205 | 205 | <a href=\"".secure_url_base()."view_profile.php?userid=".$userIds[$count]."\"><img src=\"".secure_url_base().IMAGE_URL.$userIds[$count]."_sm.jpg\"></a> |
206 | 206 | </td>"; |
@@ -37,14 +37,14 @@ discard block |
||
37 | 37 | |
38 | 38 | // activate/deactivate script |
39 | 39 | if (1) { |
40 | - echo " |
|
40 | + echo " |
|
41 | 41 | This script needs to be activated before it can be run. |
42 | 42 | Once you understand what the script does you can change the |
43 | 43 | if (1) to if (0) at the top of the file to activate it. |
44 | 44 | Be sure to deactivate the script after using it to make sure |
45 | 45 | it is not accidentally run. |
46 | 46 | "; |
47 | - exit; |
|
47 | + exit; |
|
48 | 48 | } |
49 | 49 | |
50 | 50 | db_init(); |
@@ -63,33 +63,33 @@ discard block |
||
63 | 63 | // loop over all users |
64 | 64 | while ($user = _mysql_fetch_object($result)) { |
65 | 65 | |
66 | - $id=$user->id; |
|
67 | - $email_addr=$user->email_addr; |
|
68 | - $cpid=$user->cross_project_id; |
|
66 | + $id=$user->id; |
|
67 | + $email_addr=$user->email_addr; |
|
68 | + $cpid=$user->cross_project_id; |
|
69 | 69 | |
70 | - $new_email=strtolower(trim($email_addr)); |
|
70 | + $new_email=strtolower(trim($email_addr)); |
|
71 | 71 | |
72 | - if (strcmp($email_addr, $new_email)) |
|
72 | + if (strcmp($email_addr, $new_email)) |
|
73 | 73 | echo "Problematic email address [$id] $email_addr becomes $new_email<br/>"; |
74 | 74 | |
75 | - if (!(strcmp($cpid,"0"))) { |
|
75 | + if (!(strcmp($cpid,"0"))) { |
|
76 | 76 | $newcpid=random_string(); |
77 | 77 | echo "Problematic CPID=0 for [$id] $email_addr gets CPID=$newcpid<br/>"; |
78 | - } |
|
79 | - else |
|
78 | + } |
|
79 | + else |
|
80 | 80 | $newcpid=$cpid; |
81 | 81 | |
82 | - if (strcmp($email_addr, $new_email) || strcmp($newcpid,$cpid)) { |
|
82 | + if (strcmp($email_addr, $new_email) || strcmp($newcpid,$cpid)) { |
|
83 | 83 | $update="update user set email_addr='$new_email', cross_project_id='$newcpid' where id='$id'"; |
84 | 84 | if ($confirm != "yes") { |
85 | - echo "QUERY WOULD BE [$id] $query <br/>[click the link at the bottom to enable]<br/>"; |
|
86 | - $update_needed = TRUE; |
|
85 | + echo "QUERY WOULD BE [$id] $query <br/>[click the link at the bottom to enable]<br/>"; |
|
86 | + $update_needed = TRUE; |
|
87 | 87 | } |
88 | 88 | else { |
89 | - _mysql_query($update); |
|
90 | - echo "Doing $update<br/>\n"; |
|
89 | + _mysql_query($update); |
|
90 | + echo "Doing $update<br/>\n"; |
|
91 | + } |
|
91 | 92 | } |
92 | - } |
|
93 | 93 | } |
94 | 94 | if ($confirm != "yes" && $update_needed) { |
95 | 95 | echo "You can enable the changes by <a href=\"make_emails_lowercase.php?confirm=yes\">click</a>"; |