From 67eefdcf0591faa6a6f77c3c4f7e53528dbde0c6 Mon Sep 17 00:00:00 2001 From: glaszig Date: Fri, 6 Mar 2020 16:26:23 +0100 Subject: [PATCH 1/5] fixed dhcp template markup there was one closing div too many leading to empty content area when nav is collapsed --- templates/dhcp.php | 518 +++++++++++++++++++++++---------------------- 1 file changed, 262 insertions(+), 256 deletions(-) diff --git a/templates/dhcp.php b/templates/dhcp.php index a8df0a5d..64b11b67 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -10,282 +10,288 @@
-
-
-
-
-
- -
-
- -
-
-
-
- showMessages(); ?> -
- - - - -
-
-

DHCP server settings

-
-
- - -
-
-
-
- - -
-
+
+
-
-
- - -
-
- -
-
- - -
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- -
- - -
- -
-
-
- -
- -
- aria-describedby="no-resolv-description"> - -
-

- send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers.") ?> -
no-resolv to the dnsmasq configuration.") ?> -

+
+
+
+
+
+ +
+
+
-
- -
- -
- +
+ showMessages(); ?> + + + + + + + +
+ +
+

DHCP server settings

+
+
+ +
- -
- -
- -
- "> -
- +
+
+ + +
-
-

