Bearsampp 2026.9.23
Loading...
Searching...
No Matches
class.homepage.php
Go to the documentation of this file.
1<?php
2/*
3 *
4 * * Copyright (c) 2021-2026 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
18{
19 const PAGE_INDEX = 'index';
20 const PAGE_PHPINFO = 'phpinfo';
21 const PAGE_CACHE_STATS = 'cachestats';
22
24 private $page;
25
29 private $pageList = array(
30 self::PAGE_INDEX,
31 self::PAGE_PHPINFO,
32 self::PAGE_CACHE_STATS,
33 );
34
39 public function __construct()
40 {
41 Log::initClass($this);
42
44 $this->page = !empty($page) && in_array($page, $this->pageList) ? $page : self::PAGE_INDEX;
45
46 // Ensure JS files are always up to date with the current URL/protocol
48 }
49
55 public function getPage()
56 {
57 return $this->page;
58 }
59
67 public function getPageQuery($query)
68 {
69 if (empty($query)) {
70 return '';
71 }
72
73 if (in_array($query, $this->pageList)) {
74 return $query !== self::PAGE_INDEX ? '?p=' . $query : 'index.php';
75 }
76
77 return '';
78 }
79
87 public function getPageUrl($query)
88 {
89 global $bearsamppRoot;
90
91 return Path::getLocalUrl($this->getPageQuery($query));
92 }
93
99 public function refreshAliasContent()
100 {
101 global $bearsamppBins;
102
103 $result = $bearsamppBins->getApache()->getAliasContent(
106 );
107
108 return file_put_contents(Path::getHomepagePath() . '/alias.conf', $result) !== false;
109 }
110
114 public function refreshCommonsJsContent()
115 {
116 // Redundant with global AJAX_URL in homepage.php
117 }
118}
$result
global $bearsamppBins
global $bearsamppRoot
const PAGE_PHPINFO
const PAGE_CACHE_STATS
getPageUrl($query)
refreshCommonsJsContent()
getPageQuery($query)
const PAGE_INDEX
static initClass($classInstance)
static getWebResourcesPath()
static getHomepagePath($aetrayPath=false)
static getLocalUrl($request=null)
static cleanGetVar($name, $type='text')