1
1
Fork 0

added spaces/curly braces and TODO for better using trim()

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-03-25 12:53:01 +01:00
parent a70a2381c9
commit bd4cee8c21
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78

View file

@ -655,12 +655,13 @@ class App {
$this->scheme = 'http';
if ((x($_SERVER,'HTTPS') && $_SERVER['HTTPS']) ||
/// @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') ||
(x($_SERVER['HTTP_X_FORWARDED_SSL']) && $_SERVER['HTTP_X_FORWARDED_SSL'] == 'on') ||
(x($_SERVER['FRONT_END_HTTPS']) && $_SERVER['FRONT_END_HTTPS'] == 'on') ||
(x($_SERVER,'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443)) // XXX: reasonable assumption, but isn't this hardcoding too much?
(x($_SERVER, 'SERVER_PORT') && (intval($_SERVER['SERVER_PORT']) == 443)) // XXX: reasonable assumption, but isn't this hardcoding too much?
) {
$this->scheme = 'https';
}
@ -692,22 +693,26 @@ class App {
$_SERVER["argc"] --;
}
if ((x($_SERVER,'QUERY_STRING')) && substr($_SERVER['QUERY_STRING'],0,9) === "pagename=") {
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=") {
}
} 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'],'/\\');
} elseif (x($_GET,'q')) {
$this->cmd = trim($_GET['q'],'/\\');
if (x($_GET, 'pagename')) {
$this->cmd = trim($_GET['pagename'], '/\\');
} elseif (x($_GET, 'q')) {
$this->cmd = trim($_GET['q'], '/\\');
}
@ -715,9 +720,8 @@ 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);
if (substr($this->cmd, 0, 1) === '~') {
$this->cmd = 'profile/' . substr($this->cmd, 1);
}
// Diaspora style profile url