Bearsampp
2026.9.23
Toggle main menu visibility
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
17
class
Homepage
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
43
$page
=
UtilInput::cleanGetVar
(
'p'
);
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
47
$this->
refreshCommonsJsContent
();
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(
104
Path::getWebResourcesPath
(),
105
Path::getHomepagePath
()
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
$result
Definition
ajax.apache.php:19
$bearsamppBins
global $bearsamppBins
Definition
ajax.apache.php:16
$bearsamppRoot
global $bearsamppRoot
Definition
ajax.apache.php:16
Homepage
Definition
class.homepage.php:18
Homepage\PAGE_PHPINFO
const PAGE_PHPINFO
Definition
class.homepage.php:20
Homepage\__construct
__construct()
Definition
class.homepage.php:39
Homepage\$page
$page
Definition
class.homepage.php:24
Homepage\getPage
getPage()
Definition
class.homepage.php:55
Homepage\refreshAliasContent
refreshAliasContent()
Definition
class.homepage.php:99
Homepage\PAGE_CACHE_STATS
const PAGE_CACHE_STATS
Definition
class.homepage.php:21
Homepage\getPageUrl
getPageUrl($query)
Definition
class.homepage.php:87
Homepage\refreshCommonsJsContent
refreshCommonsJsContent()
Definition
class.homepage.php:114
Homepage\$pageList
$pageList
Definition
class.homepage.php:29
Homepage\getPageQuery
getPageQuery($query)
Definition
class.homepage.php:67
Homepage\PAGE_INDEX
const PAGE_INDEX
Definition
class.homepage.php:19
Log\initClass
static initClass($classInstance)
Definition
class.log.php:784
Path\getWebResourcesPath
static getWebResourcesPath()
Definition
class.path.php:1198
Path\getHomepagePath
static getHomepagePath($aetrayPath=false)
Definition
class.path.php:511
Path\getLocalUrl
static getLocalUrl($request=null)
Definition
class.path.php:430
UtilInput\cleanGetVar
static cleanGetVar($name, $type='text')
Definition
class.util.input.php:59
sandbox
core
classes
class.homepage.php
Generated by
1.17.0