コード例 #1
0
 /**
  * Build Breadcrumb Trail
  * 
  * @return  void
  */
 protected function _buildPathway()
 {
     // create breadcrumbs
     if (Pathway::count() <= 0) {
         Pathway::append(Lang::txt(strtoupper($this->_option)), 'index.php?option=' . $this->_option);
     }
     // add "API"
     Pathway::append(Lang::txt('COM_DEVELOPER_API'), 'index.php?option=' . $this->_option . '&controller=api');
     // add "Applications"
     Pathway::append(Lang::txt('COM_DEVELOPER_API_APPLICATIONS'), 'index.php?option=' . $this->_option . '&controller=' . $this->_controller);
     // do we have an application
     if ($appid = Request::getInt('id', 0)) {
         $application = Application::oneOrFail($appid);
         // add "Applications"
         Pathway::append($application->get('name'), 'index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&id=' . $appid);
     }
     // add task
     if (isset($this->_task) && !in_array($this->_task, array('view', 'display', 'applications', 'granted'))) {
         // add "Applications"
         Pathway::append(Lang::txt('COM_DEVELOPER_API_APPLICATION_' . strtoupper($this->_task)), 'index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&id=' . $appid . '&task=' . $this->_task);
     }
     // add active
     if ($active = Request::getCmd('active', null)) {
         // add "Applications"
         Pathway::append(Lang::txt(ucfirst($active)), 'index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&id=' . $appid . '&task=' . $this->_task);
     }
 }
コード例 #2
0
 /**
  * Remove any existing tokens for applications
  * 
  * @return  void
  */
 public function removeTokensTask()
 {
     // [SECURITY] Check for request forgeries
     Request::checkToken();
     if (!User::authorise('core.edit', $this->_option)) {
         App::abort(403, Lang::txt('JERROR_ALERTNOAUTHOR'));
     }
     // Incoming
     $ids = Request::getVar('id', array(0));
     $ids = !is_array($ids) ? array($ids) : $ids;
     // Do we actually have any entries?
     if (count($ids) < 1) {
         // No entries found, so go back to the entries list with
         // a message scolding the user for not selecting anything. Tsk, tsk.
         Notify::warning(Lang::txt('COM_DEVELOPER_SELECT_APPLICATION_TO', $this->_task));
         return $this->cancelTask();
     }
     // loop through each application id
     foreach ($ids as $id) {
         // Load the entry and revoke tokens/codes
         $row = Application::oneOrFail(intval($id));
         $row->revokeAccessTokens();
         $row->revokeRefreshTokens();
         $row->revokeAuthorizationCodes();
     }
     // Set the redirect URL to the main entries listing.
     Notify::success(Lang::txt('COM_DEVELOPER_REVOKE_TOKENS_SUCCESS'));
     $this->cancelTask();
 }
コード例 #3
0
ファイル: Mysql.php プロジェクト: hubzero/framework
 /**
  * Load refresh token details by token
  * 
  * @param   string  $refresh_token  Refresh token
  * @return  array   Refresh token details
  */
 public function getRefreshToken($refresh_token)
 {
     // create refresh token
     $token = \Components\Developer\Models\Refreshtoken::oneByToken($refresh_token);
     // make sure we have a token
     if (!$token->get('id')) {
         return false;
     }
     // make sure its a published token
     if (!$token->isPublished()) {
         return false;
     }
     // get the application's client id
     $application = \Components\Developer\Models\Application::oneOrFail($token->get('application_id'));
     $token->set('client_id', $application->get('client_id'));
     // format expires to unix timestamp
     $token->set('expires', with(new Date($token->get('expires')))->toUnix());
     // return token
     return $token->toArray();
 }