Skip to content

Commit

Permalink
Fix Sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Nox committed Jul 9, 2022
1 parent 77c30ff commit b71d43a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 28 deletions.
46 changes: 20 additions & 26 deletions backend/class/Request/HttpRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,36 +76,30 @@ public function build(): Request
{
parent::build();
Cookie::getInstance()->start();
if (! empty($requestData)) {
foreach ($requestData as $key => $value) {
$this->set($key, $value);
$environment = Environment::getInstance();
// Encrypted Urls?
if ($environment->get('url>encrypt', false) === true) {
if (! empty($_GET) && $environment->get('url>forceencrypt', false) === true) {
LinkHelper::forward('/');
}
} else {
$environment = Environment::getInstance();
// Encrypted Urls?
if ($environment->get('url>encrypt', false) === true) {
if (! empty($_GET) && $environment->get('url>forceencrypt', false) === true) {
LinkHelper::forward('/');
}
$uri = substr($_SERVER['REQUEST_URI'], 1);
if (! empty($uri)) {
$noParams = explode('?', $_SERVER['REQUEST_URI'])[0];
try {
$params = LinkHelper::decryptLink($noParams);
parse_str($params, $_GET);
} catch (Exception) {
exit(WebHelper::HTTP_BAD_REQUEST);
}
$uri = substr($_SERVER['REQUEST_URI'], 1);
if (! empty($uri)) {
$noParams = explode('?', $_SERVER['REQUEST_URI'])[0];
try {
$params = LinkHelper::decryptLink($noParams);
parse_str($params, $_GET);
} catch (Exception) {
exit(WebHelper::HTTP_BAD_REQUEST);
}
}
static::getInstance()->add($_GET);
$defaultContext = Application::getInstance()->get('defaultcontext');
$context = static::getInstance()->get(Mvc::CONTEXT, $defaultContext);
static::getInstance()->set(Mvc::CONTEXT, $context);
$defaultView = Application::getInstance()->get('context>' . $context . '>defaultview');
$view = static::getInstance()->get(Mvc::VIEW, $defaultView);
static::getInstance()->set(Mvc::VIEW, $view);
}
static::getInstance()->add($_GET);
$defaultContext = Application::getInstance()->get('defaultcontext');
$context = static::getInstance()->get(Mvc::CONTEXT, $defaultContext);
static::getInstance()->set(Mvc::CONTEXT, $context);
$defaultView = Application::getInstance()->get('context>' . $context . '>defaultview');
$view = static::getInstance()->get(Mvc::VIEW, $defaultView);
static::getInstance()->set(Mvc::VIEW, $view);

return $this;
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/page/maintenance.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@
<div class="text-center">
<h1 class="fa fa-cogs size-80 theme-color hidden-xs"></h1>
<h2><strong>💀</strong></h2>
<p>This application went into <strong>Maintenance Mode</strong> at <?= $begin ?> because of <i><?= $reason ?></i></p>
<p>This application went into <strong>Maintenance Mode</strong> at <?= $begin ?> because of <em><?= $reason ?></em></p>
<img src="/asset/lib/maintenance/death.jpg" loop="false" width="33%">
<br/>
<small><a href="https://www.vikrammadan.com/">&quot;<i>Kicking The Bucket</i>&quot; by Vikram Madan</a></small>
<small><a href="https://www.vikrammadan.com/">&quot;<em>Kicking The Bucket</em>&quot; by Vikram Madan</a></small>
</div>
</body>
</html>

0 comments on commit b71d43a

Please sign in to comment.