Passed
Push — dpa_submit35 ( fcf080 )
by David
09:33
created
html/inc/host.inc 1 patch
Spacing   +20 added lines, -20 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);
@@ -293,20 +293,20 @@  discard block
 block discarded – undo
293 293
 // Older clients may have the old-style serialnum in the DB
294 294
 // despite the server being upgraded.
295 295
 //
296
-function vbox_desc($parsed_ser){
296
+function vbox_desc($parsed_ser) {
297 297
     if (empty($parsed_ser['vbox'])) return '---';
298 298
     $f = $parsed_ser['vbox'];
299 299
     $desc = sprintf('Virtualbox (%s) %s',
300 300
         $f[1], tra("installed")
301 301
     );
302
-    if (sizeof($f)<=2){
302
+    if (sizeof($f) <= 2) {
303 303
         return $desc;
304 304
     }
305
-    if ($f[2]=="1" and $f[3]=="1") {
305
+    if ($f[2] == "1" and $f[3] == "1") {
306 306
         return $desc.tra(", CPU has hardware virtualization support and it is enabled");
307
-    } elseif ($f[2]=="1" and $f[3]=="0") {
307
+    } elseif ($f[2] == "1" and $f[3] == "0") {
308 308
         return $desc.tra(", CPU has hardware virtualization support but it is disabled");
309
-    } elseif ($f[2]=="0") {
309
+    } elseif ($f[2] == "0") {
310 310
         return $desc.tra(", CPU does not have hardware virtualization support");
311 311
     }
312 312
     return $desc;
@@ -331,13 +331,13 @@  discard block
 block discarded – undo
331 331
 
332 332
 // return a human-readable version of the GPU info
333 333
 //
334
-function gpu_desc($parsed_ser, $detail=true) {
334
+function gpu_desc($parsed_ser, $detail = true) {
335 335
     $str = "";
336 336
     foreach ($parsed_ser as $d) {
337 337
         if (!is_gpu_type($d[0])) continue;
338 338
         if (count($d) < 4) continue;
339 339
         if ($str) $str .= "<p>";
340
-        if ($d[2]!="" && $d[2]!="1") $str .= "[".$d[2]."] ";
340
+        if ($d[2] != "" && $d[2] != "1") $str .= "[".$d[2]."] ";
341 341
         if ($d[0] == "CUDA") {
342 342
             $str .= "NVIDIA";
343 343
         } else if ($d[0] == "CAL") {
@@ -543,14 +543,14 @@  discard block
 block discarded – undo
543 543
     if ($pos1 === false) return $x;
544 544
     $pos2 = strpos($model, ']');
545 545
     if ($pos2 === false) return $x;
546
-    $a = substr($model, $pos1+1, $pos2-$pos1-1);
546
+    $a = substr($model, $pos1 + 1, $pos2 - $pos1 - 1);
547 547
     $y = explode(" ", $a);
548 548
     if (count($y) == 0) return $x;
549 549
     if ($y[0] == "Family") {
550 550
         $x->info = $a;
551 551
     } else {
552 552
         $x->arch = $y[0];
553
-        $x->info = substr($a, strlen($y[0])+1);
553
+        $x->info = substr($a, strlen($y[0]) + 1);
554 554
     }
555 555
     return $x;
556 556
 }
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
     $avg_time = 0;
640 640
 
641 641
     $results = BoincResult::enum("hostid=$hostid order by received_time");
642
-    foreach($results as $result) {
642
+    foreach ($results as $result) {
643 643
         if ($result->granted_credit <= 0) continue;
644 644
         $total += $result->granted_credit;
645 645
 
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 
733 733
 function link_url($sort, $rev, $show_all) {
734 734
     global $userid;
735
-    $x = $userid ? "&userid=$userid":"";
735
+    $x = $userid ? "&userid=$userid" : "";
736 736
     return "hosts_user.php?sort=$sort&rev=$rev&show_all=$show_all$x";
737 737
 }
738 738
 
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
 }
807 807
 
808 808
 function show_user_hosts($userid, $private, $show_all, $sort, $rev) {
809
-    $desc = false;  // whether the sort order's default is decreasing
809
+    $desc = false; // whether the sort order's default is decreasing
810 810
     switch ($sort) {
811 811
     case "total_credit": $sort_clause = "total_credit"; $desc = true; break;
812 812
     case "expavg_credit": $sort_clause = "expavg_credit"; $desc = true; break;
@@ -829,7 +829,7 @@  discard block
 block discarded – undo
829 829
     more_or_less($sort, $rev, $show_all);
830 830
 
831 831
     $now = time();
832
-    $old_hosts=0;
832
+    $old_hosts = 0;
833 833
     $i = 1;
834 834
     $hosts = BoincHost::enum("userid=$userid order by $sort_clause limit 100");
835 835
     $any_product_name = false;
@@ -841,9 +841,9 @@  discard block
 block discarded – undo
841 841
     }
842 842
     user_host_table_start($private, $sort, $rev, $show_all, $any_product_name);
843 843
     foreach ($hosts as $host) {
844
-        $is_old=false;
844
+        $is_old = false;
845 845
         if (($now - $host->rpc_time) > 30*86400) {
846
-            $is_old=true;
846
+            $is_old = true;
847 847
             $old_hosts++;
848 848
         }
849 849
         if (!$show_all && $is_old) continue;
@@ -852,7 +852,7 @@  discard block
 block discarded – undo
852 852
     }
853 853
     end_table();
854 854
 
855
-    if ($old_hosts>0) {
855
+    if ($old_hosts > 0) {
856 856
         more_or_less($sort, $rev, $show_all);
857 857
     }
858 858
 
Please login to merge, or discard this patch.