@@ -92,7 +92,9 @@ discard block |
||
| 92 | 92 | */ |
| 93 | 93 | public function getQueryParam($paramName) |
| 94 | 94 | { |
| 95 | - if (!isset($this->queryParams[$paramName])) return null; |
|
| 95 | + if (!isset($this->queryParams[$paramName])) { |
|
| 96 | + return null; |
|
| 97 | + } |
|
| 96 | 98 | $val = filter_var($this->queryParams[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 97 | 99 | return ($val !== null ? str_replace('\\', '', $val) : null); |
| 98 | 100 | } |
@@ -109,7 +111,9 @@ discard block |
||
| 109 | 111 | |
| 110 | 112 | public function getQueryParamPOST($paramName) |
| 111 | 113 | { |
| 112 | - if (!isset($this->queryParamsPOST[$paramName])) return null; |
|
| 114 | + if (!isset($this->queryParamsPOST[$paramName])) { |
|
| 115 | + return null; |
|
| 116 | + } |
|
| 113 | 117 | return filter_var($this->queryParamsPOST[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 114 | 118 | } |
| 115 | 119 | |
@@ -124,13 +128,17 @@ discard block |
||
| 124 | 128 | |
| 125 | 129 | public function getServerConstant($paramName) |
| 126 | 130 | { |
| 127 | - if (!isset($this->serverConstants[$paramName])) return null; |
|
| 131 | + if (!isset($this->serverConstants[$paramName])) { |
|
| 132 | + return null; |
|
| 133 | + } |
|
| 128 | 134 | return filter_var($this->serverConstants[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 129 | 135 | } |
| 130 | 136 | |
| 131 | 137 | public function getCookie($paramName) |
| 132 | 138 | { |
| 133 | - if (!isset($this->cookies[$paramName])) return null; |
|
| 139 | + if (!isset($this->cookies[$paramName])) { |
|
| 140 | + return null; |
|
| 141 | + } |
|
| 134 | 142 | return filter_var($this->cookies[$paramName], FILTER_SANITIZE_FULL_SPECIAL_CHARS); |
| 135 | 143 | } |
| 136 | 144 | |
@@ -271,9 +279,11 @@ discard block |
||
| 271 | 279 | */ |
| 272 | 280 | public function setVocab($vocabid) |
| 273 | 281 | { |
| 274 | - if (strpos($vocabid, ' ') !== false) // if there are multiple vocabularies just storing the string |
|
| 282 | + if (strpos($vocabid, ' ') !== false) { |
|
| 283 | + // if there are multiple vocabularies just storing the string |
|
| 275 | 284 | { |
| 276 | 285 | $this->setVocabids($vocabid); |
| 286 | + } |
|
| 277 | 287 | } else { |
| 278 | 288 | $this->vocab = $this->model->getVocabulary($vocabid); |
| 279 | 289 | } |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | } |
| 10 | 10 | require_once 'vendor/autoload.php'; |
| 11 | 11 | } catch (Exception $e) { |
| 12 | - echo "Error: " . $e->getMessage(); |
|
| 12 | + echo "Error: ".$e->getMessage(); |
|
| 13 | 13 | return; |
| 14 | 14 | } |
| 15 | 15 | |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | // if language code missing, redirect to guessed language |
| 28 | 28 | // in any case, redirect to <lang>/ |
| 29 | 29 | $lang = sizeof($parts) == 2 && $parts[1] !== '' ? $parts[1] : $controller->guessLanguage($request); |
| 30 | - header("Location: " . $lang . "/"); |
|
| 30 | + header("Location: ".$lang."/"); |
|
| 31 | 31 | } else { |
| 32 | 32 | if (array_key_exists($parts[1], $config->getLanguages())) { // global pages |
| 33 | 33 | $request->setLang($parts[1]); |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | } |
| 57 | 57 | if (sizeof($parts) == 3) { // language code missing |
| 58 | 58 | $lang = $controller->guessLanguage($request); |
| 59 | - $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/"; |
|
| 60 | - header("Location: " . $newurl); |
|
| 59 | + $newurl = $controller->getBaseHref().$vocab."/".$lang."/"; |
|
| 60 | + header("Location: ".$newurl); |
|
| 61 | 61 | } else { |
| 62 | 62 | if (array_key_exists($parts[2], $config->getLanguages())) { |
| 63 | 63 | $lang = $parts[2]; |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | } |
| 99 | 99 | } else { // language code missing, redirect to some language version |
| 100 | 100 | $lang = $controller->guessLanguage($request, $vocab); |
| 101 | - $newurl = $controller->getBaseHref() . $vocab . "/" . $lang . "/" . implode('/', array_slice($parts, 2)); |
|
| 101 | + $newurl = $controller->getBaseHref().$vocab."/".$lang."/".implode('/', array_slice($parts, 2)); |
|
| 102 | 102 | $qs = $request->getServerConstant('QUERY_STRING'); |
| 103 | 103 | if ($qs) { |
| 104 | - $newurl .= "?" . $qs; |
|
| 104 | + $newurl .= "?".$qs; |
|
| 105 | 105 | } |
| 106 | 106 | header("Location: $newurl"); |
| 107 | 107 | } |