From 0a4921646eb7d9b807aa60bb0c198c472d1ccee4 Mon Sep 17 00:00:00 2001 From: adrien Date: Thu, 22 May 2025 13:58:14 +0200 Subject: [PATCH] little changes --- custom.css | 0 index.php | 2 +- show.php => switch.php | 20 ++++++++++---------- 3 files changed, 11 insertions(+), 11 deletions(-) create mode 100644 custom.css rename show.php => switch.php (90%) diff --git a/custom.css b/custom.css new file mode 100644 index 0000000..e69de29 diff --git a/index.php b/index.php index 4990ef6..3233387 100644 --- a/index.php +++ b/index.php @@ -5,7 +5,7 @@ require_once "config.php"; setlocale(LC_CTYPE, $locale); if ($_SERVER["QUERY_STRING"] != "") { - include "show.php"; + include "switch.php"; exit; } ?> diff --git a/show.php b/switch.php similarity index 90% rename from show.php rename to switch.php index d694795..3890fe7 100644 --- a/show.php +++ b/switch.php @@ -20,18 +20,18 @@ if ($conf === false) { preg_match("/ sysname ([\w-]+)/", $conf, $sysname); preg_match("/ip address ([\d.]+)/", $conf, $address); -$startPattern = "(?<=\n)"; -$NL = "[\r\n]+"; +$startPattern = "(?<=[\r\n])"; +$NL = "(?:[\r\n]+)"; $vlanPvidPattern = "vlan (?P\d+)$NL"; -$vlanNamePattern = " name (?P.+)$NL"; -$vlanDescriptionPattern = " description (?P.+)$NL"; -$otherPattern = " .*$NL"; +$vlanNamePattern = "$startPattern name (?P.+)$NL"; +$vlanDescriptionPattern = "$startPattern description (?P.+)$NL"; +$otherPattern = "$startPattern .*$NL"; $endPattern = "(?\d+)\/0\/(?P\d+)$NL"; -$pvidPattern = " port (?:access|trunk pvid|hybrid pvid) vlan (?P\d+)$NL"; -$portHybridPattern = " port hybrid vlan (?:(?P\d+)(?: (?:to|\d+))* tagged|(?P\d+)(?: \d+)* untagged)$NL"; -$voiceVlanPattern = " voice-vlan (?P\d+) enable$NL"; +$pvidPattern = "$startPattern port (?:access|trunk pvid|hybrid pvid) vlan (?P\d+)$NL"; +$portHybridPattern = "$startPattern port hybrid vlan (?:(?P\d+)(?: (?:to|\d+))* tagged|(?P\d+)(?: \d+)* untagged)$NL"; +$voiceVlanPattern = "$startPattern voice-vlan (?P\d+) enable$NL"; preg_match_all("/$startPattern$interfaceAddressPattern(?:$pvidPattern|$portHybridPattern|$voiceVlanPattern|$otherPattern)*$endPattern/", $conf, $interfaces, PREG_SET_ORDER); $stack = array(); @@ -50,8 +50,9 @@ foreach ($interfaces as $interface) { <?= $sysname[1] ?? "Switch sans nom" ?> - Schéma des VLANs - + + @@ -146,7 +147,6 @@ foreach ($interfaces as $interface) { customColors.sheet.insertRule(`[style*="--pvid: ${pvid};"] { --pvid-color: ${color} }`) customColors.sheet.insertRule(`[style*="--tagged: ${pvid};"] { --tagged-color: ${color} }`) customColors.sheet.insertRule(`[style*="--untagged: ${pvid};"] { --untagged-color: ${color} }`) - console.log(customColors.sheet.cssRules) }