Skip to content

Commit

Permalink
Fix Undefined Index
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Del-Piccolo <moi@jdel.org>
  • Loading branch information
jdel committed Mar 10, 2017
1 parent 8e1474e commit b7d0386
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.php
Expand Up @@ -13,7 +13,7 @@

$config = new Config(__DIR__, 'conf/sspks.yaml');
$config->baseUrlRelative = substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/')) . '/';
$config->baseUrl = 'http' . ($_SERVER['HTTPS']?'s':'') . '://' . $_SERVER['HTTP_HOST'] . $config->baseUrlRelative;
$config->baseUrl = 'http' . (array_key_exists('HTTPS', $_SERVER) && $_SERVER['HTTPS']?'s':'') . '://' . $_SERVER['HTTP_HOST'] . $config->baseUrlRelative;

$handler = new Handler($config);
$handler->handle();
2 changes: 1 addition & 1 deletion lib/SSpkS/Handler/BrowserAllPackagesListHandler.php
Expand Up @@ -9,7 +9,7 @@ class BrowserAllPackagesListHandler extends AbstractHandler
{
public function canHandle()
{
return ($_SERVER['REQUEST_METHOD'] == 'GET' && !empty(trim($_GET['fulllist'])));
return ($_SERVER['REQUEST_METHOD'] == 'GET' && array_key_exists('fulllist', $_GET) && !empty(trim($_GET['fulllist'])));
}

public function handle()
Expand Down
2 changes: 1 addition & 1 deletion lib/SSpkS/Handler/BrowserPackageListHandler.php
Expand Up @@ -11,7 +11,7 @@ class BrowserPackageListHandler extends AbstractHandler
{
public function canHandle()
{
return ($_SERVER['REQUEST_METHOD'] == 'GET' && !empty(trim($_GET['arch'])));
return ($_SERVER['REQUEST_METHOD'] == 'GET' && array_key_exists('arch', $_GET) && !empty(trim($_GET['arch'])));
}

public function handle()
Expand Down

0 comments on commit b7d0386

Please sign in to comment.