Bearsampp
2026.7.11
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-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
17
class
Homepage
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
40
$page
=
UtilInput::cleanGetVar
(
'p'
);
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
44
$this->
refreshCommonsJsContent
();
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(
98
Path::getWebResourcesPath
(),
99
Path::getHomepagePath
()
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
$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:36
Homepage\$page
$page
Definition
class.homepage.php:22
Homepage\getPage
getPage()
Definition
class.homepage.php:52
Homepage\refreshAliasContent
refreshAliasContent()
Definition
class.homepage.php:93
Homepage\getPageUrl
getPageUrl($query)
Definition
class.homepage.php:82
Homepage\refreshCommonsJsContent
refreshCommonsJsContent()
Definition
class.homepage.php:108
Homepage\$pageList
$pageList
Definition
class.homepage.php:27
Homepage\getPageQuery
getPageQuery($query)
Definition
class.homepage.php:63
Homepage\PAGE_INDEX
const PAGE_INDEX
Definition
class.homepage.php:19
Log\initClass
static initClass($classInstance)
Definition
class.log.php:660
Path\getWebResourcesPath
static getWebResourcesPath()
Definition
class.path.php:1024
Path\getHomepagePath
static getHomepagePath($aetrayPath=false)
Definition
class.path.php:483
Path\getLocalUrl
static getLocalUrl($request=null)
Definition
class.path.php:407
UtilInput\cleanGetVar
static cleanGetVar($name, $type='text')
Definition
class.util.input.php:59
sandbox
core
classes
class.homepage.php
Generated by
1.17.0