From 596365672a9627dbcab0f1aeddc13e4fb9c3b18b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 1 Jul 2008 12:37:05 -0400 Subject: add instructions to remotesubscribe darcs-hash:20080701163705-84dde-ee039de84a45080962671d15891f3f7f685a73a6.gz --- actions/remotesubscribe.php | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) (limited to 'actions') diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php index b676484cd..4cadd1496 100644 --- a/actions/remotesubscribe.php +++ b/actions/remotesubscribe.php @@ -39,13 +39,31 @@ class RemotesubscribeAction extends Action { } } - function show_form($err=NULL) { - $nickname = $this->trimmed('nickname'); - $profile = $this->trimmed('profile_url'); - common_show_header(_t('Remote subscribe')); + function get_instructions() { + return _t('To subscribe, you can [login](%%action.login%%),' . + ' or [register](%%action.register%%) a new ' . + ' account. If you already have an account ' . + ' on another microblogging site, ' . + ' enter your profile URL below.'); + } + + function show_top($err=NULL) { if ($err) { common_element('div', 'error', $err); + } else { + $instructions = $this->get_instructions(); + $output = common_markup_to_html($instructions); + common_element_start('p', 'instructions'); + common_raw($output); + common_element_end('p'); } + } + + function show_form($err=NULL) { + $nickname = $this->trimmed('nickname'); + $profile = $this->trimmed('profile_url'); + common_show_header(_t('Remote subscribe'), NULL, $err, + array($this, 'show_top')); common_element_start('form', array('id' => 'remotesubscribe', 'method' => 'POST', 'action' => common_local_url('remotesubscribe'))); common_input('nickname', _t('User nickname'), $nickname, @@ -242,7 +260,7 @@ class RemotesubscribeAction extends Action { # We re-use this tool's fetcher, since it's pretty good $fetcher = Auth_Yadis_Yadis::getHTTPFetcher(); - + $result = $fetcher->post($req->get_normalized_http_url(), $req->to_postdata()); @@ -301,7 +319,7 @@ class RemotesubscribeAction extends Action { } # XXX: add a nonce to prevent replay attacks - + $req->set_parameter('oauth_callback', common_local_url('finishremotesubscribe')); # XXX: test to see if endpoint accepts this signature method @@ -326,8 +344,8 @@ class RemotesubscribeAction extends Action { common_redirect($req->to_url()); return; } - + function make_nonce() { return common_good_rand(16); } -} \ No newline at end of file +} -- cgit v1.2.3-54-g00ecf