X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fupdateprofile.php;h=08cb31ae037c77c55af08f5017156685ed0076a0;hb=5f2cf2553cbe97b9983c8c5d0a85abb00b1a8375;hp=4751a04ff31726b9002caca41db06099f2cbc3fd;hpb=d014d43c6860e3aaf46a5afba0ea3dffd54f630d;p=quix0rs-gnu-social.git diff --git a/actions/updateprofile.php b/actions/updateprofile.php index 4751a04ff3..08cb31ae03 100644 --- a/actions/updateprofile.php +++ b/actions/updateprofile.php @@ -29,11 +29,13 @@ class UpdateprofileAction extends Action parent::handle($args); try { common_remove_magic_from_request(); - $req = OAuthRequest::from_request(); + $req = OAuthRequest::from_request('POST', common_local_url('updateprofile')); # Note: server-to-server function! $server = omb_oauth_server(); list($consumer, $token) = $server->verify_request($req); if ($this->update_profile($req, $consumer, $token)) { + header('HTTP/1.1 200 OK'); + header('Content-type: text/plain'); print "omb_version=".OMB_VERSION_01; } } catch (OAuthException $e) { @@ -136,22 +138,24 @@ class UpdateprofileAction extends Action $orig_profile = clone($profile); - if ($nickname) { + /* Use values even if they are an empty string. Parsing an empty string in + updateProfile is the specified way of clearing a parameter in OMB. */ + if (!is_null($nickname)) { $profile->nickname = $nickname; } - if ($profile_url) { + if (!is_null($profile_url)) { $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; } @@ -173,10 +177,6 @@ class UpdateprofileAction extends Action return false; } } - header('HTTP/1.1 200 OK'); - header('Content-type: text/plain'); - print 'Updated profile'; - print "\n"; return true; } }