Always return empty array

This commit is contained in:
Bartek Fabiszewski 2017-09-19 08:22:28 +02:00
parent aabe323cb2
commit 396566e0fe
2 changed files with 57 additions and 59 deletions

View File

@ -26,9 +26,8 @@ $auth = new uAuth();
$userId = (isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? (int) $_REQUEST["userid"] : NULL; $userId = (isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? (int) $_REQUEST["userid"] : NULL;
$trackId = (isset($_REQUEST["trackid"]) && is_numeric($_REQUEST["trackid"])) ? (int) $_REQUEST["trackid"] : NULL; $trackId = (isset($_REQUEST["trackid"]) && is_numeric($_REQUEST["trackid"])) ? (int) $_REQUEST["trackid"] : NULL;
if ($userId) {
$positionsArr = []; $positionsArr = [];
if ($userId) {
if (uConfig::$public_tracks || if (uConfig::$public_tracks ||
($auth->isAuthenticated() && ($auth->isAdmin() || $auth->user->id === $userId))) { ($auth->isAuthenticated() && ($auth->isAdmin() || $auth->user->id === $userId))) {
if ($trackId) { if ($trackId) {
@ -42,6 +41,7 @@ if ($userId) {
} }
} }
} }
}
header("Content-type: text/xml"); header("Content-type: text/xml");
$xml = new XMLWriter(); $xml = new XMLWriter();
@ -76,6 +76,5 @@ if ($userId) {
$xml->endElement(); $xml->endElement();
$xml->endDocument(); $xml->endDocument();
$xml->flush(); $xml->flush();
}
?> ?>

View File

@ -24,13 +24,13 @@ $auth = new uAuth();
$userId = (isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? (int) $_REQUEST["userid"] : NULL; $userId = (isset($_REQUEST["userid"]) && is_numeric($_REQUEST["userid"])) ? (int) $_REQUEST["userid"] : NULL;
if ($userId) {
$tracksArr = []; $tracksArr = [];
if ($userId) {
if (uConfig::$public_tracks || if (uConfig::$public_tracks ||
($auth->isAuthenticated() && ($auth->isAdmin() || $auth->user->id === $userId))) { ($auth->isAuthenticated() && ($auth->isAdmin() || $auth->user->id === $userId))) {
$tracksArr = uTrack::getAll($userId); $tracksArr = uTrack::getAll($userId);
} }
}
header("Content-type: text/xml"); header("Content-type: text/xml");
$xml = new XMLWriter(); $xml = new XMLWriter();
@ -51,6 +51,5 @@ if ($userId) {
$xml->endElement(); $xml->endElement();
$xml->endDocument(); $xml->endDocument();
$xml->flush(); $xml->flush();
}
?> ?>