$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';
}
$_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'], '/\\');
}
$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