diff options
author | Zach Copley <zach@status.net> | 2010-10-21 12:23:04 -0700 |
---|---|---|
committer | Zach Copley <zach@status.net> | 2010-10-21 12:23:04 -0700 |
commit | bab012bd67bdaf431f7bdba707c9fdebb7d6b6bb (patch) | |
tree | 89f6114e1c2fd930b8a7b72a0d7c9f6ca4e581d0 /actions | |
parent | 8ac8f3d2dc95a437dea7dec2d26f09a364734a9b (diff) |
New "desktop" mode for the OAuth authorization page. If mode=deskstop
is specified in the request the page is probably meant to be displayed
in a small webview of another application, so suppress header, aside
and footer.
Diffstat (limited to 'actions')
-rw-r--r-- | actions/apioauthauthorize.php | 56 |
1 files changed, 51 insertions, 5 deletions
diff --git a/actions/apioauthauthorize.php b/actions/apioauthauthorize.php index 013cca029..8bbe0d737 100644 --- a/actions/apioauthauthorize.php +++ b/actions/apioauthauthorize.php @@ -68,11 +68,12 @@ class ApiOauthAuthorizeAction extends Action { parent::prepare($args); - $this->nickname = $this->trimmed('nickname'); - $this->password = $this->arg('password'); - $this->oauthTokenParam = $this->arg('oauth_token'); - $this->callback = $this->arg('oauth_callback'); - $this->store = new ApiStatusNetOAuthDataStore(); + $this->nickname = $this->trimmed('nickname'); + $this->password = $this->arg('password'); + $this->oauthTokenParam = $this->arg('oauth_token'); + $this->callback = $this->arg('oauth_callback'); + $this->mode = $this->arg('mode'); + $this->store = new ApiStatusNetOAuthDataStore(); try { $this->app = $this->store->getAppByRequestToken($this->oauthTokenParam); @@ -429,6 +430,51 @@ class ApiOauthAuthorizeAction extends Action // NOP } + /* + * Checks to see if a the "mode" parameter is present in the request + * and set to "desktop". If it is, the page is meant to be displayed in + * a small frame of another application, and we should suppress the + * header, aside, and footer. + */ + function desktopMode() + { + if (isset($this->mode) && $this->mode == 'desktop') { + return true; + } else { + return false; + } + } + + /* + * Override - suppress output in "desktop" mode + */ + function showHeader() + { + if ($this->desktopMode() == false) { + parent::showHeader(); + } + } + + /* + * Override - suppress output in "desktop" mode + */ + function showAside() + { + if ($this->desktopMode() == false) { + parent::showHeader(); + } + } + + /* + * Override - suppress output in "desktop" mode + */ + function showFooter() + { + if ($this->desktopMode() == false) { + parent::showHeader(); + } + } + /** * Show site notice. * |