Beispiel #1
0
 function getAppByRequestToken($token_key)
 {
     // Look up the full req tokenx
     $req_token = $this->lookup_token(null, 'request', $token_key);
     if (empty($req_token)) {
         common_debug("couldn't get request token from oauth datastore");
         return null;
     }
     // Look up the full Token
     $token = new Token();
     $token->tok = $req_token->key;
     $result = $token->find(true);
     if (empty($result)) {
         common_debug('Couldn\'t find req token in the token table.');
         return null;
     }
     // Look up the app
     $app = new Oauth_application();
     $app->consumer_key = $token->consumer_key;
     $result = $app->find(true);
     if (!empty($result)) {
         return $app;
     } else {
         common_debug("Couldn't find the app!");
         return null;
     }
 }
 function showContent()
 {
     $offset = ($this->page - 1) * APPS_PER_PAGE;
     $limit = APPS_PER_PAGE + 1;
     $application = new Oauth_application();
     $application->owner = $this->scoped->getID();
     $application->whereAdd("name != 'anonymous'");
     $application->limit($offset, $limit);
     $application->orderBy('created DESC');
     $application->find();
     $cnt = 0;
     if ($application) {
         $al = new ApplicationList($application, $this->scoped, $this);
         $cnt = $al->show();
         if (0 == $cnt) {
             $this->showEmptyListMessage();
         }
     }
     $this->elementStart('p', array('id' => 'application_register'));
     $this->element('a', array('href' => common_local_url('newapplication'), 'class' => 'more'), 'Register a new application');
     $this->elementEnd('p');
     $this->pagination($this->page > 1, $cnt > APPS_PER_PAGE, $this->page, 'oauthappssettings');
 }
 static function getByConsumerKey($key)
 {
     if (empty($key)) {
         return null;
     }
     $app = new Oauth_application();
     $app->consumer_key = $key;
     $app->limit(1);
     $result = $app->find(true);
     return empty($result) ? null : $app;
 }