public function router($resource, array $arguments) { \Config::load('rest', true); $this->format = 'json'; // If they call user, go to $this->post_user(); $controller_method = strtolower(\Input::method()) . '_' . $resource; //is this a valid method if (method_exists($this, $controller_method)) { if ($controller_method == 'post_login') { call_user_func_array(array($this, 'post_login'), $arguments); } else { $session_key = Input::post('session_key'); $session = Model_Session::find() ->where('session_key', $session_key) ->get_one(); if (!$session) { $this->response(array('status' => 0, 'error' => 'Not Authorized'), 401); return; } else { call_user_func_array(array($this, $controller_method), $arguments); } } } else { $this->response(array('status' => 0, 'error' => 'Invalid method'), 405); return; } }
It looks like you're new here. If you want to get involved, click one of these buttons!