Passed
Push — dpa_docker_wrapper_mac ( 9edeea...9420a4 )
by David
08:37
created
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.
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 ";
@@ -380,7 +380,7 @@  discard block
 block discarded – undo
380 380
 //
381 381
 function xml_get_jobs($r) {
382 382
     $jobs = array();
383
-    foreach($r->batch->job as $j) {
383
+    foreach ($r->batch->job as $j) {
384 384
         $job = new StdClass;
385 385
         $job->input_files = array();
386 386
         $job->command_line = (string)$j->command_line;
@@ -431,16 +431,16 @@  discard block
 block discarded – undo
431 431
 //
432 432
 function logical_end_time($r, $jobs, $user, $app) {
433 433
     $total_flops = 0;
434
-    foreach($jobs as $job) {
434
+    foreach ($jobs as $job) {
435 435
         //print_r($job);
436 436
         if ($job->rsc_fpops_est) {
437 437
             $total_flops += $job->rsc_fpops_est;
438 438
         } else if ($job->input_template && $job->input_template->workunit->rsc_fpops_est) {
439
-            $total_flops += (double) $job->input_template->workunit->rsc_fpops_est;
439
+            $total_flops += (double)$job->input_template->workunit->rsc_fpops_est;
440 440
         } else if ($r->batch->job_params->rsc_fpops_est) {
441
-            $total_flops += (double) $r->batch->job_params->rsc_fpops_est;
441
+            $total_flops += (double)$r->batch->job_params->rsc_fpops_est;
442 442
         } else {
443
-            $x = (double) $template->workunit->rsc_fpops_est;
443
+            $x = (double)$template->workunit->rsc_fpops_est;
444 444
             if ($x) {
445 445
                 $total_flops += $x;
446 446
             } else {
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
             }
449 449
         }
450 450
     }
451
-    $cmd = "cd " . project_dir() . "/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name";
451
+    $cmd = "cd ".project_dir()."/bin; ./adjust_user_priority --user $user->id --flops $total_flops --app $app->name";
452 452
     $x = exec($cmd);
453 453
     if (!is_numeric($x) || (double)$x == 0) {
454 454
         xml_error(-1, "$cmd returned $x");
@@ -533,15 +533,15 @@  discard block
 block discarded – undo
533 533
     }
534 534
 
535 535
     $job_params = new StdClass;
536
-    $job_params->rsc_disk_bound = (double) $r->batch->job_params->rsc_disk_bound;
537
-    $job_params->rsc_fpops_est = (double) $r->batch->job_params->rsc_fpops_est;
538
-    $job_params->rsc_fpops_bound = (double) $r->batch->job_params->rsc_fpops_bound;
539
-    $job_params->rsc_memory_bound = (double) $r->batch->job_params->rsc_memory_bound;
540
-    $job_params->delay_bound = (double) $r->batch->job_params->delay_bound;
536
+    $job_params->rsc_disk_bound = (double)$r->batch->job_params->rsc_disk_bound;
537
+    $job_params->rsc_fpops_est = (double)$r->batch->job_params->rsc_fpops_est;
538
+    $job_params->rsc_fpops_bound = (double)$r->batch->job_params->rsc_fpops_bound;
539
+    $job_params->rsc_memory_bound = (double)$r->batch->job_params->rsc_memory_bound;
540
+    $job_params->delay_bound = (double)$r->batch->job_params->delay_bound;
541 541
         // could add quorum-related stuff
542 542
 
543
-    $input_template_filename = (string) $r->batch->input_template_filename;
544
-    $output_template_filename = (string) $r->batch->output_template_filename;
543
+    $input_template_filename = (string)$r->batch->input_template_filename;
544
+    $output_template_filename = (string)$r->batch->output_template_filename;
545 545
         // possibly empty
546 546
 
547 547
     submit_jobs(
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
 }
635 635
 
636 636
 function n_outfiles($wu) {
637
-    $path = project_dir() . "/$wu->output_template_filename";
637
+    $path = project_dir()."/$wu->output_template_filename";
638 638
     $r = simplexml_load_file($path);
639 639
     return count($r->file_info);
640 640
 }
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 ";
842 842
         if ($result->server_state == 5) {   // over?
843 843
             $paths = get_outfile_paths($result);
844
-            foreach($paths as $path) {
844
+            foreach ($paths as $path) {
845 845
                 if (is_file($path)) {
846 846
                     $size = filesize($path);
847 847
                     echo "        <outfile>
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
     } else {
886 886
         $results = BoincResult::enum("workunitid=$job_id");
887 887
         foreach ($results as $r) {
888
-            switch($r->outcome) {
888
+            switch ($r->outcome) {
889 889
             case 1:
890 890
             case 3:
891 891
             case 6:
@@ -1000,8 +1000,8 @@  discard block
 block discarded – undo
1000 1000
     }
1001 1001
 
1002 1002
     $user = check_remote_submit_permissions($r, $app);
1003
-    $in = file_get_contents(project_dir() . "/templates/".$app->name."_in");
1004
-    $out = file_get_contents(project_dir() . "/templates/".$app->name."_out");
1003
+    $in = file_get_contents(project_dir()."/templates/".$app->name."_in");
1004
+    $out = file_get_contents(project_dir()."/templates/".$app->name."_out");
1005 1005
     if ($in === false || $out === false) {
1006 1006
         log_write("template file missing");
1007 1007
         xml_error(-1, "template file missing");
@@ -1013,7 +1013,7 @@  discard block
 block discarded – undo
1013 1013
 
1014 1014
 function ping($r) {
1015 1015
     xml_start_tag("ping");
1016
-    BoincDb::get();     // errors out if DB down or web disabled
1016
+    BoincDb::get(); // errors out if DB down or web disabled
1017 1017
     echo "<success>1</success>
1018 1018
         </ping>
1019 1019
     ";
@@ -1080,9 +1080,9 @@  discard block
 block discarded – undo
1080 1080
 $request_log = parse_config(get_config(), "<remote_submit_request_log>");
1081 1081
 if ($request_log) {
1082 1082
     $log_dir = parse_config(get_config(), "<log_dir>");
1083
-    $request_log = $log_dir . "/" . $request_log;
1083
+    $request_log = $log_dir."/".$request_log;
1084 1084
     if ($file = fopen($request_log, "a")) {
1085
-        fwrite($file, "\n<submit_rpc_handler date=\"" . date(DATE_ATOM) . "\">\n" . $_POST['request'] . "\n</submit_rpc_handler>\n");
1085
+        fwrite($file, "\n<submit_rpc_handler date=\"".date(DATE_ATOM)."\">\n".$_POST['request']."\n</submit_rpc_handler>\n");
1086 1086
         fclose($file);
1087 1087
     }
1088 1088
 }
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.
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   +9 added lines, -9 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"),
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   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
     }
65 65
 }
66 66
 
67
-form_start("create_account_action.php","post");
67
+form_start("create_account_action.php", "post");
68 68
 create_account_form($teamid, $next_url);
69 69
 global $recaptcha_public_key;
70 70
 if ($recaptcha_public_key) {
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
@@ -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
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.
html/inc/db_ops.inc 4 patches
Upper-Lower-Casing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -399,7 +399,7 @@  discard block
 block discarded – undo
399 399
         $x = (int)$y;
400 400
     }
401 401
     if (0<=$x && $x<=9) {
402
-        return FALSE;
402
+        return false;
403 403
     } else {
404 404
         return "$x ".error_code_str($x);
405 405
     }
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
     row("Domain name", $host->domain_name);
892 892
     $x = $host->timezone/3600;
893 893
     if ($x >= 0) $x="+$x";
894
-    row("Local Standard Time", "UTC $x hours");
894
+    row("Local Standard Time", "utc $x hours");
895 895
     row("Number of CPUs", $host->p_ncpus);
896 896
     row("CPU", "$host->p_vendor $host->p_model");
897 897
     row("GFLOPS", number_format($host->p_fpops/1e9, 2));
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
             $value=null;
309 309
         }
310 310
         if (isset($_GET[$order])) {
311
-             $order = $_GET[$order];
311
+                $order = $_GET[$order];
312 312
         } else {
313
-             $order = null;
313
+                $order = null;
314 314
         }
315 315
         if ($value) {
316 316
             if ($order == 'asc') {
@@ -1086,8 +1086,8 @@  discard block
 block discarded – undo
1086 1086
 
1087 1087
 function validate_color($validate_state) {
1088 1088
     switch ($validate_state) {
1089
-   case 1: return '33cc33'; // valid, green
1090
-   case 2: return 'ffa500'; // invalid result, orange
1089
+    case 1: return '33cc33'; // valid, green
1090
+    case 2: return 'ffa500'; // invalid result, orange
1091 1091
     }
1092 1092
     return '';
1093 1093
 }
Please login to merge, or discard this patch.
Spacing   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -40,22 +40,22 @@  discard block
 block discarded – undo
40 40
 // Should fix at some point.
41 41
 //
42 42
 function mysqltime_str($x) {
43
-    if(strpos($x,"-")==4) {
43
+    if (strpos($x, "-") == 4) {
44 44
         // Syntax of supplied mysql-timestamp is YYYY-MM-DD HH:MM:SS
45
-        $year = substr($x,0,4);
46
-        $month = substr($x,5,2);
47
-        $day = substr($x,8,2);
48
-        $hour = substr($x,11,2);
49
-        $minute = substr($x,14,2);
50
-        $second = substr($x,17,2);
45
+        $year = substr($x, 0, 4);
46
+        $month = substr($x, 5, 2);
47
+        $day = substr($x, 8, 2);
48
+        $hour = substr($x, 11, 2);
49
+        $minute = substr($x, 14, 2);
50
+        $second = substr($x, 17, 2);
51 51
     } else {
52 52
         // Syntax of supplied mysql-timestamp is YYYYMMDDHHMMSS
53
-        $year = substr($x,0,4);
54
-        $month = substr($x,4,2);
55
-        $day = substr($x,6,2);
56
-        $hour = substr($x,8,2);
57
-        $minute = substr($x,10,2);
58
-        $second = substr($x,12,2);
53
+        $year = substr($x, 0, 4);
54
+        $month = substr($x, 4, 2);
55
+        $day = substr($x, 6, 2);
56
+        $hour = substr($x, 8, 2);
57
+        $minute = substr($x, 10, 2);
58
+        $second = substr($x, 12, 2);
59 59
 
60 60
     }
61 61
     $time = mktime($hour, $minute, $second, $month, $day, $year);
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             if (preg_match('/^MYSQLI_TYPE_(.*)/', $c, $m)) $types[$n] = $m[1];
99 99
         }
100 100
     }
101
-    return array_key_exists($type_id, $types)? strtolower($types[$type_id]) : "unknown";
101
+    return array_key_exists($type_id, $types) ? strtolower($types[$type_id]) : "unknown";
102 102
 }
103 103
 
104 104
 // print a description of $table
@@ -108,38 +108,38 @@  discard block
 block discarded – undo
108 108
     $result = $db->do_query("SELECT * from $table LIMIT 1");
109 109
     $fields = $result->field_count;
110 110
 
111
-    $avgnum=(int)($fields/$columns);
112
-    if ($avgnum*$columns<$fields) {
111
+    $avgnum = (int)($fields/$columns);
112
+    if ($avgnum*$columns < $fields) {
113 113
         $avgnum++;
114 114
     }
115 115
 
116
-    $actualcolumns=0;
117
-    while ($avgnum*$actualcolumns<$fields) {
116
+    $actualcolumns = 0;
117
+    while ($avgnum*$actualcolumns < $fields) {
118 118
         $actualcolumns++;
119 119
     }
120 120
 
121
-    if ($which>$actualcolumns) {
121
+    if ($which > $actualcolumns) {
122 122
         return 0;
123 123
     }
124 124
 
125
-    $bot=($which-1)*$avgnum;
126
-    $top=$which*$avgnum;
125
+    $bot = ($which - 1)*$avgnum;
126
+    $top = $which*$avgnum;
127 127
 
128
-    $width=100.0/$actualcolumns;
128
+    $width = 100.0/$actualcolumns;
129 129
 
130 130
     echo "<td>";
131 131
     start_table('table-striped');
132 132
     echo "<tr><th align=\"left\">NAME</th><th align=\"left\">Type</th><th align=\"left\">Bytes</th>\n";
133
-    for ($count=$bot; $count<$top; $count++) {
134
-        if ($count<$fields) {
133
+    for ($count = $bot; $count < $top; $count++) {
134
+        if ($count < $fields) {
135 135
             $x = $result->fetch_field_direct($count);
136 136
             $name = $x->name;
137 137
             $type = mysql_fieldtype_str($x->type);
138 138
             $length = $x->length;
139 139
         } else {
140
-            $name="<br/> ";
141
-            $type="<br/>";
142
-            $length="<br/>";
140
+            $name = "<br/> ";
141
+            $type = "<br/>";
142
+            $length = "<br/>";
143 143
         }
144 144
         echo "\t<tr><td><b>$name</b></td><td>$type</td><td>$length</td></tr>\n";
145 145
     }
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
     echo "<h2>Description of <b>$table</b> table fields:</h2>\n";
155 155
     start_table();
156 156
     echo "<tr>";
157
-    for ($i=1; $i<=$how_many_columns; $i++) {
157
+    for ($i = 1; $i <= $how_many_columns; $i++) {
158 158
         print_describe_table_onecol($table, $i, $how_many_columns);
159 159
     }
160 160
     echo "</tr>";
@@ -173,10 +173,10 @@  discard block
 block discarded – undo
173 173
 }
174 174
 
175 175
 function print_query_field() {
176
-    $currenttime=time();
177
-    $hourago=$currenttime-3600;
178
-    $dayago=$currenttime-24*3600;
179
-    $weekago=$currenttime-7*24*3600;
176
+    $currenttime = time();
177
+    $hourago = $currenttime - 3600;
178
+    $dayago = $currenttime - 24*3600;
179
+    $weekago = $currenttime - 7*24*3600;
180 180
     echo "
181 181
         <tr>
182 182
         <td align=\"right\">Additional clauses</td>
@@ -200,11 +200,11 @@  discard block
 block discarded – undo
200 200
     }
201 201
 }
202 202
 
203
-function append_sql_query($original,$addition,$first) {
203
+function append_sql_query($original, $addition, $first) {
204 204
     if ($first == 1) {
205
-        return $original . " where " . $addition;
205
+        return $original." where ".$addition;
206 206
     } else {
207
-        return $original . " and " . $addition;
207
+        return $original." and ".$addition;
208 208
     }
209 209
 }
210 210
 
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
         if (isset($_GET[$name])) {
306 306
             $value = $_GET[$name];
307 307
         } else {
308
-            $value=null;
308
+            $value = null;
309 309
         }
310 310
         if (isset($_GET[$order])) {
311 311
              $order = $_GET[$order];
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
     }
347 347
 
348 348
     function get_url($base = "db_action.php") {
349
-        $s = $base . "?table=$this->table$this->urlquery";
349
+        $s = $base."?table=$this->table$this->urlquery";
350 350
         return $s;
351 351
     }
352 352
 
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
         $this->addeq('app_version_id');
362 362
         $this->addeq('exit_status');
363 363
         if (isset($_GET['nsecs'])) {
364
-            $_GET['mod_time'] = date("YmdHis",time() - $_GET['nsecs']);
364
+            $_GET['mod_time'] = date("YmdHis", time() - $_GET['nsecs']);
365 365
         }
366 366
         $this->addgt('mod_time');
367 367
         $this->addeq_not_CHOOSE_ALL('server_state');
@@ -382,7 +382,7 @@  discard block
 block discarded – undo
382 382
     if ($n == '0') { // intentional compare by string
383 383
         return "0";
384 384
     } else {
385
-        if(strlen($clauses)) {
385
+        if (strlen($clauses)) {
386 386
             return "<a href=\"db_action.php?table=result&query=$mq&$query&clauses=".urlencode($clauses)."&sort_by=mod_time&detail=low\">$n</a>";
387 387
         } else {
388 388
             return "<a href=\"db_action.php?table=result&query=$mq&$query&sort_by=mod_time&detail=low\">$n</a>";
@@ -395,13 +395,13 @@  discard block
 block discarded – undo
395 395
 // @return String A human readable string if error otherwise FALSE
396 396
 // @param String $stderr_out the stderr_out value to parse
397 397
 //
398
-function stderr_error_string($stderr_out){
398
+function stderr_error_string($stderr_out) {
399 399
     $y = parse_element($stderr_out, "<error_code>");
400 400
     $x = 0;
401 401
     if ($y) {
402 402
         $x = (int)$y;
403 403
     }
404
-    if (0<=$x && $x<=9) {
404
+    if (0 <= $x && $x <= 9) {
405 405
         return FALSE;
406 406
     } else {
407 407
         return "$x ".error_code_str($x);
@@ -409,8 +409,8 @@  discard block
 block discarded – undo
409 409
 }
410 410
 
411 411
 function admin_show_result_summary() {
412
-    $ntotal =0;     // TODO: how to count $result?
413
-    $nvalid = 0;    // for SUCCESS results
412
+    $ntotal = 0; // TODO: how to count $result?
413
+    $nvalid = 0; // for SUCCESS results
414 414
     $ninvalid = 0;
415 415
     $nfile_deleted = 0;
416 416
 
@@ -418,20 +418,20 @@  discard block
 block discarded – undo
418 418
     $outcome = array();
419 419
     $client_state = array();
420 420
 
421
-    for ($ss=1; $ss<6; $ss++) {
421
+    for ($ss = 1; $ss < 6; $ss++) {
422 422
         $server_state[$ss] = 0;
423 423
     }
424
-    for ($ro=0; $ro<8; $ro++) {
424
+    for ($ro = 0; $ro < 8; $ro++) {
425 425
         $outcome[$ro] = 0;
426 426
     }
427
-    for ($cs=1; $cs<7; $cs++) {
427
+    for ($cs = 1; $cs < 7; $cs++) {
428 428
         $client_state[$cs] = 0;
429 429
     }
430
-    for ($fds=0; $fds<4; $fds++) {
430
+    for ($fds = 0; $fds < 4; $fds++) {
431 431
         $delete_state[$fds] = 0;
432 432
     }
433
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
434
-        $validate_state[$vs]=0;
433
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
434
+        $validate_state[$vs] = 0;
435 435
     }
436 436
 
437 437
     $_GET['table'] = 'result';
@@ -506,7 +506,7 @@  discard block
 block discarded – undo
506 506
         //
507 507
         $delay = parse_config(get_config(), "<delete_delay_hours>");
508 508
         if ($delay) {
509
-            $start2 = $start - $delay*3600;;
509
+            $start2 = $start - $delay*3600; ;
510 510
             $main_query .= " and ((file_delete_state>1 and mod_time>FROM_UNIXTIME($start2)) or (mod_time>FROM_UNIXTIME($start)))";
511 511
         } else {
512 512
             $main_query .= " and mod_time > FROM_UNIXTIME($start)";
@@ -565,21 +565,21 @@  discard block
 block discarded – undo
565 565
 
566 566
     start_table();
567 567
     echo "<tr valign=\"top\">";
568
-    echo "<td><h2>" . link_results("$ntotal results", $urlquery, '', '') . "</h2></td>";
569
-    echo "<td><h2>" . link_results("'Over' results", $urlquery, sprintf('server_state=%d', RESULT_SERVER_STATE_OVER), '') . "</h2></td>";
570
-    echo "<td><h2>" . link_results("'Success' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_SUCCESS), '') . "</h2></td>";
571
-    echo "<td><h2>" . link_results("'Client error' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_CLIENT_ERROR), '') . "</h2></td>";
568
+    echo "<td><h2>".link_results("$ntotal results", $urlquery, '', '')."</h2></td>";
569
+    echo "<td><h2>".link_results("'Over' results", $urlquery, sprintf('server_state=%d', RESULT_SERVER_STATE_OVER), '')."</h2></td>";
570
+    echo "<td><h2>".link_results("'Success' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_SUCCESS), '')."</h2></td>";
571
+    echo "<td><h2>".link_results("'Client error' results", $urlquery, sprintf('outcome=%d', RESULT_OUTCOME_CLIENT_ERROR), '')."</h2></td>";
572 572
     echo "</tr>";
573 573
     echo "<tr valign=\"top\">";
574 574
     echo "<td>";
575 575
     start_table('table-striped');
576 576
     echo "<tr><th>Server state</th><th># results</th></tr>\n";
577
-    for ($ss=1; $ss<6; $ss++) {
577
+    for ($ss = 1; $ss < 6; $ss++) {
578 578
         $res = new StdClass;
579 579
         $res->server_state = $ss;
580 580
         row2(result_server_state_string($res),
581 581
             link_results(
582
-                "$server_state[$ss]",  $urlquery, "server_state=$ss", ''
582
+                "$server_state[$ss]", $urlquery, "server_state=$ss", ''
583 583
             )
584 584
         );
585 585
     }
@@ -590,12 +590,12 @@  discard block
 block discarded – undo
590 590
     start_table('table-striped');
591 591
     echo "<tr><th>Outcome</th><th># results</th></tr>\n";
592 592
 
593
-    for ($ro=0; $ro<8; $ro++) {
593
+    for ($ro = 0; $ro < 8; $ro++) {
594 594
         $res = new StdClass;
595 595
         $res->outcome = $ro;
596 596
         $res->exit_status = 0;
597 597
         c_row2(
598
-            $outcome[$ro]?outcome_color($ro):'',
598
+            $outcome[$ro] ?outcome_color($ro) : '',
599 599
             result_outcome_string($res),
600 600
             link_results("$outcome[$ro]", $urlquery, "outcome=$ro", '')
601 601
         );
@@ -606,12 +606,12 @@  discard block
 block discarded – undo
606 606
     echo "<td>";
607 607
     start_table('table-striped');
608 608
     echo "<tr><th>Validate state</th><th># results</th></tr>\n";
609
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
609
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
610 610
         $res = new StdClass;
611 611
         $res->validate_state = $vs;
612 612
         $res->exit_status = 0;
613 613
         c_row2(
614
-            $validate_state[$vs]?validate_color($vs):'',
614
+            $validate_state[$vs] ?validate_color($vs) : '',
615 615
             validate_state_str($res),
616 616
             link_results(
617 617
                 "$validate_state[$vs]",
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
     start_table('table-striped');
626 626
     echo "<tr><th>File Delete state</th><th># results</th></tr>\n";
627 627
 
628
-    for ($fds=0; $fds<4; $fds++) {
628
+    for ($fds = 0; $fds < 4; $fds++) {
629 629
         row2(
630 630
             file_delete_state_str($fds),
631 631
             link_results(
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
     echo "<td>";
655 655
     start_table('table-striped');
656 656
     echo "<tr><th>Client state</th><th># results</th></tr>\n";
657
-    for ($cs=1; $cs<7; $cs++) {
657
+    for ($cs = 1; $cs < 7; $cs++) {
658 658
         $res = new StdClass;
659 659
         $res->client_state = $cs;
660 660
         $res->exit_status = 0;
@@ -677,9 +677,9 @@  discard block
 block discarded – undo
677 677
         <select name=\"server_state\">
678 678
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
679 679
     ";
680
-    for ($i=1; $i<6; $i++) {
680
+    for ($i = 1; $i < 6; $i++) {
681 681
         $res = new StdClass;
682
-        $res->server_state=$i;
682
+        $res->server_state = $i;
683 683
         echo "<option value=\"$i\"> "."[$i]&nbsp;&nbsp;".'   '.result_server_state_string($res)."</option>\n";
684 684
     }
685 685
     echo "</select>\n";
@@ -690,7 +690,7 @@  discard block
 block discarded – undo
690 690
         <select name=\"outcome\">
691 691
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
692 692
     ";
693
-    for ($i=0; $i<8; $i++) {
693
+    for ($i = 0; $i < 8; $i++) {
694 694
         $res = new StdClass;
695 695
         $res->outcome = $i;
696 696
         $res->exit_status = 0;
@@ -704,7 +704,7 @@  discard block
 block discarded – undo
704 704
         <select name=\"validate_state\">
705 705
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
706 706
         ";
707
-    for ($vs=0; $vs<NVALIDATE_STATES; $vs++) {
707
+    for ($vs = 0; $vs < NVALIDATE_STATES; $vs++) {
708 708
         $res = new StdClass;
709 709
         $res->validate_state = $vs;
710 710
         $res->exit_status = 0;
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
         <select name=\"client_state\">
719 719
         <option value=\"CHOOSE_ALL\" selected=\"selected\"> Any </option>
720 720
     ";
721
-    for ($i=0; $i<7; $i++) {
721
+    for ($i = 0; $i < 7; $i++) {
722 722
         $res = new StdClass;
723 723
         $res->client_state = $i;
724 724
         $res->exit_status = 0;
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 }
756 756
 
757 757
 function table_title($table) {
758
-    switch($table) {
758
+    switch ($table) {
759 759
     case "platform": return "Platforms";
760 760
     case "app": return "Applications";
761 761
     case "app_version": return "Application Versions";
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
     row("Created", time_str($platform->create_time));
776 776
     row("Name", $platform->name);
777 777
     row("User friendly name", $platform->user_friendly_name);
778
-    row("","<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>");
778
+    row("", "<a href=\"db_action.php?table=app_version&platformid=$platform->id\">App versions for this platform</a>");
779 779
     end_table();
780 780
 }
781 781
 
@@ -787,8 +787,8 @@  discard block
 block discarded – undo
787 787
     row("User-friendly name", $app->user_friendly_name);
788 788
     row("Deprecated", $app->deprecated);
789 789
     row("Homogeneous redundancy", $app->homogeneous_redundancy);
790
-    row("","<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>");
791
-    row("","<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>");
790
+    row("", "<a href=\"db_action.php?table=app_version&appid=$app->id\">App Versions for this application</a>");
791
+    row("", "<a href=\"db_action.php?table=workunit&appid=$app->id&detail=low\">Workunits for this application</a>");
792 792
     end_table();
793 793
 }
794 794
 
@@ -796,9 +796,9 @@  discard block
 block discarded – undo
796 796
     start_table();
797 797
     row("ID", $app_version->id);
798 798
     row("Created", time_str($app_version->create_time));
799
-    row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">" . app_name_by_id($app_version->appid) . "</a>");
799
+    row("Application", "<a href=\"db_action.php?table=app&id=$app_version->appid\">".app_name_by_id($app_version->appid)."</a>");
800 800
     row("Version num", $app_version->version_num);
801
-    row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">" . platform_name_by_id($app_version->platformid) . "</a>" );
801
+    row("Platform", "<a href=\"db_action.php?table=platform&id=$app_version->platformid\">".platform_name_by_id($app_version->platformid)."</a>");
802 802
     row("Plan Class", $app_version->plan_class);
803 803
     row("XML doc", "<pre>".htmlspecialchars($app_version->xml_doc)."</pre>");
804 804
     row("min_core_version", $app_version->min_core_version);
@@ -932,7 +932,7 @@  discard block
 block discarded – undo
932 932
     row("External IP address", "$host->external_ip_addr<br>");
933 933
     row("Domain name", $host->domain_name);
934 934
     $x = $host->timezone/3600;
935
-    if ($x >= 0) $x="+$x";
935
+    if ($x >= 0) $x = "+$x";
936 936
     row("Local Standard Time", "UTC $x hours");
937 937
     row("Number of CPUs", $host->p_ncpus);
938 938
     row("CPU", "$host->p_vendor $host->p_model");
@@ -987,7 +987,7 @@  discard block
 block discarded – undo
987 987
     row("Last time modified", mysqltime_str($wu->mod_time));
988 988
     row("Name", $wu->name);
989 989
     row("XML doc", "<pre>".htmlspecialchars($wu->xml_doc)."</pre>");
990
-    row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">" . app_name_by_id($wu->appid) . " [".$wu->appid."]</a>");
990
+    row("Application", "<a href=\"db_action.php?table=app&id=$wu->appid\">".app_name_by_id($wu->appid)." [".$wu->appid."]</a>");
991 991
     row("Application version number", $wu->app_version_num);
992 992
     row("Batch", $wu->batch);
993 993
     $x = number_format($wu->rsc_fpops_est/1e9, 2);
@@ -1000,12 +1000,12 @@  discard block
 block discarded – undo
1000 1000
     $x = $wu->rsc_disk_bound/(1024*1024);
1001 1001
     $y = number_format($x, 2);
1002 1002
     row("Max Disk Usage", "$y MB");
1003
-    row("Need validate?", ($wu->need_validate?"yes [":"no [").$wu->need_validate."]");
1003
+    row("Need validate?", ($wu->need_validate ? "yes [" : "no [").$wu->need_validate."]");
1004 1004
     row("Canonical resultid",
1005 1005
             "<a href=\"db_action.php?table=result&id=$wu->canonical_resultid\">".$wu->canonical_resultid."</a>");
1006 1006
     row("Canonical credit", $wu->canonical_credit);
1007 1007
     //row("Timeout check time", time_str($wu->timeout_check_time));
1008
-    row("Delay bound", "$wu->delay_bound" . " =  " . time_diff($wu->delay_bound) );
1008
+    row("Delay bound", "$wu->delay_bound"." =  ".time_diff($wu->delay_bound));
1009 1009
     row("Error mask", wu_error_mask_str($wu->error_mask, true));
1010 1010
     row("File delete state", file_delete_state_str($wu->file_delete_state)." [".$wu->file_delete_state."]");
1011 1011
     row("Assimilation state", assimilate_state_str($wu->assimilate_state)." [".$wu->assimilate_state."]");
@@ -1015,7 +1015,7 @@  discard block
 block discarded – undo
1015 1015
     row("max error results", $wu->max_error_results);
1016 1016
     row("max total results", $wu->max_total_results);
1017 1017
     row("max success results", $wu->max_success_results);
1018
-    row("result template file",$wu->result_template_file);
1018
+    row("result template file", $wu->result_template_file);
1019 1019
     row("hr_class", $wu->hr_class);
1020 1020
     row("opaque", $wu->opaque);
1021 1021
     row("Priority", $wu->priority);
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
 }
1094 1094
 
1095 1095
 function outcome_color($outcome) {
1096
-    switch($outcome) {
1096
+    switch ($outcome) {
1097 1097
     case 0: return '9900cc'; // "Init", purple
1098 1098
     case 1: return '33cc33'; // "Success", green
1099 1099
     case 3: return 'ff3333'; // "Client error", red
@@ -1122,16 +1122,16 @@  discard block
 block discarded – undo
1122 1122
     row("Received", time_str($result->received_time));
1123 1123
     row("Last time modified", mysqltime_str($result->mod_time));
1124 1124
     row("Name", $result->name);
1125
-    row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">" . wu_name_by_id($result->workunitid) . "</a> [$result->workunitid]" );
1125
+    row("Workunit", "<a href=\"db_action.php?table=workunit&id=$result->workunitid\">".wu_name_by_id($result->workunitid)."</a> [$result->workunitid]");
1126 1126
     row("Server state", result_server_state_string($result)." [$result->server_state]");
1127 1127
     row("Outcome", result_outcome_string($result)." [$result->outcome]");
1128 1128
     row("Client state", result_client_state_string($result)." [$result->client_state]");
1129 1129
     row("Exit status", exit_status_string($result->exit_status));
1130
-    row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">" . host_name_by_id($result->hostid) . "</a> [$result->hostid]");
1131
-    row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">" . user_name_by_id($result->userid) . "</a> [$result->userid]");
1130
+    row("Host ID", "<a href=\"db_action.php?table=host&id=$result->hostid\">".host_name_by_id($result->hostid)."</a> [$result->hostid]");
1131
+    row("User ID", "<a href=\"db_action.php?table=user&id=$result->userid\">".user_name_by_id($result->userid)."</a> [$result->userid]");
1132 1132
     row("CPU time", $result->cpu_time);
1133 1133
     row("Elapsed time", $result->elapsed_time);
1134
-    if($error=stderr_error_string($result->stderr_out)) {
1134
+    if ($error = stderr_error_string($result->stderr_out)) {
1135 1135
         row("error in stderr out", $error);
1136 1136
     }
1137 1137
     row("Batch", $result->batch);
@@ -1148,16 +1148,16 @@  discard block
 block discarded – undo
1148 1148
     row("App version", $x1.app_version_string($result).$x2);
1149 1149
     row("App version ID", $result->app_version_id);
1150 1150
     row("Estimated GFLOPS", number_format($result->flops_estimate/1e9, 2));
1151
-    row("Random",$result->random);
1152
-    row("Opaque",$result->opaque);
1153
-    row("Teamid",$result->teamid);
1154
-    row("Priority",$result->priority);
1151
+    row("Random", $result->random);
1152
+    row("Opaque", $result->opaque);
1153
+    row("Teamid", $result->teamid);
1154
+    row("Priority", $result->priority);
1155 1155
     row("XML doc in", "<pre>".htmlspecialchars($result->xml_doc_in)."</pre>");
1156 1156
     row("XML doc out", "<pre>".htmlspecialchars($result->xml_doc_out)."</pre>");
1157 1157
     row("stderr out", "<pre>"
1158 1158
         .htmlspecialchars(
1159 1159
             $result->stderr_out,
1160
-            ENT_QUOTES | (defined('ENT_SUBSTITUTE')?ENT_SUBSTITUTE:0),
1160
+            ENT_QUOTES|(defined('ENT_SUBSTITUTE') ?ENT_SUBSTITUTE:0),
1161 1161
             'utf-8'
1162 1162
         )
1163 1163
         ."</pre>"
@@ -1205,23 +1205,23 @@  discard block
 block discarded – undo
1205 1205
     } else {
1206 1206
         // result has not been received yet, so show report deadline either
1207 1207
         // in green if in the future or in red if in the past.
1208
-        $timenow=time();
1209
-        if ($result->report_deadline==0)  {
1208
+        $timenow = time();
1209
+        if ($result->report_deadline == 0) {
1210 1210
             // not sent -- show create time in purple
1211
-            $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>";
1212
-        } else if ($result->report_deadline>=$timenow) {
1211
+            $received = "<font color=\"9900cc\">".time_str($result->create_time)."</font>";
1212
+        } else if ($result->report_deadline >= $timenow) {
1213 1213
             // overdue -- show deadline in red
1214
-            $received = "<font color=\"#33cc33\">". time_str($result->report_deadline) . "</font>";
1214
+            $received = "<font color=\"#33cc33\">".time_str($result->report_deadline)."</font>";
1215 1215
         } else {
1216 1216
             // in progress and not overdue -- show deadline in green
1217
-            $received = "<font color=\"#ff3333\">". time_str($result->report_deadline) . "</font>";
1217
+            $received = "<font color=\"#ff3333\">".time_str($result->report_deadline)."</font>";
1218 1218
         }
1219 1219
     }
1220 1220
     $version = app_version_string($result)." (<a href=\"db_action.php?table=app_version&id=$result->app_version_id\">$result->app_version_id</a>)";
1221 1221
     $outcome_color = outcome_color($result->outcome);
1222 1222
     $validate_color = validate_color($result->validate_state);
1223 1223
     $host_user = host_user_link($result->hostid);
1224
-    $cpu_hours = sprintf("%.1f",$result->cpu_time / 3600);
1224
+    $cpu_hours = sprintf("%.1f", $result->cpu_time/3600);
1225 1225
     $granted_credit = "<a href=credit.php?wu_id=$result->workunitid>".credit_str($result->granted_credit)."</a>";
1226 1226
     $delete_state = file_delete_state_str($result->file_delete_state);
1227 1227
 
@@ -1249,7 +1249,7 @@  discard block
 block discarded – undo
1249 1249
     row("ID", $user->id);
1250 1250
     row("Created", time_str($user->create_time));
1251 1251
     row("Name", $user->name);
1252
-    if(!in_rops()) {
1252
+    if (!in_rops()) {
1253 1253
         row("Authenticator", $user->authenticator);
1254 1254
     }
1255 1255
     row("Email address", $user->email_addr);
@@ -1264,7 +1264,7 @@  discard block
 block discarded – undo
1264 1264
     row("Default venue", $user->venue);
1265 1265
     row("Hosts", "<a href=\"db_action.php?table=host&userid=$user->id&detail=low\">click</a>");
1266 1266
     row("Cross project ID", $user->cross_project_id);
1267
-    if(!in_rops()) {
1267
+    if (!in_rops()) {
1268 1268
         row("Password Hash", $user->passwd_hash);
1269 1269
     }
1270 1270
     row("Donated", $user->donated);
@@ -1315,7 +1315,7 @@  discard block
 block discarded – undo
1315 1315
     echo "</table></td>";
1316 1316
     echo "<td><table border=\"2\">\n";
1317 1317
     echo "<tr><th>User</th><th># posts</th></tr>\n";
1318
-    for ($p=1; $p<=10; $p++) {
1318
+    for ($p = 1; $p <= 10; $p++) {
1319 1319
         row2_plain(user_links_ops($top10poster[$p]), $top10poster[$p]->posts);
1320 1320
     }
1321 1321
     echo "</table></td>";
@@ -1354,10 +1354,10 @@  discard block
 block discarded – undo
1354 1354
 function admin_show_team($team) {
1355 1355
     start_table();
1356 1356
     row("ID", $team->id);
1357
-    row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">" . user_name_by_id($team->userid) . "</a>");
1357
+    row("Team Founder", "<a href=\"db_action.php?table=user&id=$team->userid\">".user_name_by_id($team->userid)."</a>");
1358 1358
     row("Name", $team->name);
1359
-    row("Name (HTML Formatted)", "<pre>" . htmlspecialchars($team->name_html) . "</pre>" );
1360
-    row("Url", "<a href=\"http://$team->url\">" . $team->url . "</a>");
1359
+    row("Name (HTML Formatted)", "<pre>".htmlspecialchars($team->name_html)."</pre>");
1360
+    row("Url", "<a href=\"http://$team->url\">".$team->url."</a>");
1361 1361
     row("Type", team_type_string($team->type));
1362 1362
     row("Description", $team->description);
1363 1363
     row("", "<a href=\"db_action.php?table=user&teamid=$team->id\">List All Members</a>");
@@ -1400,7 +1400,7 @@  discard block
 block discarded – undo
1400 1400
     if (!strlen($host->domain_name) && !strlen($host->last_ip_addr)) {
1401 1401
         return "(blank)";
1402 1402
     } else {
1403
-        return $host->domain_name . " (" . $host->last_ip_addr . ")";
1403
+        return $host->domain_name." (".$host->last_ip_addr.")";
1404 1404
     }
1405 1405
 }
1406 1406
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -379,7 +379,8 @@  discard block
 block discarded – undo
379 379
 
380 380
 
381 381
 function link_results($n, $mq, $query, $clauses) {
382
-    if ($n == '0') { // intentional compare by string
382
+    if ($n == '0') {
383
+// intentional compare by string
383 384
         return "0";
384 385
     } else {
385 386
         if(strlen($clauses)) {
@@ -395,7 +396,7 @@  discard block
 block discarded – undo
395 396
 // @return String A human readable string if error otherwise FALSE
396 397
 // @param String $stderr_out the stderr_out value to parse
397 398
 //
398
-function stderr_error_string($stderr_out){
399
+function stderr_error_string($stderr_out) {
399 400
     $y = parse_element($stderr_out, "<error_code>");
400 401
     $x = 0;
401 402
     if ($y) {
@@ -1206,7 +1207,7 @@  discard block
 block discarded – undo
1206 1207
         // result has not been received yet, so show report deadline either
1207 1208
         // in green if in the future or in red if in the past.
1208 1209
         $timenow=time();
1209
-        if ($result->report_deadline==0)  {
1210
+        if ($result->report_deadline==0) {
1210 1211
             // not sent -- show create time in purple
1211 1212
             $received = "<font color=\"9900cc\">". time_str($result->create_time) . "</font>";
1212 1213
         } else if ($result->report_deadline>=$timenow) {
Please login to merge, or discard this patch.