From f9d27e3bae80d089a98a547bbd5212f588c11350 Mon Sep 17 00:00:00 2001 From: billz Date: Thu, 14 Sep 2023 15:14:02 +0200 Subject: [PATCH] Reorg index components into includes --- includes/functions.php | 7 ++ includes/navbar.php | 23 +++++ includes/page_actions.php | 57 +++++++++++ includes/sidebar.php | 103 ++++++++++++++++++++ index.php | 193 ++------------------------------------ 5 files changed, 198 insertions(+), 185 deletions(-) create mode 100755 includes/navbar.php create mode 100755 includes/page_actions.php create mode 100755 includes/sidebar.php diff --git a/includes/functions.php b/includes/functions.php index 3b44b1e4..f42dd122 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -664,6 +664,13 @@ function formatDateAgo($datetime, $full = false) return $string ? implode(', ', $string) . ' ago' : 'just now'; } +function initializeApp() +{ + $_SESSION["theme_url"] = getThemeOpt(); + $_SESSION["toggleState"] = getSidebarState(); + $_SESSION["bridgedEnabled"] = getBridgedState(); +} + function getThemeOpt() { if (!isset($_COOKIE['theme'])) { diff --git a/includes/navbar.php b/includes/navbar.php new file mode 100755 index 00000000..511bf515 --- /dev/null +++ b/includes/navbar.php @@ -0,0 +1,23 @@ + diff --git a/includes/page_actions.php b/includes/page_actions.php new file mode 100755 index 00000000..f97bc5d1 --- /dev/null +++ b/includes/page_actions.php @@ -0,0 +1,57 @@ + diff --git a/includes/sidebar.php b/includes/sidebar.php new file mode 100755 index 00000000..299f4bb5 --- /dev/null +++ b/includes/sidebar.php @@ -0,0 +1,103 @@ + diff --git a/index.php b/index.php index a10faa67..7af26192 100755 --- a/index.php +++ b/index.php @@ -47,14 +47,9 @@ require_once 'includes/openvpn.php'; require_once 'includes/wireguard.php'; require_once 'includes/torproxy.php'; -$output = $return = 0; -$page = $_SERVER['PATH_INFO']; - -$theme_url = getThemeOpt(); -$toggleState = getSidebarState(); -$bridgedEnabled = getBridgedState(); - -?> +initializeApp(); +?> + @@ -85,8 +80,7 @@ $bridgedEnabled = getBridgedState(); - - + " title="main" rel="stylesheet"> @@ -108,101 +102,8 @@ $bridgedEnabled = getBridgedState();
- - + +
@@ -210,89 +111,11 @@ $bridgedEnabled = getBridgedState();
- +
- +