Passed
Push — dpa_warnings3 ( 07faf2...85d2bf )
by David
19:22 queued 09:32
created
html/inc/cache.inc 2 patches
Spacing   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -32,8 +32,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 false;
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 
108 108
 // check cache size every once in a while, purge if too big
109 109
 //
110
-function cache_check_diskspace(){
110
+function cache_check_diskspace() {
111 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,
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
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
 
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
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 false;
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
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,7 +188,7 @@  discard block
 block discarded – undo
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
             //
@@ -228,7 +228,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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";
Please login to merge, or discard this patch.
html/user/submit.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
     if ($owner) {
552 552
         row2('submitter', $owner->name);
553 553
     }
554
-    row2("application", $app?$app->name:'---');
554
+    row2("application", $app ? $app->name : '---');
555 555
     row2("state", batch_state_string($batch->state));
556 556
     //row2("# jobs", $batch->njobs);
557 557
     //row2("# error jobs", $batch->nerror_jobs);
@@ -610,9 +610,9 @@  discard block
 block discarded – undo
610 610
         "status"
611 611
     ];
612 612
     row_heading_array($x);
613
-    foreach($wus as $wu) {
613
+    foreach ($wus as $wu) {
614 614
         $y = '';
615
-        switch($wu->status) {
615
+        switch ($wu->status) {
616 616
         case WU_SUCCESS:
617 617
             $resultid = $wu->canonical_resultid;
618 618
             $y = sprintf('<font color="%s">completed</font>', COLOR_SUCCESS);
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
     $results = BoincResult::enum("workunitid=$wuid");
689 689
     $upload_dir = parse_config(get_config(), "<upload_dir>");
690 690
     $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
691
-    foreach($results as $result) {
691
+    foreach ($results as $result) {
692 692
         $x = [
693 693
             "<a href=result.php?resultid=$result->id>$result->id</a>",
694 694
             state_string($result)
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
         if ($result->server_state == RESULT_SERVER_STATE_OVER) {
698 698
             $phys_names = get_outfile_phys_names($result);
699 699
             $log_names = get_outfile_log_names($result);
700
-            for ($i=0; $i<count($phys_names); $i++) {
700
+            for ($i = 0; $i < count($phys_names); $i++) {
701 701
                 if ($is_assim_move) {
702 702
                     // file is in
703 703
                     // project/results/<batchid>/<wu_name>__file_<log_name>
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -541,7 +541,7 @@  discard block
 block discarded – undo
541 541
 
542 542
     $is_assim_move = is_assim_move($app);
543 543
 
544
-    page_head("Batch $batch_id");
544
+    page_head("batch $batch_id");
545 545
     text_start(800);
546 546
     start_table();
547 547
     row2("name", $batch->name);
@@ -817,7 +817,7 @@  discard block
 block discarded – undo
817 817
 
818 818
     if (get_int('confirmed', true)) {
819 819
         retire_batch($batch);
820
-        page_head("Batch $batch_id retired");
820
+        page_head("batch $batch_id retired");
821 821
         return_link();
822 822
         page_tail();
823 823
     } else {
Please login to merge, or discard this patch.
html/user/kw_prefs.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -93,9 +93,9 @@
 block discarded – undo
93 93
     global $job_keywords;
94 94
     $kw = $job_keywords[$id];
95 95
     $u = $uprefs[$id];
96
-    $yes_checked = ($u == KW_YES)?"checked":"";
97
-    $no_checked = ($u == KW_NO)?"checked":"";
98
-    $maybe_checked = ($u == KW_MAYBE)?"checked":"";
96
+    $yes_checked = ($u == KW_YES) ? "checked" : "";
97
+    $no_checked = ($u == KW_NO) ? "checked" : "";
98
+    $maybe_checked = ($u == KW_MAYBE) ? "checked" : "";
99 99
 
100 100
     echo sprintf('<tr id="%s" hidden>%s', "row$id", "\n");
101 101
     echo sprintf('   <td width=50%% id="%s"></td>%s', "text$id", "\n");
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -298,7 +298,7 @@
 block discarded – undo
298 298
 
299 299
     render();
300 300
 
301
-EOT;
301
+eot;
302 302
     echo "</script>\n";
303 303
 }
304 304
 
Please login to merge, or discard this patch.
html/user/manage_project.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
             $app = BoincApp::lookup_id($ua->app_id);
39 39
             $names[] = $app->name;
40 40
         }
41
-        $sub = $names?implode(', ', $names):'---';
41
+        $sub = $names ?implode(', ', $names) : '---';
42 42
     }
43 43
     if ($u->manage_all) {
44 44
         $admin = 'All applications';
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
             $app = BoincApp::lookup_id($ua->app_id);
50 50
             $names[] = $app->name;
51 51
         }
52
-        $admin = $names?implode(', ', $names):'---';
52
+        $admin = $names ?implode(', ', $names) : '---';
53 53
     }
54 54
     [$yes, $no] = read_kw_prefs($user);
55 55
     global $job_keywords;
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
         implode('<br>', $kws),
70 70
         $u->quota,
71 71
         $u->max_jobs_in_progress,
72
-        ($u->logical_start_time > time())?local_time_str($u->logical_start_time):'---'
72
+        ($u->logical_start_time > time()) ?local_time_str($u->logical_start_time) : '---'
73 73
     );
74 74
 }
75 75
 
@@ -199,18 +199,18 @@  discard block
 block discarded – undo
199 199
     $manage_apps = array_map('intval', $manage_apps);
200 200
     foreach ($apps as $app) {
201 201
         $s = in_array($app->id, $submit_apps);
202
-        $m = in_array($app->id, $manage_apps)?1:0;
202
+        $m = in_array($app->id, $manage_apps) ? 1 : 0;
203 203
         if ($s || $m) {
204 204
             BoincUserSubmitApp::insert(
205 205
                 "(user_id, app_id, manage) values ($user_id, $app->id, $m)"
206 206
             );
207 207
         }
208 208
     }
209
-    $quota = (double) get_str('quota');
209
+    $quota = (double)get_str('quota');
210 210
     if ($quota != $us->quota) {
211 211
         $us->update("quota=$quota");
212 212
     }
213
-    $mj = (int) get_str('max_jobs_in_progress');
213
+    $mj = (int)get_str('max_jobs_in_progress');
214 214
     if ($mj != $us->max_jobs_in_progress) {
215 215
         $us->update("max_jobs_in_progress=$mj");
216 216
     }
Please login to merge, or discard this patch.
html/inc/kw_prefs.inc 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -31,14 +31,14 @@
 block discarded – undo
31 31
     if (file_exists($path)) {
32 32
         $x = file($path);
33 33
         $yes = explode(' ', trim($x[0]));
34
-        if ($yes[0]=='') $yes=[];
34
+        if ($yes[0] == '') $yes = [];
35 35
         $yes = array_map('intval', $yes);
36 36
         $no = explode(' ', trim($x[1]));
37
-        if ($no[0]=='') $no=[];
37
+        if ($no[0] == '') $no = [];
38 38
         $no = array_map('intval', $no);
39 39
         return [$yes, $no];
40 40
     } else {
41
-        return [[],[]];
41
+        return [[], []];
42 42
     }
43 43
 }
44 44
 
Please login to merge, or discard this patch.
html/user/submit_rpc_handler.php 1 patch
Spacing   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 function validate_batch($jobs, $template) {
146 146
     $i = 0;
147 147
     $n = count($template->file_info);
148
-    foreach($jobs as $job) {
148
+    foreach ($jobs as $job) {
149 149
         $m = count($job->input_files);
150 150
         if ($n != $m) {
151 151
             log_write("wrong # of input files for job $i: need $n, got $m");
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 // stage all the files
215 215
 //
216 216
 function stage_files(&$jobs, $user) {
217
-    foreach($jobs as $job) {
217
+    foreach ($jobs as $job) {
218 218
         foreach ($job->input_files as $file) {
219 219
             if ($file->mode != "remote") {
220 220
                 $file->name = stage_file($file, $user);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
 //
228 228
 function submit_jobs(
229 229
     $jobs, $job_params, $app, $batch_id, $priority, $app_version_num,
230
-    $input_template_filename,        // batch-level; can also specify per job
230
+    $input_template_filename, // batch-level; can also specify per job
231 231
     $output_template_filename,
232 232
     $user
233 233
 ) {
@@ -237,7 +237,7 @@  discard block
 block discarded – undo
237 237
     // one line per job
238 238
     //
239 239
     $x = "";
240
-    foreach($jobs as $job) {
240
+    foreach ($jobs as $job) {
241 241
         if ($job->name) {
242 242
             $x .= " --wu_name $job->name";
243 243
         }
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
         $x .= "\n";
273 273
     }
274 274
 
275
-    $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id";
275
+    $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id";
276 276
 
277 277
     if ($user->seti_id) {
278 278
         $cmd .= " --target_user $user->id ";
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
 //
384 384
 function xml_get_jobs($r) {
385 385
     $jobs = array();
386
-    foreach($r->batch->job as $j) {
386
+    foreach ($r->batch->job as $j) {
387 387
         $job = new StdClass;
388 388
         $job->input_files = array();
389 389
         $job->command_line = (string)$j->command_line;
@@ -436,16 +436,16 @@  discard block
 block discarded – undo
436 436
 //
437 437
 function logical_end_time($r, $jobs, $user, $app) {
438 438
     $total_flops = 0;
439
-    foreach($jobs as $job) {
439
+    foreach ($jobs as $job) {
440 440
         //print_r($job);
441 441
         if ($job->rsc_fpops_est) {
442 442
             $total_flops += $job->rsc_fpops_est;
443 443
         } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) {
444
-            $total_flops += (double) $job->input_template->workunit->rsc_fpops_est;
444
+            $total_flops += (double)$job->input_template->workunit->rsc_fpops_est;
445 445
         } else if ($r->batch->job_params->rsc_fpops_est) {
446
-            $total_flops += (double) $r->batch->job_params->rsc_fpops_est;
446
+            $total_flops += (double)$r->batch->job_params->rsc_fpops_est;
447 447
         } else {
448
-            $x = (double) $template->workunit->rsc_fpops_est;
448
+            $x = (double)$template->workunit->rsc_fpops_est;
449 449
             if ($x) {
450 450
                 $total_flops += $x;
451 451
             } else {
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
             }
454 454
         }
455 455
     }
456
-    $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name";
456
+    $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name";
457 457
     $x = exec($cmd);
458 458
     if (!is_numeric($x) || (double)$x == 0) {
459 459
         xml_error(-1, "$cmd returned $x");
@@ -538,15 +538,15 @@  discard block
 block discarded – undo
538 538
     }
539 539
 
540 540
     $job_params = new StdClass;
541
-    $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound;
542
-    $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est;
543
-    $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound;
544
-    $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound;
545
-    $job_params->delay_bound = (double) $r->batch->job_params->delay_bound;
541
+    $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound;
542
+    $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est;
543
+    $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound;
544
+    $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound;
545
+    $job_params->delay_bound = (double)$r->batch->job_params->delay_bound;
546 546
         // could add quorum-related stuff
547 547
 
548
-    $input_template_filename = (string) $r->batch->input_template_filename;
549
-    $output_template_filename = (string) $r->batch->output_template_filename;
548
+    $input_template_filename = (string)$r->batch->input_template_filename;
549
+    $output_template_filename = (string)$r->batch->output_template_filename;
550 550
         // possibly empty
551 551
 
552 552
     submit_jobs(
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 }
640 640
 
641 641
 function n_outfiles($wu) {
642
-    $path = project_dir() . "/$wu->output_template_filename";
642
+    $path = project_dir()."/$wu->output_template_filename";
643 643
     $r = simplexml_load_file($path);
644 644
     return count($r->file_info);
645 645
 }
@@ -846,7 +846,7 @@  discard block
 block discarded – undo
846 846
 ";
847 847
         if ($result->server_state == 5) {   // over?
848 848
             $paths = get_outfile_paths($result);
849
-            foreach($paths as $path) {
849
+            foreach ($paths as $path) {
850 850
                 if (is_file($path)) {
851 851
                     $size = filesize($path);
852 852
                     echo "        <outfile>
@@ -890,7 +890,7 @@  discard block
 block discarded – undo
890 890
     } else {
891 891
         $results = BoincResult::enum("workunitid=$job_id");
892 892
         foreach ($results as $r) {
893
-            switch($r->outcome) {
893
+            switch ($r->outcome) {
894 894
             case 1:
895 895
             case 3:
896 896
             case 6:
@@ -1005,8 +1005,8 @@  discard block
 block discarded – undo
1005 1005
     }
1006 1006
 
1007 1007
     $user = check_remote_submit_permissions($r, $app);
1008
-    $in = file_get_contents(project_dir() . "/templates/".$app->name."_in");
1009
-    $out = file_get_contents(project_dir() . "/templates/".$app->name."_out");
1008
+    $in = file_get_contents(project_dir()."/templates/".$app->name."_in");
1009
+    $out = file_get_contents(project_dir()."/templates/".$app->name."_out");
1010 1010
     if ($in === false || $out === false) {
1011 1011
         log_write("template file missing");
1012 1012
         xml_error(-1, "template file missing");
@@ -1018,7 +1018,7 @@  discard block
 block discarded – undo
1018 1018
 
1019 1019
 function ping($r) {
1020 1020
     xml_start_tag("ping");
1021
-    BoincDb::get();     // errors out if DB down or web disabled
1021
+    BoincDb::get(); // errors out if DB down or web disabled
1022 1022
     echo "<success>1</success>
1023 1023
         </ping>
1024 1024
     ";
@@ -1092,9 +1092,9 @@  discard block
 block discarded – undo
1092 1092
 $request_log = parse_config(get_config(), "<remote_submit_request_log>");
1093 1093
 if ($request_log) {
1094 1094
     $log_dir = parse_config(get_config(), "<log_dir>");
1095
-    $request_log = $log_dir . "/" . $request_log;
1095
+    $request_log = $log_dir."/".$request_log;
1096 1096
     if ($file = fopen($request_log, "a")) {
1097
-        fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $req . "\n</submit_rpc_handler>\n");
1097
+        fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$req."\n</submit_rpc_handler>\n");
1098 1098
         fclose($file);
1099 1099
     }
1100 1100
 }
Please login to merge, or discard this patch.
html/inc/submit_util.inc 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
     foreach ($res_in_prog as $res) {
180 180
         $wus_in_prog[$res->workunitid] = true;
181 181
     }
182
-    unset($res_in_progress);    // does this do anything?
182
+    unset($res_in_progress); // does this do anything?
183 183
 
184 184
     $fp_total = 0;
185 185
     $fp_done = 0;
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 // get the total size of output files of a batch
353 353
 //
354 354
 function batch_output_file_size($batchid) {
355
-    $batch_td_size=0;
355
+    $batch_td_size = 0;
356 356
     $wus = BoincWorkunit::enum_fields(
357 357
         'canonical_resultid',
358 358
         "batch=$batchid"
@@ -385,7 +385,7 @@  discard block
 block discarded – undo
385 385
 }
386 386
 
387 387
 function boinc_get_wu_output_files_url($user, $wu_id) {
388
-    $auth_str =  md5($user->authenticator.$wu_id);
388
+    $auth_str = md5($user->authenticator.$wu_id);
389 389
     return "get_output.php?cmd=workunit_files&wu_id=$wu_id&auth_str=$auth_str";
390 390
 }
391 391
 
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
     if (!file_exists($path)) return null;
420 420
     $x = file_get_contents($path);
421 421
     $n = sscanf($x, "%s %d", $md5, $size);
422
-    if ($n != 2 || strlen($md5)!=32) {
422
+    if ($n != 2 || strlen($md5) != 32) {
423 423
         return null;
424 424
     }
425 425
     return [$md5, $size];
Please login to merge, or discard this patch.
html/user/buda_submit.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 //
86 86
 function unzip_batch_file($user, $batch_file) {
87 87
     @mkdir("../../buda_batches");
88
-    for ($i=0; $i<1000; $i++) {
88
+    for ($i = 0; $i < 1000; $i++) {
89 89
         $batch_dir = "../../buda_batches/$i";
90 90
         $batch_dir_name = $i;
91 91
         $ret = @mkdir($batch_dir);
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
         }
137 137
         $job_files = [];
138 138
         $cmdline = '';
139
-        foreach(scandir("$batch_dir/$fname") as $f2) {
139
+        foreach (scandir("$batch_dir/$fname") as $f2) {
140 140
             if ($f2[0] == '.') continue;
141 141
             if ($f2 == 'cmdline') {
142 142
                 $cmdline = trim(file_get_contents("$batch_dir/$fname/cmdline"));
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
 function stage_input_files($batch_dir, $batch_desc, $batch_id) {
187 187
     $n = count($batch_desc->shared_files);
188 188
     $batch_desc->shared_files_phys_names = [];
189
-    for ($i=0; $i<$n; $i++) {
189
+    for ($i = 0; $i < $n; $i++) {
190 190
         $path = sprintf('%s/%s', $batch_dir, $batch_desc->shared_files[$i]);
191 191
         [$md5, $size] = $batch_desc->shared_file_infos[$i];
192 192
         $phys_name = sprintf('batch_%d_%s', $batch_id, $md5);
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
     foreach ($batch_desc->jobs as $job) {
197 197
         $n = count($batch_desc->unshared_files);
198 198
         $job->phys_names = [];
199
-        for ($i=0; $i<$n; $i++) {
199
+        for ($i = 0; $i < $n; $i++) {
200 200
             $path = sprintf('%s/%s/%s',
201 201
                 $batch_dir, $job->dir, $batch_desc->unshared_files[$i]
202 202
             );
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
     }
246 246
     $wrapper_cmdline = sprintf('"--dockerfile %s %s %s"',
247 247
         $variant_desc->dockerfile,
248
-        $wrapper_verbose?'--verbose':'',
248
+        $wrapper_verbose ? '--verbose' : '',
249 249
         $cmdline
250 250
     );
251 251
     $cmd = sprintf(
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
     $max_runtime_days = (double)$max_runtime_days;
295 295
     if ($max_runtime_days <= 0) error_page('bad runtime limit');
296 296
     if ($max_runtime_days > 100) error_page('bad runtime limit');
297
-    $max_fpops = $max_runtime_days * 4.3e9 * 86400;
297
+    $max_fpops = $max_runtime_days*4.3e9*86400;
298 298
 
299 299
     $exp_runtime_days = get_str('exp_runtime_days');
300 300
     if (!is_numeric($exp_runtime_days)) error_page('bad expected runtime');
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
     if ($exp_runtime_days > $max_runtime_days) {
305 305
         error_page('exp must be < max runtime');
306 306
     }
307
-    $exp_fpops = $exp_runtime_days * 4.3e9 * 86400;
307
+    $exp_fpops = $exp_runtime_days*4.3e9*86400;
308 308
 
309 309
     $app_desc = get_buda_desc($app);
310 310
 
Please login to merge, or discard this patch.