874874 <div class="green">
875875
876876 <?php
877+ // the displayed adapter is the first one which has an IP address, or if none have an IP, then the first physical adapter.
877878 $ adapterText = "Disconnected " ;
878879
879880 foreach ($ json_data ['Network ' ]['Adapters ' ] as $ adapter ) {
880881 if ((bool ) $ adapter ['PhysicalAdapter ' ] && is_array ($ adapter ['IPAddress ' ]) && count ($ adapter ['IPAddress ' ]) > 0 ) {
881882 $ adapterText = $ adapter ['Description ' ];
883+ $ foundAdapter = true ;
882884 break ;
883885 }
884886 };
885887
886- if ($ adapter == "" ) {
888+ if (! $ foundAdapter ) {
887889 foreach ($ json_data ['Network ' ]['Adapters ' ] as $ adapter ) {
888890 if ((bool ) $ adapter ['PhysicalAdapter ' ]) {
889891 $ adapterText = $ adapter ['Description ' ];
@@ -1204,15 +1206,15 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB</span>
12041206 $ part_size = $ part ['PartitionCapacity ' ];
12051207 $ part_taken = $ part_size - $ part ['PartitionFree ' ];
12061208 $ part_display = "" ;
1207- if (! empty ( $ part ['PartitionLabel ' ]) ) {
1209+ if ($ part ['PartitionLabel ' ] !== '' ) {
12081210 $ part_display .= $ part ['PartitionLabel ' ];
12091211 if (isset ($ part ['PartitionLetter ' ])) {
12101212 $ part_display .= " ( {$ part ['PartitionLetter ' ]}) " ;
12111213 }
12121214 } else if (isset ($ part ['PartitionLetter ' ])) { // and not partition label
12131215 $ part_display = $ part ['PartitionLetter ' ];
12141216 }
1215- if (! empty ( $ part_display) )
1217+ if ($ part_display !== '' )
12161218 $ part_display .= '<br/> ' ;
12171219 $ fs_display = $ part ['Filesystem ' ] ?? 'Unknown ' ;
12181220
@@ -1599,7 +1601,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB</span>
15991601 ' ;
16001602 }
16011603
1602- if (! empty ($ json_data ['Hardware ' ]['Batteries ' ])) {
1604+ if (count ($ json_data ['Hardware ' ]['Batteries ' ]) > 0 ) {
16031605 foreach ($ json_data ['Hardware ' ]['Batteries ' ] as $ battery ) {
16041606 $ cap = floatval ($ battery ["Remaining_Life_Percentage " ]);
16051607 if (
@@ -1618,7 +1620,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB</span>
16181620 foreach ($ json_data ['Hardware ' ]['Storage ' ] as $ disk ) {
16191621 foreach ($ disk ['Partitions ' ] as $ partNum => $ part ) {
16201622 if (isset ($ part ['DirtyBitSet ' ]) && $ part ['DirtyBitSet ' ]) {
1621- if (empty ( $ part ['PartitionLetter ' ]) ) {
1623+ if ($ part ['PartitionLetter ' ] === '' ) {
16221624 $ noteshtml .= "
16231625 <p>
16241626 Dirty bit set on <span>partition $ partNum ( {$ disk ['DeviceName ' ]})</span>
@@ -1692,7 +1694,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB</span>
16921694
16931695
16941696
1695- if (! empty ( $ noteshtml) ) {
1697+ if ($ noteshtml !== '' ) {
16961698 $ noteshtml = '<br> ' . $ noteshtml ;
16971699 echo $ noteshtml ;
16981700 }
@@ -1738,7 +1740,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB</span>
17381740 $ driveKey += 1 ;
17391741 }
17401742
1741- if (! empty ( $ drivehtml) ) {
1743+ if ($ drivehtml !== '' ) {
17421744 $ drivehtml = '<br> <h4 style="margin:5px; color:var(--meta-h4-color);">Drive / SMART Notes</h4> ' . $ drivehtml ;
17431745 echo $ drivehtml ;
17441746 }
@@ -1757,7 +1759,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB</span>
17571759
17581760 foreach ($ json_data ['System ' ]['ChoiceRegistryValues ' ] as $ regkey ) {
17591761
1760- if ($ regkey ['Value ' ] && !in_array ($ regkey ['Value ' ], $ defaultRegKeys [$ regkey ['Name ' ]])){
1762+ if ($ regkey ['Value ' ] && !in_array ($ regkey ['Value ' ], $ defaultRegKeys [$ regkey ['Name ' ]], true )){
17611763 $ reghtml .= '
17621764 <p>
17631765 Registry Value <span> ' . $ regkey ['Name ' ] . '</span> found set, value of <span> ' . $ regkey ['Value ' ] . '</span>
@@ -1766,7 +1768,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB</span>
17661768
17671769 }
17681770
1769- if (! empty ( $ reghtml) ) {
1771+ if ($ reghtml !== '' ) {
17701772 $ reghtml = '<br> <h4 style="margin:5px; color:var(--meta-h4-color);">Notable Registry Changes</h4> ' . $ reghtml ;
17711773 echo $ reghtml ;
17721774 }
@@ -1777,7 +1779,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB</span>
17771779 <?php
17781780 $ puphtml = '' ;
17791781
1780- if (! empty ($ pupsfoundInstalled )) {
1782+ if (count ($ pupsfoundInstalled ) > 0 ) {
17811783
17821784 $ puphtml .= '<h4>Notable Software found Installed</h4> ' ;
17831785
@@ -1790,7 +1792,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB</span>
17901792 $ puphtml .= '</table> ' ;
17911793 }
17921794
1793- if (! empty ($ pupsfoundRunning )) {
1795+ if (count ($ pupsfoundRunning ) > 0 ) {
17941796
17951797 $ puphtml .= '<h4>Notable Software found Running</h4> ' ;
17961798
@@ -1803,7 +1805,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB</span>
18031805 $ puphtml .= '</table> ' ;
18041806 }
18051807
1806- if (! empty ( $ puphtml) ) {
1808+ if ($ puphtml !== '' ) {
18071809 echo $ puphtml ;
18081810 } else {
18091811 echo '<h4>No Notable Software found, yay!</h4> ' ;
@@ -1904,7 +1906,7 @@ class="' . $flavor_color . '">' . (int)$drive_taken . ' GB</span>
19041906 </div>
19051907 <div class="modal-body" id="browser-container ' . $ browser ['Name ' ] . '"> ' ;
19061908 foreach ($ browser ['Profiles ' ] as $ browserprofile ) {
1907- $ profileKey = array_search ($ browserprofile , $ browser ['Profiles ' ]);
1909+ $ profileKey = array_search ($ browserprofile , $ browser ['Profiles ' ], true );
19081910 echo '
19091911 <h2> ' . $ browser ['Name ' ] . ' Profile " ' . $ browser ['Profiles ' ][$ profileKey ]['name ' ] . '"</h2>
19101912 <table id=" ' . $ browser ['Name ' ] . 'Profile ' . $ profileKey . 'Table" class="table">
0 commit comments