parent
fa5ef9d858
commit
a4a994dc19
3 changed files with 15 additions and 6 deletions
|
@ -90,6 +90,11 @@ class APIv1 extends CustomModule
|
||||||
{
|
{
|
||||||
// Unsure why I had to put this here, I guess it's being overridden somewhere in PICKLES
|
// Unsure why I had to put this here, I guess it's being overridden somewhere in PICKLES
|
||||||
header('Content-type: application/json');
|
header('Content-type: application/json');
|
||||||
|
|
||||||
|
if (isset($this->return['response_code']))
|
||||||
|
{
|
||||||
|
Browser::status($this->return['response_code']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ class api_v1_leaderboard extends APIv1
|
||||||
// Checks if we have a UID
|
// Checks if we have a UID
|
||||||
if (!isset($_GET['uid']))
|
if (!isset($_GET['uid']))
|
||||||
{
|
{
|
||||||
throw new Exception('Missing UID.');
|
throw new Exception('You must supply a leaderboard UID.');
|
||||||
}
|
}
|
||||||
|
|
||||||
$leaderboard_uid = $_GET['uid'];
|
$leaderboard_uid = $_GET['uid'];
|
||||||
|
@ -22,12 +22,12 @@ class api_v1_leaderboard extends APIv1
|
||||||
|
|
||||||
if (!$leaderboard)
|
if (!$leaderboard)
|
||||||
{
|
{
|
||||||
throw new Exception('Leaderboard UID does not exist.');
|
throw new Exception('Leaderboard does not exist.');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->uid != $leaderboard['uid'])
|
if ($this->uid != $leaderboard['uid'])
|
||||||
{
|
{
|
||||||
throw new Exception('Leaderboard UID does not belong to you.');
|
throw new Exception('Leaderboard does not belong to you.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Sets up our key suffixes
|
// Sets up our key suffixes
|
||||||
|
@ -122,7 +122,8 @@ class api_v1_leaderboard extends APIv1
|
||||||
}
|
}
|
||||||
catch (Exception $e)
|
catch (Exception $e)
|
||||||
{
|
{
|
||||||
return array('response_code' => 400, 'error' => $e->getMessage());
|
$this->response_code = 400;
|
||||||
|
$this->error = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,11 +5,14 @@ class api_v1_leaderboards extends APIv1
|
||||||
protected $request_methods = 'GET';
|
protected $request_methods = 'GET';
|
||||||
|
|
||||||
public function __default()
|
public function __default()
|
||||||
|
{
|
||||||
|
if (!isset($this->return['error']))
|
||||||
{
|
{
|
||||||
$leaderboards = new leaderboards();
|
$leaderboards = new leaderboards();
|
||||||
|
|
||||||
return $leaderboards->__default();
|
return $leaderboards->__default();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue