예제 #1
0
파일: Twitter.php 프로젝트: hutchike/notex
 public function callback()
 {
     $oauth_token = $this->params->oauth_token;
     $oauth_verifier = $this->params->oauth_verifier;
     if (isset($oauth_token) && $oauth_token != $this->session->oauth_token) {
         return $this->clear();
     }
     $connection = new TwitterOAuth(CONSUMER_KEY, CONSUMER_SECRET, $this->session->oauth_token, $this->session->oauth_token_secret);
     $this->session->access_token = $access_token = $connection->getAccessToken($oauth_verifier);
     $this->session->oauth_token = NULL;
     $this->session->oauth_token_secret = NULL;
     if (200 == $connection->http_code) {
         $session->status = 'verified';
         $this->redirect('http://' . Twitter::screen_name($access_token) . COOKIE_DOMAIN . '/');
     } else {
         return $this->clear();
     }
 }
예제 #2
0
파일: App.php 프로젝트: hutchike/notex
 public function before()
 {
     // Setup extra configuration, e.g. Twitter
     $config = Config::load('notex');
     Config::define_constants($config['twitter']);
     Config::define_constants($config['notes']);
     // Setup global variables and rendering data
     $uri = $_SERVER['REQUEST_URI'];
     $this->render->username = $this->username = $this->username_from_host();
     $this->render->screen_name = $this->screen_name = Twitter::screen_name($this->session->access_token);
     $this->render->is_owner = $this->is_owner = $this->screen_name && $this->screen_name == $this->username;
     $this->render->copy = '';
     $this->render->debug = '';
     $this->render->layout = 'notepad';
     $this->host_ip = array_key($_SERVER, 'HTTP_X_FORWARDED_FOR', $_SERVER['REMOTE_ADDR']);
     $title = ($this->username ? $this->username . '.' : '') . 'noted.cc';
     $title .= $uri == '/' ? ' | web notepad' : $uri;
     $this->render->title = $title;
     // Handle alternative content types, e.g. XML and JSON
     $type = $this->app->get_content_type();
     if ($type != 'html') {
         $this->respond_with_data_as($type);
     }
 }