isAuthenticated()) {
$user = $api->getAuthorizedUser();
echo 'Welcome ' . ($user->name ?? $user->username) . '
';
}
try {
$poll_token = array_key_exists('polltoken', $_GET) ? $_GET['polltoken'] : null;
$poll = $api->getPoll($poll_id, $poll_token);
} catch (NotFoundException $nfe) {
die('Poll not found');
} catch (NotSupportedPollException $nspe) {
die('Sorry, this poll has a not yet supported type: ' . $nspe->getMessage());
} catch (PollAccessRestrictedException $are) {
$message = array_key_exists('polltoken', $_GET)
? 'Sorry, your poll token is invalid! Please enter a valid token: '
: ('Sorry, this poll is private! If you have found this poll on a post, '
. 'please enter a link to the post, the post ID or the access token for the poll: ');
die(
$message
. '