@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | } else { |
68 | 68 | sort($files); |
69 | 69 | start_table(); |
70 | - table_header("Name<br><p class=\"text-muted\">(click to view)</p>", "Modified", "Size (bytes)", "MD5", "Delete","Download"); |
|
70 | + table_header("Name<br><p class=\"text-muted\">(click to view)</p>", "Modified", "Size (bytes)", "MD5", "Delete", "Download"); |
|
71 | 71 | foreach ($files as $f) { |
72 | 72 | $path = "$dir/$f"; |
73 | 73 | list($error, $size, $md5) = sandbox_parse_link_file($path); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $s = stat($tmp_name); |
118 | 118 | $size = $s['size']; |
119 | 119 | [$exists, $elf] = sandbox_lf_exists($user, $md5); |
120 | - if (!$exists){ |
|
120 | + if (!$exists) { |
|
121 | 121 | // move file to download dir |
122 | 122 | // |
123 | 123 | $phys_path = sandbox_physical_path($user, $md5); |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | error_page("physical file is missing"); |
151 | 151 | } |
152 | 152 | $bused = sandbox_file_in_use($user, $name); |
153 | - if ($bused){ |
|
153 | + if ($bused) { |
|
154 | 154 | $notice = "<strong>$name</strong> is being used by batch(es), you can not delete it now!<br/>"; |
155 | - } else{ |
|
155 | + } else { |
|
156 | 156 | unlink("$dir/$name"); |
157 | 157 | $notice = "<strong>$name</strong> was deleted from your sandbox<br/>"; |
158 | 158 | [$exists, $elf] = sandbox_lf_exists($user, $md5); |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | if (!$action) $action = post_str('action', true); |
197 | 197 | |
198 | 198 | switch ($action) { |
199 | -case '': list_files($user,""); break; |
|
199 | +case '': list_files($user, ""); break; |
|
200 | 200 | case 'upload_file': upload_file($user); break; |
201 | 201 | case 'delete_file': delete_file($user); break; |
202 | 202 | case 'download_file': download_file($user); break; |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $s = stat($tmp_name); |
118 | 118 | $size = $s['size']; |
119 | 119 | [$exists, $elf] = sandbox_lf_exists($user, $md5); |
120 | - if (!$exists){ |
|
120 | + if (!$exists) { |
|
121 | 121 | // move file to download dir |
122 | 122 | // |
123 | 123 | $phys_path = sandbox_physical_path($user, $md5); |
@@ -150,9 +150,9 @@ discard block |
||
150 | 150 | error_page("physical file is missing"); |
151 | 151 | } |
152 | 152 | $bused = sandbox_file_in_use($user, $name); |
153 | - if ($bused){ |
|
153 | + if ($bused) { |
|
154 | 154 | $notice = "<strong>$name</strong> is being used by batch(es), you can not delete it now!<br/>"; |
155 | - } else{ |
|
155 | + } else { |
|
156 | 156 | unlink("$dir/$name"); |
157 | 157 | $notice = "<strong>$name</strong> was deleted from your sandbox<br/>"; |
158 | 158 | [$exists, $elf] = sandbox_lf_exists($user, $md5); |
@@ -23,15 +23,15 @@ |
||
23 | 23 | admin_page_head("Account Ownership Keys"); |
24 | 24 | |
25 | 25 | if (!file_exists($account_ownership_private_key_file_path)) { |
26 | - echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
26 | + echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
27 | 27 | } else { |
28 | - echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' exists.</p>"; |
|
28 | + echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' exists.</p>"; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | if (!file_exists($account_ownership_public_key_file_path)) { |
32 | - echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
32 | + echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
33 | 33 | } else { |
34 | - echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' exists.</p>"; |
|
34 | + echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' exists.</p>"; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | echo "<p>For more info see the related wiki page: <a href=\"https://github.com/BOINC/boinc/wiki/ProofOfOwnership\">ProofOfOwnership</a></p>"; |
@@ -23,15 +23,15 @@ |
||
23 | 23 | admin_page_head("Account Ownership Keys"); |
24 | 24 | |
25 | 25 | if (!file_exists($account_ownership_private_key_file_path)) { |
26 | - echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
26 | + echo "<p>The account ownership private key '".$account_ownership_private_key_file_name."' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
27 | 27 | } else { |
28 | - echo "<p>The account ownership private key '" . $account_ownership_private_key_file_name . "' exists.</p>"; |
|
28 | + echo "<p>The account ownership private key '".$account_ownership_private_key_file_name."' exists.</p>"; |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | if (!file_exists($account_ownership_public_key_file_path)) { |
32 | - echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
32 | + echo "<p>The account ownership public key '".$account_ownership_public_key_file_name."' <b>doesn't</b> exist. Please run the 'generate_account_ownership_keys.php' script from the command line in the BOINC web server ops directory.</p>"; |
|
33 | 33 | } else { |
34 | - echo "<p>The account ownership public key '" . $account_ownership_public_key_file_name . "' exists.</p>"; |
|
34 | + echo "<p>The account ownership public key '".$account_ownership_public_key_file_name."' exists.</p>"; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | echo "<p>For more info see the related wiki page: <a href=\"https://github.com/BOINC/boinc/wiki/ProofOfOwnership\">ProofOfOwnership</a></p>"; |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | // Return path of sandbox directory for the given user. |
33 | 33 | // Create dir if not present. |
34 | 34 | // |
35 | -if (!function_exists("sandbox_dir")){ |
|
35 | +if (!function_exists("sandbox_dir")) { |
|
36 | 36 | function sandbox_dir($user) { |
37 | 37 | $dir = parse_config(get_config(), "<sandbox_dir>"); |
38 | 38 | if (!$dir) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | foreach ($files as $file) { |
64 | 64 | $path = "$dir/$file"; |
65 | 65 | [$err, $file_size, $file_md5] = sandbox_parse_link_file($path); |
66 | - if (!$err){ |
|
66 | + if (!$err) { |
|
67 | 67 | if (strcmp($md5, $file_md5) == 0) { |
68 | 68 | $exist = true; |
69 | 69 | $elf = $file; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | } |
131 | 131 | $files = sandbox_file_names($user); |
132 | 132 | foreach ($files as $f) { |
133 | - if ($regexp && !preg_match("/$regexp/",$f)) continue; |
|
133 | + if ($regexp && !preg_match("/$regexp/", $f)) continue; |
|
134 | 134 | $x .= "<option value=\"$f\">$f</option>\n"; |
135 | 135 | } |
136 | 136 | $x .= "</select>\n"; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // TODO: this is a kludge. |
153 | 153 | // Should we use the job_file and batch_file_assoc tables instead? |
154 | 154 | // |
155 | -function sandbox_file_in_use($user, $file){ |
|
155 | +function sandbox_file_in_use($user, $file) { |
|
156 | 156 | $ufiles = array(); |
157 | 157 | |
158 | 158 | $pbatches = BoincBatch::enum( |
@@ -162,16 +162,16 @@ discard block |
||
162 | 162 | ); |
163 | 163 | if (!$pbatches) return false; |
164 | 164 | |
165 | - foreach ($pbatches as $batch){ |
|
166 | - $wus = BoincWorkUnit::enum("batch = $batch->id limit 1" ); |
|
167 | - if ($wus == null){ |
|
165 | + foreach ($pbatches as $batch) { |
|
166 | + $wus = BoincWorkUnit::enum("batch = $batch->id limit 1"); |
|
167 | + if ($wus == null) { |
|
168 | 168 | continue; |
169 | 169 | } |
170 | - foreach($wus as $wu){ |
|
170 | + foreach ($wus as $wu) { |
|
171 | 171 | $x = "<in>".$wu->xml_doc."</in>"; |
172 | 172 | $x = simplexml_load_string($x); |
173 | 173 | global $fanout; |
174 | - foreach($x->workunit->file_ref as $fr){ |
|
174 | + foreach ($x->workunit->file_ref as $fr) { |
|
175 | 175 | $pname = (string)$fr->file_name; |
176 | 176 | $ufiles[] = $pname; |
177 | 177 | } |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | $dir = sandbox_dir($user); |
181 | 181 | $path = $dir."/".$file; |
182 | 182 | list($err, $size, $md5) = sandbox_parse_link_file($path); |
183 | - if (!$err){ |
|
183 | + if (!$err) { |
|
184 | 184 | $f = sandbox_file_name($user, $md5); |
185 | - foreach($ufiles as $uf) { |
|
186 | - if (strcmp($f,$uf) == 0){ |
|
185 | + foreach ($ufiles as $uf) { |
|
186 | + if (strcmp($f, $uf) == 0) { |
|
187 | 187 | return true; |
188 | 188 | } |
189 | 189 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | // Return path of sandbox directory for the given user. |
33 | 33 | // Create dir if not present. |
34 | 34 | // |
35 | -if (!function_exists("sandbox_dir")){ |
|
35 | +if (!function_exists("sandbox_dir")) { |
|
36 | 36 | function sandbox_dir($user) { |
37 | 37 | $dir = parse_config(get_config(), "<sandbox_dir>"); |
38 | 38 | if (!$dir) { |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | foreach ($files as $file) { |
64 | 64 | $path = "$dir/$file"; |
65 | 65 | [$err, $file_size, $file_md5] = sandbox_parse_link_file($path); |
66 | - if (!$err){ |
|
66 | + if (!$err) { |
|
67 | 67 | if (strcmp($md5, $file_md5) == 0) { |
68 | 68 | $exist = true; |
69 | 69 | $elf = $file; |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | // TODO: this is a kludge. |
153 | 153 | // Should we use the job_file and batch_file_assoc tables instead? |
154 | 154 | // |
155 | -function sandbox_file_in_use($user, $file){ |
|
155 | +function sandbox_file_in_use($user, $file) { |
|
156 | 156 | $ufiles = array(); |
157 | 157 | |
158 | 158 | $pbatches = BoincBatch::enum( |
@@ -162,16 +162,16 @@ discard block |
||
162 | 162 | ); |
163 | 163 | if (!$pbatches) return false; |
164 | 164 | |
165 | - foreach ($pbatches as $batch){ |
|
165 | + foreach ($pbatches as $batch) { |
|
166 | 166 | $wus = BoincWorkUnit::enum("batch = $batch->id limit 1" ); |
167 | - if ($wus == null){ |
|
167 | + if ($wus == null) { |
|
168 | 168 | continue; |
169 | 169 | } |
170 | - foreach($wus as $wu){ |
|
170 | + foreach($wus as $wu) { |
|
171 | 171 | $x = "<in>".$wu->xml_doc."</in>"; |
172 | 172 | $x = simplexml_load_string($x); |
173 | 173 | global $fanout; |
174 | - foreach($x->workunit->file_ref as $fr){ |
|
174 | + foreach($x->workunit->file_ref as $fr) { |
|
175 | 175 | $pname = (string)$fr->file_name; |
176 | 176 | $ufiles[] = $pname; |
177 | 177 | } |
@@ -180,10 +180,10 @@ discard block |
||
180 | 180 | $dir = sandbox_dir($user); |
181 | 181 | $path = $dir."/".$file; |
182 | 182 | list($err, $size, $md5) = sandbox_parse_link_file($path); |
183 | - if (!$err){ |
|
183 | + if (!$err) { |
|
184 | 184 | $f = sandbox_file_name($user, $md5); |
185 | 185 | foreach($ufiles as $uf) { |
186 | - if (strcmp($f,$uf) == 0){ |
|
186 | + if (strcmp($f,$uf) == 0) { |
|
187 | 187 | return true; |
188 | 188 | } |
189 | 189 |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | } |
138 | 138 | if ($fp_total) { |
139 | - $batch->fraction_done = $fp_done / $fp_total; |
|
139 | + $batch->fraction_done = $fp_done/$fp_total; |
|
140 | 140 | } |
141 | 141 | if ($completed && $batch->state == BATCH_STATE_IN_PROGRESS) { |
142 | 142 | $batch->state = BATCH_STATE_COMPLETE; |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | // get the total size of output files of a batch |
228 | 228 | // |
229 | 229 | function batch_output_file_size($batchid) { |
230 | - $batch_td_size=0; |
|
230 | + $batch_td_size = 0; |
|
231 | 231 | $wus = BoincWorkunit::enum("batch=$batchid"); |
232 | 232 | $fanout = parse_config(get_config(), "<uldl_dir_fanout>"); |
233 | 233 | $upload_dir = parse_config(get_config(), "<upload_dir>"); |
@@ -257,7 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | function boinc_get_wu_output_files_url($user, $wu_id) { |
260 | - $auth_str = md5($user->authenticator.$wu_id); |
|
260 | + $auth_str = md5($user->authenticator.$wu_id); |
|
261 | 261 | return "get_output.php?cmd=workunit_files&wu_id=$wu_id&auth_str=$auth_str"; |
262 | 262 | } |
263 | 263 |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | if ($user->authenticator != $auth) die('bad auth'); |
52 | 52 | } |
53 | 53 | |
54 | -function do_result_aux($result, $batch, $file_num=null) { |
|
54 | +function do_result_aux($result, $batch, $file_num = null) { |
|
55 | 55 | $phys_names = get_outfile_names($result); |
56 | 56 | $log_names = get_outfile_log_names($result); |
57 | 57 | if ($file_num !== null) { |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $dir_path = "submit/$batch->id/$result->name"; |
72 | 72 | system("rm -r $dir_path"); |
73 | 73 | mkdir($dir_path); |
74 | - for ($i=0; $i<count($phys_names); $i++) { |
|
74 | + for ($i = 0; $i < count($phys_names); $i++) { |
|
75 | 75 | $cmd = sprintf('ln -s %s %s/%s', |
76 | 76 | upload_path($phys_names[$i]), |
77 | 77 | $dir_path, |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | } |
89 | 89 | } |
90 | 90 | |
91 | -function do_result($result_id, $auth, $file_num=null) { |
|
91 | +function do_result($result_id, $auth, $file_num = null) { |
|
92 | 92 | $result = BoincResult::lookup_id($result_id); |
93 | 93 | if (!$result) die("no result $result_id"); |
94 | 94 | $workunit = BoincWorkunit::lookup_id($result->workunitid); |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | system($cmd); |
136 | 136 | } else { |
137 | 137 | mkdir(sprintf('%s/%s', $dir_path, $result->name)); |
138 | - for ($i=0; $i<count($phys_names); $i++) { |
|
138 | + for ($i = 0; $i < count($phys_names); $i++) { |
|
139 | 139 | $cmd = sprintf('ln -s %s %s/%s/%s', |
140 | 140 | upload_path($phys_names[$i]), |
141 | 141 | $dir_path, |
@@ -43,10 +43,10 @@ discard block |
||
43 | 43 | credit_to_ops($credit, $ops, $unit); |
44 | 44 | |
45 | 45 | if ($bolden) { |
46 | - $lbold="[["; |
|
47 | - $rbold="]]"; |
|
46 | + $lbold = "[["; |
|
47 | + $rbold = "]]"; |
|
48 | 48 | } else { |
49 | - $lbold=""; $rbold=""; |
|
49 | + $lbold = ""; $rbold = ""; |
|
50 | 50 | } |
51 | 51 | return " $lbold$cobbs Cobblestones$rbold of computation ($ops $unit floating-point operations)"; |
52 | 52 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | // |
87 | 87 | function show_share_buttons() { |
88 | 88 | echo '<p>'; |
89 | - $current_url = (empty($_SERVER['HTTPS']) ? 'http' : 'https') . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; |
|
89 | + $current_url = (empty($_SERVER['HTTPS']) ? 'http' : 'https')."://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; |
|
90 | 90 | $cert_url = urlencode($current_url); |
91 | 91 | |
92 | 92 | // Share on Facebook |
@@ -27,10 +27,10 @@ discard block |
||
27 | 27 | if (DISABLE_TEAMS) error_page("Teams are disabled"); |
28 | 28 | |
29 | 29 | $border = get_str("border", true); |
30 | -if ($border=="no") { |
|
31 | - $border=0; |
|
30 | +if ($border == "no") { |
|
31 | + $border = 0; |
|
32 | 32 | } else { |
33 | - $border=8; |
|
33 | + $border = 8; |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | // Make sure user_id is in the URL so that share functions work |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | if (!$user_id) { |
40 | 40 | $user = get_logged_in_user(); |
41 | 41 | Header(sprintf('Location: %s/cert_team.php?user_id=%d%s', |
42 | - url_base(), $user->id, $border==0?'&border=no':'' |
|
42 | + url_base(), $user->id, $border == 0 ? '&border=no' : '' |
|
43 | 43 | )); |
44 | 44 | exit; |
45 | 45 | } |
@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | require_once("../inc/cert.inc"); |
25 | 25 | |
26 | 26 | $border = get_str("border", true); |
27 | -if ($border=="no") { |
|
28 | - $border=0; |
|
27 | +if ($border == "no") { |
|
28 | + $border = 0; |
|
29 | 29 | } else { |
30 | - $border=8; |
|
30 | + $border = 8; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | // Make sure user_id is in the URL so that share functions work |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | if (!$user_id) { |
37 | 37 | $user = get_logged_in_user(); |
38 | 38 | Header(sprintf('Location: %s/cert1.php?user_id=%d%s', |
39 | - url_base(), $user->id, $border==0?'&border=no':'' |
|
39 | + url_base(), $user->id, $border == 0 ? '&border=no' : '' |
|
40 | 40 | )); |
41 | 41 | exit; |
42 | 42 | } |
@@ -25,10 +25,10 @@ discard block |
||
25 | 25 | require_once("../inc/user.inc"); |
26 | 26 | |
27 | 27 | $border = get_str("border", true); |
28 | -if ($border=="no") { |
|
29 | - $border=0; |
|
28 | +if ($border == "no") { |
|
29 | + $border = 0; |
|
30 | 30 | } else { |
31 | - $border=8; |
|
31 | + $border = 8; |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | // Make sure user_id is in the URL so that share functions work |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | if (!$user_id) { |
38 | 38 | $user = get_logged_in_user(); |
39 | 39 | Header(sprintf('Location: %s/cert_all.php?user_id=%d%s', |
40 | - url_base(), $user->id, $border==0?'&border=no':'' |
|
40 | + url_base(), $user->id, $border == 0 ? '&border=no' : '' |
|
41 | 41 | )); |
42 | 42 | exit; |
43 | 43 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | <tr><th align=left>Project</th><th align=left>Cobblestones</th><th align=left>Joined</th></tr> |
92 | 92 | "; |
93 | 93 | foreach ($user->projects as $p) { |
94 | - if ($p->total_credit<100) continue; |
|
94 | + if ($p->total_credit < 100) continue; |
|
95 | 95 | show_proj($p); |
96 | 96 | } |
97 | 97 | echo " |