Passed
Push — master ( 57e0bd...949aa5 )
by
unknown
16:34 queued 06:25
created
html/user/forum_moderate_post.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
 start_table();
50 50
 
51 51
 $get_reason = true;
52
-if (get_str('action')=="hide") {
52
+if (get_str('action') == "hide") {
53 53
     //display input that selects reason
54 54
     echo "<input type=hidden name=action value=hide>";
55 55
     row1(tra("Hide post"));
@@ -66,12 +66,12 @@  discard block
 block discarded – undo
66 66
             )
67 67
         )
68 68
     );
69
-} elseif (get_str('action')=="move") {
69
+} elseif (get_str('action') == "move") {
70 70
     row1(tra("Move post"));
71 71
     echo "<input type=hidden name=action value=move>";
72 72
     row2(tra("Destination thread ID:"), "<input name=\"threadid\">");
73 73
     // TODO: display where to move the post as a dropdown instead of having to get ID
74
-} elseif (get_str('action')=="banish_user") {
74
+} elseif (get_str('action') == "banish_user") {
75 75
     $userid = get_int('userid');
76 76
     $user = BoincUser::lookup_id($userid);
77 77
     BoincForumPrefs::lookup($user);
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         error_page("no user found");
80 80
     }
81 81
     $x = $user->prefs->banished_until;
