Passed
Push — master ( e80e02...42f91b )
by Vitalii
01:22 queued 22s
created
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/submit.php 3 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -369,7 +369,7 @@
 block discarded – undo
369 369
             $text = "---";
370 370
             if ($batch->state == BATCH_STATE_COMPLETE) {
371 371
                 $y = '<font color="red">failed</font>';
372
-            }   else {
372
+            } else {
373 373
                 $y = "in progress";
374 374
             }
375 375
         }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -365,11 +365,11 @@  discard block
 block discarded – undo
365 365
 function progress_bar($batch, $wus, $width) {
366 366
     $w_success = $width*$batch->fraction_done;
367 367
     $w_fail = $width*$batch->nerror_jobs/$batch->njobs;
368
-    $nsuccess = $batch->njobs * $batch->fraction_done;
368
+    $nsuccess = $batch->njobs*$batch->fraction_done;
369 369
     $nsent = wus_nsent($wus);
370 370
     $nprog = $nsent - $nsuccess - $batch->nerror_jobs;
371 371
     $w_prog = $width*$nprog/$batch->njobs;
372
-    $nunsent = $batch->njobs-$nsent;
372
+    $nunsent = $batch->njobs - $nsent;
373 373
     $w_unsent = $width*$nunsent/$batch->njobs;
374 374
     $x = '<table height=20><tr>';
375 375
     if ($w_fail) {
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
     page_head("Batch $batch_id");
408 408
     start_table();
409 409
     row2("name", $batch->name);
410
-    row2("application", $app?$app->name:'---');
410
+    row2("application", $app ? $app->name : '---');
411 411
     row2("state", batch_state_string($batch->state));
412 412
     //row2("# jobs", $batch->njobs);
413 413
     //row2("# error jobs", $batch->nerror_jobs);
@@ -454,7 +454,7 @@  discard block
 block discarded – undo
454 454
         "Canonical instance<br><small>click to see result page on BOINC server</smallp>",
455 455
         "Download Results"
456 456
     );
457
-    foreach($wus as $wu) {
457
+    foreach ($wus as $wu) {
458 458
         $resultid = $wu->canonical_resultid;
459 459
         if ($resultid) {
460 460
             $x = "<a href=result.php?resultid=$resultid>$resultid</a>";
@@ -465,7 +465,7 @@  discard block
 block discarded – undo
465 465
             $text = "---";
466 466
             if ($batch->state == BATCH_STATE_COMPLETE) {
467 467
                 $y = '<font color="red">failed</font>';
468
-            }   else {
468
+            } else {
469 469
                 $y = "in progress";
470 470
             }
471 471
         }
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
     $results = BoincResult::enum("workunitid=$wuid");
531 531
     $upload_dir = parse_config(get_config(), "<upload_dir>");
532 532
     $fanout = parse_config(get_config(), "<uldl_dir_fanout>");
533
-    foreach($results as $result) {
533
+    foreach ($results as $result) {
534 534
         echo "<tr>
535 535
             <td><a href=result.php?resultid=$result->id>$result->id &middot; $result->name </a></td>
536 536
             <td>".state_string($result)."</td>
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
         if ($result->server_state == 5) {
541 541
             $phys_names = get_outfile_names($result);
542 542
             $log_names = get_outfile_log_names($result);
543
-            for ($i=0; $i<count($phys_names); $i++) {
543
+            for ($i = 0; $i < count($phys_names); $i++) {
544 544
                 $url = sprintf(
545 545
                     'get_output2.php?cmd=result&result_id=%d&file_num=%d',
546 546
                     $result->id, $i
Please login to merge, or discard this patch.
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
     $wus = BoincWorkunit::enum("batch = $batch->id");
405 405
     $batch = get_batch_params($batch, $wus);
406 406
 
407
-    page_head("Batch $batch_id");
407
+    page_head("batch $batch_id");
408 408
     start_table();
409 409
     row2("name", $batch->name);
410 410
     row2("application", $app?$app->name:'---');
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
     $wu = BoincWorkunit::lookup_id($wuid);
490 490
     if (!$wu) error_page("no such job");
491 491
 
492
-    page_head("Job $wuid");
492
+    page_head("job $wuid");
493 493
 
494 494
     echo "
495 495
         <a href=workunit.php?wuid=$wuid>Workunit details</a> &middot;
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
@@ -1049,24 +1049,24 @@
 block discarded – undo
1049 1049
 log_write("----- Handling RPC; command ".$r->getName());
1050 1050
 
1051 1051
 switch ($r->getName()) {
1052
-    case 'abort_batch': handle_abort_batch($r); break;
1053
-    case 'abort_jobs': handle_abort_jobs($r); break;
1054
-    case 'create_batch': create_batch($r); break;
1055
-    case 'estimate_batch': estimate_batch($r); break;
1056
-    case 'get_templates': get_templates($r); break;
1057
-    case 'ping': ping($r); break;
1058
-    case 'query_batch': query_batch($r); break;
1059
-    case 'query_batch2': query_batch2($r); break;
1060
-    case 'query_batches': query_batches($r); break;
1061
-    case 'query_job': query_job($r); break;
1062
-    case 'query_completed_job': query_completed_job($r); break;
1063
-    case 'retire_batch': handle_retire_batch($r); break;
1064
-    case 'set_expire_time': handle_set_expire_time($r); break;
1065
-    case 'submit_batch': submit_batch($r); break;
1066
-    default:
1067
-        log_write("bad command");
1068
-        xml_error(-1, "bad command: ".$r->getName());
1069
-        break;
1052
+case 'abort_batch': handle_abort_batch($r); break;
1053
+case 'abort_jobs': handle_abort_jobs($r); break;
1054
+case 'create_batch': create_batch($r); break;
1055
+case 'estimate_batch': estimate_batch($r); break;
1056
+case 'get_templates': get_templates($r); break;
1057
+case 'ping': ping($r); break;
1058
+case 'query_batch': query_batch($r); break;
1059
+case 'query_batch2': query_batch2($r); break;
1060
+case 'query_batches': query_batches($r); break;
1061
+case 'query_job': query_job($r); break;
1062
+case 'query_completed_job': query_completed_job($r); break;
1063
+case 'retire_batch': handle_retire_batch($r); break;
1064
+case 'set_expire_time': handle_set_expire_time($r); break;
1065
+case 'submit_batch': submit_batch($r); break;
1066
+default:
1067
+    log_write("bad command");
1068
+    xml_error(-1, "bad command: ".$r->getName());
1069
+    break;
1070 1070
 }
1071 1071
 
1072 1072
 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);
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
 function validate_batch($jobs, $template) {
143 143
     $i = 0;
144 144
     $n = count($template->file_info);
145
-    foreach($jobs as $job) {
145
+    foreach ($jobs as $job) {
146 146
         $m = count($job->input_files);
147 147
         if ($n != $m) {
148 148
             log_write("wrong # of input files for job $i: need $n, got $m");
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 // stage all the files
212 212
 //
213 213
 function stage_files(&$jobs, $user) {
214
-    foreach($jobs as $job) {
214
+    foreach ($jobs as $job) {
215 215
         foreach ($job->input_files as $file) {
216 216
             if ($file->mode != "remote") {
217 217
                 $file->name = stage_file($file, $user);
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 //
225 225
 function submit_jobs(
226 226
     $jobs, $job_params, $app, $batch_id, $priority, $app_version_num,
227
-    $input_template_filename,        // batch-level; can also specify per job
227
+    $input_template_filename, // batch-level; can also specify per job
228 228
     $output_template_filename,
229 229
     $user
230 230
 ) {
@@ -234,7 +234,7 @@  discard block
 block discarded – undo
234 234
     // one line per job
235 235
     //
236 236
     $x = "";
237
-    foreach($jobs as $job) {
237
+    foreach ($jobs as $job) {
238 238
         if ($job->name) {
239 239
             $x .= " --wu_name $job->name";
240 240
         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
         $x .= "\n";
270 270
     }
271 271
 
272
-    $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id";
272
+    $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id";
273 273
 
274 274
     if ($user->seti_id) {
275 275
         $cmd .= " --target_user $user->id ";
@@ -377,7 +377,7 @@  discard block
 block discarded – undo
377 377
 //
378 378
 function xml_get_jobs($r) {
379 379
     $jobs = array();
380
-    foreach($r->batch->job as $j) {
380
+    foreach ($r->batch->job as $j) {
381 381
         $job = new StdClass;
382 382
         $job->input_files = array();
383 383
         $job->command_line = (string)$j->command_line;
@@ -428,16 +428,16 @@  discard block
 block discarded – undo
428 428
 //
429 429
 function logical_end_time($r, $jobs, $user, $app) {
430 430
     $total_flops = 0;
431
-    foreach($jobs as $job) {
431
+    foreach ($jobs as $job) {
432 432
         //print_r($job);
433 433
         if ($job->rsc_fpops_est) {
434 434
             $total_flops += $job->rsc_fpops_est;
435 435
         } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) {
436
-            $total_flops += (double) $job->input_template->workunit->rsc_fpops_est;
436
+            $total_flops += (double)$job->input_template->workunit->rsc_fpops_est;
437 437
         } else if ($r->batch->job_params->rsc_fpops_est) {
438
-            $total_flops += (double) $r->batch->job_params->rsc_fpops_est;
438
+            $total_flops += (double)$r->batch->job_params->rsc_fpops_est;
439 439
         } else {
440
-            $x = (double) $template->workunit->rsc_fpops_est;
440
+            $x = (double)$template->workunit->rsc_fpops_est;
441 441
             if ($x) {
442 442
                 $total_flops += $x;
443 443
             } else {
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
             }
446 446
         }
447 447
     }
448
-    $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name";
448
+    $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name";
449 449
     $x = exec($cmd);
450 450
     if (!is_numeric($x) || (double)$x == 0) {
451 451
         xml_error(-1, "$cmd returned $x");
@@ -530,15 +530,15 @@  discard block
 block discarded – undo
530 530
     }
531 531
 
532 532
     $job_params = new StdClass;
533
-    $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound;
534
-    $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est;
535
-    $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound;
536
-    $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound;
537
-    $job_params->delay_bound = (double) $r->batch->job_params->delay_bound;
533
+    $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound;
534
+    $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est;
535
+    $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound;
536
+    $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound;
537
+    $job_params->delay_bound = (double)$r->batch->job_params->delay_bound;
538 538
         // could add quorum-related stuff
539 539
 
540
-    $input_template_filename = (string) $r->batch->input_template_filename;
541
-    $output_template_filename = (string) $r->batch->output_template_filename;
540
+    $input_template_filename = (string)$r->batch->input_template_filename;
541
+    $output_template_filename = (string)$r->batch->output_template_filename;
542 542
         // possibly empty
543 543
 
544 544
     submit_jobs(
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 }
632 632
 
633 633
 function n_outfiles($wu) {
634
-    $path = project_dir() . "/$wu->output_template_filename";
634
+    $path = project_dir()."/$wu->output_template_filename";
635 635
     $r = simplexml_load_file($path);
636 636
     return count($r->file_info);
637 637
 }
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 ";
839 839
         if ($result->server_state == 5) {   // over?
840 840
             $paths = get_outfile_paths($result);
841
-            foreach($paths as $path) {
841
+            foreach ($paths as $path) {
842 842
                 if (is_file($path)) {
843 843
                     $size = filesize($path);
844 844
                     echo "        <outfile>
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
     } else {
883 883
         $results = BoincResult::enum("workunitid=$job_id");
884 884
         foreach ($results as $r) {
885
-            switch($r->outcome) {
885
+            switch ($r->outcome) {
886 886
             case 1:
887 887
             case 3:
888 888
             case 6:
@@ -997,8 +997,8 @@  discard block
 block discarded – undo
997 997
     }
998 998
 
999 999
     list($user, $user_submit) = check_remote_submit_permissions($r, $app);
1000
-    $in = file_get_contents(project_dir() . "/templates/".$app->name."_in");
1001
-    $out = file_get_contents(project_dir() . "/templates/".$app->name."_out");
1000
+    $in = file_get_contents(project_dir()."/templates/".$app->name."_in");
1001
+    $out = file_get_contents(project_dir()."/templates/".$app->name."_out");
1002 1002
     if ($in === false || $out === false) {
1003 1003
         log_write("template file missing");
1004 1004
         xml_error(-1, "template file missing");
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
 
1011 1011
 function ping($r) {
1012 1012
     xml_start_tag("ping");
1013
-    BoincDb::get();     // errors out if DB down or web disabled
1013
+    BoincDb::get(); // errors out if DB down or web disabled
1014 1014
     echo "<success>1</success>
1015 1015
         </ping>
1016 1016
     ";
@@ -1077,9 +1077,9 @@  discard block
 block discarded – undo
1077 1077
 $request_log = parse_config(get_config(), "<remote_submit_request_log>");
1078 1078
 if ($request_log) {
1079 1079
     $log_dir = parse_config(get_config(), "<log_dir>");
1080
-    $request_log = $log_dir . "/" . $request_log;
1080
+    $request_log = $log_dir."/".$request_log;
1081 1081
     if ($file = fopen($request_log, "a")) {
1082
-        fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n");
1082
+        fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n");
1083 1083
         fclose($file);
1084 1084
     }
1085 1085
 }
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.
html/user/forum_search.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
     </select>");
57 57
 
58 58
 $forumid = null;
59
-if (get_str("forumid",true)){
59
+if (get_str("forumid",true)) {
60 60
     $forumid = get_str("forumid");
61 61
 }
62 62
 $forumlist="<option value=\"-1\">".tra("All")."</option>";
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
 foreach ($categories as $category) {
65 65
     $forums = BoincForum::enum("parent_type=0 and category=$category->id");
66 66
     foreach ($forums as $forum) {
67
-        if ($forum->id==$forumid){
67
+        if ($forum->id==$forumid) {
68 68
             $forumlist.="<option selected value=\"".$forum->id."\">".$forum->title."</option>";
69 69
         } else {
70 70
             $forumlist.="<option value=\"".$forum->id."\">".$forum->title."</option>";
@@ -76,8 +76,8 @@  discard block
 block discarded – undo
76 76
     '<select class="form-control" name="search_forum">'.$forumlist.'</select');
77 77
 
78 78
 $sortlist = null;
79
-foreach ($thread_sort_styles as $id => $style){
80
-    if ($id == CREATE_TIME_NEW){
79
+foreach ($thread_sort_styles as $id => $style) {
80
+    if ($id == CREATE_TIME_NEW) {
81 81
         $sortlist.="<option selected value=\"".$id."\">".$style."</option>";
82 82
     } else {
83 83
         $sortlist.="<option value=\"".$id."\">".$style."</option>";
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,18 +56,18 @@  discard block
 block discarded – undo
56 56
     </select>");
57 57
 
58 58
 $forumid = null;
59
-if (get_str("forumid",true)){
59
+if (get_str("forumid", true)) {
60 60
     $forumid = get_str("forumid");
61 61
 }
62
-$forumlist="<option value=\"-1\">".tra("All")."</option>";
62
+$forumlist = "<option value=\"-1\">".tra("All")."</option>";
63 63
 $categories = BoincCategory::enum();
64 64
 foreach ($categories as $category) {
65 65
     $forums = BoincForum::enum("parent_type=0 and category=$category->id");
66 66
     foreach ($forums as $forum) {
67
-        if ($forum->id==$forumid){
68
-            $forumlist.="<option selected value=\"".$forum->id."\">".$forum->title."</option>";
67
+        if ($forum->id == $forumid) {
68
+            $forumlist .= "<option selected value=\"".$forum->id."\">".$forum->title."</option>";
69 69
         } else {
70
-            $forumlist.="<option value=\"".$forum->id."\">".$forum->title."</option>";
70
+            $forumlist .= "<option value=\"".$forum->id."\">".$forum->title."</option>";
71 71
         }
72 72
     }
73 73
 }
@@ -76,11 +76,11 @@  discard block
 block discarded – undo
76 76
     '<select class="form-control" name="search_forum">'.$forumlist.'</select');
77 77
 
78 78
 $sortlist = null;
79
-foreach ($thread_sort_styles as $id => $style){
80
-    if ($id == CREATE_TIME_NEW){
81
-        $sortlist.="<option selected value=\"".$id."\">".$style."</option>";
79
+foreach ($thread_sort_styles as $id => $style) {
80
+    if ($id == CREATE_TIME_NEW) {
81
+        $sortlist .= "<option selected value=\"".$id."\">".$style."</option>";
82 82
     } else {
83
-        $sortlist.="<option value=\"".$id."\">".$style."</option>";
83
+        $sortlist .= "<option value=\"".$id."\">".$style."</option>";
84 84
     }
85 85
 }
86 86
 row2(tra("Sort by"),
@@ -98,5 +98,5 @@  discard block
 block discarded – undo
98 98
 
99 99
 page_tail();
100 100
 
101
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
101
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
102 102
 ?>
Please login to merge, or discard this patch.
html/user/create_account_form.php 2 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     $team = BoincTeam::lookup_id($teamid);
58 58
     $user = BoincUser::lookup_id($team->userid);
59 59
     if (!$user) {
60
-        error_page("Team $team->name has no founder");
60
+        error_page("team $team->name has no founder");
61 61
         $teamid = 0;
62 62
     } else {
63 63
         echo "<b>".tra("This account will belong to the team %1 and will have the project preferences of its founder.", "<a href=\"team_display.php?teamid=$team->id\">$team->name</a>")."</b><p>";
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     }
67 67
 }
68 68
 
69
-form_start("create_account_action.php","post");
69
+form_start("create_account_action.php", "post");
70 70
 create_account_form($teamid, $next_url);
71 71
 global $recaptcha_public_key;
72 72
 if ($recaptcha_public_key) {
@@ -77,5 +77,5 @@  discard block
 block discarded – undo
77 77
 
78 78
 page_tail();
79 79
 
80
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
80
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
81 81
 ?>
Please login to merge, or discard this patch.
html/user/forum_edit.php 2 patches
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -70,7 +70,7 @@
 block discarded – undo
70 70
         $now = time();
71 71
         $post->update("signature=$add_signature, content='$content', modified=$now");
72 72
     
73
-        if ($can_edit_title){
73
+        if ($can_edit_title) {
74 74
             $title = trim($title);
75 75
             $title = sanitize_tags($title);
76 76
             $title = BoincDb::escape_string($title);
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 $post_owner = BoincUser::lookup_id($post->user);
44 44
 if (($logged_in_user->id != $post_owner->id) || (can_reply($thread, $forum, $logged_in_user) == false)) {
45
-    error_page (tra("You are not authorized to edit this post."));
45
+    error_page(tra("You are not authorized to edit this post."));
46 46
 }
47 47
 
48 48
 $thread_owner = BoincUser::lookup_id($thread->owner);
@@ -51,13 +51,13 @@  discard block
 block discarded – undo
51 51
 // (ie. not a response to another post)
52 52
 // allow the user to modify the thread title
53 53
 //
54
-$can_edit_title = ($post->parent_post==0 && $thread_owner->id==$logged_in_user->id && !is_banished($logged_in_user));
54
+$can_edit_title = ($post->parent_post == 0 && $thread_owner->id == $logged_in_user->id && !is_banished($logged_in_user));
55 55
 
56 56
 $content = post_str("content", true);
57 57
 $title = post_str("title", true);
58 58
 $preview = post_str("preview", true);
59 59
 
60
-if (post_str('submit',true) && (!$preview)) {
60
+if (post_str('submit', true) && (!$preview)) {
61 61
     if (POST_MAX_LINKS
62 62
         && link_count($content) > POST_MAX_LINKS
63 63
         && !is_moderator($logged_in_user, $forum)
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
     }
67 67
     check_tokens($logged_in_user->authenticator);
68 68
 
69
-    $add_signature = (post_str('add_signature', true) == "1")?1:0;
69
+    $add_signature = (post_str('add_signature', true) == "1") ? 1 : 0;
70 70
     $content = substr($content, 0, 64000);
71 71
     $content = trim($content);
72 72
     if (strlen($content)) {
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
         $now = time();
75 75
         $post->update("signature=$add_signature, content='$content', modified=$now");
76 76
 
77
-        if ($can_edit_title){
77
+        if ($can_edit_title) {
78 78
             $title = trim($title);
79 79
             $title = sanitize_tags($title);
80 80
             $title = BoincDb::escape_string($title);
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
     }
88 88
 }
89 89
 
90
-page_head(tra("Edit post"),'','','', $bbcode_js);
90
+page_head(tra("Edit post"), '', '', '', $bbcode_js);
91 91
 
92 92
 switch ($forum->parent_type) {
93 93
 case 0:
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
         sprintf(
123 123
             '<input type="text" size=%d name="title" value="%s">',
124 124
             80,
125
-            htmlspecialchars($preview?$title:$thread->title)
125
+            htmlspecialchars($preview ? $title : $thread->title)
126 126
         ),
127 127
         null, FORUM_LH_PCT
128 128
     );
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
         $bbcode_html,
140 140
         12,
141 141
         80,
142
-        htmlspecialchars($preview?$content:$post->content)
142
+        htmlspecialchars($preview ? $content : $post->content)
143 143
     ),
144 144
     null, FORUM_LH_PCT
145 145
 );
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
         '<input id="add_signature" name="add_signature" value="1" type="checkbox" %s>
150 150
         <label for="add_signature">%s</label>
151 151
         ',
152
-        $post->signature?'checked="true"':'',
152
+        $post->signature ? 'checked="true"' : '',
153 153
         tra("Add my signature to this post")
154 154
     ),
155 155
     null, FORUM_LH_PCT
@@ -170,5 +170,5 @@  discard block
 block discarded – undo
170 170
 
171 171
 page_tail();
172 172
 
173
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
173
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
174 174
 ?>
Please login to merge, or discard this patch.
html/inc/forum_email.inc 4 patches
Upper-Lower-Casing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -113,7 +113,7 @@
 block discarded – undo
113 113
 
114 114
 For assistance with ".PROJECT." go to ".$master_url;
115 115
 
116
-    $subject = "THREAD $action REPORT: $thread->title";
116
+    $subject = "thread $action REPORT: $thread->title";
117 117
     $success = mail_report_list($forum, $subject, $body);
118 118
     $success &= send_email($user, $subject, $body);
119 119
     pm_send_msg($user, $user, $subject, $body, false);
Please login to merge, or discard this patch.
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -131,7 +131,7 @@  discard block
 block discarded – undo
131 131
     $link = secure_url_base() . "forum_thread.php?id=" . $thread->id;
132 132
     $body = "A " . PROJECT . " user has posted to the thread
133 133
 \"" . $thread->title . "\".\n"
134
-           ."To view the updated thread, visit:\n$link
134
+            ."To view the updated thread, visit:\n$link
135 135
 
136 136
 --------------------------
137 137
 To change email preferences, visit:
@@ -149,7 +149,7 @@  discard block
 block discarded – undo
149 149
     $link = secure_url_base() . "forum_forum.php?id=" . $forum->id;
150 150
     $body = "A " . PROJECT . " user has added a thread to the forum
151 151
 \"" . $thread->title . "\".\n"
152
-           ."To view the updated forum, visit:\n$link
152
+            ."To view the updated forum, visit:\n$link
153 153
 
154 154
 --------------------------
155 155
 To change email preferences, visit:
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 //////////////////// a user clicks the red "x" to report a post ///////////
163 163
 //
164 164
 function send_report_post_email($user, $forum, $thread,  $post, $message) {
165
-	global $master_url;
165
+    global $master_url;
166 166
 
167 167
     $body = "";
168 168
     $owner = BoincUser::lookup_id($post->user);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 //////////////////// a banishment vote has been started  ///////////
219 219
 //
220 220
 function send_banish_vote_email($user, $duration, $reason, $end_time) {
221
-	global $master_url;
221
+    global $master_url;
222 222
     $now=time();
223 223
     $subject = PROJECT." banishment vote underway";
224 224
     $vote_url = $master_url."forum_banishment_vote.php";
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
     pm_send_msg($user, $user, $subject, $body, false);
241 241
 
242 242
     $body .= "\n\n<a href=".$vote_url."?action=yes&userid="
243
-             .$user->id
244
-           .">[vote to banish author]</a>\n\n"
245
-           ."<a href=".$vote_url."?action=no&userid="
246
-             .$user->id
247
-           .">[vote not to banish author]</a>";
243
+                .$user->id
244
+            .">[vote to banish author]</a>\n\n"
245
+            ."<a href=".$vote_url."?action=no&userid="
246
+                .$user->id
247
+            .">[vote not to banish author]</a>";
248 248
 
249 249
     $forum = new BoincForum;
250 250
     $forum->parent_type = 0;
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 // - project forums: everyone in POST_REPORT_EMAILS
25 25
 // - team message board: team founder and admins
26 26
 //
27
-function mail_report_list($forum, $subject, $body, $must_send=false) {
27
+function mail_report_list($forum, $subject, $body, $must_send = false) {
28 28
     $success = true;
29 29
     switch ($forum->parent_type) {
30 30
     case 0:
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 function send_moderation_email($forum, $post, $thread, $explanation, $action) {
66 66
     global $master_url;
67 67
 
68
-    $moderator=get_logged_in_user();
68
+    $moderator = get_logged_in_user();
69 69
     $body = "";
70 70
     $user = BoincUser::lookup_id($post->user);
71 71
 
@@ -126,11 +126,11 @@  discard block
 block discarded – undo
126 126
 // There's a new post in the thread, which the user is subscribed to.
127 127
 // send them an email notifying them.
128 128
 //
129
-function send_thread_notification_email($thread, $user){
130
-    $title = PROJECT . ": there is a new post in '". $thread->title ."'";
131
-    $link = secure_url_base() . "forum_thread.php?id=" . $thread->id;
132
-    $body = "A " . PROJECT . " user has posted to the thread
133
-\"" . $thread->title . "\".\n"
129
+function send_thread_notification_email($thread, $user) {
130
+    $title = PROJECT.": there is a new post in '".$thread->title."'";
131
+    $link = secure_url_base()."forum_thread.php?id=".$thread->id;
132
+    $body = "A ".PROJECT." user has posted to the thread
133
+\"" . $thread->title."\".\n"
134 134
            ."To view the updated thread, visit:\n$link
135 135
 
136 136
 --------------------------
@@ -144,11 +144,11 @@  discard block
 block discarded – undo
144 144
 // There's a new thread in the forum, which the user is subscribed to.
145 145
 // send them an email notifying them.
146 146
 //
147
-function send_forum_notification_email($forum, $user){
148
-    $title = PROJECT . ": there is a new thread in '". $forum->title ."'";
149
-    $link = secure_url_base() . "forum_forum.php?id=" . $forum->id;
150
-    $body = "A " . PROJECT . " user has added a thread to the forum
151
-\"" . $thread->title . "\".\n"
147
+function send_forum_notification_email($forum, $user) {
148
+    $title = PROJECT.": there is a new thread in '".$forum->title."'";
149
+    $link = secure_url_base()."forum_forum.php?id=".$forum->id;
150
+    $body = "A ".PROJECT." user has added a thread to the forum
151
+\"" . $thread->title."\".\n"
152 152
            ."To view the updated forum, visit:\n$link
153 153
 
154 154
 --------------------------
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 
162 162
 //////////////////// a user clicks the red "x" to report a post ///////////
163 163
 //
164
-function send_report_post_email($user, $forum, $thread,  $post, $message) {
164
+function send_report_post_email($user, $forum, $thread, $post, $message) {
165 165
 	global $master_url;
166 166
 
167 167
     $body = "";
@@ -219,16 +219,16 @@  discard block
 block discarded – undo
219 219
 //
220 220
 function send_banish_vote_email($user, $duration, $reason, $end_time) {
221 221
 	global $master_url;
222
-    $now=time();
222
+    $now = time();
223 223
     $subject = PROJECT." banishment vote underway";
224 224
     $vote_url = $master_url."forum_banishment_vote.php";
225 225
     $body = "
226 226
 A vote has been started to banish you
227 227
 from the ".PROJECT." message boards until ".date('M j,
228
-Y G:i', $duration+$now).",
228
+Y G:i', $duration + $now).",
229 229
 because your postings have not followed our guidelines.
230 230
 
231
-This vote will last until ".date('M j, Y G:i',$end_time)." or until a majority
231
+This vote will last until ".date('M j, Y G:i', $end_time)." or until a majority
232 232
 decision has been reached.  If the vote does not result in banishment, you will be
233 233
 able to resume posting at that time.
234 234
     ";
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 // There's a new post in the thread, which the user is subscribed to.
127 127
 // send them an email notifying them.
128 128
 //
129
-function send_thread_notification_email($thread, $user){
129
+function send_thread_notification_email($thread, $user) {
130 130
     $title = PROJECT . ": there is a new post in '". $thread->title ."'";
131 131
     $link = secure_url_base() . "forum_thread.php?id=" . $thread->id;
132 132
     $body = "A " . PROJECT . " user has posted to the thread
@@ -144,7 +144,7 @@  discard block
 block discarded – undo
144 144
 // There's a new thread in the forum, which the user is subscribed to.
145 145
 // send them an email notifying them.
146 146
 //
147
-function send_forum_notification_email($forum, $user){
147
+function send_forum_notification_email($forum, $user) {
148 148
     $title = PROJECT . ": there is a new thread in '". $forum->title ."'";
149 149
     $link = secure_url_base() . "forum_forum.php?id=" . $forum->id;
150 150
     $body = "A " . PROJECT . " user has added a thread to the forum
Please login to merge, or discard this patch.