Completed
Push — master ( 853573...80a2ca )
by Kevin
12:02
created
html/inc/host.inc 2 patches
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";
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
             row2(tra("Product name"), $host->product_name);
99 99
         }
100 100
         $x = $host->timezone/3600;
101
-        if ($x >= 0) $x="+$x";
101
+        if ($x >= 0) $x = "+$x";
102 102
         row2(tra("Local Standard Time"), tra("UTC %1 hours", $x));
103 103
     } else {
104 104
         $owner = BoincUser::lookup_id($host->userid);
@@ -258,15 +258,15 @@  discard block
 block discarded – undo
258 258
 // "[vbox|5.0.0|1|1]", where now two additional flags give information about
259 259
 // hardware virtualization support. Older clients may have the old-style
260 260
 // serialnum in the DB despite the server being upgraded.
261
-function vbox_desc($x){
262
-    if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)){
261
+function vbox_desc($x) {
262
+    if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/", $x, $matches)) {
263 263
         $desc = "Virtualbox (".$matches[1].") ".tra("installed");
264
-        if (sizeof($matches)>2){
265
-            if ($matches[3]=="1" and $matches[4]=="1") {
264
+        if (sizeof($matches) > 2) {
265
+            if ($matches[3] == "1" and $matches[4] == "1") {
266 266
                 return $desc.tra(", CPU has hardware virtualization support and it is enabled");
267
-            } elseif ($matches[3]=="1" and $matches[4]=="0") {
267
+            } elseif ($matches[3] == "1" and $matches[4] == "0") {
268 268
                 return $desc.tra(", CPU has hardware virtualization support but it is disabled");
269
-            } elseif ($matches[3]=="0") {
269
+            } elseif ($matches[3] == "0") {
270 270
                 return $desc.tra(", CPU does not have hardware virtualization support");
271 271
             }
272 272
         } else {
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 // Given string of the form [BOINC|vers][type|model|count|RAM|driver-vers][vbox|vers],
281 281
 // return a human-readable version of the GPU info
282 282
 //
283
-function gpu_desc($x, $detail=true) {
283
+function gpu_desc($x, $detail = true) {
284 284
     $descs = explode("]", $x);
285 285
     array_pop($descs);
286 286
     $str = "";
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
         if ($d[0] == "BOINC") continue;
292 292
         if ($d[0] == "vbox") continue;
293 293
         if ($str) $str .= "<p>";
294
-        if ($d[2]!="" && $d[2]!="1") $str .= "[".$d[2]."] ";
294
+        if ($d[2] != "" && $d[2] != "1") $str .= "[".$d[2]."] ";
295 295
         if ($d[0] == "CUDA") {
296 296
             $str .= "NVIDIA";
297 297
         } else if ($d[0] == "CAL") {
@@ -498,14 +498,14 @@  discard block
 block discarded – undo
498 498
     if ($pos1 === false) return $x;
499 499
     $pos2 = strpos($model, ']');
500 500
     if ($pos2 === false) return $x;
501
-    $a = substr($model, $pos1+1, $pos2-$pos1-1);
501
+    $a = substr($model, $pos1 + 1, $pos2 - $pos1 - 1);
502 502
     $y = explode(" ", $a);
503 503
     if (count($y) == 0) return $x;
504 504
     if ($y[0] == "Family") {
505 505
         $x->info = $a;
506 506
     } else {
507 507
         $x->arch = $y[0];
508
-        $x->info = substr($a, strlen($y[0])+1);
508
+        $x->info = substr($a, strlen($y[0]) + 1);
509 509
     }
510 510
     return $x;
511 511
 }
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
     $avg_time = 0;
595 595
 
596 596
     $results = BoincResult::enum("hostid=$hostid order by received_time");
597
-    foreach($results as $result) {
597
+    foreach ($results as $result) {
598 598
         if ($result->granted_credit <= 0) continue;
599 599
         $total += $result->granted_credit;
600 600
 
@@ -687,7 +687,7 @@  discard block
 block discarded – undo
687 687
 
688 688
 function link_url($sort, $rev, $show_all) {
689 689
     global $userid;
690
-    $x = $userid ? "&userid=$userid":"";
690
+    $x = $userid ? "&userid=$userid" : "";
691 691
     return "hosts_user.php?sort=$sort&rev=$rev&show_all=$show_all$x";
692 692
 }
693 693
 
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 }
762 762
 
763 763
 function show_user_hosts($userid, $private, $show_all, $sort, $rev) {
764
-    $desc = false;  // whether the sort order's default is decreasing
764
+    $desc = false; // whether the sort order's default is decreasing
765 765
     switch ($sort) {
766 766
     case "total_credit": $sort_clause = "total_credit"; $desc = true; break;
767 767
     case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break;
@@ -784,7 +784,7 @@  discard block
 block discarded – undo
784 784
     more_or_less($sort, $rev, $show_all);
785 785
 
786 786
     $now = time();
787
-    $old_hosts=0;
787
+    $old_hosts = 0;
788 788
     $i = 1;
789 789
     $hosts = BoincHost::enum("userid=$userid order by $sort_clause");
790 790
     $any_product_name = false;
@@ -796,9 +796,9 @@  discard block
 block discarded – undo
796 796
     }
797 797
     user_host_table_start($private, $sort, $rev, $show_all, $any_product_name);
798 798
     foreach ($hosts as $host) {
799
-        $is_old=false;
799
+        $is_old = false;
800 800
         if (($now - $host->rpc_time) > 30*86400) {
801
-            $is_old=true;
801
+            $is_old = true;
802 802
             $old_hosts++;
803 803
         }
804 804
         if (!$show_all && $is_old) continue;
@@ -807,7 +807,7 @@  discard block
 block discarded – undo
807 807
     }
808 808
     end_table();
809 809
 
810
-    if ($old_hosts>0) {
810
+    if ($old_hosts > 0) {
811 811
         more_or_less($sort, $rev, $show_all);
812 812
     }
813 813
 
@@ -827,6 +827,6 @@  discard block
 block discarded – undo
827 827
     }
828 828
 }
829 829
 
830
-$cvs_version_tracker[]="\$Id$";  //Generated automatically - do not edit
830
+$cvs_version_tracker[] = "\$Id$"; //Generated automatically - do not edit
831 831
 
832 832
 ?>
Please login to merge, or discard this patch.
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
             if ($host->last_ip_addr != $host->external_ip_addr) {
91 91
                 row2(tra("External IP address"), $host->external_ip_addr);
92 92
             }
93
-        } else { 
93
+        } else {
94 94
             row2(tra("IP address"), "<a href=show_host_detail.php?hostid=$host->id&ipprivate=1>".tra("Show IP address")."</a>");
95 95
         }
96 96
         row2(tra("Domain name"), $host->domain_name);
@@ -258,10 +258,10 @@  discard block
 block discarded – undo
258 258
 // "[vbox|5.0.0|1|1]", where now two additional flags give information about
259 259
 // hardware virtualization support. Older clients may have the old-style
260 260
 // serialnum in the DB despite the server being upgraded.
261
-function vbox_desc($x){
262
-    if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)){
261
+function vbox_desc($x) {
262
+    if (preg_match("/\[vbox\|(.*?)(\|([01])\|([01]))?\]/",$x,$matches)) {
263 263
         $desc = "Virtualbox (".$matches[1].") ".tra("installed");
264
-        if (sizeof($matches)>2){
264
+        if (sizeof($matches)>2) {
265 265
             if ($matches[3]=="1" and $matches[4]=="1") {
266 266
                 return $desc.tra(", CPU has hardware virtualization support and it is enabled");
267 267
             } elseif ($matches[3]=="1" and $matches[4]=="0") {
Please login to merge, or discard this patch.