From e5b3d84ace716dfc9f211cb981107c55a95523f5 Mon Sep 17 00:00:00 2001 From: David Beniamine <david.beniamine@tetras-libre.fr> Date: Mon, 31 Jan 2022 11:46:32 +0100 Subject: [PATCH] Fix bad column alignment --- wol/www/index.php | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/wol/www/index.php b/wol/www/index.php index b859a90..42487a6 100644 --- a/wol/www/index.php +++ b/wol/www/index.php @@ -107,23 +107,43 @@ if(!isset($action)){ $registry = array(); foreach($lines as $line){ if($line != ""){ - $entry=explode(' ', $line); + $entry=explode(' ', preg_replace("/\s\s+/", " ", $line)); $nb_infos=count($entry); if($nb_infos < 2){ continue; } + # Remove and shift lines with double IPS + if (filter_var($entry[4], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) { + if ($entry[4] != $entry[3]) { + $entry[3] = $entry[3] . " ou ". $entry[4]; + } + unset($entry[4]); + $entry=array_values($entry); + } + # Add aditionnal IPS to IP field + if ($nb_infos > 9) { + for($i=9 ; $i< $nb_infos; $i++) { + if ($entry[$i] != "NA" && strpos($entry[3], $entry[$i]) === false) { + $entry[3] .= " ou " . $entry[$i]; + } + } + } array_push($registry, $entry); - # Format date mac name [num_apt_upgrade deb_version pt_version git_branch git_update] ip + # Format + # 0 1 2 3 4 5 6 7 8 + # date mac name "ip [ou ip2]" num_apt_upgrade deb_version pt_version git_branch git_update echo "<tr>"; + # Name echo "<td>".$entry[2]."</td>"; - echo "<td> ".$entry[$nb_infos-1]."</td>"; + # IPs + echo "<td> ".$entry[3]."</td>"; + # MAC echo "<td>".$entry[1]."</td>"; - #echo "<td>".$entry[0]."</td>"; if($nb_infos > 5){ + echo "<td>".$entry[5]."</td>"; + echo "<td>".$entry[6]."</td>"; echo "<td>".$entry[4]."</td>"; - echo "<td>".str_replace('_', ' ', $entry[5])."</td>"; - echo "<td>".$entry[3]."</td>"; - echo "<td> branche ".$entry[6].", ".$entry[7]." commits en retard</td>"; + echo "<td> branche ".$entry[7].", ".$entry[8]." commits en retard</td>"; }else{ echo "<td>NA</td>"; echo "<td>NA</td>"; -- GitLab