diff --git a/composer.lock b/composer.lock index fa030ad..8ef2737 100644 --- a/composer.lock +++ b/composer.lock @@ -91,16 +91,16 @@ }, { "name": "indieauth/client", - "version": "0.1.7", + "version": "0.1.8", "source": { "type": "git", "url": "https://github.com/indieweb/indieauth-client-php.git", - "reference": "dec4f2f77ddaab11b00537db0a5fe52cc0bc3296" + "reference": "f979f8ee0fc6daaa6a393e7afdac894000d09544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/indieweb/indieauth-client-php/zipball/dec4f2f77ddaab11b00537db0a5fe52cc0bc3296", - "reference": "dec4f2f77ddaab11b00537db0a5fe52cc0bc3296", + "url": "https://api.github.com/repos/indieweb/indieauth-client-php/zipball/f979f8ee0fc6daaa6a393e7afdac894000d09544", + "reference": "f979f8ee0fc6daaa6a393e7afdac894000d09544", "shasum": "" }, "require": { @@ -126,7 +126,7 @@ } ], "description": "IndieAuth Client Library", - "time": "2014-10-06 06:25:22" + "time": "2014-10-06 07:37:10" }, { "name": "indieweb/date-formatter", diff --git a/controllers/auth.php b/controllers/auth.php index 0ecdf80..b8f9e1a 100644 --- a/controllers/auth.php +++ b/controllers/auth.php @@ -64,12 +64,10 @@ function hostname($url) { function add_hcard_info($user, $hCard) { if($user && $hCard) { // Update the user's h-card info if present - if(array_key_exists('name', $hCard)) { - $user->name = $hCard['name']; - } - if(array_key_exists('photo', $hCard)) { - $user->photo_url = $hCard['photo']; - } + if(BarnabyWalters\Mf2\hasProp($hCard, 'name')) + $user->name = BarnabyWalters\Mf2\getPlaintext($hCard, 'name'); + if(BarnabyWalters\Mf2\hasProp($hCard, 'photo')) + $user->photo_url = BarnabyWalters\Mf2\getPlaintext($hCard, 'photo'); } } @@ -107,7 +105,7 @@ $app->get('/auth/start', function() use($app) { $authorizationEndpoint = IndieAuth\Client::discoverAuthorizationEndpoint($me); $tokenEndpoint = IndieAuth\Client::discoverTokenEndpoint($me); $micropubEndpoint = IndieAuth\Client::discoverMicropubEndpoint($me); - $hCard = IndieAuth\Client::getHCard($me); + $hCard = IndieAuth\Client::representativeHCard($me); // Generate a "state" parameter for the request $state = IndieAuth\Client::generateStateParameter();