$req = OAuthRequest::from_request();
$token = $req->get_parameter('oauth_token');
# I think this is the success metric
$req = OAuthRequest::from_request();
$token = $req->get_parameter('oauth_token');
# I think this is the success metric
- common_user_error(_t('User being listened to doesn\'t exist.'));
+ common_user_error(_('User being listened to doesn\'t exist.'));
+ return;
+ }
+
+ $other = User::staticGet('uri', $omb['listener']);
+
+ if ($other) {
+ common_user_error(_('You can use the local subscription!'));
$fullname = $req->get_parameter('omb_listener_fullname');
$homepage = $req->get_parameter('omb_listener_homepage');
$bio = $req->get_parameter('omb_listener_bio');
$fullname = $req->get_parameter('omb_listener_fullname');
$homepage = $req->get_parameter('omb_listener_homepage');
$bio = $req->get_parameter('omb_listener_bio');
$avatar_url = $req->get_parameter('omb_listener_avatar');
list($newtok, $newsecret) = $this->access_token($omb);
$avatar_url = $req->get_parameter('omb_listener_avatar');
list($newtok, $newsecret) = $this->access_token($omb);
if ($exists) {
$profile->update($orig_profile);
} else {
$profile->created = DB_DataObject_Cast::dateTime(); # current time
$id = $profile->insert();
if ($exists) {
$profile->update($orig_profile);
} else {
$profile->created = DB_DataObject_Cast::dateTime(); # current time
$id = $profile->insert();
- $remote->postnoticeurl = $omb[OMB_ENDPOINT_POSTNOTICE];
- $remote->updateprofileurl = $omb[OMB_ENDPOINT_UPDATEPROFILE];
+ $remote->postnoticeurl = $omb['post_notice_url'];
+ $remote->updateprofileurl = $omb['update_profile_url'];
$sub = new Subscription();
$sub->subscriber = $remote->id;
$sub->subscribed = $user->id;
$sub->token = $newtok;
$sub->secret = $newsecret;
$sub->created = DB_DataObject_Cast::dateTime(); # current time
$sub = new Subscription();
$sub->subscriber = $remote->id;
$sub->subscribed = $user->id;
$sub->token = $newtok;
$sub->secret = $newsecret;
$sub->created = DB_DataObject_Cast::dateTime(); # current time
# If we show subscriptions in reverse chron order, this should
# show up close to the top of the page
# If we show subscriptions in reverse chron order, this should
# show up close to the top of the page
function add_avatar($profile, $url) {
$temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
copy($url, $temp_filename);
return $profile->setOriginal($temp_filename);
}
function add_avatar($profile, $url) {
$temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
copy($url, $temp_filename);
return $profile->setOriginal($temp_filename);
}
$con = omb_oauth_consumer();
$tok = new OAuthToken($omb['token'], $omb['secret']);
$con = omb_oauth_consumer();
$tok = new OAuthToken($omb['token'], $omb['secret']);
- $url = omb_service_uri($omb[OAUTH_ENDPOINT_ACCESS]);
-
+ common_debug('using request token "'.$tok.'"', __FILE__);
+
+ $url = $omb['access_token_url'];
+
+ common_debug('using access token url "'.$url.'"', __FILE__);
+
# XXX: Is this the right thing to do? Strip off GET params and make them
# POST params? Seems wrong to me.
# XXX: Is this the right thing to do? Strip off GET params and make them
# POST params? Seems wrong to me.
$parsed = parse_url($url);
$params = array();
parse_str($parsed['query'], $params);
$req = OAuthRequest::from_consumer_and_token($con, $tok, "POST", $url, $params);
$parsed = parse_url($url);
$params = array();
parse_str($parsed['query'], $params);
$req = OAuthRequest::from_consumer_and_token($con, $tok, "POST", $url, $params);
$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
$result = $fetcher->post($req->get_normalized_http_url(),
$fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
$result = $fetcher->post($req->get_normalized_http_url(),
if ($result->status != 200) {
return NULL;
}
parse_str($result->body, $return);
if ($result->status != 200) {
return NULL;
}
parse_str($result->body, $return);