Bearsampp 2026.7.11
Loading...
Searching...
No Matches
class.homepage.php
Go to the documentation of this file.
1<?php
2/*
3 *
4 * * Copyright (c) 2021-2024 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
22 private $page;
23
27 private $pageList = array(
28 self::PAGE_INDEX,
29 self::PAGE_PHPINFO,
30 );
31
36 public function __construct()
37 {
38 Log::initClass($this);
39
41 $this->page = !empty($page) && in_array($page, $this->pageList) ? $page : self::PAGE_INDEX;
42
43 // Ensure JS files are always up to date with the current URL/protocol
45 }
46
52 public function getPage()
53 {
54 return $this->page;
55 }
56
63 public function getPageQuery($query)
64 {
65 if (empty($query)) {
66 return '';
67 }
68
69 if (in_array($query, $this->pageList)) {
70 return $query !== self::PAGE_INDEX ? '?p=' . $query : 'index.php';
71 }
72
73 return '';
74 }
75
82 public function getPageUrl($query)
83 {
84 global $bearsamppRoot;
85 return Path::getLocalUrl($this->getPageQuery($query));
86 }
87
93 public function refreshAliasContent()
94 {
95 global $bearsamppBins;
96
97 $result = $bearsamppBins->getApache()->getAliasContent(
100 );
101
102 return file_put_contents(Path::getHomepagePath() . '/alias.conf', $result) !== false;
103 }
104
108 public function refreshCommonsJsContent()
109 {
110 // Redundant with global AJAX_URL in homepage.php
111 }
112}
$result
global $bearsamppBins
global $bearsamppRoot
const PAGE_PHPINFO
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')