public function view_token() { $this->assertLoggedIn(); $this->set('area', 'app'); try { $token = new OAuthToken($this->args('id')); if (!$token->isHydrated()) { throw new Exception("This app does not exist."); } if (!User::$me->isHydrated() && $token->get('user_id') != User::$me->id) { throw new Exception("You are not authorized to edit this token."); } $this->setTitle("View App Token - " . $token->getName()); $this->set('bots', $token->getActiveBots()->getAll()); $this->set('token', $token); } catch (Exception $e) { $this->setTitle('View App - Error'); $this->set('megaerror', $e->getMessage()); } }