X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fremotesubscribe.php;h=7323103fc5c0d5bb289ede1815c5979e1dde8c7f;hb=7dc271723110cd2e9b179a3ae8dc8eee2c7c2534;hp=3c8346fbedd47db680729ff16ae513009562d9cc;hpb=1200e005b1df080899cf25c1ba93f76f81710d70;p=quix0rs-gnu-social.git diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php index 3c8346fbed..7323103fc5 100644 --- a/actions/remotesubscribe.php +++ b/actions/remotesubscribe.php @@ -1,7 +1,7 @@ err) { $this->element('div', 'error', $this->err); } else { - $inst = _('To subscribe, you can [login](%%action.login%%),' . - ' or [register](%%action.register%%) a new ' . - ' account. If you already have an account ' . - ' on a [compatible microblogging site](%%doc.openmublog%%), ' . - ' enter your profile URL below.'); + $inst = sprintf(_('To subscribe, you can [login](%%%%action.%s%%%%),' . + ' or [register](%%%%action.%s%%%%) a new ' . + ' account. If you already have an account ' . + ' on a [compatible microblogging site](%%doc.openmublog%%), ' . + ' enter your profile URL below.'), + (!common_config('site','openidonly')) ? 'login' : 'openidlogin', + (!common_config('site','openidonly')) ? 'register' : 'openidlogin'); $output = common_markup_to_html($inst); $this->elementStart('div', 'instructions'); $this->raw($output); @@ -92,14 +94,26 @@ class RemotesubscribeAction extends Action { # id = remotesubscribe conflicts with the # button on profile page - $this->elementStart('form', array('id' => 'remsub', 'method' => 'post', - 'action' => common_local_url('remotesubscribe'))); + $this->elementStart('form', array('id' => 'form_remote_subscribe', + 'method' => 'post', + 'class' => 'form_settings', + 'action' => common_local_url('remotesubscribe'))); + $this->elementStart('fieldset'); + $this->element('legend', _('Subscribe to a remote user')); $this->hidden('token', common_session_token()); + + $this->elementStart('ul', 'form_data'); + $this->elementStart('li'); $this->input('nickname', _('User nickname'), $this->nickname, _('Nickname of the user you want to follow')); + $this->elementEnd('li'); + $this->elementStart('li'); $this->input('profile_url', _('Profile URL'), $this->profile_url, _('URL of your profile on another compatible microblogging service')); + $this->elementEnd('li'); + $this->elementEnd('ul'); $this->submit('submit', _('Subscribe')); + $this->elementEnd('fieldset'); $this->elementEnd('form'); } @@ -309,8 +323,7 @@ class RemotesubscribeAction extends Action $result = $fetcher->post($req->get_normalized_http_url(), $req->to_postdata(), - array('User-Agent' => 'Laconica/' . LACONICA_VERSION)); - + array('User-Agent: Laconica/' . LACONICA_VERSION)); if ($result->status != 200) { return null; } @@ -322,8 +335,6 @@ class RemotesubscribeAction extends Action function requestAuthorization($user, $omb, $token, $secret) { - global $config; # for license URL - $con = omb_oauth_consumer(); $tok = new OAuthToken($token, $secret); @@ -347,7 +358,7 @@ class RemotesubscribeAction extends Action $req->set_parameter('omb_listenee', $user->uri); $req->set_parameter('omb_listenee_profile', common_profile_url($user->nickname)); $req->set_parameter('omb_listenee_nickname', $user->nickname); - $req->set_parameter('omb_listenee_license', $config['license']['url']); + $req->set_parameter('omb_listenee_license', common_config('license', 'url')); $profile = $user->getProfile(); if (!$profile) { @@ -356,16 +367,16 @@ class RemotesubscribeAction extends Action return; } - if ($profile->fullname) { + if (!is_null($profile->fullname)) { $req->set_parameter('omb_listenee_fullname', $profile->fullname); } - if ($profile->homepage) { + if (!is_null($profile->homepage)) { $req->set_parameter('omb_listenee_homepage', $profile->homepage); } - if ($profile->bio) { + if (!is_null($profile->bio)) { $req->set_parameter('omb_listenee_bio', $profile->bio); } - if ($profile->location) { + if (!is_null($profile->location)) { $req->set_parameter('omb_listenee_location', $profile->location); } $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE); @@ -398,7 +409,7 @@ class RemotesubscribeAction extends Action # Redirect to authorization service - common_redirect($req->to_url()); + common_redirect($req->to_url(), 303); return; } }