Passed
Push — dpa_docker_wrapper12 ( e18bd7 )
by David
08:59
created
html/ops/manage_user.php 3 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -141,7 +141,7 @@
 block discarded – undo
141 141
     global $special_user_bitfield;
142 142
     $Nbf = sizeof($special_user_bitfield);
143 143
 
144
-    admin_page_head("Management $user->name");
144
+    admin_page_head("management $user->name");
145 145
 
146 146
     if (!defined("POST_REPORT_EMAILS")) {
147 147
         echo "<p><font color='RED'>
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 // Delete a user if they have no credit, results, or posts
41 41
 //
42
-function possibly_delete_user($user){
43
-    if ($user->total_credit > 0.0){
42
+function possibly_delete_user($user) {
43
+    if ($user->total_credit > 0.0) {
44 44
         admin_error_page("Cannot delete user: User has credit.");
45 45
     }
46 46
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         admin_error_page("Cannot delete user: User has forum posts.");
57 57
     }
58 58
 
59
-    if ($user->teamid){
59
+    if ($user->teamid) {
60 60
         user_quit_team($user);
61 61
     }
62 62
     delete_user($user);
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
             // put a timestamp in wiki to trigger re-validation of credentials
102 102
 
103
-            if (function_exists('touch_wiki_user')){
103
+            if (function_exists('touch_wiki_user')) {
104 104
                 touch_wiki_user($user);
105 105
             }
106 106
 
Please login to merge, or discard this patch.
Spacing   +23 added lines, -23 removed lines patch added patch discarded remove patch
@@ -39,8 +39,8 @@  discard block
 block discarded – undo
39 39
 
40 40
 // Delete a user if they have no credit, results, or posts
41 41
 //
42
-function possibly_delete_user($user){
43
-    if ($user->total_credit > 0.0){
42
+function possibly_delete_user($user) {
43
+    if ($user->total_credit > 0.0) {
44 44
         admin_error_page("Cannot delete user: User has credit.");
45 45
     }
46 46
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
         admin_error_page("Cannot delete user: User has forum posts.");
57 57
     }
58 58
 
59
-    if ($user->teamid){
59
+    if ($user->teamid) {
60 60
         user_quit_team($user);
61 61
     }
62 62
     delete_user($user);
@@ -67,8 +67,8 @@  discard block
 block discarded – undo
67 67
 function handle_special_user($user) {
68 68
     global $special_user_bitfield;
69 69
     $Nbf = sizeof($special_user_bitfield);
70
-    $bits="";
71
-    for ($i=0; $i<$Nbf; $i++) {
70
+    $bits = "";
71
+    for ($i = 0; $i < $Nbf; $i++) {
72 72
         $key = "special_user_$i";
73 73
         if (array_key_exists($key, $_POST) && $_POST[$key]) {
74 74
             $bits .= "1";
@@ -94,35 +94,35 @@  discard block
 block discarded – undo
94 94
         );
95 95
     } else {
96 96
         if (is_numeric($dt)) {
97
-            $t = $dt>0 ? time()+$dt : 0;
97
+            $t = $dt > 0 ? time() + $dt : 0;
98 98
             $q = "UPDATE forum_preferences SET banished_until=$t WHERE userid=$user->id";
99 99
             _mysql_query($q);
100 100
 
101 101
             // put a timestamp in wiki to trigger re-validation of credentials
102 102
 
103
-            if (function_exists('touch_wiki_user')){
103
+            if (function_exists('touch_wiki_user')) {
104 104
                 touch_wiki_user($user);
105 105
             }
106 106
 
107 107
             // Send suspension e-mail to user and administrators
108 108
 
109
-            if ($dt>0) {
110
-                $subject = PROJECT." posting privileges suspended for ". $user->name;
109
+            if ($dt > 0) {
110
+                $subject = PROJECT." posting privileges suspended for ".$user->name;
111 111
                 $body = "
112
-Forum posting privileges for the " .PROJECT. " user \"".$user->name."\"
113
-have been suspended for " .time_diff($dt). " by ".$g_logged_in_user->name.".
112
+Forum posting privileges for the " .PROJECT." user \"".$user->name."\"
113
+have been suspended for " .time_diff($dt)." by ".$g_logged_in_user->name.".
114 114
 The reason given was:
115 115
 
116 116
 $reason
117 117
 
118
-The suspension will end at " .time_str($t)."\n";
118
+The suspension will end at ".time_str($t)."\n";
119 119
             } else {
120
-                $subject = PROJECT." user ". $user->name. " unsuspended";
120
+                $subject = PROJECT." user ".$user->name." unsuspended";
121 121
                 $body = "
122
-Forum posting privileges for the " .PROJECT. " user \"".$user->name."\"
122
+Forum posting privileges for the " .PROJECT." user \"".$user->name."\"
123 123
 have been restored by ".$g_logged_in_user->name."\n";
124 124
                 if ($reason) {
125
-                    $body.="The reason given was:\n\n   $reason\n";
125
+                    $body .= "The reason given was:\n\n   $reason\n";
126 126
                 }
127 127
             }
128 128
 
@@ -186,13 +186,13 @@  discard block
 block discarded – undo
186 186
     row1("Special User Status");
187 187
 
188 188
     echo "<tr>\n";
189
-    for ($i=0; $i<$Nbf; $i++) {
189
+    for ($i = 0; $i < $Nbf; $i++) {
190 190
         $bit = substr($user->prefs->special_user, $i, 1);
191 191
         echo "<tr><td><input type='checkbox'' name='special_user_".$i."' value='1'";
192 192
         if ($bit == 1) {
193 193
             echo " checked='checked'";
194 194
         }
195
-        echo ">". $special_user_bitfield[$i] ."</td></tr>\n";
195
+        echo ">".$special_user_bitfield[$i]."</td></tr>\n";
196 196
     }
197 197
     echo "</tr>";
198 198
 
@@ -217,10 +217,10 @@  discard block
 block discarded – undo
217 217
     if ($user->prefs->banished_until) {
218 218
         $dt = $user->prefs->banished_until - time();
219 219
         if ($dt > 0) {
220
-            $x = " Suspended until " . time_str($user->prefs->banished_until)
221
-                ."<br/> (Expires in " . time_diff($dt) .")" ;
220
+            $x = " Suspended until ".time_str($user->prefs->banished_until)
221
+                ."<br/> (Expires in ".time_diff($dt).")";
222 222
         } else {
223
-            $x = " last suspended " . time_str($user->prefs->banished_until);
223
+            $x = " last suspended ".time_str($user->prefs->banished_until);
224 224
         }
225 225
         row1($x);
226 226
     } else {
@@ -238,11 +238,11 @@  discard block
 block discarded – undo
238 238
     ";
239 239
     echo "
240 240
         <input type='radio' name='suspend_for' value='172800'> 48 hours  <br/>
241
-        <input type='radio' name='suspend_for' value='",86400*7,"'> 1 week  <br/>
242
-        <input type='radio' name='suspend_for' value='",86400*14,"'> 2 weeks  <br/>
241
+        <input type='radio' name='suspend_for' value='",86400*7, "'> 1 week  <br/>
242
+        <input type='radio' name='suspend_for' value='",86400*14, "'> 2 weeks  <br/>
243 243
     ";
244 244
 
245
-    if ($dt>0) {
245
+    if ($dt > 0) {
246 246
         echo "
247 247
             <input type='radio' name='suspend_for' value='-1'>  <b>unsuspend</b>   <br/>";
248 248
     }
Please login to merge, or discard this patch.
html/ops/manage_apps.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -49,7 +49,7 @@
 block discarded – undo
49 49
     $n = post_str("fraction_done_exact", true)?1:0;
50 50
     $app->update("fraction_done_exact=$n");
51 51
 
52
-    echo "Application $id updated.
52
+    echo "application $id updated.
53 53
         <p>
54 54
         You must restart the project for this to take effect.
55 55
     ";
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
     $app = BoincApp::lookup_id($id);
26 26
     if (!$app) admin_error_page("no such app");
27 27
 
28
-    $n = post_str("deprecated", true)?1:0;
28
+    $n = post_str("deprecated", true) ? 1 : 0;
29 29
     $app->update("deprecated=$n");
30 30
 
31 31
     $n = post_num("weight");
@@ -37,16 +37,16 @@  discard block
 block discarded – undo
37 37
     $n = post_int("target_nresults");
38 38
     $app->update("target_nresults=$n");
39 39
 
40
-    $n = post_str("homogeneous_app_version", true)?1:0;
40
+    $n = post_str("homogeneous_app_version", true) ? 1 : 0;
41 41
     $app->update("homogeneous_app_version=$n");
42 42
 
43
-    $n = post_str("non_cpu_intensive", true)?1:0;
43
+    $n = post_str("non_cpu_intensive", true) ? 1 : 0;
44 44
     $app->update("non_cpu_intensive=$n");
45 45
 
46
-    $n = post_str("beta", true)?1:0;
46
+    $n = post_str("beta", true) ? 1 : 0;
47 47
     $app->update("beta=$n");
48 48
 
49
-    $n = post_str("fraction_done_exact", true)?1:0;
49
+    $n = post_str("fraction_done_exact", true) ? 1 : 0;
50 50
     $app->update("fraction_done_exact=$n");
51 51
 
52 52
     echo "Application $id updated.
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 function add_app() {
59 59
     $name = BoincDb::escape_string(post_str('add_name'));
60 60
     $user_friendly_name = BoincDb::escape_string(post_str('add_user_friendly_name'));
61
-    if (empty($name) || empty($user_friendly_name) ) {
61
+    if (empty($name) || empty($user_friendly_name)) {
62 62
         admin_error_page(
63 63
             "To add a new application please supply both a brief name and a longer 'user-friendly' name.</font></p>"
64 64
         );
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
         <h2>Edit applications</h2>
82 82
     ";
83 83
 
84
-    $app_clause="deprecated=0";
85
-    $action_url="manage_apps.php";
86
-    if($all) {
84
+    $app_clause = "deprecated=0";
85
+    $action_url = "manage_apps.php";
86
+    if ($all) {
87 87
         $app_clause = "";
88
-        $action_url="manage_apps.php?all=1";
88
+        $action_url = "manage_apps.php?all=1";
89 89
         echo "<a href=\"manage_apps.php\">Don't show deprecated applications</a>";
90 90
     } else {
91 91
         echo "<a href=\"manage_apps.php?all=1\">Show deprecated applications</a>";
@@ -117,8 +117,8 @@  discard block
 block discarded – undo
117 117
     $apps = BoincApp::enum($app_clause);
118 118
     foreach ($apps as $app) {
119 119
         // grey-out deprecated versions
120
-        $f1=$f2='';
121
-        if ($app->deprecated==1) {
120
+        $f1 = $f2 = '';
121
+        if ($app->deprecated == 1) {
122 122
             $f1 = "<font color='GREY'>";
123 123
             $f2 = "</font>";
124 124
         }
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
         echo "  <TD align='left'>$f1<a href=app_details.php?appid=$app->id>$app->name</a><br> $app->user_friendly_name $f2</TD>\n";
130 130
 
131
-        echo "  <TD align='center'>$f1 " .date_str($app->create_time)."$f2</TD>\n";
131
+        echo "  <TD align='center'>$f1 ".date_str($app->create_time)."$f2</TD>\n";
132 132
 
133 133
         $v = $app->weight;
134 134
         echo "  <TD align='center'>
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         ";
152 152
 
153 153
         $v = '';
154
-        if ($app->homogeneous_app_version) $v=' CHECKED ';
154
+        if ($app->homogeneous_app_version) $v = ' CHECKED ';
155 155
         echo "  <TD align='center'>
156 156
             <input name='homogeneous_app_version' type='checkbox' $v></TD>
157 157
         ";
Please login to merge, or discard this patch.
html/ops/cancel_workunits.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -100,7 +100,8 @@
 block discarded – undo
100 100
     echo "</p>\n";
101 101
     echo "</form>\n";
102 102
 
103
-} else { // if ($qclause)
103
+} else {
104
+// if ($qclause)
104 105
 
105 106
     $query = "SELECT id, name FROM workunit WHERE canonical_resultid = 0 AND error_mask = 0 AND $qclause;";
106 107
     $db = BoincDb::get(true);
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
 admin_page_head("Cancel Jobs");
30 30
 
31 31
 $limit = get_int('limit', true);
32
-if (!$limit || $limit==0) {
32
+if (!$limit || $limit == 0) {
33 33
     $limit = 100;
34 34
 }
35 35
 
@@ -42,9 +42,9 @@  discard block
 block discarded – undo
42 42
 $clause = get_str('clause', true);
43 43
 
44 44
 if ($minid && $maxid) {
45
-    $qclause = "id >=" . $minid . " AND id <=" . $maxid;
45
+    $qclause = "id >=".$minid." AND id <=".$maxid;
46 46
 } else if ($list) {
47
-    $qclause = "id IN (" . $list . ")";
47
+    $qclause = "id IN (".$list.")";
48 48
 } else if ($uclause) {
49 49
     $qclause = urldecode($uclause);
50 50
 } else if ($clause) {
Please login to merge, or discard this patch.
html/ops/build_po.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 "X-Poedit-SourceCharset: utf-8\\n"
37 37
 
38 38
 
39
-HDR;
39
+hdr;
40 40
 
41 41
 $out = fopen("en.po", "w");
42 42
 
Please login to merge, or discard this patch.
html/user/server_status.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@
 block discarded – undo
251 251
         $pid = file_get_contents($path);
252 252
         if ($pid) {
253 253
             $pid = trim($pid);
254
-            $out = Array();
254
+            $out = array();
255 255
             exec("ps -ww $pid", $out);
256 256
             foreach ($out as $y) {
257 257
                 if (strstr($y, (string)$pid)) return 1;
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -180,7 +180,7 @@  discard block
 block discarded – undo
180 180
             $avg = round($app->info->avg, 2);
181 181
             $min = round($app->info->min, 2);
182 182
             $max = round($app->info->max, 2);
183
-            $x = $max?"$avg ($min - $max)":"---";
183
+            $x = $max ? "$avg ($min - $max)" : "---";
184 184
             $u = $app->info->users;
185 185
         } else {
186 186
             $x = '---';
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $cmd = trim($cmd);
276 276
         $x = explode(" ", $cmd);
277 277
         $prog = $x[0];
278
-        $pidname = $prog . '.pid';
278
+        $pidname = $prog.'.pid';
279 279
     }
280 280
     $path = "../../pid_$host/$pidname";
281 281
     if (is_file($path)) {
@@ -316,12 +316,12 @@  discard block
 block discarded – undo
316 316
     }
317 317
     $master_host = $u["host"];
318 318
     if ($config->www_host) {
319
-        $web_host = trim((string) $config->www_host);
319
+        $web_host = trim((string)$config->www_host);
320 320
     } else {
321 321
         $web_host = $main_host;
322 322
     }
323 323
     if ($config->sched_host) {
324
-        $sched_host = trim((string) $config->sched_host);
324
+        $sched_host = trim((string)$config->sched_host);
325 325
     } else {
326 326
         $sched_host = $main_host;
327 327
     }
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
 
332 332
     // the upload and download servers are sort of daemons too
333 333
     //
334
-    $url = trim((string) $config->download_url);
334
+    $url = trim((string)$config->download_url);
335 335
     $u = parse_url($url);
336 336
     $h = $u["host"];
337 337
     if ($h == $master_host) {
@@ -343,14 +343,14 @@  discard block
 block discarded – undo
343 343
     } else {
344 344
         $have_remote = true;
345 345
     }
346
-    $url = trim((string) $config->upload_url);
346
+    $url = trim((string)$config->upload_url);
347 347
     $u = parse_url($url);
348 348
     $h = $u["host"];
349 349
     if ($h == $master_host) {
350 350
         $y = new StdClass;
351 351
         $y->cmd = "Upload server";
352 352
         $y->host = $h;
353
-        $y->status = !file_exists("../../stop_upload");;
353
+        $y->status = !file_exists("../../stop_upload"); ;
354 354
         $local_daemons[] = $y;
355 355
     } else {
356 356
         $have_remote = true;
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
     $y = new StdClass;
362 362
     $y->cmd = "Scheduler";
363 363
     $y->host = $sched_host;
364
-    $y->status = !file_exists("../../stop_sched");;
364
+    $y->status = !file_exists("../../stop_sched"); ;
365 365
     $local_daemons[] = $y;
366 366
 
367 367
     foreach ($daemons->daemon as $d) {
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
             $disabled_daemons[] = $x;
375 375
             continue;
376 376
         }
377
-        $host = $d->host?(string)$d->host:$main_host;
377
+        $host = $d->host ? (string)$d->host : $main_host;
378 378
         if ($host != $web_host) {
379 379
             $have_remote = true;
380 380
             continue;
Please login to merge, or discard this patch.
html/user/team_change_founder_form.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -92,7 +92,8 @@
 block discarded – undo
92 92
 
93 93
 $navailable_users = 0;
94 94
 foreach ($users as $user) {
95
-    if ($user->id != $team->userid) {       //don't show current founder
95
+    if ($user->id != $team->userid) {
96
+//don't show current founder
96 97
         $user_total_credit = format_credit($user->total_credit);
97 98
         $user_expavg_credit = format_credit($user->expavg_credit);
98 99
         $selected = ($user->id == $team->ping_user)?"selected":"";
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
     if ($user->id != $team->userid) {       //don't show current founder
96 96
         $user_total_credit = format_credit($user->total_credit);
97 97
         $user_expavg_credit = format_credit($user->expavg_credit);
98
-        $selected = ($user->id == $team->ping_user)?"selected":"";
98
+        $selected = ($user->id == $team->ping_user) ? "selected" : "";
99 99
         echo '
100 100
             <tr>
101 101
             <td><input type="radio" name="userid" value="'.$user->id.'">
Please login to merge, or discard this patch.
html/user/submit_status.php 1 patch
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -32,7 +32,7 @@
 block discarded – undo
32 32
     if (!$batch || $batch->user_id != $user->id) {
33 33
         error_page("no batch");
34 34
     }
35
-    page_head("Batch $batch->id");
35
+    page_head("batch $batch->id");
36 36
     $results = BoincResult::enum("batch=$batch->id order by workunitid");
37 37
     result_table_start(true, true, null);
38 38
     foreach ($results as $result) {
Please login to merge, or discard this patch.
html/user/submit_rpc_handler.php 4 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -691,7 +691,8 @@
 block discarded – undo
691 691
         <id>$result->id</id>
692 692
         <state>".state_string($result)."</state>
693 693
 ";
694
-        if ($result->server_state == 5) {   // over?
694
+        if ($result->server_state == 5) {
695
+// over?
695 696
             $paths = get_outfile_paths($result);
696 697
             foreach($paths as $path) {
697 698
                 if (is_file($path)) {
Please login to merge, or discard this patch.
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -595,7 +595,7 @@
 block discarded – undo
595 595
 // return a batch specified by the command, using either ID or name
596 596
 //
597 597
 function get_batch($r) {
598
-    $batch = NULL;
598
+    $batch = null;
599 599
     if (!empty($r->batch_id)) {
600 600
         $batch_id = (int)($r->batch_id);
601 601
         $batch = BoincBatch::lookup_id($batch_id);
Please login to merge, or discard this patch.
Switch Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1102,24 +1102,24 @@
 block discarded – undo
1102 1102
 log_write("----- Handling RPC; command ".$r->getName());
1103 1103
 
1104 1104
 switch ($r->getName()) {
1105
-    case 'abort_batch': handle_abort_batch($r); break;
1106
-    case 'abort_jobs': handle_abort_jobs($r); break;
1107
-    case 'create_batch': create_batch($r); break;
1108
-    case 'estimate_batch': estimate_batch($r); break;
1109
-    case 'get_templates': get_templates($r); break;
1110
-    case 'ping': ping($r); break;
1111
-    case 'query_batch': query_batch($r); break;
1112
-    case 'query_batch2': query_batch2($r); break;
1113
-    case 'query_batches': query_batches($r); break;
1114
-    case 'query_job': query_job($r); break;
1115
-    case 'query_completed_job': query_completed_job($r); break;
1116
-    case 'retire_batch': handle_retire_batch($r); break;
1117
-    case 'set_expire_time': handle_set_expire_time($r); break;
1118
-    case 'submit_batch': submit_batch($r); break;
1119
-    default:
1120
-        log_write("bad command");
1121
-        xml_error(-1, "bad command");
1122
-        break;
1105
+case 'abort_batch': handle_abort_batch($r); break;
1106
+case 'abort_jobs': handle_abort_jobs($r); break;
1107
+case 'create_batch': create_batch($r); break;
1108
+case 'estimate_batch': estimate_batch($r); break;
1109
+case 'get_templates': get_templates($r); break;
1110
+case 'ping': ping($r); break;
1111
+case 'query_batch': query_batch($r); break;
1112
+case 'query_batch2': query_batch2($r); break;
1113
+case 'query_batches': query_batches($r); break;
1114
+case 'query_job': query_job($r); break;
1115
+case 'query_completed_job': query_completed_job($r); break;
1116
+case 'retire_batch': handle_retire_batch($r); break;
1117
+case 'set_expire_time': handle_set_expire_time($r); break;
1118
+case 'submit_batch': submit_batch($r); break;
1119
+default:
1120
+    log_write("bad command");
1121
+    xml_error(-1, "bad command");
1122
+    break;
1123 1123
 }
1124 1124
 
1125 1125
 log_write("RPC done");
Please login to merge, or discard this 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/user/get_project_config.php 3 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,10 +28,10 @@
 block discarded – undo
28 28
 //
29 29
 function show_platforms() {
30 30
     $xmlFragment = unserialize(get_cached_data(3600, "project_config_platform_xml"));
31
-    if ($xmlFragment==false){
31
+    if ($xmlFragment==false) {
32 32
         $platforms = BoincDB::get()->enum_fields("platform, DBNAME.app_version, DBNAME.app", "BoincPlatform", "platform.name, platform.user_friendly_name, plan_class", "app_version.platformid = platform.id and app_version.appid = app.id and app_version.deprecated=0 and app.deprecated=0 group by platform.name, plan_class", "");
33 33
         $xmlFragment = "    <platforms>";
34
-        foreach ($platforms as $platform){
34
+        foreach ($platforms as $platform) {
35 35
             $xmlFragment .= "
36 36
             <platform>
37 37
                 <platform_name>$platform->name</platform_name>
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -86,11 +86,11 @@  discard block
 block discarded – undo
86 86
 }
87 87
 
88 88
 if ($disable_account_creation || defined('INVITE_CODES')) {
89
-	echo "    <account_creation_disabled/>\n";
89
+    echo "    <account_creation_disabled/>\n";
90 90
 }
91 91
 
92 92
 if (defined('INVITE_CODES')) {
93
-	echo "    <invite_code_required/>\n";
93
+    echo "    <invite_code_required/>\n";
94 94
 }
95 95
 
96 96
 echo "    <min_passwd_length>$min_passwd_length</min_passwd_length>\n";
@@ -113,9 +113,9 @@  discard block
 block discarded – undo
113 113
 // the terms_of_use.txt file in the project base directory.
114 114
 //
115 115
 if (defined('TERMSOFUSE_FILE')) {
116
-  $tou_file = TERMSOFUSE_FILE;
116
+    $tou_file = TERMSOFUSE_FILE;
117 117
 } else {
118
-  $tou_file =  "../../terms_of_use.txt";
118
+    $tou_file =  "../../terms_of_use.txt";
119 119
 }
120 120
 if (file_exists($tou_file)) {
121 121
     $terms_of_use = trim(file_get_contents($tou_file));
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 //
31 31
 function show_platforms() {
32 32
     $xmlFragment = unserialize(get_cached_data(3600, "project_config_platform_xml"));
33
-    if ($xmlFragment==false){
33
+    if ($xmlFragment == false) {
34 34
         $platforms = BoincDB::get()->enum_fields("platform, DBNAME.app_version, DBNAME.app", "BoincPlatform", "platform.name, platform.user_friendly_name, plan_class", "app_version.platformid = platform.id and app_version.appid = app.id and app_version.deprecated=0 and app.deprecated=0 group by platform.name, plan_class", "");
35 35
         $xmlFragment = "    <platforms>";
36
-        foreach ($platforms as $platform){
36
+        foreach ($platforms as $platform) {
37 37
             $xmlFragment .= "
38 38
             <platform>
39 39
                 <platform_name>$platform->name</platform_name>
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 if (defined('TERMSOFUSE_FILE')) {
116 116
   $tou_file = TERMSOFUSE_FILE;
117 117
 } else {
118
-  $tou_file =  "../../terms_of_use.txt";
118
+  $tou_file = "../../terms_of_use.txt";
119 119
 }
120 120
 if (file_exists($tou_file)) {
121 121
     $terms_of_use = trim(file_get_contents($tou_file));
Please login to merge, or discard this patch.