Passed
Pull Request — master (#5571)
by
unknown
09:06
created
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/forum_reply.php 2 patches
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $parent_post_id = 0;
51 51
 }
52 52
 
53
-if ($filter != "false"){
53
+if ($filter != "false") {
54 54
     $filter = true;
55 55
 } else {
56 56
     $filter = false;
@@ -65,10 +65,10 @@  discard block
 block discarded – undo
65 65
 }
66 66
 
67 67
 $warning = null;
68
-if ($content && (!$preview)){
69
-    if (post_str('add_signature',true)=="add_it"){
68
+if ($content && (!$preview)) {
69
+    if (post_str('add_signature',true)=="add_it") {
70 70
         $add_signature=true;    // set a flag and concatenate later
71
-    }  else {
71
+    } else {
72 72
         $add_signature=false;
73 73
     }
74 74
     check_tokens($logged_in_user->authenticator);
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
     $parent_post_id = 0;
51 51
 }
52 52
 
53
-if ($filter != "false"){
53
+if ($filter != "false") {
54 54
     $filter = true;
55 55
 } else {
56 56
     $filter = false;
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 }
66 66
 
67 67
 $warning = null;
68
-if ($content && (!$preview)){
69
-    if (post_str('add_signature',true)=="add_it"){
70
-        $add_signature=true;    // set a flag and concatenate later
71
-    }  else {
72
-        $add_signature=false;
68
+if ($content && (!$preview)) {
69
+    if (post_str('add_signature', true) == "add_it") {
70
+        $add_signature = true; // set a flag and concatenate later
71
+    } else {
72
+        $add_signature = false;
73 73
     }
74 74
     check_tokens($logged_in_user->authenticator);
75 75
     if (!akismet_check($logged_in_user, $content)) {
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
     }
89 89
 }
90 90
 
91
-page_head(tra("Post to thread"),'','','', $bbcode_js);
91
+page_head(tra("Post to thread"), '', '', '', $bbcode_js);
92 92
 
93 93
 show_forum_header($logged_in_user);
94 94
 
@@ -142,7 +142,7 @@  discard block
 block discarded – undo
142 142
     $x1 = tra("Message:").bbcode_info().post_warning();
143 143
     $x2 = "";
144 144
     if ($parent_post) {
145
-        $x2 .=" ".tra("reply to %1 Message ID %2:", "<a href=#".$parent_post->id.">", " ".$parent_post->id."</a>");
145
+        $x2 .= " ".tra("reply to %1 Message ID %2:", "<a href=#".$parent_post->id.">", " ".$parent_post->id."</a>");
146 146
     }
147 147
     $x2 .= "<form action=forum_reply.php?thread=".$thread->id;
148 148
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     $x2 .= " method=\"post\" name=\"post\" onsubmit=\"return checkForm(this)\">\n";
154 154
     $x2 .= form_tokens($logged_in_user->authenticator);
155 155
     $x2 .= start_table_str().$bbcode_html.end_table_str()."<textarea class=\"form-control\" name=\"content\" rows=\"18\">";
156
-    $no_quote = get_int("no_quote", true)==1;
156
+    $no_quote = get_int("no_quote", true) == 1;
157 157
     if ($preview) {
158 158
         $x2 .= htmlspecialchars($content);
159 159
     } else if (!$no_quote) {
@@ -162,9 +162,9 @@  discard block
 block discarded – undo
162 162
         }
163 163
     }
164 164
     if (!$logged_in_user->prefs->no_signature_by_default) {
165
-        $enable_signature="checked=\"true\"";
165
+        $enable_signature = "checked=\"true\"";
166 166
     } else {
167
-        $enable_signature="";
167
+        $enable_signature = "";
168 168
     }
169 169
     $x2 .= "</textarea><p> </p>
170 170
         <input class=\"btn btn-primary btn-sm \" type=\"submit\" name=\"preview\" value=\"".tra("Preview")."\">
@@ -179,9 +179,9 @@  discard block
 block discarded – undo
179 179
 }
180 180
 
181 181
 function quote_text($text) {
182
-    $text = "[quote]" . $text . "[/quote]";
182
+    $text = "[quote]".$text."[/quote]";
183 183
     return $text;
184 184
 }
185 185
 
186
-$cvs_version_tracker[]="\$Id$";
186
+$cvs_version_tracker[] = "\$Id$";
187 187
 ?>
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/edit_forum_preferences_form.php 2 patches
Braces   +6 added lines, -5 removed lines patch added patch discarded remove patch
@@ -53,8 +53,9 @@  discard block
 block discarded – undo
53 53
 // ------------ Forum identity -----------
54 54
 
55 55
 $select_0 = $select_1 = $select_2 = "";
56
-if (strlen($user->prefs->avatar)){
57
-    if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar
56
+if (strlen($user->prefs->avatar)) {
57
+    if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") {
58
+// Gravatar
58 59
         $select_1 = "checked=\"true\"";
59 60
     } else {
60 61
         $select_2 = "checked=\"true\"";
@@ -73,7 +74,7 @@  discard block
 block discarded – undo
73 74
     <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2.">
74 75
         <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">"
75 76
 );
76
-if (strlen($user->prefs->avatar)){
77
+if (strlen($user->prefs->avatar)) {
77 78
     row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>",
78 79
     "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">");
79 80
 }
@@ -92,7 +93,7 @@  discard block
 block discarded – undo
92 93
     textarea_with_counter("signature", 250, $signature)
93 94
     ."<br><input type=\"checkbox\" name=\"signature_by_default\" ".$signature_by_default."> ".tra("Attach signature by default")
94 95
 );
95
-if ($user->prefs->signature!=""){
96
+if ($user->prefs->signature!="") {
96 97
     row2(tra("Signature preview").
97 98
         "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>",
98 99
         output_transform($user->prefs->signature)
@@ -138,7 +139,7 @@  discard block
 block discarded – undo
138 139
 
139 140
 $filtered_userlist = get_ignored_list($user);
140 141
 $forum_filtered_userlist = "";
141
-for ($i=0; $i<sizeof($filtered_userlist); $i++){
142
+for ($i=0; $i<sizeof($filtered_userlist); $i++) {
142 143
     $id = (int)$filtered_userlist[$i];
143 144
     if ($id) {
144 145
         $filtered_user = BoincUser::lookup_id($id);
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -38,9 +38,9 @@  discard block
 block discarded – undo
38 38
 // ------------ Notification -----------
39 39
 
40 40
 row1(tra("Notifications"));
41
-$ch0 = $user->prefs->pm_notification==0?"checked":"";
42
-$ch1 = $user->prefs->pm_notification==1?"checked":"";
43
-$ch2 = $user->prefs->pm_notification==2?"checked":"";
41
+$ch0 = $user->prefs->pm_notification == 0 ? "checked" : "";
42
+$ch1 = $user->prefs->pm_notification == 1 ? "checked" : "";
43
+$ch2 = $user->prefs->pm_notification == 2 ? "checked" : "";
44 44
 row2(
45 45
     tra("How should we notify you of new private messages, friend requests, posts in subscribed threads, and other events?"),
46 46
     "<input type=radio name=pm_notification value=0 $ch0> ".tra("On my Account page (no email)")."
@@ -53,8 +53,8 @@  discard block
 block discarded – undo
53 53
 // ------------ Forum identity -----------
54 54
 
55 55
 $select_0 = $select_1 = $select_2 = "";
56
-if (strlen($user->prefs->avatar)){
57
-    if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18)=="//www.gravatar.com") { // Gravatar
56
+if (strlen($user->prefs->avatar)) {
57
+    if (substr($user->prefs->avatar, 0, 23) == 'http://www.gravatar.com' || substr($user->prefs->avatar, 0, 18) == "//www.gravatar.com") { // Gravatar
58 58
         $select_1 = "checked=\"true\"";
59 59
     } else {
60 60
         $select_2 = "checked=\"true\"";
@@ -73,15 +73,15 @@  discard block
 block discarded – undo
73 73
     <input type=\"radio\" id=\"avatar_select_2\" name=\"avatar_select\" value=\"2\" ".$select_2.">
74 74
         <label for=\"avatar_select_2\">".tra("Use this uploaded avatar:")."</label> <input type=\"file\" name=\"picture\">"
75 75
 );
76
-if (strlen($user->prefs->avatar)){
76
+if (strlen($user->prefs->avatar)) {
77 77
     row2(tra("Avatar preview")."<br><p class=\"text-muted\">".tra("This is how your avatar will look")."</p>",
78 78
     "<img src=\"".$user->prefs->avatar."\" width=\"100\" height=\"100\">");
79 79
 }
80 80
 
81
-$signature_by_default = $user->prefs->no_signature_by_default==false?"checked=\"checked\"":"";
81
+$signature_by_default = $user->prefs->no_signature_by_default == false ? "checked=\"checked\"" : "";
82 82
 
83
-$signature=$user->prefs->signature;
84
-$maxlen=250;
83
+$signature = $user->prefs->signature;
84
+$maxlen = 250;
85 85
 row2(
86 86
     tra("Signature for message board posts")
87 87
     .bbcode_info()
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
     textarea_with_counter("signature", 250, $signature)
93 93
     ."<br><input type=\"checkbox\" name=\"signature_by_default\" ".$signature_by_default."> ".tra("Attach signature by default")
94 94
 );
95
-if ($user->prefs->signature!=""){
95
+if ($user->prefs->signature != "") {
96 96
     row2(tra("Signature preview").
97 97
         "<br><p class=\"text-muted\">".tra("This is how your signature will look in the forums")."</p>",
98 98
         output_transform($user->prefs->signature)
@@ -101,13 +101,13 @@  discard block
 block discarded – undo
101 101
 
102 102
 // ------------ Message display  -----------
103 103
 
104
-$forum_hide_avatars = $user->prefs->hide_avatars?"checked=\"checked\"":"";
105
-$forum_hide_signatures = $user->prefs->hide_signatures?"checked=\"checked\"":"";
106
-$forum_link_popup = $user->prefs->link_popup?"checked=\"checked\"":"";
107
-$forum_image_as_link = $user->prefs->images_as_links?"checked=\"checked\"":"";
108
-$forum_jump_to_unread = $user->prefs->jump_to_unread?"checked=\"checked\"":"";
109
-$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts?"checked=\"checked\"":"";
110
-$forum_highlight_special = $user->prefs->highlight_special?"checked=\"checked\"":"";
104
+$forum_hide_avatars = $user->prefs->hide_avatars ? "checked=\"checked\"" : "";
105
+$forum_hide_signatures = $user->prefs->hide_signatures ? "checked=\"checked\"" : "";
106
+$forum_link_popup = $user->prefs->link_popup ? "checked=\"checked\"" : "";
107
+$forum_image_as_link = $user->prefs->images_as_links ? "checked=\"checked\"" : "";
108
+$forum_jump_to_unread = $user->prefs->jump_to_unread ? "checked=\"checked\"" : "";
109
+$forum_ignore_sticky_posts = $user->prefs->ignore_sticky_posts ? "checked=\"checked\"" : "";
110
+$forum_highlight_special = $user->prefs->highlight_special ? "checked=\"checked\"" : "";
111 111
 
112 112
 $forum_minimum_wrap_postcount = intval($user->prefs->minimum_wrap_postcount);
113 113
 $forum_display_wrap_postcount = intval($user->prefs->display_wrap_postcount);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 
139 139
 $filtered_userlist = get_ignored_list($user);
140 140
 $forum_filtered_userlist = "";
141
-for ($i=0; $i<sizeof($filtered_userlist); $i++){
141
+for ($i = 0; $i < sizeof($filtered_userlist); $i++) {
142 142
     $id = (int)$filtered_userlist[$i];
143 143
     if ($id) {
144 144
         $filtered_user = BoincUser::lookup_id($id);
@@ -168,5 +168,5 @@  discard block
 block discarded – undo
168 168
 end_table();
169 169
 page_tail();
170 170
 
171
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
171
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
172 172
 ?>
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   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     if ($template) {
59 59
         $t = (double)$template->workunit->rsc_fpops_est;
60 60
     }
61
-    foreach($r->batch->job as $job) {
61
+    foreach ($r->batch->job as $job) {
62 62
         $y = (double)$job->rsc_fpops_est;
63 63
         if ($y) {
64 64
             $x += $y;
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 function est_elapsed_time($r, $template) {
85 85
     // crude estimate: batch FLOPs / project FLOPS
86 86
     //
87
-    return batch_flop_count($r, $template) / project_flops();
87
+    return batch_flop_count($r, $template)/project_flops();
88 88
 }
89 89
 
90 90
 // if batch-level input template filename was given, read it;
@@ -94,9 +94,9 @@  discard block
 block discarded – undo
94 94
 //
95 95
 function read_input_template($app, $r) {
96 96
     if ((isset($r->batch)) && (isset($r->batch->workunit_template_file)) && ($r->batch->workunit_template_file)) {
97
-        $path = project_dir() . "/templates/".$r->batch->workunit_template_file;
97
+        $path = project_dir()."/templates/".$r->batch->workunit_template_file;
98 98
     } else {
99
-        $path = project_dir() . "/templates/$app->name"."_in";
99
+        $path = project_dir()."/templates/$app->name"."_in";
100 100
     }
101 101
     if (file_exists($path)) {
102 102
         $x = simplexml_load_file($path);
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 function validate_batch($jobs, $template) {
142 142
     $i = 0;
143 143
     $n = count($template->file_info);
144
-    foreach($jobs as $job) {
144
+    foreach ($jobs as $job) {
145 145
         $m = count($job->input_files);
146 146
         if ($n != $m) {
147 147
             log_write("wrong # of input files for job $i: need $n, got $m");
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
 // stage all the files
203 203
 //
204 204
 function stage_files(&$jobs) {
205
-    foreach($jobs as $job) {
205
+    foreach ($jobs as $job) {
206 206
         foreach ($job->input_files as $file) {
207 207
             if ($file->mode != "remote") {
208 208
                 $file->name = stage_file($file);
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
 //
216 216
 function submit_jobs(
217 217
     $jobs, $job_params, $app, $batch_id, $priority, $app_version_num,
218
-    $input_template_filename,        // batch-level; can also specify per job
218
+    $input_template_filename, // batch-level; can also specify per job
219 219
     $output_template_filename,
220 220
     $user
221 221
 ) {
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
     // one line per job
226 226
     //
227 227
     $x = "";
228
-    foreach($jobs as $job) {
228
+    foreach ($jobs as $job) {
229 229
         if ($job->name) {
230 230
             $x .= " --wu_name $job->name";
231 231
         }
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
         $x .= "\n";
261 261
     }
262 262
 
263
-    $cmd = "cd " . project_dir() . "; ./bin/create_work --appname $app->name --batch $batch_id";
263
+    $cmd = "cd ".project_dir()."; ./bin/create_work --appname $app->name --batch $batch_id";
264 264
 
265 265
     if ($user->seti_id) {
266 266
         $cmd .= " --target_user $user->id ";
@@ -296,7 +296,7 @@  discard block
 block discarded – undo
296 296
 
297 297
     // send stdin/stderr to a temp file
298 298
     $cmd .= sprintf(' >%s 2>&1',
299
-        "/tmp/create_work_" . getmypid() . ".err"
299
+        "/tmp/create_work_".getmypid().".err"
300 300
     );
301 301
 
302 302
     $h = popen($cmd, "w");
@@ -369,7 +369,7 @@  discard block
 block discarded – undo
369 369
 //
370 370
 function xml_get_jobs($r) {
371 371
     $jobs = array();
372
-    foreach($r->batch->job as $j) {
372
+    foreach ($r->batch->job as $j) {
373 373
         $job = new StdClass;
374 374
         $job->input_files = array();
375 375
         $job->command_line = (string)$j->command_line;
@@ -420,16 +420,16 @@  discard block
 block discarded – undo
420 420
 //
421 421
 function logical_end_time($r, $jobs, $user, $app) {
422 422
     $total_flops = 0;
423
-    foreach($jobs as $job) {
423
+    foreach ($jobs as $job) {
424 424
         //print_r($job);
425 425
         if ($job->rsc_fpops_est) {
426 426
             $total_flops += $job->rsc_fpops_est;
427 427
         } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) {
428
-            $total_flops += (double) $job->input_template->workunit->rsc_fpops_est;
428
+            $total_flops += (double)$job->input_template->workunit->rsc_fpops_est;
429 429
         } else if ($r->batch->job_params->rsc_fpops_est) {
430
-            $total_flops += (double) $r->batch->job_params->rsc_fpops_est;
430
+            $total_flops += (double)$r->batch->job_params->rsc_fpops_est;
431 431
         } else {
432
-            $x = (double) $template->workunit->rsc_fpops_est;
432
+            $x = (double)$template->workunit->rsc_fpops_est;
433 433
             if ($x) {
434 434
                 $total_flops += $x;
435 435
             } else {
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
             }
438 438
         }
439 439
     }
440
-    $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name";
440
+    $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name";
441 441
     $x = exec($cmd);
442 442
     if (!is_numeric($x) || (double)$x == 0) {
443 443
         xml_error(-1, "$cmd returned $x");
@@ -515,15 +515,15 @@  discard block
 block discarded – undo
515 515
     }
516 516
 
517 517
     $job_params = new StdClass;
518
-    $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound;
519
-    $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est;
520
-    $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound;
521
-    $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound;
522
-    $job_params->delay_bound = (double) $r->batch->job_params->delay_bound;
518
+    $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound;
519
+    $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est;
520
+    $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound;
521
+    $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound;
522
+    $job_params->delay_bound = (double)$r->batch->job_params->delay_bound;
523 523
         // could add quorum-related stuff
524 524
 
525
-    $input_template_filename = (string) $r->batch->input_template_filename;
526
-    $output_template_filename = (string) $r->batch->output_template_filename;
525
+    $input_template_filename = (string)$r->batch->input_template_filename;
526
+    $output_template_filename = (string)$r->batch->output_template_filename;
527 527
         // possibly empty
528 528
 
529 529
     submit_jobs(
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 }
614 614
 
615 615
 function n_outfiles($wu) {
616
-    $path = project_dir() . "/$wu->output_template_filename";
616
+    $path = project_dir()."/$wu->output_template_filename";
617 617
     $r = simplexml_load_file($path);
618 618
     return count($r->file_info);
619 619
 }
@@ -820,7 +820,7 @@  discard block
 block discarded – undo
820 820
 ";
821 821
         if ($result->server_state == 5) {   // over?
822 822
             $paths = get_outfile_paths($result);
823
-            foreach($paths as $path) {
823
+            foreach ($paths as $path) {
824 824
                 if (is_file($path)) {
825 825
                     $size = filesize($path);
826 826
                     echo "        <outfile>
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
     } else {
865 865
         $results = BoincResult::enum("workunitid=$job_id");
866 866
         foreach ($results as $r) {
867
-            switch($r->outcome) {
867
+            switch ($r->outcome) {
868 868
             case 1:
869 869
             case 3:
870 870
             case 6:
@@ -979,8 +979,8 @@  discard block
 block discarded – undo
979 979
     }
980 980
 
981 981
     list($user, $user_submit) = check_remote_submit_permissions($r, $app);
982
-    $in = file_get_contents(project_dir() . "/templates/".$app->name."_in");
983
-    $out = file_get_contents(project_dir() . "/templates/".$app->name."_out");
982
+    $in = file_get_contents(project_dir()."/templates/".$app->name."_in");
983
+    $out = file_get_contents(project_dir()."/templates/".$app->name."_out");
984 984
     if ($in === false || $out === false) {
985 985
         log_write("template file missing");
986 986
         xml_error(-1, "template file missing");
@@ -992,7 +992,7 @@  discard block
 block discarded – undo
992 992
 
993 993
 function ping($r) {
994 994
     xml_start_tag("ping");
995
-    BoincDb::get();     // errors out if DB down or web disabled
995
+    BoincDb::get(); // errors out if DB down or web disabled
996 996
     echo "<success>1</success>
997 997
         </ping>
998 998
     ";
@@ -1059,9 +1059,9 @@  discard block
 block discarded – undo
1059 1059
 $request_log = parse_config(get_config(), "<remote_submit_request_log>");
1060 1060
 if ($request_log) {
1061 1061
     $log_dir = parse_config(get_config(), "<log_dir>");
1062
-    $request_log = $log_dir . "/" . $request_log;
1062
+    $request_log = $log_dir."/".$request_log;
1063 1063
     if ($file = fopen($request_log, "a")) {
1064
-        fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n");
1064
+        fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n");
1065 1065
         fclose($file);
1066 1066
     }
1067 1067
 }
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   +11 added lines, -11 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,22 +76,22 @@  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"),
87 87
     '<select class="form-control" name="search_sort">'.$sortlist.'</select');
88 88
 
89 89
 row1("&nbsp;");
90
-row2("","<input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Start the search")."\">");
90
+row2("", "<input class=\"btn btn-success\" type=\"submit\" value=\"".tra("Start the search")."\">");
91 91
 echo "</form>";
92 92
 end_table();
93 93
 
94 94
 page_tail();
95 95
 
96
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
96
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
97 97
 ?>
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   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
 $post_owner = BoincUser::lookup_id($post->user);
46 46
 if (($logged_in_user->id != $post_owner->id) || (can_reply($thread, $forum, $logged_in_user) == false)) {
47
-    error_page (tra("You are not authorized to edit this post."));
47
+    error_page(tra("You are not authorized to edit this post."));
48 48
 }
49 49
 
50 50
 $thread_owner = BoincUser::lookup_id($thread->owner);
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
 // (ie. not a response to another post)
54 54
 // allow the user to modify the thread title
55 55
 //
56
-$can_edit_title = ($post->parent_post==0 && $thread_owner->id==$logged_in_user->id && !is_banished($logged_in_user));
56
+$can_edit_title = ($post->parent_post == 0 && $thread_owner->id == $logged_in_user->id && !is_banished($logged_in_user));
57 57
 
58 58
 $content = post_str("content", true);
59 59
 $title = post_str("title", true);
60 60
 $preview = post_str("preview", true);
61 61
 
62
-if (post_str('submit',true) && (!$preview)) {
62
+if (post_str('submit', true) && (!$preview)) {
63 63
     if (POST_MAX_LINKS
64 64
         && link_count($content) > POST_MAX_LINKS
65 65
         && !is_moderator($logged_in_user, $forum)
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
     }
69 69
     check_tokens($logged_in_user->authenticator);
70 70
     
71
-    $add_signature = (post_str('add_signature', true) == "1")?1:0;
71
+    $add_signature = (post_str('add_signature', true) == "1") ? 1 : 0;
72 72
     $content = substr($content, 0, 64000);
73 73
     $content = trim($content);
74 74
     if (strlen($content)) {
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
         $now = time();
77 77
         $post->update("signature=$add_signature, content='$content', modified=$now");
78 78
     
79
-        if ($can_edit_title){
79
+        if ($can_edit_title) {
80 80
             $title = trim($title);
81 81
             $title = sanitize_tags($title);
82 82
             $title = BoincDb::escape_string($title);
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
     }
90 90
 }
91 91
 
92
-page_head(tra("Edit post"),'','','', $bbcode_js);
92
+page_head(tra("Edit post"), '', '', '', $bbcode_js);
93 93
 
94 94
 show_forum_header($logged_in_user);
95 95
 switch ($forum->parent_type) {
@@ -144,9 +144,9 @@  discard block
 block discarded – undo
144 144
 }
145 145
 
146 146
 if ($post->signature) {
147
-    $enable_signature="checked=\"true\"";
147
+    $enable_signature = "checked=\"true\"";
148 148
 } else {
149
-    $enable_signature="";
149
+    $enable_signature = "";
150 150
 }
151 151
 row2("", "<input id=\"add_signature\" name=\"add_signature\" value=\"1\" ".$enable_signature." type=\"checkbox\">
152 152
     <label for=\"add_signature\">".tra("Add my signature to this post")."</label>");
@@ -159,5 +159,5 @@  discard block
 block discarded – undo
159 159
 
160 160
 page_tail();
161 161
 
162
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
162
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
163 163
 ?>
Please login to merge, or discard this patch.