Bearsampp 2025.8.29
Loading...
Searching...
No Matches
homepage.php
Go to the documentation of this file.
1<?php
2/*
3 *
4 * * Copyright (c) 2022-2025 Bearsampp
5 * * License: GNU General Public License version 3 or later; see LICENSE.txt
6 * * Website: https://bearsampp.com
7 * * Github: https://github.com/Bearsampp
8 *
9 */
10
16
20require_once __DIR__ . '/../../root.php';
21require_once __DIR__ . '/../../classes/actions/class.action.quickPick.php';
22
28
32$resourcesPath = rtrim( $bearsamppHomepage->getResourcesPath(), '/' ) . '/';
33
39
40// Instantiate the QuickPick class
42
43$ajaxUrl = $bearsamppCore->getAjaxPath() . '/ajax.getmodule_versions.php';
44
45
50
54$getLoader = '<span class = "loader float-end"><img src = "' . $imagesPath . 'loader.gif" alt="spinner"></span>';
55
60?>
61<!DOCTYPE html>
62<html lang = "<?php echo htmlspecialchars($bearsamppLang->getValue( Lang::LOCALE ), ENT_QUOTES, 'UTF-8') ?>">
63
64<head>
65 <meta charset = "utf-8">
66 <meta name = "viewport" content = "width=device-width, initial-scale=1.0">
67 <meta name = "description" content = "Localhost Dashboard">
68 <meta name = "author" content = "Bearsampp">
69
70 <?php
74 $cssFiles = [
75 "/css/app.css",
76 "/libs/bootstrap/css/bootstrap.min.css",
77 "/libs/fontawesome/css/all.min.css",
78 ];
80
81 "/libs/bootstrap/js/bootstrap.bundle.min.js",
82 "/libs/fontawesome/js/all.min.js",
83 "/js/_commons.js",
84 "/js/latestversion.js",
85 "/js/summary.js",
86 "/js/apache.js",
87 '/js/mailpit.js',
88 "/js/mariadb.js",
89 "/js/memcached.js",
90 "/js/mysql.js",
91 "/js/nodejs.js",
92 "/js/php.js",
93 "/js/postgresql.js",
94 "/js/xlight.js",
95 "/js/quickpick.js",
96 "/js/loading-cursor.js"
97 ];
98
102 foreach ( $cssFiles as $file ) {
103 echo '<link href="' . $resourcesPath . $file . '" rel="stylesheet">' . PHP_EOL;
104 }
105 ?>
106
107 <link href = "<?php echo $iconsPath . 'favicon.ico'; ?>" rel = "icon" />
108 <title><?php echo APP_TITLE . ' ' . $bearsamppCore->getAppVersion(); ?></title>
109
110 <!-- Inline script to set loading cursor immediately -->
111 <script>
112 // Set loading cursor immediately
113 document.documentElement.classList.add('loading-cursor');
114
115 // Create and show loading overlay
116 window.addEventListener('DOMContentLoaded', function() {
117 // Remove loading cursor when page is fully loaded
118 window.addEventListener('load', function() {
119 document.documentElement.classList.remove('loading-cursor');
120
121 // If there's an overlay, remove it
122 const existingOverlay = document.querySelector('.loading-overlay');
123 if (existingOverlay) {
124 existingOverlay.parentNode.removeChild(existingOverlay);
125 }
126 });
127 });
128 </script>
129</head>
130
131<body>
132<nav class = "navbar navbar-expand-md navbar-light bg-dark fixed-top" role = "navigation">
133 <div class = "container-fluid">
134 <div class = "d-inline-block">
135 <a class = "navbar-brand" href = "<?php echo Util::getWebsiteUrl(); ?>" aria-label = 'Home'>
136 <img class = "p-1" alt = "<?php echo APP_TITLE . ' ' . $bearsamppCore->getAppVersion(); ?>"
137 src = "<?php echo $imagesPath . 'header-logo.png'; ?>">
138 </a>
139 <button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarSupportedContent" aria-controls = "navbarSupportedContent"
140 aria-expanded = "false" aria-label = "Toggle navigation">
141 <span class = "navbar-toggler-icon"></span>
142 </button>
143 </div>
144 </div>
145 <?php
146 try {
147 echo $quickPick->loadQuickpick($imagesPath);
148 } catch (Exception $e) {
149 // Log the error but continue with the page
150 error_log('Error loading QuickPick: ' . $e->getMessage());
151 echo '<div id="quickPickError" class="text-center mt-3 pe-3">
152 <span>QuickPick unavailable</span>
153 </div>';
154 }
155 ?>
156
157 <div class = "collapse navbar-collapse icons" id = "navbarSupportedContent">
158 <div class = "d-flex flex-row justify-content-space-between align-items-center flex-fill mb-0">
159 <a data-bs-toggle = "tooltip" data-bs-placement = "top" data-bs-title = "<?php echo $bearsamppLang->getValue( Lang::DISCORD ); ?>" target = "_blank"
160 href = "https://discord.gg/AgwVNAzV" aria-label = "Discord">
161 <i class = 'fa-brands fa-discord'></i>
162 </a>
163 <a data-bs-toggle = "tooltip" data-bs-placement = "top" data-bs-title = "<?php echo $bearsamppLang->getValue( Lang::FACEBOOK ); ?>" target = "_blank"
164 href = "https://www.facebook.com/groups/bearsampp" aria-label = "Facebook">
165 <i class = "fa-brands fa-facebook"></i>
166 </a>
167 <a data-bs-toggle = "tooltip" data-bs-placement = "top" data-bs-title = "<?php echo $bearsamppLang->getValue( Lang::GITHUB ); ?>" target = "_blank"
168 href = "<?php echo Util::getGithubUrl(); ?>" aria-label = "GitHub">
169 <i class = "fa-brands fa-github"></i>
170 </a>
171 <a data-bs-toggle = "tooltip" data-bs-placement = "top" data-bs-title = "<?php echo $bearsamppLang->getValue( Lang::DONATE ); ?>" target = "_blank"
172 href = "<?php echo Util::getWebsiteUrl( 'donate' ); ?>"><img class = "donate" src = "<?php echo $imagesPath . 'donate.png'; ?>" alt = 'Donation Icon' />
173 </a>
174 </div>
175 </div>
176</nav>
177
178<div id = "page-wrapper">
179 <?php
180 try {
181 include __DIR__ . '/tpls/hp.latestversion.html';
182 } catch (Exception $e) {
183 error_log('Error including latest version template: ' . $e->getMessage());
184 echo '<div class="alert alert-warning">Latest version information unavailable</div>';
185 }
186
187 try {
188 $page = preg_replace('/[^a-z0-9_-]/i', '', (string) $bearsamppHomepage->getPage());
189 $pagePath = __DIR__ . '/tpls/hp.' . $page . '.html';
190 if (is_file($pagePath)) {
191 include $pagePath;
192 } else {
193 include __DIR__ . '/tpls/hp.index.html';
194 }
195 } catch (Exception $e) {
196 error_log('Error including page template: ' . $e->getMessage());
197 echo '<div class="alert alert-warning">Page content unavailable</div>';
198 }
199 ?>
200</div>
201
202<?php
203foreach ( $jsFiles as $file ) {
204 echo '<script src="' . $resourcesPath . $file . '"></script>' . PHP_EOL;
205}
206?>
207</body>
208</html>
global $bearsamppLang
global $bearsamppRoot
global $bearsamppCore
catch(Exception $e)
global $downloadTitle
const DOWNLOAD_MORE
$quickPick
Definition homepage.php:41
$resourcesPath
Definition homepage.php:32
$pagePath
Definition homepage.php:189
global $bearsamppConfig
Definition homepage.php:27
global $bearsamppHomepage
Definition homepage.php:27
$iconsPath
Definition homepage.php:37
$jsFiles
Definition homepage.php:79
$getLoader
Definition homepage.php:54
$imagesPath
Definition homepage.php:38
$ajaxUrl
Definition homepage.php:43
const APP_TITLE
Definition root.php:13