added spaces/curly braces and TODO for better using trim()
Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
parent
a70a2381c9
commit
bd4cee8c21
10
boot.php
10
boot.php
|
@ -655,6 +655,7 @@ class App {
|
|||
|
||||
|
||||
$this->scheme = 'http';
|
||||
/// @TODO x() should be better used here ...
|
||||
if ((x($_SERVER, 'HTTPS') && $_SERVER['HTTPS']) ||
|
||||
(x($_SERVER['HTTP_FORWARDED']) && preg_match("/proto=https/", $_SERVER['HTTP_FORWARDED'])) ||
|
||||
(x($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') ||
|
||||
|
@ -695,14 +696,18 @@ class App {
|
|||
if ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 9) === "pagename=") {
|
||||
$this->query_string = substr($_SERVER['QUERY_STRING'],9);
|
||||
// removing trailing / - maybe a nginx problem
|
||||
if (substr($this->query_string, 0, 1) == "/")
|
||||
/// @TODO can be shortened by trim($str, '/') !
|
||||
if (substr($this->query_string, 0, 1) == "/") {
|
||||
$this->query_string = substr($this->query_string, 1);
|
||||
}
|
||||
} elseif ((x($_SERVER, 'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'], 0, 2) === "q=") {
|
||||
$this->query_string = substr($_SERVER['QUERY_STRING'],2);
|
||||
// removing trailing / - maybe a nginx problem
|
||||
if (substr($this->query_string, 0, 1) == "/")
|
||||
/// @TODO can be shortened by trim($str, '/') !
|
||||
if (substr($this->query_string, 0, 1) == "/") {
|
||||
$this->query_string = substr($this->query_string, 1);
|
||||
}
|
||||
}
|
||||
|
||||
if (x($_GET, 'pagename')) {
|
||||
$this->cmd = trim($_GET['pagename'], '/\\');
|
||||
|
@ -715,7 +720,6 @@ class App {
|
|||
$this->query_string = str_replace($this->cmd."&",$this->cmd."?", $this->query_string);
|
||||
|
||||
// unix style "homedir"
|
||||
|
||||
if (substr($this->cmd, 0, 1) === '~') {
|
||||
$this->cmd = 'profile/' . substr($this->cmd, 1);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user