@@ -32,8 +32,8 @@ discard block |
||
32 | 32 | mkdir("../cache", 0770); |
33 | 33 | chmod("../cache", 0770); |
34 | 34 | } |
35 | - for ($i=0;$i<256;$i++) { |
|
36 | - $j=sprintf("%02x",$i); |
|
35 | + for ($i = 0; $i < 256; $i++) { |
|
36 | + $j = sprintf("%02x", $i); |
|
37 | 37 | if (!@filemtime("../cache/$j")) { |
38 | 38 | mkdir("../cache/$j", 0770); |
39 | 39 | chmod("../cache/$j", 0770); |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | -function get_path($params, $phpfile=null) { |
|
44 | +function get_path($params, $phpfile = null) { |
|
45 | 45 | if (!@filemtime("../cache/00")) make_cache_dirs(); |
46 | 46 | if ($phpfile) { |
47 | 47 | $z = $phpfile; |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | } |
52 | 52 | |
53 | 53 | // add a layer of subdirectories for reducing file lookup time |
54 | - $sz = substr(md5($z."_".urlencode($params)),1,2); |
|
54 | + $sz = substr(md5($z."_".urlencode($params)), 1, 2); |
|
55 | 55 | $path = "../cache/".$sz."/".$z; |
56 | 56 | if ($params) { |
57 | 57 | $path = $path."_".urlencode($params); |
@@ -60,14 +60,14 @@ discard block |
||
60 | 60 | } |
61 | 61 | |
62 | 62 | function disk_usage($dir) { |
63 | - $usage=0; |
|
64 | - if ($handle=@opendir($dir)) { |
|
65 | - while ($file=readdir($handle)) { |
|
63 | + $usage = 0; |
|
64 | + if ($handle = @opendir($dir)) { |
|
65 | + while ($file = readdir($handle)) { |
|
66 | 66 | if (($file != ".") && ($file != "..")) { |
67 | 67 | if (@is_dir($dir."/".$file)) { |
68 | - $usage+=disk_usage($dir."/".$file); |
|
68 | + $usage += disk_usage($dir."/".$file); |
|
69 | 69 | } else { |
70 | - $usage+=@filesize($dir."/".$file); |
|
70 | + $usage += @filesize($dir."/".$file); |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -81,8 +81,8 @@ discard block |
||
81 | 81 | if (!chdir($dir)) { |
82 | 82 | return; |
83 | 83 | } |
84 | - if ($handle=@opendir(".")) { |
|
85 | - while ($file=readdir($handle)) { |
|
84 | + if ($handle = @opendir(".")) { |
|
85 | + while ($file = readdir($handle)) { |
|
86 | 86 | if ($file == ".") continue; |
87 | 87 | if ($file == "..") continue; |
88 | 88 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | if (@is_dir($file)) { |
94 | 94 | clean_cache($max_age, $file); |
95 | 95 | } else { |
96 | - if ((time()-@filemtime($file))>$max_age) { |
|
96 | + if ((time() - @filemtime($file)) > $max_age) { |
|
97 | 97 | //echo "unlinking ".getcwd()."/$file\n"; |
98 | 98 | @unlink($file); |
99 | 99 | } |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | |
108 | 108 | // check cache size every once in a while, purge if too big |
109 | 109 | // |
110 | -function cache_check_diskspace(){ |
|
111 | - if ((rand() % CACHE_SIZE_CHECK_FREQ)) return; |
|
110 | +function cache_check_diskspace() { |
|
111 | + if ((rand()%CACHE_SIZE_CHECK_FREQ)) return; |
|
112 | 112 | if (disk_usage("../cache") < MAX_CACHE_USAGE) return; |
113 | 113 | $x = max(TEAM_PAGE_TTL, USER_PAGE_TTL, USER_HOST_TTL, |
114 | 114 | USER_PROFILE_TTL, TOP_PAGES_TTL, INDEX_PAGE_TTL |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | clean_cache($x, "../cache"); |
117 | 117 | } |
118 | 118 | |
119 | -function cache_need_to_regenerate($path, $max_age){ |
|
119 | +function cache_need_to_regenerate($path, $max_age) { |
|
120 | 120 | $regenerate = false; |
121 | 121 | $request = apache_request_headers(); |
122 | 122 | |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | // and touch the cached copy so other processes |
129 | 129 | // don't regenerate at the same time |
130 | 130 | // |
131 | - if ($lastmodified<time()-$max_age) { |
|
131 | + if ($lastmodified < time() - $max_age) { |
|
132 | 132 | $regenerate = true; |
133 | 133 | @touch($path); |
134 | 134 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | } |
140 | 140 | |
141 | 141 | // Returns cached data or false if nothing was found |
142 | -function get_cached_data($max_age, $params=""){ |
|
142 | +function get_cached_data($max_age, $params = "") { |
|
143 | 143 | global $no_cache; |
144 | 144 | |
145 | 145 | if ($no_cache) return; |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | } |
156 | 156 | } else { |
157 | 157 | cache_check_diskspace(); |
158 | - $regenerate=cache_need_to_regenerate($path, $max_age); |
|
158 | + $regenerate = cache_need_to_regenerate($path, $max_age); |
|
159 | 159 | if (!$regenerate) { |
160 | 160 | return file_get_contents($path); |
161 | 161 | } |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | // DEPRECATED |
168 | -function start_cache($max_age, $params=""){ |
|
168 | +function start_cache($max_age, $params = "") { |
|
169 | 169 | global $no_cache, $caching, $memcache; |
170 | 170 | |
171 | 171 | if ($no_cache) return; |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | $regenerate = cache_need_to_regenerate($path, $max_age); |
189 | 189 | } |
190 | 190 | //Is the stored version too old, do we need to regenerate it? |
191 | - if ($regenerate){ |
|
191 | + if ($regenerate) { |
|
192 | 192 | // If cached version is too old (or non-existent) |
193 | 193 | // generate the page and write to cache |
194 | 194 | // |
195 | 195 | ob_start(); |
196 | 196 | ob_implicit_flush(0); |
197 | - Header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
|
198 | - Header("Expires: " . gmdate("D, d M Y H:i:s",time()+$max_age) . " GMT"); |
|
199 | - Header("Cache-Control: public, max-age=" . $max_age); |
|
197 | + Header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); |
|
198 | + Header("Expires: ".gmdate("D, d M Y H:i:s", time() + $max_age)." GMT"); |
|
199 | + Header("Cache-Control: public, max-age=".$max_age); |
|
200 | 200 | |
201 | 201 | // allow the calling page to see cache period |
202 | 202 | // |
@@ -208,9 +208,9 @@ discard block |
||
208 | 208 | if (strstr($params, "format=xml")) { |
209 | 209 | header('Content-type: text/xml'); |
210 | 210 | } |
211 | - Header("Last-Modified: " . gmdate("D, d M Y H:i:s",$lastmodified) . " GMT"); |
|
212 | - Header("Expires: " . gmdate("D, d M Y H:i:s",$lastmodified+$max_age) . " GMT"); |
|
213 | - Header("Cache-Control: public, max-age=" . $max_age ); |
|
211 | + Header("Last-Modified: ".gmdate("D, d M Y H:i:s", $lastmodified)." GMT"); |
|
212 | + Header("Expires: ".gmdate("D, d M Y H:i:s", $lastmodified + $max_age)." GMT"); |
|
213 | + Header("Cache-Control: public, max-age=".$max_age); |
|
214 | 214 | if ($cache && $cache->content) { |
215 | 215 | echo $cache->content; |
216 | 216 | exit; |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | |
229 | 229 | // write output buffer both to client and to cache |
230 | 230 | // DEPRECATED |
231 | -function end_cache($max_age,$params=""){ |
|
231 | +function end_cache($max_age, $params = "") { |
|
232 | 232 | global $no_cache; |
233 | 233 | if ($no_cache) return; |
234 | 234 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | } |
254 | 254 | } |
255 | 255 | |
256 | -function set_cached_data($max_age, $data, $params=""){ |
|
256 | +function set_cached_data($max_age, $data, $params = "") { |
|
257 | 257 | // for the benefit of hackers |
258 | 258 | if (strstr($params, "..")) { |
259 | 259 | return "bad params"; |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | } |
296 | 296 | $server_arr = array(); |
297 | 297 | $servers = explode('|', MEMCACHE_SERVERS); |
298 | - foreach($servers as &$server) { |
|
298 | + foreach ($servers as &$server) { |
|
299 | 299 | list($ip, $port, $weight) = explode(':', $server); |
300 | 300 | if (!$port) { $port = 11211; } |
301 | 301 | $server_arr[] = array($ip, $port, $weight); |
@@ -84,20 +84,20 @@ discard block |
||
84 | 84 | if ($offset === false) $offset = 0; |
85 | 85 | if ($offset >= $nmsgs) $offset = 0; |
86 | 86 | echo sprintf('Showing messages %d to %d of %d', |
87 | - $offset+1, |
|
88 | - min($offset+$nshow, $nmsgs), |
|
87 | + $offset + 1, |
|
88 | + min($offset + $nshow, $nmsgs), |
|
89 | 89 | $nmsgs |
90 | 90 | ); |
91 | 91 | if ($offset) { |
92 | 92 | echo sprintf( |
93 | 93 | ' · <a href=pm.php?action=inbox&offset=%d>Previous %d</a>', |
94 | - max(0, $offset-$nshow), $nshow |
|
94 | + max(0, $offset - $nshow), $nshow |
|
95 | 95 | ); |
96 | 96 | } |
97 | - if ($offset+$nshow < $nmsgs) { |
|
97 | + if ($offset + $nshow < $nmsgs) { |
|
98 | 98 | echo sprintf( |
99 | 99 | ' · <a href=pm.php?action=inbox&offset=%d>Next %d</a>', |
100 | - $offset+$nshow, $nshow |
|
100 | + $offset + $nshow, $nshow |
|
101 | 101 | ); |
102 | 102 | } |
103 | 103 | } |
@@ -112,12 +112,12 @@ discard block |
||
112 | 112 | array('style="width: 12em;"', 'style="width: 10em;"', "") |
113 | 113 | ); |
114 | 114 | $i = 0; |
115 | - foreach($msgs as $msg) { |
|
116 | - if ($i<$offset) { |
|
115 | + foreach ($msgs as $msg) { |
|
116 | + if ($i < $offset) { |
|
117 | 117 | $i++; |
118 | 118 | continue; |
119 | 119 | } |
120 | - if ($i>=$offset+$nshow) break; |
|
120 | + if ($i >= $offset + $nshow) break; |
|
121 | 121 | $i++; |
122 | 122 | $sender = BoincUser::lookup_id($msg->senderid); |
123 | 123 | if (!$sender) { |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | $msgs = BoincPrivateMessage::enum( |
366 | 366 | "userid=$logged_in_user->id" |
367 | 367 | ); |
368 | - foreach($msgs as $msg) { |
|
368 | + foreach ($msgs as $msg) { |
|
369 | 369 | $x = "pm_select_$msg->id"; |
370 | 370 | if (post_str($x, true)) { |
371 | 371 | $msg = BoincPrivateMessage::lookup_id($msg->id); |
@@ -420,5 +420,5 @@ discard block |
||
420 | 420 | error_page(tra("Unknown action")); |
421 | 421 | } |
422 | 422 | |
423 | -$cvs_version_tracker[]="\$Id: pm.php 14077 2007-11-03 04:26:47Z davea $"; |
|
423 | +$cvs_version_tracker[] = "\$Id: pm.php 14077 2007-11-03 04:26:47Z davea $"; |
|
424 | 424 | ?> |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | foreach ($files as $file) { |
62 | 62 | $path = "$dir/$file"; |
63 | 63 | [$err, $file_size, $file_md5] = sandbox_parse_link_file($path); |
64 | - if (!$err){ |
|
64 | + if (!$err) { |
|
65 | 65 | if (strcmp($md5, $file_md5) == 0) { |
66 | 66 | $exist = true; |
67 | 67 | $elf = $file; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | $files = sandbox_file_names($user); |
126 | 126 | foreach ($files as $f) { |
127 | - if ($regexp && !preg_match("/$regexp/",$f)) continue; |
|
127 | + if ($regexp && !preg_match("/$regexp/", $f)) continue; |
|
128 | 128 | $x .= "<option value=\"$f\">$f</option>\n"; |
129 | 129 | } |
130 | 130 | $x .= "</select>\n"; |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | // TODO: this is a kludge. |
155 | 155 | // Should we use the job_file and batch_file_assoc tables instead? |
156 | 156 | // |
157 | -function sandbox_file_in_use($user, $file){ |
|
157 | +function sandbox_file_in_use($user, $file) { |
|
158 | 158 | $ufiles = array(); |
159 | 159 | |
160 | 160 | $pbatches = BoincBatch::enum( |
@@ -164,16 +164,16 @@ discard block |
||
164 | 164 | ); |
165 | 165 | if (!$pbatches) return false; |
166 | 166 | |
167 | - foreach ($pbatches as $batch){ |
|
168 | - $wus = BoincWorkUnit::enum("batch = $batch->id limit 1" ); |
|
169 | - if ($wus == null){ |
|
167 | + foreach ($pbatches as $batch) { |
|
168 | + $wus = BoincWorkUnit::enum("batch = $batch->id limit 1"); |
|
169 | + if ($wus == null) { |
|
170 | 170 | continue; |
171 | 171 | } |
172 | - foreach($wus as $wu){ |
|
172 | + foreach ($wus as $wu) { |
|
173 | 173 | $x = "<in>".$wu->xml_doc."</in>"; |
174 | 174 | $x = simplexml_load_string($x); |
175 | 175 | global $fanout; |
176 | - foreach($x->workunit->file_ref as $fr){ |
|
176 | + foreach ($x->workunit->file_ref as $fr) { |
|
177 | 177 | $pname = (string)$fr->file_name; |
178 | 178 | $ufiles[] = $pname; |
179 | 179 | } |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | $dir = sandbox_dir($user); |
183 | 183 | $path = $dir."/".$file; |
184 | 184 | list($err, $size, $md5) = sandbox_parse_link_file($path); |
185 | - if (!$err){ |
|
185 | + if (!$err) { |
|
186 | 186 | $f = sandbox_file_name($user, $md5); |
187 | - foreach($ufiles as $uf) { |
|
188 | - if (strcmp($f,$uf) == 0){ |
|
187 | + foreach ($ufiles as $uf) { |
|
188 | + if (strcmp($f, $uf) == 0) { |
|
189 | 189 | return true; |
190 | 190 | } |
191 | 191 | } |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if ($template) { |
60 | 60 | $t = (double)$template->workunit->rsc_fpops_est; |
61 | 61 | } |
62 | - foreach($r->batch->job as $job) { |
|
62 | + foreach ($r->batch->job as $job) { |
|
63 | 63 | $y = (double)$job->rsc_fpops_est; |
64 | 64 | if ($y) { |
65 | 65 | $x += $y; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | function est_elapsed_time($r, $template) { |
86 | 86 | // crude estimate: batch FLOPs / project FLOPS |
87 | 87 | // |
88 | - return batch_flop_count($r, $template) / project_flops(); |
|
88 | + return batch_flop_count($r, $template)/project_flops(); |
|
89 | 89 | } |
90 | 90 | |
91 | 91 | // if batch-level input template filename was given, read it; |
@@ -95,9 +95,9 @@ discard block |
||
95 | 95 | // |
96 | 96 | function read_input_template($app, $r) { |
97 | 97 | if ((isset($r->batch)) && (isset($r->batch->workunit_template_file)) && ($r->batch->workunit_template_file)) { |
98 | - $path = project_dir() . "/templates/".$r->batch->workunit_template_file; |
|
98 | + $path = project_dir()."/templates/".$r->batch->workunit_template_file; |
|
99 | 99 | } else { |
100 | - $path = project_dir() . "/templates/$app->name"."_in"; |
|
100 | + $path = project_dir()."/templates/$app->name"."_in"; |
|
101 | 101 | } |
102 | 102 | if (file_exists($path)) { |
103 | 103 | $x = simplexml_load_file($path); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | function validate_batch($jobs, $template) { |
143 | 143 | $i = 0; |
144 | 144 | $n = count($template->file_info); |
145 | - foreach($jobs as $job) { |
|
145 | + foreach ($jobs as $job) { |
|
146 | 146 | $m = count($job->input_files); |
147 | 147 | if ($n != $m) { |
148 | 148 | log_write("wrong # of input files for job $i: need $n, got $m"); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | // stage all the files |
212 | 212 | // |
213 | 213 | function stage_files(&$jobs, $user) { |
214 | - foreach($jobs as $job) { |
|
214 | + foreach ($jobs as $job) { |
|
215 | 215 | foreach ($job->input_files as $file) { |
216 | 216 | if ($file->mode != "remote") { |
217 | 217 | $file->name = stage_file($file, $user); |
@@ -224,7 +224,7 @@ discard block |
||
224 | 224 | // |
225 | 225 | function submit_jobs( |
226 | 226 | $jobs, $job_params, $app, $batch_id, $priority, $app_version_num, |
227 | - $input_template_filename, // batch-level; can also specify per job |
|
227 | + $input_template_filename, // batch-level; can also specify per job |
|
228 | 228 | $output_template_filename, |
229 | 229 | $user |
230 | 230 | ) { |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | // one line per job |
235 | 235 | // |
236 | 236 | $x = ""; |
237 | - foreach($jobs as $job) { |
|
237 | + foreach ($jobs as $job) { |
|
238 | 238 | if ($job->name) { |
239 | 239 | $x .= " --wu_name $job->name"; |
240 | 240 | } |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | $x .= "\n"; |
270 | 270 | } |
271 | 271 | |
272 | - $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
272 | + $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id"; |
|
273 | 273 | |
274 | 274 | if ($user->seti_id) { |
275 | 275 | $cmd .= " --target_user $user->id "; |
@@ -377,7 +377,7 @@ discard block |
||
377 | 377 | // |
378 | 378 | function xml_get_jobs($r) { |
379 | 379 | $jobs = array(); |
380 | - foreach($r->batch->job as $j) { |
|
380 | + foreach ($r->batch->job as $j) { |
|
381 | 381 | $job = new StdClass; |
382 | 382 | $job->input_files = array(); |
383 | 383 | $job->command_line = (string)$j->command_line; |
@@ -428,16 +428,16 @@ discard block |
||
428 | 428 | // |
429 | 429 | function logical_end_time($r, $jobs, $user, $app) { |
430 | 430 | $total_flops = 0; |
431 | - foreach($jobs as $job) { |
|
431 | + foreach ($jobs as $job) { |
|
432 | 432 | //print_r($job); |
433 | 433 | if ($job->rsc_fpops_est) { |
434 | 434 | $total_flops += $job->rsc_fpops_est; |
435 | 435 | } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) { |
436 | - $total_flops += (double) $job->input_template->workunit->rsc_fpops_est; |
|
436 | + $total_flops += (double)$job->input_template->workunit->rsc_fpops_est; |
|
437 | 437 | } else if ($r->batch->job_params->rsc_fpops_est) { |
438 | - $total_flops += (double) $r->batch->job_params->rsc_fpops_est; |
|
438 | + $total_flops += (double)$r->batch->job_params->rsc_fpops_est; |
|
439 | 439 | } else { |
440 | - $x = (double) $template->workunit->rsc_fpops_est; |
|
440 | + $x = (double)$template->workunit->rsc_fpops_est; |
|
441 | 441 | if ($x) { |
442 | 442 | $total_flops += $x; |
443 | 443 | } else { |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | } |
446 | 446 | } |
447 | 447 | } |
448 | - $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
448 | + $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name"; |
|
449 | 449 | $x = exec($cmd); |
450 | 450 | if (!is_numeric($x) || (double)$x == 0) { |
451 | 451 | xml_error(-1, "$cmd returned $x"); |
@@ -530,15 +530,15 @@ discard block |
||
530 | 530 | } |
531 | 531 | |
532 | 532 | $job_params = new StdClass; |
533 | - $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound; |
|
534 | - $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est; |
|
535 | - $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound; |
|
536 | - $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound; |
|
537 | - $job_params->delay_bound = (double) $r->batch->job_params->delay_bound; |
|
533 | + $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound; |
|
534 | + $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est; |
|
535 | + $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound; |
|
536 | + $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound; |
|
537 | + $job_params->delay_bound = (double)$r->batch->job_params->delay_bound; |
|
538 | 538 | // could add quorum-related stuff |
539 | 539 | |
540 | - $input_template_filename = (string) $r->batch->input_template_filename; |
|
541 | - $output_template_filename = (string) $r->batch->output_template_filename; |
|
540 | + $input_template_filename = (string)$r->batch->input_template_filename; |
|
541 | + $output_template_filename = (string)$r->batch->output_template_filename; |
|
542 | 542 | // possibly empty |
543 | 543 | |
544 | 544 | submit_jobs( |
@@ -631,7 +631,7 @@ discard block |
||
631 | 631 | } |
632 | 632 | |
633 | 633 | function n_outfiles($wu) { |
634 | - $path = project_dir() . "/$wu->output_template_filename"; |
|
634 | + $path = project_dir()."/$wu->output_template_filename"; |
|
635 | 635 | $r = simplexml_load_file($path); |
636 | 636 | return count($r->file_info); |
637 | 637 | } |
@@ -838,7 +838,7 @@ discard block |
||
838 | 838 | "; |
839 | 839 | if ($result->server_state == 5) { // over? |
840 | 840 | $paths = get_outfile_paths($result); |
841 | - foreach($paths as $path) { |
|
841 | + foreach ($paths as $path) { |
|
842 | 842 | if (is_file($path)) { |
843 | 843 | $size = filesize($path); |
844 | 844 | echo " <outfile> |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | } else { |
883 | 883 | $results = BoincResult::enum("workunitid=$job_id"); |
884 | 884 | foreach ($results as $r) { |
885 | - switch($r->outcome) { |
|
885 | + switch ($r->outcome) { |
|
886 | 886 | case 1: |
887 | 887 | case 3: |
888 | 888 | case 6: |
@@ -997,8 +997,8 @@ discard block |
||
997 | 997 | } |
998 | 998 | |
999 | 999 | list($user, $user_submit) = check_remote_submit_permissions($r, $app); |
1000 | - $in = file_get_contents(project_dir() . "/templates/".$app->name."_in"); |
|
1001 | - $out = file_get_contents(project_dir() . "/templates/".$app->name."_out"); |
|
1000 | + $in = file_get_contents(project_dir()."/templates/".$app->name."_in"); |
|
1001 | + $out = file_get_contents(project_dir()."/templates/".$app->name."_out"); |
|
1002 | 1002 | if ($in === false || $out === false) { |
1003 | 1003 | log_write("template file missing"); |
1004 | 1004 | xml_error(-1, "template file missing"); |
@@ -1010,7 +1010,7 @@ discard block |
||
1010 | 1010 | |
1011 | 1011 | function ping($r) { |
1012 | 1012 | xml_start_tag("ping"); |
1013 | - BoincDb::get(); // errors out if DB down or web disabled |
|
1013 | + BoincDb::get(); // errors out if DB down or web disabled |
|
1014 | 1014 | echo "<success>1</success> |
1015 | 1015 | </ping> |
1016 | 1016 | "; |
@@ -1077,9 +1077,9 @@ discard block |
||
1077 | 1077 | $request_log = parse_config(get_config(), "<remote_submit_request_log>"); |
1078 | 1078 | if ($request_log) { |
1079 | 1079 | $log_dir = parse_config(get_config(), "<log_dir>"); |
1080 | - $request_log = $log_dir . "/" . $request_log; |
|
1080 | + $request_log = $log_dir."/".$request_log; |
|
1081 | 1081 | if ($file = fopen($request_log, "a")) { |
1082 | - fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n"); |
|
1082 | + fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n"); |
|
1083 | 1083 | fclose($file); |
1084 | 1084 | } |
1085 | 1085 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | require_once("../inc/submit_util.inc"); |
80 | 80 | |
81 | 81 | function upload_error_description($errno) { |
82 | - switch($errno) { |
|
82 | + switch ($errno) { |
|
83 | 83 | case UPLOAD_ERR_INI_SIZE: |
84 | 84 | return "The uploaded file exceeds upload_max_filesize of php.ini."; break; |
85 | 85 | case UPLOAD_ERR_FORM_SIZE: |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | $delete_time = (int)$r->delete_time; |
106 | 106 | $batch_id = (int)$r->batch_id; |
107 | 107 | $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); |
108 | - $phys_names= array(); |
|
109 | - foreach($r->phys_name as $f) { |
|
108 | + $phys_names = array(); |
|
109 | + foreach ($r->phys_name as $f) { |
|
110 | 110 | $phys_names[] = (string)$f; |
111 | 111 | } |
112 | 112 | $i = 0; |
113 | - foreach($phys_names as $fname) { |
|
114 | - $path = dir_hier_path($fname, project_dir() . "/download", $fanout); |
|
113 | + foreach ($phys_names as $fname) { |
|
114 | + $path = dir_hier_path($fname, project_dir()."/download", $fanout); |
|
115 | 115 | |
116 | 116 | // if the job_file record is there, |
117 | 117 | // update the delete time first to avoid race condition |
@@ -218,11 +218,11 @@ discard block |
||
218 | 218 | foreach ($_FILES as $f) { |
219 | 219 | $tmp_name = $f['tmp_name']; |
220 | 220 | $fname = $phys_names[$i]; |
221 | - $path = dir_hier_path($fname, project_dir() . "/download", $fanout); |
|
221 | + $path = dir_hier_path($fname, project_dir()."/download", $fanout); |
|
222 | 222 | |
223 | 223 | // see if file is in download hierarchy |
224 | 224 | // |
225 | - switch(check_download_file($tmp_name, $path)) { |
|
225 | + switch (check_download_file($tmp_name, $path)) { |
|
226 | 226 | case 0: |
227 | 227 | // file is already there |
228 | 228 | // note: check_download_file() generates .md5 in cases 1 and 2 |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | if ($request_log) { |
278 | 278 | $request_log_dir = parse_config(get_config(), "<log_dir>"); |
279 | 279 | if ($request_log_dir) { |
280 | - $request_log = $request_log_dir . "/" . $request_log; |
|
280 | + $request_log = $request_log_dir."/".$request_log; |
|
281 | 281 | } |
282 | 282 | if ($file = fopen($request_log, "a+")) { |
283 | - fwrite($file, "\n<job_file date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</job_file>\n"); |
|
283 | + fwrite($file, "\n<job_file date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</job_file>\n"); |
|
284 | 284 | fclose($file); |
285 | 285 | } |
286 | 286 | } |
@@ -292,7 +292,7 @@ discard block |
||
292 | 292 | xml_error(-1, "can't parse request message: $req", __FILE__, __LINE__); |
293 | 293 | } |
294 | 294 | |
295 | -switch($r->getName()) { |
|
295 | +switch ($r->getName()) { |
|
296 | 296 | case 'query_files': |
297 | 297 | query_files($r); |
298 | 298 | break; |
@@ -189,7 +189,7 @@ discard block |
||
189 | 189 | 'type' => MENU_CALLBACK |
190 | 190 | ); |
191 | 191 | $items['account_finish.php'] = array( |
192 | - 'title' => 'Welcome to ' . variable_get('site_name', 'Drupal-BOINC'), |
|
192 | + 'title' => 'Welcome to '.variable_get('site_name', 'Drupal-BOINC'), |
|
193 | 193 | 'description' => 'RPC for after a user has created an account.', |
194 | 194 | 'page callback' => 'boincuser_account_finish', |
195 | 195 | 'access callback' => TRUE, |
@@ -249,8 +249,8 @@ discard block |
||
249 | 249 | // termsofuse is enabled, by having text in the termsofuse variable. |
250 | 250 | $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
251 | 251 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
252 | - if ( (!empty($termsofuse)) and ($user->uid) ) { |
|
253 | - if ( !boincuser_check_termsofuse($user) and ($existinguser_tou) ) { |
|
252 | + if ((!empty($termsofuse)) and ($user->uid)) { |
|
253 | + if (!boincuser_check_termsofuse($user) and ($existinguser_tou)) { |
|
254 | 254 | |
255 | 255 | // Admins are exempt, otherwise the admin may not be able to |
256 | 256 | // access the site! |
@@ -264,14 +264,14 @@ discard block |
||
264 | 264 | 'user/termsofuse', |
265 | 265 | 'logout', |
266 | 266 | 'account/info/edit', |
267 | - 'user/' . $user->uid . '/edit', |
|
268 | - 'user/' . $user->uid . '/recoveremail/*', |
|
267 | + 'user/'.$user->uid.'/edit', |
|
268 | + 'user/'.$user->uid.'/recoveremail/*', |
|
269 | 269 | 'recover_email.php', |
270 | 270 | ); |
271 | 271 | if (module_exists('boincuser_delete')) { |
272 | - $paths0[] = 'user/' . $user->uid . '/delete'; |
|
273 | - $paths0[] = 'user/' . $user->uid . '/deleteconfirm/*'; |
|
274 | - $paths0[] = 'user/' . $user->uid . '/odeleteconfirm/*'; |
|
272 | + $paths0[] = 'user/'.$user->uid.'/delete'; |
|
273 | + $paths0[] = 'user/'.$user->uid.'/deleteconfirm/*'; |
|
274 | + $paths0[] = 'user/'.$user->uid.'/odeleteconfirm/*'; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | // Paths added by the admin |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | } |
283 | 283 | |
284 | 284 | // paths to ignore |
285 | - $paths_to_ignore = array_unique( array_merge($paths0, $paths2) ); |
|
285 | + $paths_to_ignore = array_unique(array_merge($paths0, $paths2)); |
|
286 | 286 | |
287 | 287 | if (!_boincuser_ignore_paths($path, $paths_to_ignore)) { |
288 | 288 | drupal_goto('user/termsofuse'); |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | require_boinc('password_compat/password'); |
305 | 305 | // Handle BOINC integration for users with UID > 1 (skip anonymous and admin) |
306 | 306 | if (isset($account->uid) && ($account->uid > 1)) { |
307 | - switch($op) { |
|
307 | + switch ($op) { |
|
308 | 308 | case 'load': |
309 | 309 | // User loading; insert BOINC data into the user object |
310 | 310 | $drupal_user = db_fetch_object(db_query(" |
@@ -334,11 +334,11 @@ discard block |
||
334 | 334 | )); |
335 | 335 | $account->boincuser_name = $boinc_user->name; |
336 | 336 | $account->boincuser_account_key = $boinc_user->authenticator; |
337 | - $account->boincuser_weak_auth = md5($boinc_user->authenticator . $boinc_user->passwd_hash); |
|
337 | + $account->boincuser_weak_auth = md5($boinc_user->authenticator.$boinc_user->passwd_hash); |
|
338 | 338 | $account->boincuser_total_credit = round($boinc_user->total_credit); |
339 | 339 | $account->boincuser_expavg_credit = round($boinc_user->expavg_credit); |
340 | 340 | $account->boincuser_expavg_time = round($boinc_user->expavg_time); |
341 | - $account->boincuser_cpid = md5($boinc_user->cross_project_id . $account->mail); |
|
341 | + $account->boincuser_cpid = md5($boinc_user->cross_project_id.$account->mail); |
|
342 | 342 | $account->boincuser_default_pref_set = $boinc_user->venue; |
343 | 343 | $account->boincteam_id = $boinc_user->teamid; |
344 | 344 | $account->boincuser_previous_email_addr = $boinc_user->previous_email_addr; |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | |
508 | 508 | // Set password hash appropriately |
509 | 509 | $passwd = ($edit['pass']) ? $edit['pass'] : $edit['current_pass']; |
510 | - $passwd_hash = password_hash( md5($passwd.$lower_email_addr), PASSWORD_DEFAULT ); |
|
510 | + $passwd_hash = password_hash(md5($passwd.$lower_email_addr), PASSWORD_DEFAULT); |
|
511 | 511 | // Algorithm for changing email and/or password |
512 | 512 | if ($changing_email) { |
513 | 513 | // locally store current email to set as previous email |
@@ -595,8 +595,8 @@ discard block |
||
595 | 595 | } |
596 | 596 | |
597 | 597 | // Check if user has agreed to terms of use. |
598 | - if ( (!empty($termsofuse)) and ($account->uid) and |
|
599 | - (!boincuser_check_termsofuse($account)) and ($existinguser_tou) ) { |
|
598 | + if ((!empty($termsofuse)) and ($account->uid) and |
|
599 | + (!boincuser_check_termsofuse($account)) and ($existinguser_tou)) { |
|
600 | 600 | |
601 | 601 | // Admins are exempted. |
602 | 602 | $administrator_role = array_search('administrator', user_roles(true)); |
@@ -610,9 +610,9 @@ discard block |
||
610 | 610 | $query_for_destination = ''; |
611 | 611 | $prevdest = $_REQUEST['destination']; |
612 | 612 | if ($prevdest) { |
613 | - $query_for_destination = '?destination=' . $prevdest; |
|
613 | + $query_for_destination = '?destination='.$prevdest; |
|
614 | 614 | } |
615 | - $_REQUEST['destination'] = $path_for_destination . $query_for_destination; |
|
615 | + $_REQUEST['destination'] = $path_for_destination.$query_for_destination; |
|
616 | 616 | |
617 | 617 | } |
618 | 618 | } |
@@ -645,7 +645,7 @@ discard block |
||
645 | 645 | // In Drupal 7, these operation cases will all exist as their own hooks, |
646 | 646 | // so let's approximate that here so that this function can simply be removed |
647 | 647 | // upon migration to 7 |
648 | - switch($op) { |
|
648 | + switch ($op) { |
|
649 | 649 | case 'update': |
650 | 650 | boincuser_node_update($node); |
651 | 651 | } |
@@ -656,7 +656,7 @@ discard block |
||
656 | 656 | * is updated (forward compatible to Drupal 7) |
657 | 657 | */ |
658 | 658 | function boincuser_node_update($node) { |
659 | - switch($node->type) { |
|
659 | + switch ($node->type) { |
|
660 | 660 | case 'profile': |
661 | 661 | // Update the BOINC database directly |
662 | 662 | $account = user_load($node->uid); |
@@ -778,7 +778,7 @@ discard block |
||
778 | 778 | } |
779 | 779 | |
780 | 780 | $form['cancel'] = array( |
781 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest) . '</li>', |
|
781 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $cancel_dest).'</li>', |
|
782 | 782 | '#weight' => 1004, |
783 | 783 | ); |
784 | 784 | $form['form control tabs suffix'] = array( |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
812 | 812 | $form['buttons']['preview_changes']['#weight'] = 1004; |
813 | 813 | $form['buttons']['cancel'] = array( |
814 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
814 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}").'</li>', |
|
815 | 815 | '#weight' => 1005, |
816 | 816 | ); |
817 | 817 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
@@ -843,7 +843,7 @@ discard block |
||
843 | 843 | $form['actions']['submit']['#suffix'] = '</li>'; |
844 | 844 | $form['actions']['submit']['#weight'] = 1002; |
845 | 845 | $form['actions']['cancel'] = array( |
846 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}") . '</li>', |
|
846 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), "node/{$form['nid']['#value']}").'</li>', |
|
847 | 847 | '#weight' => 1005, |
848 | 848 | ); |
849 | 849 | $form['actions']['form control tabs suffix'] = array( |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | $form['privatemsg']['preview']['#suffix'] = '</li>'; |
871 | 871 | $form['privatemsg']['preview']['#weight'] = 1003; |
872 | 872 | $form['privatemsg']['cancel'] = array( |
873 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
873 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', |
|
874 | 874 | '#weight' => 1004, |
875 | 875 | ); |
876 | 876 | $form['privatemsg']['form control tabs suffix'] = array( |
@@ -958,11 +958,11 @@ discard block |
||
958 | 958 | // Set special message if user has not agreed to TOU |
959 | 959 | $existinguser_tou = variable_get('boinc_weboptions_existinguser_tou', FALSE); |
960 | 960 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
961 | - if ( (!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users')) ) { |
|
961 | + if ((!boincuser_check_termsofuse($account)) and ($existinguser_tou) and (!empty($termsofuse)) and (!user_access('administer users'))) { |
|
962 | 962 | drupal_set_message( |
963 | 963 | bts('INFO: You have not agreed to the terms of use for @project. You may use this form to change your email address and/or password. Please note: you may not delete your account within seven (7) days of changing your email address.', |
964 | 964 | array( |
965 | - '@project' => variable_get('site_name','Drupal-BOINC'), |
|
965 | + '@project' => variable_get('site_name', 'Drupal-BOINC'), |
|
966 | 966 | ), NULL, 'boinc:account-credentials-change') |
967 | 967 | , 'info'); |
968 | 968 | } |
@@ -1027,36 +1027,36 @@ discard block |
||
1027 | 1027 | $form['account']['boincuser_id'] = array( |
1028 | 1028 | '#value' => ' |
1029 | 1029 | <div class="form-item"> |
1030 | - <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1031 | - <span>' . $account->boincuser_id . '</span> |
|
1030 | + <label>' . bts('BOINC user ID', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
1031 | + <span>' . $account->boincuser_id.'</span> |
|
1032 | 1032 | </div>', |
1033 | 1033 | ); |
1034 | 1034 | $form['account']['user_id'] = array( |
1035 | 1035 | '#value' => ' |
1036 | 1036 | <div class="form-item"> |
1037 | - <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1038 | - <span>' . $account->uid . '</span> |
|
1037 | + <label>' . bts('Drupal user ID', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
1038 | + <span>' . $account->uid.'</span> |
|
1039 | 1039 | </div>', |
1040 | 1040 | ); |
1041 | 1041 | $form['account']['account_key'] = array( |
1042 | 1042 | '#value' => ' |
1043 | 1043 | <div class="form-item"> |
1044 | - <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1045 | - <span>' . $account->boincuser_account_key . '</span> |
|
1044 | + <label>' . bts('Account key', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
1045 | + <span>' . $account->boincuser_account_key.'</span> |
|
1046 | 1046 | </div>', |
1047 | 1047 | ); |
1048 | 1048 | $form['account']['weak_account_key'] = array( |
1049 | 1049 | '#value' => ' |
1050 | 1050 | <div class="form-item"> |
1051 | - <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1052 | - <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}" . '</span> |
|
1051 | + <label>' . bts('Weak account key', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
1052 | + <span>' . "{$account->boincuser_id}_{$account->boincuser_weak_auth}".'</span> |
|
1053 | 1053 | </div>', |
1054 | 1054 | ); |
1055 | 1055 | $form['account']['cpid'] = array( |
1056 | 1056 | '#value' => ' |
1057 | 1057 | <div class="form-item"> |
1058 | - <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change') . '</label> |
|
1059 | - <span>' . $account->boincuser_cpid . '</span> |
|
1058 | + <label>' . bts('Cross-project ID', array(), NULL, 'boinc:account-credentials-change').'</label> |
|
1059 | + <span>' . $account->boincuser_cpid.'</span> |
|
1060 | 1060 | </div>', |
1061 | 1061 | ); |
1062 | 1062 | |
@@ -1074,7 +1074,7 @@ discard block |
||
1074 | 1074 | $form['submit']['#suffix'] = '</li>'; |
1075 | 1075 | $form['submit']['#weight'] = 1002; |
1076 | 1076 | $form['cancel'] = array( |
1077 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1077 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', |
|
1078 | 1078 | '#weight' => 1003, |
1079 | 1079 | ); |
1080 | 1080 | if (isset($form['delete']) AND is_array($form['delete'])) { |
@@ -1170,7 +1170,7 @@ discard block |
||
1170 | 1170 | $form['buttons']['preview_changes']['#suffix'] = '</li>'; |
1171 | 1171 | $form['buttons']['preview_changes']['#weight'] = 1004; |
1172 | 1172 | $form['buttons']['cancel'] = array( |
1173 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']) . '</li>', |
|
1173 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), $_GET['q']).'</li>', |
|
1174 | 1174 | '#weight' => 1005, |
1175 | 1175 | ); |
1176 | 1176 | $form['buttons']['delete']['#prefix'] = '<li class="tab">'; |
@@ -1219,11 +1219,11 @@ discard block |
||
1219 | 1219 | // Set name temporarily to dummy value to beat validation |
1220 | 1220 | $form['name'] = array( |
1221 | 1221 | '#type' => 'hidden', |
1222 | - '#value' => rand() . '.' . time() |
|
1222 | + '#value' => rand().'.'.time() |
|
1223 | 1223 | ); |
1224 | 1224 | |
1225 | 1225 | // Add JS for submit button disabling |
1226 | - drupal_add_js(drupal_get_path('module', 'boincuser') . '/boincuser.js'); |
|
1226 | + drupal_add_js(drupal_get_path('module', 'boincuser').'/boincuser.js'); |
|
1227 | 1227 | |
1228 | 1228 | // Terms of use section |
1229 | 1229 | $termsofuse = variable_get('boinc_weboptions_termsofuse', ''); |
@@ -1239,7 +1239,7 @@ discard block |
||
1239 | 1239 | |
1240 | 1240 | $form['termsofuse']['title1'] = array( |
1241 | 1241 | '#weight' => -12, |
1242 | - '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register' ) . '</h2>', |
|
1242 | + '#value' => '<h2>'.bts(variable_get('boinc_weboptions_registrationtitle', 'Please read and acknowledge our terms of use'), array(), NULL, 'project:user-register').'</h2>', |
|
1243 | 1243 | '#prefix' => '<div id="register-title1">', |
1244 | 1244 | '#suffix' => '</div>', |
1245 | 1245 | ); |
@@ -1262,7 +1262,7 @@ discard block |
||
1262 | 1262 | |
1263 | 1263 | $form['title2'] = array( |
1264 | 1264 | '#weight' => -6, |
1265 | - '#value' => '<h2>' . bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register') . '</h2>', |
|
1265 | + '#value' => '<h2>'.bts(variable_get('boinc_weboptions_registrationtitle2', 'Fill in your name, email, and choose a secure passphrase.'), array(), NULL, 'project:user-register').'</h2>', |
|
1266 | 1266 | '#prefix' => '<div id="register-title2">', |
1267 | 1267 | '#suffix' => '</div>', |
1268 | 1268 | ); |
@@ -1326,7 +1326,7 @@ discard block |
||
1326 | 1326 | $form['buttons']['submit']['#suffix'] = '</li>'; |
1327 | 1327 | $form['buttons']['submit']['#weight'] = 1002; |
1328 | 1328 | $form['buttons']['cancel'] = array( |
1329 | - '#value' => '<li class="tab">' . l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login') . '</li>', |
|
1329 | + '#value' => '<li class="tab">'.l(bts('Cancel', array(), NULL, 'boinc:form-cancel'), 'user/login').'</li>', |
|
1330 | 1330 | '#weight' => 1005, |
1331 | 1331 | ); |
1332 | 1332 | $form['buttons']['form control tabs suffix'] = array( |
@@ -1408,7 +1408,7 @@ discard block |
||
1408 | 1408 | */ |
1409 | 1409 | function boincuser_token_list($type = 'all') { |
1410 | 1410 | if ($type == 'user' || $type == 'all') { |
1411 | - $tokens['user']['display-name'] = t("The user's name that should be displayed"); |
|
1411 | + $tokens['user']['display-name'] = t("The user's name that should be displayed"); |
|
1412 | 1412 | return $tokens; |
1413 | 1413 | } |
1414 | 1414 | } |
@@ -1420,9 +1420,9 @@ discard block |
||
1420 | 1420 | if ($view->args) { |
1421 | 1421 | $account_id = $view->args[0]; |
1422 | 1422 | } |
1423 | - if ($view->name=="user_activity") { |
|
1423 | + if ($view->name == "user_activity") { |
|
1424 | 1424 | // Run the following custom query for the user_activity view |
1425 | - $view->build_info['query']= " |
|
1425 | + $view->build_info['query'] = " |
|
1426 | 1426 | SELECT node_revisions.vid AS vid, |
1427 | 1427 | node.nid AS node_nid, |
1428 | 1428 | node.uid AS users_node_uid, |
@@ -1462,13 +1462,13 @@ discard block |
||
1462 | 1462 | // Delete expired users in the BOINC database, user_delete table. |
1463 | 1463 | require_boinc('boinc_db'); |
1464 | 1464 | $num_deleted = BoincUserDeleted::delete_expired(); |
1465 | - if ($num_deleted>0) { |
|
1465 | + if ($num_deleted > 0) { |
|
1466 | 1466 | watchdog('boincuser', "Deleted ${num_deleted} users from user_deleted table", WATCHDOG_NOTICE); |
1467 | 1467 | } |
1468 | 1468 | |
1469 | 1469 | // Delete expired tokens from token table |
1470 | 1470 | $tokens_deleted = BoincToken::delete_expired(); |
1471 | - if ($tokens_deleted>0) { |
|
1471 | + if ($tokens_deleted > 0) { |
|
1472 | 1472 | watchdog('boincuser', "Deleted ${tokens_deleted} tokens from token table", WATCHDOG_NOTICE); |
1473 | 1473 | } |
1474 | 1474 | } |
@@ -1553,38 +1553,38 @@ discard block |
||
1553 | 1553 | case 'boinc': |
1554 | 1554 | $output .= '<ol>'; |
1555 | 1555 | if ($registration_enabled) { |
1556 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
1556 | + $output .= '<li>'.bts('First !create_an_account here at @sitename.', |
|
1557 | 1557 | array( |
1558 | 1558 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
1559 | 1559 | '@sitename' => $site_name, |
1560 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1560 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1561 | 1561 | } |
1562 | - $output .= ' <li>' . bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page') . '</li>'; |
|
1563 | - $output .= ' <li>' . bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
|
1562 | + $output .= ' <li>'.bts("Install BOINC on this device if not already present.", array(), NULL, 'boinc:join-page').'</li>'; |
|
1563 | + $output .= ' <li>'.bts("Select <i>Tools / Add Project</i>. Choose @sitename from the list, or enter @siteurl.", |
|
1564 | 1564 | array( |
1565 | 1565 | '@sitename' => $site_name, |
1566 | 1566 | '@siteurl' => $base_url, |
1567 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1567 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1568 | 1568 | if ($registration_enabled) { |
1569 | - $output .= '<li>' . bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", |
|
1569 | + $output .= '<li>'.bts("If you're running a command-line or pre-5.0 version of BOINC, use <b>!boinccmd</b> to add the project.", |
|
1570 | 1570 | array( |
1571 | 1571 | '!boinccmd' => l('boinccmd --project_attach', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
1572 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1572 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1573 | 1573 | } |
1574 | 1574 | else { |
1575 | - $output .= '<li>' . bts("If you're running a command-line version of BOINC, |
|
1575 | + $output .= '<li>'.bts("If you're running a command-line version of BOINC, |
|
1576 | 1576 | please follow the <b>!instructionslink</b> to first <i>create an account</i>, and then <i>attach</i> to this project. Use the same project URL as above.", |
1577 | 1577 | array( |
1578 | 1578 | '!instructionslink' => l('instructions', 'http://boinc.berkeley.edu/wiki/Boinccmd_tool'), |
1579 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1579 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1580 | 1580 | } |
1581 | - $output .= '<li>' . bts("If you're running a pre-5.0 version of BOINC, please |
|
1581 | + $output .= '<li>'.bts("If you're running a pre-5.0 version of BOINC, please |
|
1582 | 1582 | upgrade to a more recent version of BOINC to create an account |
1583 | 1583 | at @this_project.", |
1584 | 1584 | array( |
1585 | 1585 | '@this_project' => $site_name, |
1586 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1587 | - $output .= '</ol>'; |
|
1586 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1587 | + $output .= '</ol>'; |
|
1588 | 1588 | break; |
1589 | 1589 | case 'new': |
1590 | 1590 | default: |
@@ -1596,37 +1596,37 @@ discard block |
||
1596 | 1596 | // $ruleslink = drupal_lookup_path('source', $ruleslinkB); |
1597 | 1597 | //} |
1598 | 1598 | |
1599 | - $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', '') ); |
|
1599 | + $ruleslink = drupal_lookup_path('source', variable_get('boinc_weboptions_rulespolicies', '')); |
|
1600 | 1600 | |
1601 | 1601 | // Join page output |
1602 | 1602 | $output .= '<ol>'; |
1603 | 1603 | if ($registration_enabled) { |
1604 | - $output .= '<li>' . bts('First !create_an_account here at @sitename.', |
|
1604 | + $output .= '<li>'.bts('First !create_an_account here at @sitename.', |
|
1605 | 1605 | array( |
1606 | 1606 | '!create_an_account' => l(bts('create an account', array(), NULL, 'boinc:join-page'), 'user/registration'), |
1607 | 1607 | '@sitename' => $site_name, |
1608 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1608 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1609 | 1609 | } |
1610 | - else if ( menu_valid_path(array('link_path' => $ruleslink)) ) { |
|
1611 | - $output .= ' <li>' . bts("Read our !rules_and_policies.", array( |
|
1610 | + else if (menu_valid_path(array('link_path' => $ruleslink))) { |
|
1611 | + $output .= ' <li>'.bts("Read our !rules_and_policies.", array( |
|
1612 | 1612 | '!rules_and_policies' => l(bts('Rules and Policies', array(), NULL, 'boinc:join-page'), $ruleslink), |
1613 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1613 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1614 | 1614 | } |
1615 | - $output .= ' <li>' . bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
|
1615 | + $output .= ' <li>'.bts('Download the BOINC desktop software.', array(), NULL, 'boinc:join-page'); |
|
1616 | 1616 | $output .= ' <p>'; |
1617 | 1617 | $output .= ' <a class="button" href="http://boinc.berkeley.edu/download.php">Download</a>'; |
1618 | 1618 | $output .= ' </p>'; |
1619 | - $output .= ' ' . bts("For Android devices, visit !fdroid_link or download !apk_link directly.", array( |
|
1619 | + $output .= ' '.bts("For Android devices, visit !fdroid_link or download !apk_link directly.", array( |
|
1620 | 1620 | '!fdroid_link' => '<a href="https://f-droid.org/en/packages/edu.berkeley.boinc">F-Droid</a>', |
1621 | 1621 | '!apk_link' => '<a href="https://boinc.berkeley.edu/download_all.php">BOINC for Android</a>', |
1622 | 1622 | ), NULL, 'boinc:join-page'); |
1623 | 1623 | $output .= ' </li>'; |
1624 | - $output .= ' <li>' . bts('Run the installer.', array(), NULL, 'boinc:join-page') . '</li>'; |
|
1625 | - $output .= ' <li>' . bts('Choose @sitename from the list, or enter @siteurl.', array( |
|
1624 | + $output .= ' <li>'.bts('Run the installer.', array(), NULL, 'boinc:join-page').'</li>'; |
|
1625 | + $output .= ' <li>'.bts('Choose @sitename from the list, or enter @siteurl.', array( |
|
1626 | 1626 | '@sitename' => $site_name, |
1627 | 1627 | '@siteurl' => $base_url, |
1628 | - ), NULL, 'boinc:join-page') . '</li>'; |
|
1629 | - $output .= '</ol>'; |
|
1628 | + ), NULL, 'boinc:join-page').'</li>'; |
|
1629 | + $output .= '</ol>'; |
|
1630 | 1630 | } |
1631 | 1631 | $output .= '</div>'; |
1632 | 1632 | return $output; |
@@ -1639,7 +1639,7 @@ discard block |
||
1639 | 1639 | global $user; |
1640 | 1640 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
1641 | 1641 | // get the front page message from database; this is set in the admin interface under BOINC Other |
1642 | - $site_message = variable_get('boinc_other_frontpage',''); |
|
1642 | + $site_message = variable_get('boinc_other_frontpage', ''); |
|
1643 | 1643 | |
1644 | 1644 | // Determine the user of the day |
1645 | 1645 | $current_uotd = db_fetch_object(db_query(" |
@@ -1661,30 +1661,30 @@ discard block |
||
1661 | 1661 | $output .= ($user->uid) ? bts('Welcome back!', array(), NULL, 'boinc:front-page') : ($site_name ? bts('What is @this_project?', array('@this_project' => $site_name)) : bts('Welcome!', array(), NULL, 'boinc:front-page')); |
1662 | 1662 | $output .= '</h2>'; |
1663 | 1663 | $output .= '<div class="boinc-overview balance-height-front">'; |
1664 | - $output .= ' <div>' . bts($site_message, array(), NULL, "project:front page") . ' ' . l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about') . '</div>'; |
|
1664 | + $output .= ' <div>'.bts($site_message, array(), NULL, "project:front page").' '.l(bts('Learn more', array(), NULL, 'boinc:front-page'), 'about').'</div>'; |
|
1665 | 1665 | if ($user->uid) { |
1666 | - $output .= ' <div>' . l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
1666 | + $output .= ' <div>'.l(bts('View account', array(), NULL, 'boinc:front-page'), 'dashboard', array('attributes' => array('class' => 'join button'))).'</div>'; |
|
1667 | 1667 | } |
1668 | 1668 | else { |
1669 | - $output .= ' <div>' . l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))) . '</div>'; |
|
1669 | + $output .= ' <div>'.l(bts('Join now', array(), NULL, 'boinc:front-page'), 'join', array('attributes' => array('class' => 'join button'))).'</div>'; |
|
1670 | 1670 | } |
1671 | 1671 | $output .= '</div>'; |
1672 | 1672 | $output .= '<div class="boinc-overview-details">'; |
1673 | 1673 | $output .= ' <div class="detail-container">'; |
1674 | - $output .= ' <a class="user-of-the-day" href="account/' . $uotd->uid . '">'; |
|
1674 | + $output .= ' <a class="user-of-the-day" href="account/'.$uotd->uid.'">'; |
|
1675 | 1675 | $output .= ' <div class="picture">'; |
1676 | 1676 | $output .= theme('imagefield_image', $uotd_image['image'], $uotd_image['alt'], |
1677 | 1677 | $uotd_image['alt'], array(), FALSE); |
1678 | 1678 | $output .= ' </div>'; |
1679 | - $output .= ' <div class="text">' . bts('User of the day', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1680 | - $output .= ' <div class="detail">' . $uotd->boincuser_name . '</div>'; |
|
1679 | + $output .= ' <div class="text">'.bts('User of the day', array(), NULL, 'boinc:front-page').'</div>'; |
|
1680 | + $output .= ' <div class="detail">'.$uotd->boincuser_name.'</div>'; |
|
1681 | 1681 | $output .= ' </a>'; |
1682 | 1682 | $output .= ' <div class="volunteers">'; |
1683 | - $output .= ' <div class="text">' . bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1683 | + $output .= ' <div class="text">'.bts('Over 500,000 volunteers and counting.', array(), NULL, 'boinc:front-page').'</div>'; |
|
1684 | 1684 | $output .= ' <div class="platforms">'; |
1685 | - $output .= ' <div class="detail platform windows">' . bts('Windows', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1686 | - $output .= ' <div class="detail platform mac">' . bts('Mac', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1687 | - $output .= ' <div class="detail platform linux">' . bts('Linux', array(), NULL, 'boinc:front-page') . '</div>'; |
|
1685 | + $output .= ' <div class="detail platform windows">'.bts('Windows', array(), NULL, 'boinc:front-page').'</div>'; |
|
1686 | + $output .= ' <div class="detail platform mac">'.bts('Mac', array(), NULL, 'boinc:front-page').'</div>'; |
|
1687 | + $output .= ' <div class="detail platform linux">'.bts('Linux', array(), NULL, 'boinc:front-page').'</div>'; |
|
1688 | 1688 | $output .= ' </div>'; |
1689 | 1689 | $output .= ' </div>'; |
1690 | 1690 | $output .= ' </div>'; |
@@ -1715,7 +1715,7 @@ discard block |
||
1715 | 1715 | $enablethisRPC = variable_get('boinc_weboptions_enableaccountcreateRPC', TRUE); |
1716 | 1716 | if (!$enablethisRPC) { |
1717 | 1717 | $mess = bts('Account creation is done through our Web site. Please register at @url', array( |
1718 | - '@url' => $base_url . '/user/registration', |
|
1718 | + '@url' => $base_url.'/user/registration', |
|
1719 | 1719 | ), |
1720 | 1720 | NULL, 'boinc:create_account'); |
1721 | 1721 | xml_error(-208, $mess); |
@@ -1747,8 +1747,8 @@ discard block |
||
1747 | 1747 | $boinc_user = BoincUser::lookup_email_addr($params['email_addr']); |
1748 | 1748 | if ($boinc_user) { |
1749 | 1749 | // Return authenticator for existing users |
1750 | - if ( ($params['passwd_hash'] == $boinc_user->passwd_hash) or |
|
1751 | - password_verify($params['passwd_hash'], $boinc_user->passwd_hash) ) { |
|
1750 | + if (($params['passwd_hash'] == $boinc_user->passwd_hash) or |
|
1751 | + password_verify($params['passwd_hash'], $boinc_user->passwd_hash)) { |
|
1752 | 1752 | $output = array('authenticator' => $boinc_user->authenticator); |
1753 | 1753 | } |
1754 | 1754 | else { |
@@ -1804,7 +1804,7 @@ discard block |
||
1804 | 1804 | // Ensure there is a authentication token before continuing |
1805 | 1805 | if (empty($authtoken)) { |
1806 | 1806 | drupal_not_found(); |
1807 | - return ; |
|
1807 | + return; |
|
1808 | 1808 | } |
1809 | 1809 | |
1810 | 1810 | if (strlen($authtoken) != 32) { |
@@ -1826,8 +1826,8 @@ discard block |
||
1826 | 1826 | } |
1827 | 1827 | |
1828 | 1828 | // Lookup path to custom account finish page |
1829 | - $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '') ); |
|
1830 | - if ( menu_valid_path(array('link_path' => $customaccountfinishpath)) ) { |
|
1829 | + $customaccountfinishpath = drupal_lookup_path('source', variable_get('boinc_weboptions_accountfinish', '')); |
|
1830 | + if (menu_valid_path(array('link_path' => $customaccountfinishpath))) { |
|
1831 | 1831 | $node = menu_get_object('node', 1, $customaccountfinishpath); |
1832 | 1832 | if ($node) { |
1833 | 1833 | return node_page_view($node); |
@@ -1836,12 +1836,12 @@ discard block |
||
1836 | 1836 | |
1837 | 1837 | // open links in new window |
1838 | 1838 | $options = array( |
1839 | - 'attributes' => array( 'target' => '_blank' ), |
|
1839 | + 'attributes' => array('target' => '_blank'), |
|
1840 | 1840 | ); |
1841 | 1841 | |
1842 | 1842 | // Check moderation page exists |
1843 | - $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '') ); |
|
1844 | - if ( menu_valid_path(array('link_path' => $moderationpath)) ) { |
|
1843 | + $moderationpath = drupal_lookup_path('source', variable_get('boinc_weboptions_moderationpage', '')); |
|
1844 | + if (menu_valid_path(array('link_path' => $moderationpath))) { |
|
1845 | 1845 | $modsentence = bts('Please note: user profiles are subject to !moderation.', array('!moderation' => l(bts('moderation', array(), NULL, 'boinc:account-finish'), $moderationpath, $options)), NULL, 'boinc:account-finish'); |
1846 | 1846 | } else { |
1847 | 1847 | $modsentence = bts('Please note: user profiles are subject to moderation.', array(), NULL, 'boinc:account-finish'); |
@@ -1849,11 +1849,11 @@ discard block |
||
1849 | 1849 | |
1850 | 1850 | $username = $user->boincuser_name; |
1851 | 1851 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
1852 | - $output = "<p>" . bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)', |
|
1852 | + $output = "<p>".bts('Thank you @user_name for joining @site_name. Your account has been created. Your BOINC client should start working on assigned tasks soon, without any additional action or configuration. Please visit the links below for more information and additional options. (Links will open in a new window.)', |
|
1853 | 1853 | array( |
1854 | 1854 | '@user_name' => $username, |
1855 | 1855 | '@site_name' => $site_name, |
1856 | - ), NULL, 'boinc:account-finish') . "</p>"; |
|
1856 | + ), NULL, 'boinc:account-finish')."</p>"; |
|
1857 | 1857 | |
1858 | 1858 | $links = array( |
1859 | 1859 | array( |
@@ -1919,7 +1919,7 @@ discard block |
||
1919 | 1919 | ); |
1920 | 1920 | |
1921 | 1921 | //List of links |
1922 | - $output .= theme_item_list($links, $title = NULL, $type='ul'); |
|
1922 | + $output .= theme_item_list($links, $title = NULL, $type = 'ul'); |
|
1923 | 1923 | |
1924 | 1924 | return $output; |
1925 | 1925 | } |
@@ -2036,7 +2036,7 @@ discard block |
||
2036 | 2036 | global $base_url; |
2037 | 2037 | global $base_path; |
2038 | 2038 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
2039 | - $site_url = $base_url . $base_path; |
|
2039 | + $site_url = $base_url.$base_path; |
|
2040 | 2040 | $moderator = user_load($user->uid); |
2041 | 2041 | $profile->moderate = 0; |
2042 | 2042 | $profile->status = 0; |
@@ -2097,7 +2097,7 @@ discard block |
||
2097 | 2097 | global $base_url; |
2098 | 2098 | global $base_path; |
2099 | 2099 | $site_name = variable_get('site_name', 'Drupal-BOINC'); |
2100 | - $site_url = $base_url . $base_path; |
|
2100 | + $site_url = $base_url.$base_path; |
|
2101 | 2101 | $moderator = user_load($user->uid); |
2102 | 2102 | $settings = array( |
2103 | 2103 | 'from' => '', |
@@ -2201,25 +2201,25 @@ discard block |
||
2201 | 2201 | if (!$projects) return bts('no projects...', array(), NULL, 'boinc:account-dashboard'); |
2202 | 2202 | |
2203 | 2203 | $output = ''; |
2204 | - $output .= '<table class="user-projects">' . "\n"; |
|
2205 | - $output .= '<thead>' . "\n"; |
|
2206 | - $output .= ' <tr>' . "\n"; |
|
2207 | - $output .= ' <th>' . bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite') . '</th>' . "\n"; |
|
2208 | - $output .= ' <th class="numeric">' . bts('Avg credit', array(), NULL, 'boinc:account-dashboard') . '</th>' . "\n"; |
|
2209 | - $output .= ' <th class="numeric">' . bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits') . '</th>' . "\n"; |
|
2210 | - $output .= ' </tr>' . "\n"; |
|
2211 | - $output .= '</thead>' . "\n"; |
|
2212 | - $output .= '<tbody>' . "\n"; |
|
2204 | + $output .= '<table class="user-projects">'."\n"; |
|
2205 | + $output .= '<thead>'."\n"; |
|
2206 | + $output .= ' <tr>'."\n"; |
|
2207 | + $output .= ' <th>'.bts('Name', array(), NULL, 'boinc:project-name:-1:ignoreoverwrite').'</th>'."\n"; |
|
2208 | + $output .= ' <th class="numeric">'.bts('Avg credit', array(), NULL, 'boinc:account-dashboard').'</th>'."\n"; |
|
2209 | + $output .= ' <th class="numeric">'.bts('Total credit', array(), NULL, 'boinc:user-or-team-total-credits').'</th>'."\n"; |
|
2210 | + $output .= ' </tr>'."\n"; |
|
2211 | + $output .= '</thead>'."\n"; |
|
2212 | + $output .= '<tbody>'."\n"; |
|
2213 | 2213 | foreach ($projects AS $project) { |
2214 | - $url = rtrim($project->url, '/') . '/show_user.php?userid=' . $project->id; |
|
2215 | - $output .= ' <tr>' . "\n"; |
|
2216 | - $output .= ' <td>' . l($project->name, $url) . '</td>' . "\n"; |
|
2217 | - $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->expavg_credit) . '</td>' . "\n"; |
|
2218 | - $output .= ' <td class="numeric">' . boincwork_format_stats((float) $project->total_credit) . '</td>' . "\n"; |
|
2219 | - $output .= ' </tr>' . "\n"; |
|
2214 | + $url = rtrim($project->url, '/').'/show_user.php?userid='.$project->id; |
|
2215 | + $output .= ' <tr>'."\n"; |
|
2216 | + $output .= ' <td>'.l($project->name, $url).'</td>'."\n"; |
|
2217 | + $output .= ' <td class="numeric">'.boincwork_format_stats((float)$project->expavg_credit).'</td>'."\n"; |
|
2218 | + $output .= ' <td class="numeric">'.boincwork_format_stats((float)$project->total_credit).'</td>'."\n"; |
|
2219 | + $output .= ' </tr>'."\n"; |
|
2220 | 2220 | } |
2221 | - $output .= '</tbody>' . "\n"; |
|
2222 | - $output .= '</table>' . "\n"; |
|
2221 | + $output .= '</tbody>'."\n"; |
|
2222 | + $output .= '</table>'."\n"; |
|
2223 | 2223 | $more_link = ($account) ? "user/{$account->uid}/stats" : 'account/stats'; |
2224 | 2224 | //$output .= "<div class=\"more-link\"><a href=\"{$more_link}\">More stats</a></div>" . "\n"; |
2225 | 2225 | return $output; |
@@ -2239,8 +2239,8 @@ discard block |
||
2239 | 2239 | 'cpid' => $cpid |
2240 | 2240 | ); |
2241 | 2241 | $args = array(); |
2242 | - foreach ($get as $arg => $value) $args[] = "{$arg}=" . rawurlencode($value); |
|
2243 | - $query = '?' . implode('&', $args); |
|
2242 | + foreach ($get as $arg => $value) $args[] = "{$arg}=".rawurlencode($value); |
|
2243 | + $query = '?'.implode('&', $args); |
|
2244 | 2244 | |
2245 | 2245 | // Load XML from RPC |
2246 | 2246 | $target_url = "http://{$stats_server}/{$stats_rpc}{$query}"; |
@@ -2312,12 +2312,12 @@ discard block |
||
2312 | 2312 | $output .= '<ul class="tab-list">'; |
2313 | 2313 | $count = 0; |
2314 | 2314 | foreach ($links as $key => $link) { |
2315 | - $output .= '<li class="' . (($count == 0) ? 'first primary ' : '') . 'tab">'; |
|
2315 | + $output .= '<li class="'.(($count == 0) ? 'first primary ' : '').'tab">'; |
|
2316 | 2316 | $output .= l($link['title'], $link['href'], array('query' => drupal_get_destination())); |
2317 | 2317 | $output .= '</li>'; |
2318 | 2318 | $count++; |
2319 | 2319 | } |
2320 | - $output .= '<li class="' . (($count) ? '' : 'first ') . 'last tab">' . flag_create_link('abuse_user_meta', $account->uid) . '</li>'; |
|
2320 | + $output .= '<li class="'.(($count) ? '' : 'first ').'last tab">'.flag_create_link('abuse_user_meta', $account->uid).'</li>'; |
|
2321 | 2321 | $output .= '</ul>'; |
2322 | 2322 | } |
2323 | 2323 | return $output; |
@@ -2358,7 +2358,7 @@ discard block |
||
2358 | 2358 | function boincuser_apachesolr_index_documents_alter(array &$documents, $entity, $entity_type, $env_id) { |
2359 | 2359 | |
2360 | 2360 | foreach ($documents as $document) { |
2361 | - if ( $document->entity_type=='node' AND $document->bundle=='profile' ) { |
|
2361 | + if ($document->entity_type == 'node' AND $document->bundle == 'profile') { |
|
2362 | 2362 | // Node information. |
2363 | 2363 | $nid = $document->entity_id; |
2364 | 2364 | $node = node_load($nid); |
@@ -2408,11 +2408,11 @@ discard block |
||
2408 | 2408 | // privatemsg module. We need to convert them back to spaces for the |
2409 | 2409 | // check below. |
2410 | 2410 | $boincname = preg_replace("/\\xc2\\xa0/", " ", $boincname); |
2411 | - if ($drupalid>0) { |
|
2411 | + if ($drupalid > 0) { |
|
2412 | 2412 | if ($recipient = user_load(array('uid' => $drupalid))) { |
2413 | 2413 | // Double-check that the loaded user matches both boincuser_id |
2414 | 2414 | // and boincuser_name. |
2415 | - if ( ($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name) ) { |
|
2415 | + if (($boincid == $recipient->boincuser_id) AND ($boincname == $recipient->boincuser_name)) { |
|
2416 | 2416 | return $recipient; |
2417 | 2417 | } |
2418 | 2418 | } |
@@ -141,12 +141,12 @@ discard block |
||
141 | 141 | // prefix for links; needed for pages not in top dir |
142 | 142 | $user, |
143 | 143 | // logged-in user, if any |
144 | - $fixed=false, |
|
144 | + $fixed = false, |
|
145 | 145 | // if true, navbar is fixed at top of page. |
146 | 146 | // NOTE: if you do this, you must set a global var $fixed_navbar |
147 | 147 | // to true at compile time |
148 | 148 | // (it needs to be set when page_head() is called). |
149 | - $inverse=false |
|
149 | + $inverse = false |
|
150 | 150 | // white on black? |
151 | 151 | ) { |
152 | 152 | global $master_url; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | // output a panel. |
216 | 216 | // $content_func is a function that generates the panel contents |
217 | 217 | // |
218 | -function panel($title, $content_func, $class="panel-primary", $body_class="") { |
|
218 | +function panel($title, $content_func, $class = "panel-primary", $body_class = "") { |
|
219 | 219 | echo sprintf('<div class="panel %s"> |
220 | 220 | ', $class |
221 | 221 | ); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | // $left_width is the width of left column in 1/12 units. |
243 | 243 | // $arg is passed to the functions. |
244 | 244 | // |
245 | -function grid($top_func, $left_func, $right_func, $left_width=6, $arg=null) { |
|
245 | +function grid($top_func, $left_func, $right_func, $left_width = 6, $arg = null) { |
|
246 | 246 | echo ' |
247 | 247 | <div class="container-fluid"> |
248 | 248 | '; |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | </div> |
258 | 258 | '; |
259 | 259 | } |
260 | - $right_width = 12-$left_width; |
|
260 | + $right_width = 12 - $left_width; |
|
261 | 261 | echo ' |
262 | 262 | <div class="row"> |
263 | 263 | <div class="col-sm-'.$left_width.'"> |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | // use extra = "name=x" |
282 | 282 | // call forum_focus(x, foo) after defining the field |
283 | 283 | // |
284 | -function form_start($action, $method='get', $extra='') { |
|
284 | +function form_start($action, $method = 'get', $extra = '') { |
|
285 | 285 | echo sprintf( |
286 | 286 | '<div class="container-fluid"> |
287 | 287 | <form class="form-horizontal" method="%s" action="%s" %s>' |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | // just the input field |
314 | 314 | // |
315 | 315 | function form_input_text_field( |
316 | - $name, $value='', $type='text', $attrs='', $extra='' |
|
316 | + $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
317 | 317 | ) { |
318 | 318 | return sprintf( |
319 | 319 | '<input %s type="%s" class="form-control" name="%s" value="%s">%s', |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | // the whole row |
325 | 325 | // |
326 | 326 | function form_input_text( |
327 | - $label, $name, $value='', $type='text', $attrs='', $extra='' |
|
327 | + $label, $name, $value = '', $type = 'text', $attrs = '', $extra = '' |
|
328 | 328 | ) { |
329 | 329 | echo sprintf(' |
330 | 330 | <div class="form-group"> |
@@ -352,7 +352,7 @@ discard block |
||
352 | 352 | ); |
353 | 353 | } |
354 | 354 | |
355 | -function form_input_textarea($label, $name, $value='', $nrows=4) { |
|
355 | +function form_input_textarea($label, $name, $value = '', $nrows = 4) { |
|
356 | 356 | echo sprintf(' |
357 | 357 | <div class="form-group"> |
358 | 358 | <label align=right class="%s" for="%s">%s</label> |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | // $items is either a string of <option> elements, or an array |
370 | 370 | // |
371 | -function form_select($label, $name, $items, $selected=null) { |
|
371 | +function form_select($label, $name, $items, $selected = null) { |
|
372 | 372 | echo sprintf(' |
373 | 373 | <div class="form-group"> |
374 | 374 | <label align=right class="%s" for="%s">%s</label> |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | foreach ($items as $i) { |
382 | 382 | echo sprintf( |
383 | 383 | '<option %s value=%s>%s</option>', |
384 | - ($i[0]==$selected)?'selected':'', |
|
384 | + ($i[0] == $selected) ? 'selected' : '', |
|
385 | 385 | $i[0], $i[1] |
386 | 386 | ); |
387 | 387 | } |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | // same, for multiple select. |
395 | 395 | // $selected, if non-null, is a list of selected values |
396 | 396 | // |
397 | -function form_select_multiple($label, $name, $items, $selected=null) { |
|
397 | +function form_select_multiple($label, $name, $items, $selected = null) { |
|
398 | 398 | echo sprintf(' |
399 | 399 | <div class="form-group"> |
400 | 400 | <label align=right class="%s" for="%s">%s</label> |
@@ -406,7 +406,7 @@ discard block |
||
406 | 406 | foreach ($items as $i) { |
407 | 407 | echo sprintf( |
408 | 408 | '<option %s value=%s>%s</option>', |
409 | - ($selected && in_array($i[0], $selected))?'selected':'', |
|
409 | + ($selected && in_array($i[0], $selected)) ? 'selected' : '', |
|
410 | 410 | $i[0], $i[1] |
411 | 411 | ); |
412 | 412 | } |
@@ -415,12 +415,12 @@ discard block |
||
415 | 415 | |
416 | 416 | // return a list of string for checkbox items |
417 | 417 | // |
418 | -function checkbox_item_strings($items, $attrs='') { |
|
418 | +function checkbox_item_strings($items, $attrs = '') { |
|
419 | 419 | $x = []; |
420 | 420 | foreach ($items as $i) { |
421 | 421 | $x[] = sprintf('<input %s type="checkbox" name="%s" %s> %s |
422 | 422 | ', |
423 | - $attrs, $i[0], $i[2]?"checked":"", $i[1] |
|
423 | + $attrs, $i[0], $i[2] ? "checked" : "", $i[1] |
|
424 | 424 | ); |
425 | 425 | } |
426 | 426 | return $x; |
@@ -428,7 +428,7 @@ discard block |
||
428 | 428 | |
429 | 429 | // $items is list of (name, label, checked) |
430 | 430 | // |
431 | -function form_checkboxes($label, $items, $attrs='') { |
|
431 | +function form_checkboxes($label, $items, $attrs = '') { |
|
432 | 432 | echo sprintf(' |
433 | 433 | <div class="form-group"> |
434 | 434 | <label align=right class="%s">%s</label> |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | FORM_LEFT_CLASS, $label, FORM_RIGHT_CLASS |
455 | 455 | ); |
456 | 456 | foreach ($items as $i) { |
457 | - $checked = ($selected == $i[0])?"checked":""; |
|
457 | + $checked = ($selected == $i[0]) ? "checked" : ""; |
|
458 | 458 | echo sprintf('<input type="radio" name="%s" value="%s" %s> %s <br> |
459 | 459 | ', |
460 | 460 | $name, $i[0], $checked, $i[1] |
@@ -487,7 +487,7 @@ discard block |
||
487 | 487 | '; |
488 | 488 | } |
489 | 489 | |
490 | -function form_submit($text, $attrs='') { |
|
490 | +function form_submit($text, $attrs = '') { |
|
491 | 491 | form_general( |
492 | 492 | "", |
493 | 493 | sprintf( |
@@ -497,11 +497,11 @@ discard block |
||
497 | 497 | ); |
498 | 498 | } |
499 | 499 | |
500 | -function form_checkbox($label, $name, $checked=false) { |
|
500 | +function form_checkbox($label, $name, $checked = false) { |
|
501 | 501 | echo sprintf(' |
502 | 502 | <div class="form-group"> |
503 | 503 | <input type="checkbox" name="%s" %s> <span class="lead">%s</span> |
504 | 504 | </div> |
505 | - ', $name, $checked?"checked":"", $label |
|
505 | + ', $name, $checked ? "checked" : "", $label |
|
506 | 506 | ); |
507 | 507 | } |
@@ -56,18 +56,18 @@ discard block |
||
56 | 56 | </select>"); |
57 | 57 | |
58 | 58 | $forumid = null; |
59 | -if (get_str("forumid",true)){ |
|
59 | +if (get_str("forumid", true)) { |
|
60 | 60 | $forumid = get_str("forumid"); |
61 | 61 | } |
62 | -$forumlist="<option value=\"-1\">".tra("All")."</option>"; |
|
62 | +$forumlist = "<option value=\"-1\">".tra("All")."</option>"; |
|
63 | 63 | $categories = BoincCategory::enum(); |
64 | 64 | foreach ($categories as $category) { |
65 | 65 | $forums = BoincForum::enum("parent_type=0 and category=$category->id"); |
66 | 66 | foreach ($forums as $forum) { |
67 | - if ($forum->id==$forumid){ |
|
68 | - $forumlist.="<option selected value=\"".$forum->id."\">".$forum->title."</option>"; |
|
67 | + if ($forum->id == $forumid) { |
|
68 | + $forumlist .= "<option selected value=\"".$forum->id."\">".$forum->title."</option>"; |
|
69 | 69 | } else { |
70 | - $forumlist.="<option value=\"".$forum->id."\">".$forum->title."</option>"; |
|
70 | + $forumlist .= "<option value=\"".$forum->id."\">".$forum->title."</option>"; |
|
71 | 71 | } |
72 | 72 | } |
73 | 73 | } |
@@ -76,11 +76,11 @@ discard block |
||
76 | 76 | '<select class="form-control" name="search_forum">'.$forumlist.'</select'); |
77 | 77 | |
78 | 78 | $sortlist = null; |
79 | -foreach ($thread_sort_styles as $id => $style){ |
|
80 | - if ($id == CREATE_TIME_NEW){ |
|
81 | - $sortlist.="<option selected value=\"".$id."\">".$style."</option>"; |
|
79 | +foreach ($thread_sort_styles as $id => $style) { |
|
80 | + if ($id == CREATE_TIME_NEW) { |
|
81 | + $sortlist .= "<option selected value=\"".$id."\">".$style."</option>"; |
|
82 | 82 | } else { |
83 | - $sortlist.="<option value=\"".$id."\">".$style."</option>"; |
|
83 | + $sortlist .= "<option value=\"".$id."\">".$style."</option>"; |
|
84 | 84 | } |
85 | 85 | } |
86 | 86 | row2(tra("Sort by"), |
@@ -98,5 +98,5 @@ discard block |
||
98 | 98 | |
99 | 99 | page_tail(); |
100 | 100 | |
101 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
101 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
102 | 102 | ?> |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | // they've participated in |
34 | 34 | // |
35 | 35 | function get_other_projects($user) { |
36 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
36 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
37 | 37 | $url = "http://boinc.netsoft-online.com/get_user.php?cpid=".$cpid; |
38 | 38 | |
39 | 39 | // Check the cache for that URL |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | usort($user->projects, "cmp"); |
123 | 123 | if ($personal) { |
124 | - $t = tra("Projects in which you are participating"); |
|
124 | + $t = tra("Projects in which you are participating"); |
|
125 | 125 | } else { |
126 | 126 | $t = tra("Projects in which %1 is participating", $user->name); |
127 | 127 | } |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | } |
181 | 181 | |
182 | 182 | if (!NO_STATS) { |
183 | - $cpid = md5($user->cross_project_id . $user->email_addr); |
|
183 | + $cpid = md5($user->cross_project_id.$user->email_addr); |
|
184 | 184 | $x = ""; |
185 | 185 | shuffle($cpid_stats_sites); |
186 | 186 | foreach ($cpid_stats_sites as $site) { |
@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $u = normalize_user_url($user->url); |
265 | 265 | row2( |
266 | 266 | tra("URL"), |
267 | - $u?sprintf('<a href="%s">%s</a>', $u, $u):tra('Invalid URL') |
|
267 | + $u ?sprintf('<a href="%s">%s</a>', $u, $u) : tra('Invalid URL') |
|
268 | 268 | ); |
269 | 269 | } |
270 | 270 | if (USER_COUNTRY) { |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | // if $badge_height is > 0, show badges |
376 | 376 | // if $name_limit, limit name to N chars |
377 | 377 | // |
378 | -function user_links($user, $badge_height=0, $name_limit=0) { |
|
378 | +function user_links($user, $badge_height = 0, $name_limit = 0) { |
|
379 | 379 | if (!$user) { |
380 | 380 | error_log("user_links(): null arg\n"); |
381 | 381 | return; |
@@ -407,13 +407,13 @@ discard block |
||
407 | 407 | $user->id, |
408 | 408 | $name |
409 | 409 | ); |
410 | - if (function_exists("project_user_links")){ |
|
410 | + if (function_exists("project_user_links")) { |
|
411 | 411 | $x .= project_user_links($user); |
412 | 412 | } |
413 | 413 | if ($badge_height) { |
414 | 414 | $x .= badges_string(true, $user, $badge_height); |
415 | 415 | } |
416 | - return $name_limit?"<nobr>$x</nobr>":$x; |
|
416 | + return $name_limit ? "<nobr>$x</nobr>" : $x; |
|
417 | 417 | } |
418 | 418 | |
419 | 419 | function show_community_private($user) { |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | |
461 | 461 | // if there's a foundership request, notify the founder |
462 | 462 | // |
463 | - if ($user->id==$team->userid && $team->ping_user >0) { |
|
463 | + if ($user->id == $team->userid && $team->ping_user > 0) { |
|
464 | 464 | $x .= "<p class=\"text-danger\">".tra("(foundership change request pending)")."</p>"; |
465 | 465 | } |
466 | 466 | row2(tra("Member of team"), $x); |
@@ -484,7 +484,7 @@ discard block |
||
484 | 484 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
485 | 485 | $x = []; |
486 | 486 | if ($friends) { |
487 | - foreach($friends as $friend) { |
|
487 | + foreach ($friends as $friend) { |
|
488 | 488 | $fuser = BoincUser::lookup_id($friend->user_dest); |
489 | 489 | if (!$fuser) continue; |
490 | 490 | $x[] = friend_links($fuser); |
@@ -530,7 +530,7 @@ discard block |
||
530 | 530 | |
531 | 531 | // return an object with data to show the user's community links |
532 | 532 | // |
533 | -function get_community_links_object($user){ |
|
533 | +function get_community_links_object($user) { |
|
534 | 534 | $cache_object = new StdClass; |
535 | 535 | $cache_object->post_count = total_posts($user); |
536 | 536 | $cache_object->user = $user; |
@@ -538,7 +538,7 @@ discard block |
||
538 | 538 | $cache_object->friends = array(); |
539 | 539 | |
540 | 540 | $friends = BoincFriend::enum("user_src=$user->id and reciprocated=1"); |
541 | - foreach($friends as $friend) { |
|
541 | + foreach ($friends as $friend) { |
|
542 | 542 | $fuser = BoincUser::lookup_id($friend->user_dest); |
543 | 543 | if (!$fuser) continue; |
544 | 544 | $cache_object->friends[] = $fuser; |
@@ -548,7 +548,7 @@ discard block |
||
548 | 548 | |
549 | 549 | // show community links of another user (described by $clo) |
550 | 550 | // |
551 | -function community_links($clo, $logged_in_user){ |
|
551 | +function community_links($clo, $logged_in_user) { |
|
552 | 552 | $user = $clo->user; |
553 | 553 | if (!$user) { |
554 | 554 | error_log("community_links(): null user\n"); |
@@ -578,15 +578,15 @@ discard block |
||
578 | 578 | "<a href=\"friend.php?action=cancel_confirm&userid=$user->id\">".tra("Cancel friendship")."</a>" |
579 | 579 | ); |
580 | 580 | } else if ($friend) { |
581 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
581 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Request pending")."</a>"); |
|
582 | 582 | } else { |
583 | - row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
583 | + row2(tra("Friends"), "<a href=\"friend.php?action=add&userid=$user->id\">".tra("Add as friend")."</a>"); |
|
584 | 584 | } |
585 | 585 | } |
586 | 586 | |
587 | 587 | if ($friends) { |
588 | 588 | $x = []; |
589 | - foreach($friends as $friend) { |
|
589 | + foreach ($friends as $friend) { |
|
590 | 590 | $x[] = friend_links($friend); |
591 | 591 | } |
592 | 592 | row2(tra('Friends'), implode('<br>', $x)); |
@@ -653,6 +653,6 @@ discard block |
||
653 | 653 | } |
654 | 654 | |
655 | 655 | |
656 | -$cvs_version_tracker[]="\$Id$"; //Generated automatically - do not edit |
|
656 | +$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit |
|
657 | 657 | |
658 | 658 | ?> |