82
-    if ($x>time()) {
82
+    if ($x > time()) {
83 83
         error_page(tra("User is already banished"));
84 84
     }
85 85
     row1(tra("Banish user"));
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
     echo "<input type=\"hidden\" name=\"id\" value=\"".$postid."\">\n";
98 98
     echo "<input type=\"hidden\" name=\"userid\" value=\"".$userid."\">\n";
99 99
     echo "<input type=\"hidden\" name=\"confirmed\" value=\"yes\">\n";
100
-} elseif (get_str('action')=="delete") {
100
+} elseif (get_str('action') == "delete") {
101 101
     echo "<input type=hidden name=action value=delete>";
102 102
     row2(
103 103
         "Are you sure want to delete this post?  This cannot be undone.",
Please login to merge, or discard this patch.
html/user/team_search.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 // where team includes a field "refcnt".
32 32
 //
33 33
 function merge_lists($list1, &$list2, $weight) {
34
-    foreach($list1 as $team) {
34
+    foreach ($list1 as $team) {
35 35
         $id = $team->id;
36 36
         if (array_key_exists($id, $list2)) {
37 37
             $list2[$id]->refcnt += $weight;
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
         if (defined("SHOW_NONVALIDATED_TEAMS")) {
98 98
             $user = BoincUser::lookup_id($team->userid);
99 99
             echo "<td>";
100
-            echo $user->email_validated?"Yes":"No";
100
+            echo $user->email_validated ? "Yes" : "No";
101 101
             echo "</td>\n";
102 102
         }
103 103
         echo "
@@ -137,7 +137,7 @@  discard block
 block discarded – undo
137 137
     xml_header();
138 138
     echo "<teams>\n";
139 139
     sort_list($list);
140
-    foreach($list as $team) {
140
+    foreach ($list as $team) {
141 141
         show_team_xml($team);
142 142
     }
143 143
     echo "</teams>\n";
@@ -164,14 +164,14 @@  discard block
 block discarded – undo
164 164
         merge_lists($list2, $list, 3);
165 165
         $tried = true;
166 166
     }
167
-    if (strlen($params->country) && $params->country!='None') {
167
+    if (strlen($params->country) && $params->country != 'None') {
168 168
         $country = BoincDb::escape_string($params->country);
169 169
         $list2 = get_teams("country = '$country'", $params->active);
170 170
         //echo "<br>country matches: ",sizeof($list2);
171 171
         merge_lists($list2, $list, 1);
172 172
         $tried = true;
173 173
     }
174
-    if ($params->type and $params->type>1) {
174
+    if ($params->type and $params->type > 1) {
175 175
         $list2 = get_teams("type=$params->type", $params->active);
176 176
         //echo "<br>type matches: ",sizeof($list2);
177 177
         merge_lists($list2, $list, 2);
Please login to merge, or discard this patch.
html/user/forum_thread_status.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@
 block discarded – undo
35 35
 }
36 36
 
37 37
 $owner = BoincUser::lookup_id($thread->owner);
38
-if ($logged_in_user->id == $owner->id){
38
+if ($logged_in_user->id == $owner->id) {
39 39
     $action = get_str("action");
40 40
     if ($action == "set") {
41 41
         $ret = $thread->update("status=1");
42 42
     } else {
43 43
         $ret = $thread->update("status=0");
44 44
     }
45
-    if (!$ret){
45
+    if (!$ret) {
46 46
         error_page("Could not update the status of the thread: ".$thread->id);
47 47
     }
48 48
 } else {
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@
 block discarded – undo
35 35
 }
36 36
 
37 37
 $owner = BoincUser::lookup_id($thread->owner);
38
-if ($logged_in_user->id == $owner->id){
38
+if ($logged_in_user->id == $owner->id) {
39 39
     $action = get_str("action");
40 40
     if ($action == "set") {
41 41
         $ret = $thread->update("status=1");
42 42
     } else {
43 43
         $ret = $thread->update("status=0");
44 44
     }
45
-    if (!$ret){
45
+    if (!$ret) {
46 46
         error_page("Could not update the status of the thread: ".$thread->id);
47 47
     }
48 48
 } else {
Please login to merge, or discard this patch.
html/user/lammps.php 4 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     $ppid=$pstatus['pid'];
36 36
     $ret=`ps -o pid --no-heading --ppid $ppid`;
37 37
     //echo "parent pid is $ppid\nterninate it\n";
38
-     proc_terminate($p);
38
+        proc_terminate($p);
39 39
     // echo "child process is $ret\n";
40 40
     $pids=preg_split('/\s+/',$ret);
41 41
     foreach($pids as $pid){
@@ -61,9 +61,9 @@  discard block
 block discarded – undo
61 61
     while (1) {
62 62
         $ctime=time();
63 63
         if($ctime-$stime >=2 and ! file_exists("log.1")){
64
-           if($GLOBALS["debug"]) echo "time out "."<br>";
65
-           terminate_job($p);
66
-           break;
64
+            if($GLOBALS["debug"]) echo "time out "."<br>";
65
+            terminate_job($p);
66
+            break;
67 67
         }
68 68
         if (file_exists("log.1")) {
69 69
             list($avg_cpu, $test_steps) = calc_step_cpu("log.1");
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
     }
113 113
     fclose($fd);
114 114
     //$total_steps = $loopno*$looprun;
115
-     if($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>";
115
+        if($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>";
116 116
     return $total_steps;
117 117
 }
118 118
 
@@ -147,12 +147,12 @@  discard block
 block discarded – undo
147 147
         $cpu = (float)$arr[2];
148 148
         //echo "step=".$step." cpu=".$cpu."\n";
149 149
         if ($cpu==0) {
150
-           $count=0;
151
-           $start_step = $step;
150
+            $count=0;
151
+            $start_step = $step;
152 152
         } else {
153 153
             $count+=1;
154 154
             if($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>";
155
-           if($count >= 10) {
155
+            if($count >= 10) {
156 156
                 $end_step = $step;
157 157
                 $steps = $end_step-$start_step;
158 158
                 $avg_cpu = $cpu/$steps;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
         if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches))
185 185
         {
186
-             if($GLOBALS["debug"]){print "matches=";print_r($matches);}
186
+                if($GLOBALS["debug"]){print "matches=";print_r($matches);}
187 187
 
188 188
             $dump_types=(int)$matches[1];
189 189
             break;
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
         echo "can not open file $cmd_file\n";
199 199
         exit(-1);
200 200
     }
201
-     if($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>";
201
+        if($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>";
202 202
 
203 203
     $loopno=1;
204 204
     $looprun=1;
@@ -216,8 +216,8 @@  discard block
 block discarded – undo
216 216
     }
217 217
     fclose($fd);
218 218
     if($GLOBALS["debug"]){
219
-         print "max loopno(number of loops to run)=".$loopno."<br>";
220
-         print "max looprun(steps for each loop)=".$looprun."<br>";
219
+            print "max loopno(number of loops to run)=".$loopno."<br>";
220
+            print "max looprun(steps for each loop)=".$looprun."<br>";
221 221
     }
222 222
     //$est_size = $loopno*$structure_file_size*0.8*$dump_types;
223 223
     $test_log_size = filesize("log.1");
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
             <br>Please refer to the following Error Message:<br><p>
369 369
         ";
370 370
         foreach($err_msgs as $line){
371
-             $err=$err.$line."<br>";
371
+                $err=$err.$line."<br>";
372 372
         }
373 373
         $err=$err." <p>
374 374
             <a href=sandbox.php><strong> File_Sandbox </strong></a>
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
     //
394 394
     $njobs = count(file($cmdline_file_path));
395 395
     $secs_est = estimated_makespan($njobs, $info->rsc_fpops_est);
396
-     if($GLOBALS["debug"])echo "secs_est is $secs_est\n";
396
+        if($GLOBALS["debug"])echo "secs_est is $secs_est\n";
397 397
     //assume the server's flops is 1.5G and the average client's flops is 1G
398 398
     $hrs_est = number_format($secs_est*1.5/60, 2);
399 399
     //$hrs_est = number_format($secs_est, 2);
Please login to merge, or discard this patch.
Braces   +19 added lines, -20 removed lines patch added patch discarded remove patch
@@ -38,8 +38,8 @@  discard block
 block discarded – undo
38 38
      proc_terminate($p);
39 39
     // echo "child process is $ret\n";
40 40
     $pids=preg_split('/\s+/',$ret);
41
-    foreach($pids as $pid){
42
-        if(is_numeric($pid)){
41
+    foreach($pids as $pid) {
42
+        if(is_numeric($pid)) {
43 43
             if($GLOBALS["debug"])echo "killing child process $pid\n";
44 44
             posix_kill($pid,9);
45 45
         }
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     $p = proc_open("$cmd", $descs, $pipes);
61 61
     while (1) {
62 62
         $ctime=time();
63
-        if($ctime-$stime >=2 and ! file_exists("log.1")){
63
+        if($ctime-$stime >=2 and ! file_exists("log.1")) {
64 64
            if($GLOBALS["debug"]) echo "time out "."<br>";
65 65
            terminate_job($p);
66 66
            break;
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
                 $steps = $end_step-$start_step;
158 158
                 $avg_cpu = $cpu/$steps;
159 159
                 #$avg_cpu = $cpu/$count;
160
-                if ($GLOBALS["debug"]){
160
+                if ($GLOBALS["debug"]) {
161 161
                     echo "test steps is ".$steps."<br>";
162 162
                     echo "avg_cpu is ".$avg_cpu."<br>";
163 163
                 }
@@ -169,20 +169,19 @@  discard block
 block discarded – undo
169 169
     return array($avg_cpu,$test_steps);
170 170
 }
171 171
 
172
-function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps){
172
+function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps) {
173 173
     $dump_types = 0;
174 174
     $fd = fopen($lammps_script,"r");
175
-    if (!$fd){
175
+    if (!$fd) {
176 176
         echo "can not open file $lammps_script\n";
177 177
         exit(-1);
178 178
     }
179
-    while (!feof($fd)){
179
+    while (!feof($fd)) {
180 180
         $line = fgets($fd, 4096);
181 181
         //if (preg_match("/^\s*dump/", $line)
182 182
         //    and preg_match_all("/dump\S+\.\w{3}/", $line, $matches, PREG_PATTERN_ORDER))
183 183
 
184
-        if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches))
185
-        {
184
+        if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches)) {
186 185
              if($GLOBALS["debug"]){print "matches=";print_r($matches);}
187 186
 
188 187
             $dump_types=(int)$matches[1];
@@ -194,7 +193,7 @@  discard block
 block discarded – undo
194 193
 
195 194
     $structure_file_size = filesize($structure_file);
196 195
     $fd = fopen($cmd_file,"r");
197
-    if (!$fd){
196
+    if (!$fd) {
198 197
         echo "can not open file $cmd_file\n";
199 198
         exit(-1);
200 199
     }
@@ -202,10 +201,10 @@  discard block
 block discarded – undo
202 201
 
203 202
     $loopno=1;
204 203
     $looprun=1;
205
-    while (!feof($fd)){
204
+    while (!feof($fd)) {
206 205
         $line = fgets($fd,4096);
207
-        if(preg_match("/loopnumber\s+\d+/", $line, $matches)){
208
-            if(preg_match("/\d+/", $matches[0], $no)){
206
+        if(preg_match("/loopnumber\s+\d+/", $line, $matches)) {
207
+            if(preg_match("/\d+/", $matches[0], $no)) {
209 208
                 //$loopno=$no[0];
210 209
                 if($no[0]>$loopno)$loopno=$no[0];
211 210
             }
@@ -215,7 +214,7 @@  discard block
 block discarded – undo
215 214
         }
216 215
     }
217 216
     fclose($fd);
218
-    if($GLOBALS["debug"]){
217
+    if($GLOBALS["debug"]) {
219 218
          print "max loopno(number of loops to run)=".$loopno."<br>";
220 219
          print "max looprun(steps for each loop)=".$looprun."<br>";
221 220
     }
@@ -231,7 +230,7 @@  discard block
 block discarded – undo
231 230
     $app_fixed_size = 5e7;
232 231
     $est_size = $log_size+$dump_size+$app_fixed_size;
233 232
 
234
-    if($GLOBALS["debug"]){
233
+    if($GLOBALS["debug"]) {
235 234
         print "test_steps=".$test_steps."<br>";
236 235
         print "test_log_size=".$test_log_size."<br>";
237 236
         print "log_size1=".$log_size1."<br>";
@@ -367,7 +366,7 @@  discard block
 block discarded – undo
367 366
         $err="Your test job <strong>failed</strong>
368 367
             <br>Please refer to the following Error Message:<br><p>
369 368
         ";
370
-        foreach($err_msgs as $line){
369
+        foreach($err_msgs as $line) {
371 370
              $err=$err.$line."<br>";
372 371
         }
373 372
         $err=$err." <p>
@@ -380,9 +379,9 @@  discard block
 block discarded – undo
380 379
     $info->rsc_fpops_est = $est_cpu_time * 1.5e9;
381 380
     $info->rsc_fpops_bound = $info->rsc_fpops_est * 20;
382 381
 
383
-    if ($disk==0){
382
+    if ($disk==0) {
384 383
         $info->rsc_disk_bound=1000000;
385
-    } else{
384
+    } else {
386 385
         $info->rsc_disk_bound = $disk;
387 386
     }
388 387
 
@@ -444,7 +443,7 @@  discard block
 block discarded – undo
444 443
 
445 444
     $njobs=0;
446 445
     $cmdlines = file($info->cmdline_file_path);
447
-    foreach ($cmdlines as $cmdline){
446
+    foreach ($cmdlines as $cmdline) {
448 447
         if (preg_match("/^\s*-var/", $cmdline)) {
449 448
             $njobs++;
450 449
         }
@@ -460,7 +459,7 @@  discard block
 block discarded – undo
460 459
 
461 460
     $i = 0;
462 461
     foreach ($cmdlines as $cmdline) {
463
-        if (preg_match("/^\s*-var/", $cmdline)){
462
+        if (preg_match("/^\s*-var/", $cmdline)) {
464 463
             submit_job($app, $batch_id, $info, $cmdline, $i);
465 464
             $i++;
466 465
         }
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -430,7 +430,7 @@
 block discarded – undo
430 430
     //echo "<br> $cmd\n";
431 431
 
432 432
     system($cmd, $ret);
433
-    if ($ret === FALSE) {
433
+    if ($ret === false) {
434 434
         error_page("can't create job");
435 435
     } else {
436 436
         header('Location: submit.php');
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
 
18 18
 display_errors();
19 19
 
20
-$debug=0;
20
+$debug = 0;
21 21
 
22 22
 // test a LAMMPS job
23 23
 //
@@ -30,17 +30,17 @@  discard block
 block discarded – undo
30 30
 // output: success flag, CPU time per step, est. disk usage per job
31 31
 //
32 32
 function terminate_job($p) {
33
-    $pstatus=proc_get_status($p);
34
-    $ppid=$pstatus['pid'];
35
-    $ret=`ps -o pid --no-heading --ppid $ppid`;
33
+    $pstatus = proc_get_status($p);
34
+    $ppid = $pstatus['pid'];
35
+    $ret = `ps -o pid --no-heading --ppid $ppid`;
36 36
     //echo "parent pid is $ppid\nterninate it\n";
37 37
      proc_terminate($p);
38 38
     // echo "child process is $ret\n";
39
-    $pids=preg_split('/\s+/',$ret);
40
-    foreach($pids as $pid){
41
-        if(is_numeric($pid)){
42
-            if($GLOBALS["debug"])echo "killing child process $pid\n";
43
-            posix_kill($pid,9);
39
+    $pids = preg_split('/\s+/', $ret);
40
+    foreach ($pids as $pid) {
41
+        if (is_numeric($pid)) {
42
+            if ($GLOBALS["debug"])echo "killing child process $pid\n";
43
+            posix_kill($pid, 9);
44 44
         }
45 45
     }
46 46
 }
@@ -51,23 +51,23 @@  discard block
 block discarded – undo
51 51
     $descs = array();
52 52
     $pipes = array();
53 53
     $options = file("cmd_variables");
54
-    $options[0] = chop($options[0],"\n");
54
+    $options[0] = chop($options[0], "\n");
55 55
     $cmd = "../lmp_linux ".$options[0]."&>output";
56 56
     if ($GLOBALS["debug"]) echo $cmd."<br>";
57 57
     system("unzip pot_files >/dev/null");
58 58
     $stime = time();
59 59
     $p = proc_open("$cmd", $descs, $pipes);
60 60
     while (1) {
61
-        $ctime=time();
62
-        if($ctime-$stime >=2 and ! file_exists("log.1")){
63
-           if($GLOBALS["debug"]) echo "time out "."<br>";
61
+        $ctime = time();
62
+        if ($ctime - $stime >= 2 and !file_exists("log.1")) {
63
+           if ($GLOBALS["debug"]) echo "time out "."<br>";
64 64
            terminate_job($p);
65 65
            break;
66 66
         }
67 67
         if (file_exists("log.1")) {
68 68
             list($avg_cpu, $test_steps) = calc_step_cpu("log.1");
69 69
             if ($avg_cpu != 0) {
70
-                if($GLOBALS["debug"])echo "avg_cpu is ".$avg_cpu."<br>";
70
+                if ($GLOBALS["debug"])echo "avg_cpu is ".$avg_cpu."<br>";
71 71
                 terminate_job($p);
72 72
                 $test_result = 1;
73 73
                 break;
@@ -86,32 +86,32 @@  discard block
 block discarded – undo
86 86
 }
87 87
 
88 88
 function get_total_steps($cmd_file) {
89
-    $fd = fopen($cmd_file,"r");
89
+    $fd = fopen($cmd_file, "r");
90 90
     if (!$fd) {
91 91
         echo "can not open file $cmd_file\n";
92 92
         exit(-1);
93 93
     }
94 94
     $this_loopno = 1;
95 95
     $this_looprun = 1;
96
-    $total_steps=1;
96
+    $total_steps = 1;
97 97
     while (!feof($fd)) {
98
-        $line = fgets($fd,4096);
98
+        $line = fgets($fd, 4096);
99 99
         if (preg_match("/loopnumber\s+\d+/", $line, $matches)
100 100
             && preg_match("/\d+/", $matches[0], $no)
101 101
         ) {
102
-            $this_loopno=$no[0];
102
+            $this_loopno = $no[0];
103 103
         }
104 104
         if (preg_match("/looprun\s+\d+/", $line, $matches)
105 105
             and preg_match("/\d+/", $matches[0], $no)
106 106
         ) {
107
-            $this_looprun=$no[0];
108
-            if($this_loopno*$this_looprun>$total_steps)$total_steps=$this_loopno*$this_looprun;
107
+            $this_looprun = $no[0];
108
+            if ($this_loopno*$this_looprun > $total_steps)$total_steps = $this_loopno*$this_looprun;
109 109
         }
110 110
 
111 111
     }
112 112
     fclose($fd);
113 113
     //$total_steps = $loopno*$looprun;
114
-     if($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>";
114
+     if ($GLOBALS["debug"])print "total_steps = ".$total_steps."<br>";
115 115
     return $total_steps;
116 116
 }
117 117
 
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
     }
130 130
     $count = 0;
131 131
     while (!feof($fd)) {
132
-        $line = fgets($fd,4096);
133
-        if (preg_match('/^Step\s+CPU/',$line)) {
132
+        $line = fgets($fd, 4096);
133
+        if (preg_match('/^Step\s+CPU/', $line)) {
134 134
             //echo $line."\n";
135 135
             $start = 1;
136 136
             continue;
@@ -139,24 +139,24 @@  discard block
 block discarded – undo
139 139
         $arr = preg_split("/\s+/", $line);
140 140
         //print_r($arr);
141 141
 
142
-        if (count($arr) <=6 || !is_numeric($arr[1])) {
142
+        if (count($arr) <= 6 || !is_numeric($arr[1])) {
143 143
             continue;
144 144
         }
145 145
         $step = (int)$arr[1];
146 146
         $cpu = (float)$arr[2];
147 147
         //echo "step=".$step." cpu=".$cpu."\n";
148
-        if ($cpu==0) {
149
-           $count=0;
148
+        if ($cpu == 0) {
149
+           $count = 0;
150 150
            $start_step = $step;
151 151
         } else {
152
-            $count+=1;
153
-            if($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>";
154
-           if($count >= 10) {
152
+            $count += 1;
153
+            if ($GLOBALS["debug"])echo "step=".$step." cpu=".$cpu."count=".$count."<br>";
154
+           if ($count >= 10) {
155 155
                 $end_step = $step;
156
-                $steps = $end_step-$start_step;
156
+                $steps = $end_step - $start_step;
157 157
                 $avg_cpu = $cpu/$steps;
158 158
                 #$avg_cpu = $cpu/$count;
159
-                if ($GLOBALS["debug"]){
159
+                if ($GLOBALS["debug"]) {
160 160
                     echo "test steps is ".$steps."<br>";
161 161
                     echo "avg_cpu is ".$avg_cpu."<br>";
162 162
                 }
@@ -165,56 +165,56 @@  discard block
 block discarded – undo
165 165
             }
166 166
         }
167 167
     }
168
-    return array($avg_cpu,$test_steps);
168
+    return array($avg_cpu, $test_steps);
169 169
 }
170 170
 
171
-function calc_est_size($lammps_script, $structure_file, $cmd_file,$test_steps){
171
+function calc_est_size($lammps_script, $structure_file, $cmd_file, $test_steps) {
172 172
     $dump_types = 0;
173
-    $fd = fopen($lammps_script,"r");
174
-    if (!$fd){
173
+    $fd = fopen($lammps_script, "r");
174
+    if (!$fd) {
175 175
         echo "can not open file $lammps_script\n";
176 176
         exit(-1);
177 177
     }
178
-    while (!feof($fd)){
178
+    while (!feof($fd)) {
179 179
         $line = fgets($fd, 4096);
180 180
         //if (preg_match("/^\s*dump/", $line)
181 181
         //    and preg_match_all("/dump\S+\.\w{3}/", $line, $matches, PREG_PATTERN_ORDER))
182 182
 
183
-        if(preg_match("/^\s*dump\s+(\d)\s+/", $line,$matches))
183
+        if (preg_match("/^\s*dump\s+(\d)\s+/", $line, $matches))
184 184
         {
185
-             if($GLOBALS["debug"]){print "matches=";print_r($matches);}
185
+             if ($GLOBALS["debug"]) {print "matches="; print_r($matches); }
186 186
 
187
-            $dump_types=(int)$matches[1];
187
+            $dump_types = (int)$matches[1];
188 188
             break;
189 189
         }
190 190
     }
191 191
     fclose($fd);
192
-    if($GLOBALS["debug"])print "dump_types= ".$dump_types."<br>";
192
+    if ($GLOBALS["debug"])print "dump_types= ".$dump_types."<br>";
193 193
 
194 194
     $structure_file_size = filesize($structure_file);
195
-    $fd = fopen($cmd_file,"r");
196
-    if (!$fd){
195
+    $fd = fopen($cmd_file, "r");
196
+    if (!$fd) {
197 197
         echo "can not open file $cmd_file\n";
198 198
         exit(-1);
199 199
     }
200
-     if($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>";
201
-
202
-    $loopno=1;
203
-    $looprun=1;
204
-    while (!feof($fd)){
205
-        $line = fgets($fd,4096);
206
-        if(preg_match("/loopnumber\s+\d+/", $line, $matches)){
207
-            if(preg_match("/\d+/", $matches[0], $no)){
200
+     if ($GLOBALS["debug"]) print "structure_file_size=".$structure_file_size."<br>";
201
+
202
+    $loopno = 1;
203
+    $looprun = 1;
204
+    while (!feof($fd)) {
205
+        $line = fgets($fd, 4096);
206
+        if (preg_match("/loopnumber\s+\d+/", $line, $matches)) {
207
+            if (preg_match("/\d+/", $matches[0], $no)) {
208 208
                 //$loopno=$no[0];
209
-                if($no[0]>$loopno)$loopno=$no[0];
209
+                if ($no[0] > $loopno)$loopno = $no[0];
210 210
             }
211 211
         }
212 212
         if (preg_match("/looprun\s+\d+/", $line, $matches) and preg_match("/\d+/", $matches[0], $no)) {
213
-            if($no[0]>$looprun)$looprun=$no[0];
213
+            if ($no[0] > $looprun)$looprun = $no[0];
214 214
         }
215 215
     }
216 216
     fclose($fd);
217
-    if($GLOBALS["debug"]){
217
+    if ($GLOBALS["debug"]) {
218 218
          print "max loopno(number of loops to run)=".$loopno."<br>";
219 219
          print "max looprun(steps for each loop)=".$looprun."<br>";
220 220
     }
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
     $dump_files = glob("dump1*");
226 226
     $test_dump_file = $dump_files[0];
227 227
     $test_dump_size = filesize($test_dump_file);
228
-    $dump_size1 = $test_dump_size+0.5*$test_dump_size*ceil(($looprun-$test_steps)/$test_steps);
228
+    $dump_size1 = $test_dump_size + 0.5*$test_dump_size*ceil(($looprun - $test_steps)/$test_steps);
229 229
     $dump_size = $loopno*$dump_size1*$dump_types;
230 230
     $app_fixed_size = 5e7;
231
-    $est_size = $log_size+$dump_size+$app_fixed_size;
231
+    $est_size = $log_size + $dump_size + $app_fixed_size;
232 232
 
233
-    if($GLOBALS["debug"]){
233
+    if ($GLOBALS["debug"]) {
234 234
         print "test_steps=".$test_steps."<br>";
235 235
         print "test_log_size=".$test_log_size."<br>";
236 236
         print "log_size1=".$log_size1."<br>";
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
     if ($njobs < $nhosts) {
322 322
         return $flops_per_job/$median_flops;
323 323
     } else {
324
-        $k = (int)(($njobs+$nhosts-1)/$nhosts);
324
+        $k = (int)(($njobs + $nhosts - 1)/$nhosts);
325 325
         return $k*$flops_per_job/$median_flops;
326 326
     }
327 327
 }
@@ -361,27 +361,27 @@  discard block
 block discarded – undo
361 361
     if ($GLOBALS["debug"]) {
362 362
         print "est_cpu_time is ".$est_cpu_time."<br>";
363 363
     }
364
-    if ($error==0) {
365
-        $err_msgs=file("output");
366
-        $err="Your test job <strong>failed</strong>
364
+    if ($error == 0) {
365
+        $err_msgs = file("output");
366
+        $err = "Your test job <strong>failed</strong>
367 367
             <br>Please refer to the following Error Message:<br><p>
368 368
         ";
369
-        foreach($err_msgs as $line){
370
-             $err=$err.$line."<br>";
369
+        foreach ($err_msgs as $line) {
370
+             $err = $err.$line."<br>";
371 371
         }
372
-        $err=$err." <p>
372
+        $err = $err." <p>
373 373
             <a href=sandbox.php><strong> File_Sandbox </strong></a>
374 374
         ";
375 375
         error_page($err);
376 376
     }
377 377
 
378 378
     system("rm *");
379
-    $info->rsc_fpops_est = $est_cpu_time * 1.5e9;
380
-    $info->rsc_fpops_bound = $info->rsc_fpops_est * 20;
379
+    $info->rsc_fpops_est = $est_cpu_time*1.5e9;
380
+    $info->rsc_fpops_bound = $info->rsc_fpops_est*20;
381 381
 
382
-    if ($disk==0){
383
-        $info->rsc_disk_bound=1000000;
384
-    } else{
382
+    if ($disk == 0) {
383
+        $info->rsc_disk_bound = 1000000;
384
+    } else {
385 385
         $info->rsc_disk_bound = $disk;
386 386
     }
387 387
 
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
     //
393 393
     $njobs = count(file($cmdline_file_path));
394 394
     $secs_est = estimated_makespan($njobs, $info->rsc_fpops_est);
395
-     if($GLOBALS["debug"])echo "secs_est is $secs_est\n";
395
+     if ($GLOBALS["debug"])echo "secs_est is $secs_est\n";
396 396
     //assume the server's flops is 1.5G and the average client's flops is 1G
397 397
     $hrs_est = number_format($secs_est*1.5/60, 2);
398 398
     //$hrs_est = number_format($secs_est, 2);
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
 }
417 417
 
418 418
 function submit_job($app, $batch_id, $info, $cmdline, $i) {
419
-    $client_disk=$info->rsc_disk_bound*2;
420
-    if($client_disk<500000000) $client_disk=500000000;
419
+    $client_disk = $info->rsc_disk_bound*2;
420
+    if ($client_disk < 500000000) $client_disk = 500000000;
421 421
     $cmd = "cd ../..; ./bin/create_work --appname $app->name --batch $batch_id --rsc_fpops_est $info->rsc_fpops_est --rsc_fpops_bound $info->rsc_fpops_bound --rsc_disk_bound $client_disk";
422 422
     if ($cmdline) {
423 423
         $cmd .= " --command_line \"$cmdline\"";
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
     $x = file_get_contents("$tmpfile");
442 442
     $info = unserialize($x);
443 443
 
444
-    $njobs=0;
444
+    $njobs = 0;
445 445
     $cmdlines = file($info->cmdline_file_path);
446
-    foreach ($cmdlines as $cmdline){
446
+    foreach ($cmdlines as $cmdline) {
447 447
         if (preg_match("/^\s*-var/", $cmdline)) {
448 448
             $njobs++;
449 449
         }
@@ -459,7 +459,7 @@  discard block
 block discarded – undo
459 459
 
460 460
     $i = 0;
461 461
     foreach ($cmdlines as $cmdline) {
462
-        if (preg_match("/^\s*-var/", $cmdline)){
462
+        if (preg_match("/^\s*-var/", $cmdline)) {
463 463
             submit_job($app, $batch_id, $info, $cmdline, $i);
464 464
             $i++;
465 465
         }
Please login to merge, or discard this patch.
html/user/show_user.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -39,12 +39,12 @@  discard block
 block discarded – undo
39 39
 }
40 40
 $format = get_str("format", true);
41 41
 
42
-if ($format=="xml"){
42
+if ($format=="xml") {
43 43
     // don't do caching for XML
44 44
     xml_header();
45 45
     $retval = db_init_xml();
46 46
     if ($retval) xml_error($retval);
47
-    if ($auth){
47
+    if ($auth) {
48 48
         $user = BoincUser::lookup_auth($auth);
49 49
         $show_hosts = true;
50 50
     } else {
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
     //
61 61
     $cache_args="userid=".$id;
62 62
     $cached_data = get_cached_data(USER_PAGE_TTL, $cache_args);
63
-    if ($cached_data){
63
+    if ($cached_data) {
64 64
         // We found some old but non-stale data, let's use it
65 65
         $data = unserialize($cached_data);
66 66
         $user = $data->user;
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -38,12 +38,12 @@  discard block
 block discarded – undo
38 38
 }
39 39
 $format = get_str("format", true);
40 40
 
41
-if ($format=="xml"){
41
+if ($format == "xml") {
42 42
     // don't do caching for XML
43 43
     xml_header();
44 44
     $retval = db_init_xml();
45 45
     if ($retval) xml_error($retval);
46
-    if ($auth){
46
+    if ($auth) {
47 47
         $user = BoincUser::lookup_auth($auth);
48 48
         $show_hosts = true;
49 49
     } else {
@@ -57,9 +57,9 @@  discard block
 block discarded – undo
57 57
     // The page may be presented in many different languages,
58 58
     // so here we cache the data instead
59 59
     //
60
-    $cache_args="userid=".$id;
60
+    $cache_args = "userid=".$id;
61 61
     $cached_data = get_cached_data(USER_PAGE_TTL, $cache_args);
62
-    if ($cached_data){
62
+    if ($cached_data) {
63 63
         // We found some old but non-stale data, let's use it
64 64
         $data = unserialize($cached_data);
65 65
         $user = $data->user;
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
         }
76 76
         BoincForumPrefs::lookup($user);
77 77
         $user = @get_other_projects($user);
78
-        $community_links =  get_community_links_object($user);
78
+        $community_links = get_community_links_object($user);
79 79
 
80 80
         $data = new StdClass;
81 81
         $data->user = $user;
Please login to merge, or discard this patch.
html/user/notify_rss.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,7 @@
 block discarded – undo
39 39
 } else {
40 40
     $last_mod_time = time();
41 41
 }
42
-$create_date  = gmdate('D, d M Y H:i:s', $last_mod_time) . ' GMT';
42
+$create_date = gmdate('D, d M Y H:i:s', $last_mod_time).' GMT';
43 43
 
44 44
 header("Expires: ".gmdate('D, d M Y H:i:s', time())." GMT");
45 45
 header("Last-Modified: ".$create_date);
Please login to merge, or discard this patch.
html/ops/bbcode_convert_signature.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,15 +42,15 @@
 block discarded – undo
42 42
     $start_id = 0; //Set this to something else if you like
43 43
     $forum_preferencess = _mysql_query("select * from forum_preferences where userid>$start_id order by userid");
44 44
     echo _mysql_error();
45
-    $i=0;
46
-    while ($forum_preferences = _mysql_fetch_object($forum_preferencess)){
45
+    $i = 0;
46
+    while ($forum_preferences = _mysql_fetch_object($forum_preferencess)) {
47 47
         $i++;
48 48
         if ($i%100 == 0) {                      //For every 100 forum_preferencess
49
-            echo $forum_preferences->userid.". "; flush();   // print out where we are
49
+            echo $forum_preferences->userid.". "; flush(); // print out where we are
50 50
             //usleep(200000);
51 51
         }
52 52
 
53
-        if ($forum_preferences->userid > $start_id){
53
+        if ($forum_preferences->userid > $start_id) {
54 54
             fix_forum_preferences($forum_preferences);
55 55
         }
56 56
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -43,14 +43,15 @@
 block discarded – undo
43 43
     $forum_preferencess = _mysql_query("select * from forum_preferences where userid>$start_id order by userid");
44 44
     echo _mysql_error();
45 45
     $i=0;
46
-    while ($forum_preferences = _mysql_fetch_object($forum_preferencess)){
46
+    while ($forum_preferences = _mysql_fetch_object($forum_preferencess)) {
47 47
         $i++;
48
-        if ($i%100 == 0) {                      //For every 100 forum_preferencess
48
+        if ($i%100 == 0) {
49
+//For every 100 forum_preferencess
49 50
             echo $forum_preferences->userid.". "; flush();   // print out where we are
50 51
             //usleep(200000);
51 52
         }
52 53
 
53
-        if ($forum_preferences->userid > $start_id){
54
+        if ($forum_preferences->userid > $start_id) {
54 55
             fix_forum_preferences($forum_preferences);
55 56
         }
56 57
     }
Please login to merge, or discard this patch.
html/ops/user_graph.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
26 26
 
27 27
 
28 28
     // Create the graph. These two calls are always required
29
-    $graph = new Graph(350,250,"auto");
29
+    $graph = new Graph(350, 250, "auto");
30 30
     //$graph->SetScale("lin");
31 31
     //$graph->SetScale("textlin");
32 32
     $graph->SetScale("loglin");
33 33
 
34 34
     // Create the linear plot
35
-    $lineplot=new BarPlot($arr, $xarr);
35
+    $lineplot = new BarPlot($arr, $xarr);
36 36
     $lineplot->SetColor("blue");
37 37
 
38 38
     // Add the plot to the graph
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 function show_text($xarr, $yarr) {
46 46
     $n = sizeof($xarr);
47
-    for ($i=0; $i<$n; $i++) {
47
+    for ($i = 0; $i < $n; $i++) {
48 48
         echo "<br>$xarr[$i] $yarr[$i]\n";
49 49
     }
50 50
 }
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
         if ($ind > $maxind) $maxind = $ind;
91 91
     }
92 92
     $xarr = array();
93
-    for ($i=0; $i<=$maxind; $i++) {
93
+    for ($i = 0; $i <= $maxind; $i++) {
94 94
         $xarr[$i] = $i;
95
-        if (is_null($yarr[$i])) $yarr[$i]=0;
95
+        if (is_null($yarr[$i])) $yarr[$i] = 0;
96 96
     }
97 97
     if ($show_text) {
98 98
         show_text($xarr, $yarr);
Please login to merge, or discard this patch.
html/ops/bbcode_convert.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -44,15 +44,15 @@
 block discarded – undo
44 44
     $start_id = 0; //Set this to something else if you like
45 45
     $posts = _mysql_query("select * from post where id>$start_id order by id");
46 46
     echo _mysql_error();
47
-    $i=0;
48
-    while ($post = _mysql_fetch_object($posts)){
47
+    $i = 0;
48
+    while ($post = _mysql_fetch_object($posts)) {
49 49
         $i++;
50 50
         if ($i%100 == 0) {                      //For every 100 posts
51
-            echo $post->id.". "; flush();   // print out where we are
51
+            echo $post->id.". "; flush(); // print out where we are
52 52
             //usleep(200000);
53 53
         }
54 54
 
55
-        if ($post->id > $start_id){
55
+        if ($post->id > $start_id) {
56 56
             fix_post($post);
57 57
         }
58 58
     }
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -45,14 +45,15 @@
 block discarded – undo
45 45
     $posts = _mysql_query("select * from post where id>$start_id order by id");
46 46
     echo _mysql_error();
47 47
     $i=0;
48
-    while ($post = _mysql_fetch_object($posts)){
48
+    while ($post = _mysql_fetch_object($posts)) {
49 49
         $i++;
50
-        if ($i%100 == 0) {                      //For every 100 posts
50
+        if ($i%100 == 0) {
51
+//For every 100 posts
51 52
             echo $post->id.". "; flush();   // print out where we are
52 53
             //usleep(200000);
53 54
         }
54 55
 
55
-        if ($post->id > $start_id){
56
+        if ($post->id > $start_id) {
56 57
             fix_post($post);
57 58
         }
58 59
     }
Please login to merge, or discard this patch.