]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/finishremotesubscribe.php
Make OMB work if the configured domain name does not exclusively contain lower case...
[quix0rs-gnu-social.git] / actions / finishremotesubscribe.php
index f9094a50cafa91fd2b240d3df930229d9f7471e8..3e3a817154ddef6c5a81bb413a15817cf7956be8 100644 (file)
@@ -44,7 +44,7 @@ class FinishremotesubscribeAction extends Action
         common_debug('stored request: '.print_r($omb,true), __FILE__);
 
         common_remove_magic_from_request();
-        $req = OAuthRequest::from_request();
+        $req = OAuthRequest::from_request('POST', common_local_url('finishuserauthorization'));
 
         $token = $req->get_parameter('oauth_token');
 
@@ -136,16 +136,16 @@ class FinishremotesubscribeAction extends Action
         $profile->nickname = $nickname;
         $profile->profileurl = $profile_url;
 
-        if ($fullname) {
+        if (!is_null($fullname)) {
             $profile->fullname = $fullname;
         }
-        if ($homepage) {
+        if (!is_null($homepage)) {
             $profile->homepage = $homepage;
         }
-        if ($bio) {
+        if (!is_null($bio)) {
             $profile->bio = $bio;
         }
-        if ($location) {
+        if (!is_null($location)) {
             $profile->location = $location;
         }
 
@@ -230,14 +230,21 @@ class FinishremotesubscribeAction extends Action
         # show up close to the top of the page
 
         common_redirect(common_local_url('subscribers', array('nickname' =>
-                                                             $user->nickname)));
+                                                             $user->nickname)),
+                        303);
     }
 
     function add_avatar($profile, $url)
     {
         $temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
         copy($url, $temp_filename);
-        return $profile->setOriginal($temp_filename);
+        $imagefile = new ImageFile($profile->id, $temp_filename);
+        $filename = Avatar::filename($profile->id,
+                                     image_type_to_extension($imagefile->type),
+                                     null,
+                                     common_timestamp());
+        rename($temp_filename, Avatar::path($filename));
+        return $profile->setOriginal($filename);
     }
 
     function access_token($omb)
@@ -277,7 +284,7 @@ class FinishremotesubscribeAction extends Action
         $fetcher = Auth_Yadis_Yadis::getHTTPFetcher();
         $result = $fetcher->post($req->get_normalized_http_url(),
                                  $req->to_postdata(),
-                                 array('User-Agent' => 'Laconica/' . LACONICA_VERSION));
+                                 array('User-AgentLaconica/' . LACONICA_VERSION));
 
         common_debug('got result: "'.print_r($result,true).'"', __FILE__);