public static function microsoftRemoveDevice($uri, $email)
{
trigger_error('The api is deprecated and will be removed in version 5', E_USER_DEPRECATED);
if (BaseAPI::isAuthorized()) {
// redefine
$uri = (string) $uri;
// validate
if ($uri == '') {
BaseAPI::output(BaseAPI::BAD_REQUEST, array('message' => 'No uri-parameter provided.'));
}
if ($email == '') {
BaseAPI::output(BaseAPI::BAD_REQUEST, array('message' => 'No email-parameter provided.'));
}
try {
// load user
$user = new User(null, $email);
// get current uris
$uris = (array) $user->getSetting('microsoft_channel_uri');
// not already in array?
$index = array_search($uri, $uris);
if ($index !== false) {
// remove from array
unset($uris[$index]);
// save it
$user->setSetting('microsoft_channel_uri', $uris);
}
} catch (Exception $e) {
BaseAPI::output(BaseAPI::FORBIDDEN, array('message' => 'Can\'t authenticate you.'));
}
}
}