Passed
Pull Request — master (#5705)
by David
10:24
created
html/inc/host.inc 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 
33 33
 function sched_log_name($x) {
34 34
     if ($x == 0) return "NO_SUCH_LOG";
35
-    return gmdate('Y-m-d_H/Y-m-d_H:i', $x) . ".txt";
35
+    return gmdate('Y-m-d_H/Y-m-d_H:i', $x).".txt";
36 36
 }
37 37
 
38 38
 function sched_log_link($x) {
39 39
     if (file_exists("sched_logs")) {
40
-        return "<a href=\"../sched_logs/" . sched_log_name($x) . "\">" . time_str($x) . "</a>";
40
+        return "<a href=\"../sched_logs/".sched_log_name($x)."\">".time_str($x)."</a>";
41 41
     } else {
42 42
         return time_str($x);
43 43
     }
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
 
46 46
 function location_form($host) {
47 47
     $none = "selected";
48
-    $h=$w=$s=$m="";
48
+    $h = $w = $s = $m = "";
49 49
     if ($host->venue == "home") $h = "selected";
50 50
     if ($host->venue == "work") $w = "selected";
51 51
     if ($host->venue == "school") $s = "selected";
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
             row2(tra("Product name"), $host->product_name);
100 100
         }
101 101
         $x = $host->timezone/3600;
102
-        if ($x >= 0) $x="+$x";
102
+        if ($x >= 0) $x = "+$x";
103 103
         row2(tra("Local Standard Time"), tra("UTC %1 hours", $x));
104 104
     } else {
105 105
         $owner = BoincUser::lookup_id($host->userid);
@@ -259,15 +259,15 @@  discard block
 block discarded – undo
259 259
 // "[vbox|5.0.0|1|1]", where now two additional flags give information about
260 260
 // hardware virtualization support. Older clients may have the old-style
261 261
 // serialnum in the DB despite the server being upgraded.
262
-function vbox_desc($x){
263
-    if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)){
262
+function vbox_desc($x) {
263
+    if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/", $x, $matches)) {
264 264
         $desc = "Virtualbox (".$matches[1].") ".tra("installed");
265
-        if (sizeof($matches)>2){
266
-            if ($matches[3]=="1" and $matches[4]=="1") {
265
+        if (sizeof($matches) > 2) {
266
+            if ($matches[3] == "1" and $matches[4] == "1") {
267 267
                 return $desc.tra(", CPU has hardware virtualization support and it is enabled");
268
-            } elseif ($matches[3]=="1" and $matches[4]=="0") {
268
+            } elseif ($matches[3] == "1" and $matches[4] == "0") {
269 269
                 return $desc.tra(", CPU has hardware virtualization support but it is disabled");
270
-            } elseif ($matches[3]=="0") {
270
+            } elseif ($matches[3] == "0") {
271 271
                 return $desc.tra(", CPU does not have hardware virtualization support");
272 272
             }
273 273
         } else {
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 // Given string of the form [BOINC|vers][type|model|count|RAM|driver-vers][vbox|vers],
282 282
 // return a human-readable version of the GPU info
283 283
 //
284
-function gpu_desc($x, $detail=true) {
284
+function gpu_desc($x, $detail = true) {
285 285
     $descs = explode("]", $x);
286 286
     array_pop($descs);
287 287
     $str = "";
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
         if ($d[0] == "vbox") continue;
294 294
         if (count($d) < 4) continue;
295 295
         if ($str) $str .= "<p>";
296
-        if ($d[2]!="" && $d[2]!="1") $str .= "[".$d[2]."] ";
296
+        if ($d[2] != "" && $d[2] != "1") $str .= "[".$d[2]."] ";
297 297
         if ($d[0] == "CUDA") {
298 298
             $str .= "NVIDIA";
299 299
         } else if ($d[0] == "CAL") {
@@ -500,14 +500,14 @@  discard block
 block discarded – undo
500 500
     if ($pos1 === false) return $x;
501 501
     $pos2 = strpos($model, ']');
502 502
     if ($pos2 === false) return $x;
503
-    $a = substr($model, $pos1+1, $pos2-$pos1-1);
503
+    $a = substr($model, $pos1 + 1, $pos2 - $pos1 - 1);
504 504
     $y = explode(" ", $a);
505 505
     if (count($y) == 0) return $x;
506 506
     if ($y[0] == "Family") {
507 507
         $x->info = $a;
508 508
     } else {
509 509
         $x->arch = $y[0];
510
-        $x->info = substr($a, strlen($y[0])+1);
510
+        $x->info = substr($a, strlen($y[0]) + 1);
511 511
     }
512 512
     return $x;
513 513
 }
@@ -596,7 +596,7 @@  discard block
 block discarded – undo
596 596
     $avg_time = 0;
597 597
 
598 598
     $results = BoincResult::enum("hostid=$hostid order by received_time");
599
-    foreach($results as $result) {
599
+    foreach ($results as $result) {
600 600
         if ($result->granted_credit <= 0) continue;
601 601
         $total += $result->granted_credit;
602 602
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 
690 690
 function link_url($sort, $rev, $show_all) {
691 691
     global $userid;
692
-    $x = $userid ? "&userid=$userid":"";
692
+    $x = $userid ? "&userid=$userid" : "";
693 693
     return "hosts_user.php?sort=$sort&rev=$rev&show_all=$show_all$x";
694 694
 }
695 695
 
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 }
764 764
 
765 765
 function show_user_hosts($userid, $private, $show_all, $sort, $rev) {
766
-    $desc = false;  // whether the sort order's default is decreasing
766
+    $desc = false; // whether the sort order's default is decreasing
767 767
     switch ($sort) {
768 768
     case "total_credit": $sort_clause = "total_credit"; $desc = true; break;
769 769
     case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break;
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
     more_or_less($sort, $rev, $show_all);
787 787
 
788 788
     $now = time();
789
-    $old_hosts=0;
789
+    $old_hosts = 0;
790 790
     $i = 1;
791 791
     $hosts = BoincHost::enum("userid=$userid order by $sort_clause");
792 792
     $any_product_name = false;
@@ -798,9 +798,9 @@  discard block
 block discarded – undo
798 798
     }
799 799
     user_host_table_start($private, $sort, $rev, $show_all, $any_product_name);
800 800
     foreach ($hosts as $host) {
801
-        $is_old=false;
801
+        $is_old = false;
802 802
         if (($now - $host->rpc_time) > 30*86400) {
803
-            $is_old=true;
803
+            $is_old = true;
804 804
             $old_hosts++;
805 805
         }
806 806
         if (!$show_all && $is_old) continue;
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
     }
810 810
     end_table();
811 811
 
812
-    if ($old_hosts>0) {
812
+    if ($old_hosts > 0) {
813 813
         more_or_less($sort, $rev, $show_all);
814 814
     }
815 815
 
@@ -829,6 +829,6 @@  discard block
 block discarded – undo
829 829
     }
830 830
 }
831 831
 
832
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
832
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
833 833
 
834 834
 ?>
Please login to merge, or discard this patch.