Code complete on API.
This commit is contained in:
parent
1e140d1a09
commit
78c8ed42ac
4 changed files with 117 additions and 6 deletions
|
@ -11,12 +11,13 @@ class APIv1 extends CustomModule
|
|||
$response_code = 200;
|
||||
$error = 'An unexcepted error has occurred.';
|
||||
|
||||
echo($_SERVER['REQUEST_METHOD']);
|
||||
print_r($this->request_methods);
|
||||
if (!is_array($this->request_methods))
|
||||
{
|
||||
$this->request_methods = array($this->request_methods);
|
||||
}
|
||||
|
||||
// Checks the request method
|
||||
if ((is_array($this->request_methods) && !in_array($_SERVER['REQUEST_METHOD'], $this->request_methods))
|
||||
|| $this->request_methods != $_SERVER['REQUEST_METHOD'])
|
||||
if (!in_array($_SERVER['REQUEST_METHOD'], $this->request_methods))
|
||||
{
|
||||
$response_code = 400;
|
||||
$error = 'Invalid request method.';
|
||||
|
|
|
@ -11,7 +11,9 @@ class CustomModule extends Module
|
|||
|
||||
$this->redis = new CustomRedis();
|
||||
|
||||
if (substr(get_class($this), 0, 3) != 'api')
|
||||
$class = get_class($this);
|
||||
|
||||
if ($class == 'api' || substr($class, 0, 3) != 'api')
|
||||
{
|
||||
if (isset($_COOKIE['__auth']))
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue