2024.8.23
Loading...
Searching...
No Matches
homepage.php
Go to the documentation of this file.
1<?php
2/*
3 * Copyright (c) 2021-2024 Bearsampp
4 * License: GNU General Public License version 3 or later; see LICENSE.txt
5 * Author: Bear
6 * Website: https://bearsampp.com
7 * Github: https://github.com/Bearsampp
8 */
9
10/**
11 * This script sets up the homepage for the Bearsampp application, including loading necessary resources,
12 * setting up the navigation bar, and including dynamic content based on the application's state.
13 * It utilizes global variables to access application settings and paths.
14 */
15
16/**
17 * Include the main root.php file which initializes the application environment.
18 */
19include __DIR__ . '/../../root.php';
20include __DIR__ . '/../../classes/actions/class.action.quickPick.php';
21
22/**
23 * Declare global variables to access various parts of the application such as language settings,
24 * core functionalities, homepage configurations, and more.
25 */
27
28/**
29 * Set the base path for resources, ensuring there is a trailing slash.
30 */
31$resourcesPath = rtrim( $bearsamppHomepage->getResourcesPath(), '/' ) . '/';
32
33/**
34 * Define paths for icons and images used in the homepage.
35 */
38
39// Instantiate the QuickPick class
41
42$ajaxUrl = $bearsamppCore->getAjaxPath() . '/ajax.getmodule_versions.php';
43
44
45/**
46 * Retrieve and store the localized string for the 'Download More' label.
47 */
49
50/**
51 * HTML snippet for a loading spinner image.
52 */
53$getLoader = '<span class = "loader float-end"><img src = "' . $imagesPath . 'loader.gif' . '" alt="spinner"></span>';
54
55/**
56 * HTML structure defining the head of the document, including meta tags, CSS and JS resource inclusion,
57 * and the document title.
58 */
59?>
60<!DOCTYPE html>
61<html lang = "<?php echo $bearsamppLang->getValue( Lang::LOCALE ) ?>">
62
63<head>
64 <meta charset = "utf-8">
65 <meta name = "viewport" content = "width=device-width, initial-scale=1.0">
66 <meta name = "description" content = "Localhost Dashboard">
67 <meta name = "author" content = "Bearsampp">
68
69 <?php
70 /**
71 * Arrays of CSS and JS files to be included in the page.
72 */
73 $cssFiles = [
74 "/css/app.css",
75 "/libs/bootstrap/css/bootstrap.min.css",
76 "/libs/fontawesome/css/all.min.css",
77 ];
79
80 "/libs/bootstrap/js/bootstrap.bundle.min.js",
81 "/libs/fontawesome/js/all.min.js",
82 "/js/_commons.js",
83 "/js/latestversion.js",
84 "/js/summary.js",
85 "/js/apache.js",
86 "/js/filezilla.js",
87 "/js/mailhog.js",
88 '/js/mailpit.js',
89 "/js/mariadb.js",
90 "/js/memcached.js",
91 "/js/mysql.js",
92 "/js/nodejs.js",
93 "/js/php.js",
94 "/js/postgresql.js",
95 "/js/xlight.js",
96 "/js/quickpick.js"
97 ];
98
99 /**
100 * Loop through CSS files and include them in the page.
101 */
102 foreach ( $cssFiles as $file ) {
103 echo '<link href="' . $resourcesPath . $file . '" rel="stylesheet">' . PHP_EOL;
104 }
105
106 /**
107 * Loop through JS files and include them in the page.
108 */
109 foreach ( $jsFiles as $file ) {
110 echo '<script src="' . $resourcesPath . $file . '" defer></script>' . PHP_EOL;
111 }
112 ?>
113
114 <link href = "<?php echo $iconsPath . 'favicon.ico'; ?>" rel = "icon" />
115 <title><?php echo APP_TITLE . ' ' . $bearsamppCore->getAppVersion(); ?></title>
116</head>
117
118<body>
119<nav class = "navbar navbar-expand-md navbar-light bg-dark fixed-top" role = "navigation">
120 <div class = "container-fluid">
121 <div class = "d-inline-block">
122 <a class = "navbar-brand" href = "<?php echo Util::getWebsiteUrl(); ?>" aria-label = 'Home'>
123 <img class = "p-1" alt = "<?php echo APP_TITLE . ' ' . $bearsamppCore->getAppVersion(); ?>"
124 src = "<?php echo $imagesPath . 'header-logo.png'; ?>">
125 </a>
126 <button class = "navbar-toggler" type = "button" data-bs-toggle = "collapse" data-bs-target = "#navbarSupportedContent" aria-controls = "navbarSupportedContent"
127 aria-expanded = "false" aria-label = "Toggle navigation">
128 <span class = "navbar-toggler-icon"></span>
129 </button>
130 </div>
131 </div>
132 <?php echo $quickPick->loadQuickpick($imagesPath ); ?>
133
134 <div class = "collapse navbar-collapse icons" id = "navbarSupportedContent">
135 <div class = "d-flex flex-row justify-content-space-between align-items-center flex-fill mb-0">
136 <a data-bs-toggle = "tooltip" data-bs-placement = "top" data-bs-title = "<?php echo $bearsamppLang->getValue( Lang::DISCORD ); ?>" target = "_blank"
137 href = "https://discord.gg/AgwVNAzV" aria-label = "Discord">
138 <i class = 'fa-brands fa-discord'></i>
139 </a>
140 <a data-bs-toggle = "tooltip" data-bs-placement = "top" data-bs-title = "<?php echo $bearsamppLang->getValue( Lang::FACEBOOK ); ?>" target = "_blank"
141 href = "https://www.facebook.com/groups/bearsampp" aria-label = "Facebook">
142 <i class = "fa-brands fa-facebook"></i>
143 </a>
144 <a data-bs-toggle = "tooltip" data-bs-placement = "top" data-bs-title = "<?php echo $bearsamppLang->getValue( Lang::GITHUB ); ?>" target = "_blank"
145 href = "<?php echo Util::getGithubUrl(); ?>" aria-label = "GitHub">
146 <i class = "fa-brands fa-github"></i>
147 </a>
148 <a data-bs-toggle = "tooltip" data-bs-placement = "top" data-bs-title = "<?php echo $bearsamppLang->getValue( Lang::DONATE ); ?>" target = "_blank"
149 href = "<?php echo Util::getWebsiteUrl( 'donate' ); ?>"><img class = "donate" src = "<?php echo $imagesPath . 'donate.png'; ?>" alt = 'Donation Icon' />
150 </a>
151 </div>
152 </div>
153</nav>
154
155<div id = "page-wrapper">
156 <?php include 'tpls/hp.latestversion.html'; ?>
157 <?php include 'tpls/hp.' . $bearsamppHomepage->getPage() . '.html'; ?>
158</div>
159</body>
160</html>
const DOWNLOAD_MORE
$quickPick
Definition homepage.php:40
$resourcesPath
Definition homepage.php:31
global $bearsamppConfig
Definition homepage.php:26
global $bearsamppHomepage
Definition homepage.php:26
$iconsPath
Definition homepage.php:36
$downloadTitle
Definition homepage.php:48
$jsFiles
Definition homepage.php:78
global $bearsamppLang
Definition homepage.php:26
global $bearsamppRoot
Definition homepage.php:26
$getLoader
Definition homepage.php:53
$imagesPath
Definition homepage.php:37
$ajaxUrl
Definition homepage.php:42
global $bearsamppCore
Definition homepage.php:26
const APP_TITLE
Definition root.php:12