Beispiel #1
0
 /**
  * Gets authorize URL and redirects to dropbox
  *
  * @return void HTTP redirect (to dropbox.com)
  */
 public function setupDropboxPost()
 {
     $qs = '';
     if (isset($_GET['edit'])) {
         $qs = '?edit';
     }
     $secret = $this->getSecret();
     try {
         getSession()->set('flowDropboxKey', $this->utility->encrypt($_POST['dropboxKey'], $secret));
         getSession()->set('flowDropboxSecret', $this->utility->encrypt($_POST['dropboxSecret'], $secret));
         getSession()->set('flowDropboxFolder', $_POST['dropboxFolder']);
         $callback = urlencode(sprintf('%s://%s%s%s', $this->utility->getProtocol(false), getenv('HTTP_HOST'), '/setup/dropbox/callback', $qs));
         $oauth = new Dropbox_OAuth_PHP($_POST['dropboxKey'], $_POST['dropboxSecret']);
         getSession()->set('dropboxToken', $oauth->getRequestToken());
         $url = $oauth->getAuthorizeUrl($callback);
         $this->route->redirect($url, null, true);
     } catch (Dropbox_Exception $e) {
         getLogger()->crit('An error occured getting the Dropbox authorize url.', $e);
         $this->route->run('/error/500', EpiRoute::httpGet);
     }
 }