- - - ]/[domain/]][[#][@|[#]]"); ?> - -

- -
-
- -
+
+
+ + +
+
-
-
-
-

- -

-
- aria-describedby="log-dhcp-requests"> - -
-
- aria-describedby="log-dhcp-queries"> - -
-
-
-
+
+
+ + +
+
+ + +
+
-
-

Client list

-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
+
+
+ + +
+
- -
-

+
+
+ + +
+
-
- - -
-
- " class="form-control"> +
+ + +
+ +
+
+
+ +
+ +
+ aria-describedby="no-resolv-description"> + +
+

+ send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers.") ?> +
no-resolv to the dnsmasq configuration.") ?> +

+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ "> +
+ +
+
+

+ + + ]/[domain/]][[#][@|[#]]"); ?> + +

+ +
+
+ + +
+ +
+
+
+

+ +

+
+ aria-describedby="log-dhcp-requests"> + +
+
+ aria-describedby="log-dhcp-queries"> + +
+
+
+ +
+ +
+

Client list

+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
+ + +
+

+ +
+ + +
+
+ " class="form-control"> +
+
+ " class="form-control"> +
+
+ +
+
+ +
+ +
+
+
+ " class="form-control" autofocus="autofocus">
- " class="form-control"> + " class="form-control">
- +
-
- -
+
+
-
-
-
- " class="form-control" autofocus="autofocus"> -
-
- " class="form-control"> -
-
- -
-
-
- - + - -
-

-
-
- '.htmlspecialchars($log, ENT_QUOTES).''; - ?> -
-
-
+ +
+

+
+
+ '.htmlspecialchars($log, ENT_QUOTES).''; + ?> +
+
+
- +
-
+ + +
-
- -
- -
-
+ + +
+
From 287bfcb5686fc413ee43c861cce38dd4bb079a25 Mon Sep 17 00:00:00 2001 From: glaszig Date: Fri, 6 Mar 2020 16:39:24 +0100 Subject: [PATCH 2/5] dhcp: moved logging-related controls to logging tab --- templates/dhcp.php | 44 +++++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 27 deletions(-) diff --git a/templates/dhcp.php b/templates/dhcp.php index 64b11b67..3b6f665a 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -33,7 +33,7 @@ -
-
-
-
-

- -

-
- aria-describedby="log-dhcp-requests"> - -
-
- aria-describedby="log-dhcp-queries"> - -
-
-
-
@@ -273,15 +256,22 @@
-

-
-
- '.htmlspecialchars($log, ENT_QUOTES).''; - ?> -
-
+

+

+ +
+ aria-describedby="log-dhcp-requests"> + +
+
+ aria-describedby="log-dhcp-queries"> + +
+ + '.htmlspecialchars($log, ENT_QUOTES).''; + ?>
From ad6a4b5228e7ce0c23bbdb60bb5fc6b08fd8ade2 Mon Sep 17 00:00:00 2001 From: glaszig Date: Fri, 6 Mar 2020 16:41:49 +0100 Subject: [PATCH 3/5] improved tab id --- templates/dhcp.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/dhcp.php b/templates/dhcp.php index 3b6f665a..09c46450 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -38,7 +38,7 @@ - + @@ -255,7 +255,7 @@ -
+

From 1d6b4e64687b7cafa44ae8b405ace7e3800e3eb4 Mon Sep 17 00:00:00 2001 From: glaszig Date: Fri, 6 Mar 2020 16:53:22 +0100 Subject: [PATCH 4/5] moved dhcp tab panes into partials --- templates/dhcp.php | 238 +------------------------------ templates/dhcp/advanced.php | 63 ++++++++ templates/dhcp/clients.php | 35 +++++ templates/dhcp/general.php | 59 ++++++++ templates/dhcp/logging.php | 19 +++ templates/dhcp/static_leases.php | 48 +++++++ 6 files changed, 230 insertions(+), 232 deletions(-) create mode 100644 templates/dhcp/advanced.php create mode 100644 templates/dhcp/clients.php create mode 100644 templates/dhcp/general.php create mode 100644 templates/dhcp/logging.php create mode 100644 templates/dhcp/static_leases.php diff --git a/templates/dhcp.php b/templates/dhcp.php index 09c46450..2b57586a 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -40,240 +40,14 @@ + -
- -
-

DHCP server settings

-
-
- - -
-
-
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- - -
-
- -
-
- - -
-
- -
-
- - -
-
- -
- - -
- -
-
-
- -
- -
- aria-describedby="no-resolv-description"> - -
-

- send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers.") ?> -
no-resolv to the dnsmasq configuration.") ?> -

-
- -
- -
- -
- -
-
- -
- -
- -
- "> -
- -
-
-

- - - ]/[domain/]][[#][@|[#]]"); ?> - -

- -
-
- - -
- -
- -
-

Client list

-
-
-
-
- -
-
- - - - - - - - - - - - - - - - - - - -
-
-
-
-
-
-
- - -
-

- -
- - -
-
- " class="form-control"> -
-
- " class="form-control"> -
-
- -
-
- -
- -
-
-
- " class="form-control" autofocus="autofocus"> -
-
- " class="form-control"> -
-
- -
-
-
- - - - - -
-

-

- -
- aria-describedby="log-dhcp-requests"> - -
-
- aria-describedby="log-dhcp-queries"> - -
- - '.htmlspecialchars($log, ENT_QUOTES).''; - ?> -
- + + + + +
diff --git a/templates/dhcp/advanced.php b/templates/dhcp/advanced.php new file mode 100644 index 00000000..6366977c --- /dev/null +++ b/templates/dhcp/advanced.php @@ -0,0 +1,63 @@ + +
+ +
+
+
+ +
+ +
+ aria-describedby="no-resolv-description"> + +
+

+ send DNS queries to the servers configured below exclusively. By default RaspAP also uses its upstream DHCP server's name servers.") ?> +
no-resolv to the dnsmasq configuration.") ?> +

+
+ +
+ +
+ +
+ +
+
+ +
+ +
+ +
+ "> +
+ +
+
+

+ + + ]/[domain/]][[#][@|[#]]"); ?> + +

+ +
+
+ + +
+ +
diff --git a/templates/dhcp/clients.php b/templates/dhcp/clients.php new file mode 100644 index 00000000..c0d9d06d --- /dev/null +++ b/templates/dhcp/clients.php @@ -0,0 +1,35 @@ +
+

Client list

+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + +
+
+
+
+
+
+
diff --git a/templates/dhcp/general.php b/templates/dhcp/general.php new file mode 100644 index 00000000..e4023392 --- /dev/null +++ b/templates/dhcp/general.php @@ -0,0 +1,59 @@ +
+

DHCP server settings

+
+
+ + +
+
+
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ +
+
+ + +
+
+ +
diff --git a/templates/dhcp/logging.php b/templates/dhcp/logging.php new file mode 100644 index 00000000..60e7166e --- /dev/null +++ b/templates/dhcp/logging.php @@ -0,0 +1,19 @@ + +
+

+

+ +
+ aria-describedby="log-dhcp-requests"> + +
+
+ aria-describedby="log-dhcp-queries"> + +
+ + '.htmlspecialchars($log, ENT_QUOTES).''; + ?> +
diff --git a/templates/dhcp/static_leases.php b/templates/dhcp/static_leases.php new file mode 100644 index 00000000..3b804270 --- /dev/null +++ b/templates/dhcp/static_leases.php @@ -0,0 +1,48 @@ + +
+

+ +
+ + +
+
+ " class="form-control"> +
+
+ " class="form-control"> +
+
+ +
+
+ +
+ +
+
+
+ " class="form-control" autofocus="autofocus"> +
+
+ " class="form-control"> +
+
+ +
+
+ + +
From 29d4653524852b81769d846c863fce9cf63c0b50 Mon Sep 17 00:00:00 2001 From: glaszig Date: Fri, 6 Mar 2020 16:54:48 +0100 Subject: [PATCH 5/5] prevent variable name collision in renderTemplate() function --- includes/functions.php | 6 +++--- templates/dhcp.php | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/includes/functions.php b/includes/functions.php index c5ba1a47..e177aa52 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -271,15 +271,15 @@ function ConvertToSecurity($security) /** * Renders a simple PHP template */ -function renderTemplate($name, $data = []) +function renderTemplate($name, $__template_data = []) { $file = realpath(dirname(__FILE__) . "/../templates/$name.php"); if (!file_exists($file)) { return "template $name ($file) not found"; } - if (is_array($data)) { - extract($data); + if (is_array($__template_data)) { + extract($__template_data); } ob_start(); diff --git a/templates/dhcp.php b/templates/dhcp.php index 2b57586a..c93ab7ef 100755 --- a/templates/dhcp.php +++ b/templates/dhcp.php @@ -43,11 +43,11 @@
- - - - - + + + + +