fix: exclude query params from REQUEST_PATH
This commit is contained in:
parent
9e7c18afba
commit
ba8e95fa4f
|
@ -10,3 +10,5 @@ define('HOSTAS_UNIX_USER', 'www-data');
|
||||||
define('HOSTAS_ACCESS_LIST', array(
|
define('HOSTAS_ACCESS_LIST', array(
|
||||||
'example.org' => HOSTAS_ACCESS_LEVEL->trusted
|
'example.org' => HOSTAS_ACCESS_LEVEL->trusted
|
||||||
));
|
));
|
||||||
|
|
||||||
|
define('HOSTAS_MAX_POSTS_PER_PAGE', 50);
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
<?php
|
<?php
|
||||||
require_once($_SERVER['DOCUMENT_ROOT'] . '/config.php');
|
require_once($_SERVER['DOCUMENT_ROOT'] . '/config.php');
|
||||||
|
|
||||||
|
// $clean_uri is the request URI with any query strings removed
|
||||||
|
$clean_uri = strtok($_SERVER['REQUEST_URI'], '?');
|
||||||
|
|
||||||
// e.g. /api/v1/test/request/ -> ['', 'api', 'v1', 'test', 'request'].
|
// e.g. /api/v1/test/request/ -> ['', 'api', 'v1', 'test', 'request'].
|
||||||
// For convenience later, we take a slice that excludes ['', 'api', 'v1'].
|
// For convenience later, we take a slice that excludes ['', 'api', 'v1'].
|
||||||
define('REQUEST_PATH', array_slice(explode('/', $_SERVER['REQUEST_URI']), offset: 3));
|
define('REQUEST_PATH', array_slice(explode('/', $clean_uri), offset: 3));
|
||||||
|
|
||||||
switch (REQUEST_PATH[0]) {
|
switch (REQUEST_PATH[0]) {
|
||||||
case 'actor': // /api/v1/actor
|
case 'actor': // /api/v1/actor
|
||||||
|
|
Loading…
Reference in New Issue