$act->time = time();
$act->title = _("Follow");
- $act->content = sprintf(_("%s is now following %s."),
+ // TRANS: Success message for subscribe to user attempt through OStatus.
+ // TRANS: %1$s is the subscriber name, %2$s is the subscribed user's name.
+ $act->content = sprintf(_("%1$s is now following %2$s."),
$subscriber->getBestName(),
$other->getBestName());
$act->time = time();
$act->title = _("Unfollow");
- $act->content = sprintf(_("%s stopped following %s."),
+ // TRANS: Success message for unsubscribe from user attempt through OStatus.
+ // TRANS: %1$s is the unsubscriber's name, %2$s is the unsubscribed user's name.
+ $act->content = sprintf(_("%1$s stopped following %2$s."),
$profile->getBestName(),
$other->getBestName());
$act->time = time();
$act->title = _m("Join");
- $act->content = sprintf(_m("%s has joined group %s."),
+ // TRANS: Success message for subscribe to group attempt through OStatus.
+ // TRANS: %1$s is the member name, %2$s is the subscribed group's name.
+ $act->content = sprintf(_m("%1$s has joined group %2$s."),
$member->getBestName(),
$oprofile->getBestName());
$act->time = time();
$act->title = _m("Leave");
- $act->content = sprintf(_m("%s has left group %s."),
+ // TRANS: Success message for unsubscribe from group attempt through OStatus.
+ // TRANS: %1$s is the member name, %2$s is the unsubscribed group's name.
+ $act->content = sprintf(_m("%1$s has left group %2$s."),
$member->getBestName(),
$oprofile->getBestName());
$act->time = time();
$act->title = _("Favor");
- $act->content = sprintf(_("%s marked notice %s as a favorite."),
+ // TRANS: Success message for adding a favorite notice through OStatus.
+ // TRANS: %1$s is the favoring user's name, %2$s is URI to the favored notice.
+ $act->content = sprintf(_("%1$s marked notice %2$s as a favorite."),
$profile->getBestName(),
$notice->uri);
common_date_iso8601(time()));
$act->time = time();
$act->title = _("Disfavor");
- $act->content = sprintf(_("%s marked notice %s as no longer a favorite."),
+ // TRANS: Success message for remove a favorite notice through OStatus.
+ // TRANS: %1$s is the unfavoring user's name, %2$s is URI to the no longer favored notice.
+ $act->content = sprintf(_("%1$s marked notice %2$s as no longer a favorite."),
$profile->getBestName(),
$notice->uri);
'class' => 'entity_subscribe'));
$action->element('a', array('href' => common_local_url($target),
'class' => 'entity_remote_subscribe')
- , _m('Remote'));
+ , _m('Remote')); // @todo: i18n: Add translator hint for this text.
$action->elementEnd('p');
$action->elementEnd('div');
}
common_date_iso8601(time()));
$act->time = time();
$act->title = _m("Profile update");
+ // TRANS: Ping text for remote profile update through OStatus.
+ // TRANS: %s is user that updated their profile.
$act->content = sprintf(_m("%s has updated their profile page."),
$profile->getBestName());
array('nickname' => $profileUser->nickname));
$output->element('a', array('href' => $url,
'class' => 'entity_remote_subscribe'),
- _m('Subscribe'));
+ _m('Subscribe')); // @todo: i18n: Add context.
$output->elementEnd('li');
}
}
'homepage' => 'http://status.net/wiki/Plugin:OStatus',
'rawdescription' =>
_m('Follow people across social networks that implement '.
- '<a href="http://ostatus.org/">OStatus</a>.'));
+ '<a href="http://ostatus.org/">OStatus</a>.')); // @todo i18n: Add translator hint.
return true;
}
$this->input('profile',
_m('Join group'),
$this->profile_uri,
- _m("OStatus group's address, like http://example.net/group/nickname"));
+ _m("OStatus group's address, like http://example.net/group/nickname."));
$this->elementEnd('li');
$this->elementEnd('ul');
// Local user or group the remote wants to subscribe to
$this->nickname = $this->trimmed('nickname');
$this->group = $this->trimmed('group');
-
+
// Webfinger or profile URL of the remote user
$this->profile = $this->trimmed('profile');
return true;
}
-
+
function handle($args)
{
parent::handle($args);
$this->showForm();
}
}
-
+
function showForm($err = null)
{
$this->err = $err;
$this->elementStart('ul', 'form_data');
$this->elementStart('li', array('id' => 'ostatus_nickname'));
$this->input('nickname', _m('User nickname'), $this->nickname,
- _m('Nickname of the user you want to follow'));
+ _m('Nickname of the user you want to follow.'));
$this->hidden('group', $this->group); // pass-through for magic links
$this->elementEnd('li');
$this->elementStart('li', array('id' => 'ostatus_profile'));
$this->input('profile', _m('Profile Account'), $this->profile,
- _m('Your account id (i.e. user@identi.ca)'));
+ _m('Your account id (e.g. user@identi.ca).'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->submit('submit', $submit);
function title()
{
- return _m('OStatus Connect');
+ return _m('OStatus Connect');
}
-
+
}
$this->input('profile',
_m('Subscribe to'),
$this->profile_uri,
- _m("OStatus user's address, like nickname@example.com or http://example.net/nickname"));
+ _m("OStatus user's address, like nickname@example.com or http://example.net/nickname")); // @todo i18n FIXME: needs context/translator hint.
$this->elementEnd('li');
$this->elementEnd('ul');
- $this->submit('validate', _m('Continue'));
+ $this->submit('validate', _m('Continue')); // @todo i18n FIXME: needs context/translator hint.
$this->elementEnd('fieldset');
$this->hidden('profile', $this->profile_uri);
if ($this->oprofile->isGroup()) {
$this->submit('submit', _m('Join'), 'submit', null,
- _m('Join this group'));
+ _m('Join this group')); // @todo i18n FIXME: needs context/translator hint.
} else {
$this->submit('submit', _m('Confirm'), 'submit', null,
- _m('Subscribe to this user'));
+ _m('Subscribe to this user')); // @todo i18n FIXME: needs context/translator hint.
}
$this->elementEnd('fieldset');
$this->elementEnd('form');
} else if (Validate::uri($this->profile_uri)) {
$this->oprofile = Ostatus_profile::ensureProfileURL($this->profile_uri);
} else {
- $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname");
+ $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
common_debug('Invalid address format.', __FILE__);
return false;
}
return true;
} catch (FeedSubBadURLException $e) {
- $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname");
+ $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
common_debug('Invalid URL or could not reach server.', __FILE__);
} catch (FeedSubBadResponseException $e) {
$this->error = _m("Sorry, we could not reach that feed. Please try that OStatus address again later.");
common_debug('Not a recognized feed type.', __FILE__);
} catch (Exception $e) {
// Any new ones we forgot about
- $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname");
+ $this->error = _m("Sorry, we could not reach that address. Please make sure that the OStatus address is like nickname@example.com or http://example.net/nickname.");
common_debug(sprintf('Bad feed URL: %s %s', get_class($e), $e->getMessage()), __FILE__);
}
function prepare($args)
{
$this->user = User::siteOwner();
-
+
if (!$this->user) {
$this->clientError(_('No such user.'), 404);
return false;
$nick = common_canonical_nickname($this->user->nickname);
$acct = 'acct:' . $nick . '@' . common_config('site', 'server');
-
+
$this->xrd = new XRD();
// Check to see if a $config['webfinger']['owner'] has been set
$this->handleGet();
}
}
-
+
/**
* Handler for POST content updates from the hub
*/
$feedid = $this->arg('feed');
common_log(LOG_INFO, "POST for feed id $feedid");
if (!$feedid) {
- throw new ServerException('Empty or invalid feed id', 400);
+ throw new ServerException('Empty or invalid feed id.', 400);
}
$feedsub = FeedSub::staticGet('id', $feedid);
if (!$feedsub) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ServerException('Unknown PuSH feed id ' . $feedid, 400);
}
$qm = QueueManager::get();
$qm->enqueue($data, 'pushin');
}
-
+
/**
* Handler for GET verification requests from the hub.
*/
$feedsub = FeedSub::staticGet('uri', $topic);
if (!$feedsub) {
- throw new ClientException("Bad hub.topic feed $topic", 404);
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
+ throw new ClientException("Bad hub.topic feed $topic.", 404);
}
if ($feedsub->verify_token !== $verify_token) {
- throw new ClientException("Bad hub.verify_token $token for $topic", 404);
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
+ throw new ClientException("Bad hub.verify_token $token for $topic.", 404);
}
if ($mode == 'subscribe') {
// We may get re-sub requests legitimately.
if ($feedsub->sub_state != 'subscribe' && $feedsub->sub_state != 'active') {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Unexpected subscribe request for $topic.", 404);
}
} else {
if ($feedsub->sub_state != 'unsubscribe') {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Unexpected unsubscribe request for $topic.", 404);
}
}
*/
-
class PushHubAction extends Action
{
function arg($arg, $def=null)
$this->subunsub($mode);
break;
case "publish":
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Publishing outside feeds not supported.", 400);
default:
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Unrecognized mode '$mode'.", 400);
}
}
$topic = $this->argUrl('hub.topic');
if (!$this->recognizedFeed($topic)) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Unsupported hub.topic $topic; this hub only serves local user and group Atom feeds.");
}
$verify = $this->arg('hub.verify'); // @fixme may be multiple
if ($verify != 'sync' && $verify != 'async') {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid hub.verify $verify; must be sync or async.");
}
$lease = $this->arg('hub.lease_seconds', null);
if ($mode == 'subscribe' && $lease != '' && !preg_match('/^\d+$/', $lease)) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid hub.lease $lease; must be empty or positive integer.");
}
$secret = $this->arg('hub.secret', null);
if ($secret != '' && strlen($secret) >= 200) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid hub.secret $secret; must be under 200 bytes.");
}
if ($feed == $userFeed) {
$user = User::staticGet('id', $id);
if (!$user) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid hub.topic $feed; user doesn't exist.");
} else {
return true;
if ($feed == $groupFeed) {
$user = User_group::staticGet('id', $id);
if (!$user) {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid hub.topic $feed; group doesn't exist.");
} else {
return true;
if (Validate::uri($url, $params)) {
return $url;
} else {
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
throw new ClientException("Invalid URL passed for $arg: '$url'");
}
}
return HubSub::staticGet($feed, $callback);
}
}
-
$this->uri = $this->trimmed('uri');
$this->uri = Discovery::normalize($this->uri);
-
+
if (Discovery::isWebfinger($this->uri)) {
$parts = explode('@', substr(urldecode($this->uri), 5));
if (count($parts) == 2) {
// We'll never actually get updates in this mode.
return true;
} else {
- throw new ServerException("Attempting to start PuSH subscription for feed with no hub");
+ throw new ServerException("Attempting to start PuSH subscription for feed with no hub.");
}
}
// We'll never actually get updates in this mode.
return true;
} else {
- throw new ServerException("Attempting to end PuSH subscription for feed with no hub");
+ throw new ServerException("Attempting to end PuSH subscription for feed with no hub.");
}
}
}
}
-
if ($status >= 200 && $status < 300) {
common_log(LOG_INFO, "Verified $mode of $this->callback:$this->topic");
} else {
+ // @todo i18n FIXME: add i18n and use sprintf for parameter.
throw new ClientException("Hub subscriber verification returned HTTP $status");
}
/**
* Queue up a large batch of pushes to multiple subscribers
* for this same topic update.
- *
+ *
* If queues are disabled, this will run immediately.
- *
+ *
* @param string $atom well-formed Atom feed
* @param array $pushCallbacks list of callback URLs
*/
}
}
}
-
{
const PUBLICKEYREL = 'magic-public-key';
-
+
public $__table = 'magicsig';
public $user_id;
public $keypair;
public $alg;
-
+
public $publicKey;
public $privateKey;
-
+
public function __construct($alg = 'RSA-SHA256')
{
$this->alg = $alg;
}
-
+
public /*static*/ function staticGet($k, $v=null)
{
$obj = parent::staticGet(__CLASS__, $k, $v);
public function generate($user_id)
{
$rsa = new Crypt_RSA();
-
+
$keypair = $rsa->createKey();
$rsa->loadKey($keypair['privatekey']);
$this->publicKey = new Crypt_RSA();
$this->publicKey->loadKey($keypair['publickey']);
-
+
$this->user_id = $user_id;
$this->insert();
}
$private_exp = '.' . Magicsig::base64_url_encode($this->privateKey->exponent->toBytes());
}
- return 'RSA.' . $mod . '.' . $exp . $private_exp;
+ return 'RSA.' . $mod . '.' . $exp . $private_exp;
}
-
+
public static function fromString($text)
{
$magic_sig = new Magicsig();
-
+
// remove whitespace
$text = preg_replace('/\s+/', '', $text);
if (!preg_match('/RSA\.([^\.]+)\.([^\.]+)(.([^\.]+))?/', $text, $matches)) {
return false;
}
-
+
$mod = $matches[1];
$exp = $matches[2];
if (!empty($matches[4])) {
$this->publicKey = $rsa;
}
}
-
+
public function getName()
{
return $this->alg;
}
}
-
+
public function sign($bytes)
{
$sig = $this->privateKey->sign($bytes);
return base64_decode(strtr($input, '-_', '+/'));
}
}
-
-
} else if ($this->group_id && !$this->profile_id) {
return true;
} else if ($this->group_id && $this->profile_id) {
- throw new ServerException("Invalid ostatus_profile state: both group and profile IDs set for $this->uri");
+ // @todo i18n FIXME: use sprintf and add i18n.
+ throw new ServerException("Invalid ostatus_profile state: both group and profile IDs set for $this->uri.");
} else {
- throw new ServerException("Invalid ostatus_profile state: both group and profile IDs empty for $this->uri");
+ // @todo i18n FIXME: use sprintf and add i18n.
+ throw new ServerException("Invalid ostatus_profile state: both group and profile IDs empty for $this->uri.");
}
}
} else if ($entry instanceof Notice) {
return $preamble . $entry->asAtomEntry(true, true);
} else {
- throw new ServerException("Invalid type passed to Ostatus_profile::notify; must be XML string or Activity entry");
+ // @todo i18n FIXME: use sprintf and add i18n.
+ throw new ServerException("Invalid type passed to Ostatus_profile::notify; must be XML string or Activity entry.");
}
}
$sourceContent = $note->title;
} else {
// @fixme fetch from $sourceUrl?
- throw new ClientException("No content for notice {$sourceUri}");
+ // @todo i18n FIXME: use sprintf and add i18n.
+ throw new ClientException("No content for notice {$sourceUri}.");
}
// Get (safe!) HTML and text versions of the content
' class="attachment more"' .
' title="'. htmlspecialchars(_m('Show more')) . '">' .
'…' .
- '</a>';
+ '</a>'; // @todo i18n FIXME: add translator hint/context.
}
}
$response = $client->get($profile_url);
if (!$response->isOk()) {
+ // @todo i18n FIXME: use sprintf and add i18n.
throw new Exception("Could not reach profile page: " . $profile_url);
}
return self::ensureFeedURL($feedurl, $hints);
}
+ // @todo i18n FIXME: use sprintf and add i18n.
throw new Exception("Could not find a feed URL for profile page " . $finalUrl);
}
$user = User::staticGet('id', $profile->id);
if (!empty($user)) {
+ // @todo i18n FIXME: use sprintf and add i18n.
throw new OStatusShadowException($profile, "'$profile_url' is the profile for local user '{$user->nickname}'.");
}
return;
}
if (!common_valid_http_url($url)) {
- throw new ServerException(sprintf(_m("Invalid avatar URL %s"), $url));
+ throw new ServerException(sprintf(_m("Invalid avatar URL %s."), $url));
}
if ($this->isGroup()) {
}
if (!$self) {
throw new ServerException(sprintf(
- _m("Tried to update avatar for unsaved remote profile %s"),
+ _m("Tried to update avatar for unsaved remote profile %s."),
$this->uri));
}
// ripped from oauthstore.php (for old OMB client)
$temp_filename = tempnam(sys_get_temp_dir(), 'listener_avatar');
if (!copy($url, $temp_filename)) {
- throw new ServerException(sprintf(_m("Unable to fetch avatar from %s"), $url));
+ throw new ServerException(sprintf(_m("Unable to fetch avatar from %s."), $url));
}
if ($this->isGroup()) {
if ($object->link && common_valid_http_url($object->link)) {
return $object->link;
}
- throw new ServerException("No author ID URI found");
+ throw new ServerException("No author ID URI found.");
}
/**
$user = User::staticGet('uri', $homeuri);
if ($user) {
+ // @todo i18n FIXME: add i18n.
throw new Exception("Local user can't be referenced as remote.");
}
if (OStatusPlugin::localGroupFromUrl($homeuri)) {
+ // @todo i18n FIXME: add i18n.
throw new Exception("Local group can't be referenced as remote.");
}
$oprofile->profile_id = $profile->insert();
if (!$oprofile->profile_id) {
- throw new ServerException("Can't save local profile");
+ // @todo i18n FIXME: add i18n.
+ throw new ServerException("Can't save local profile.");
}
} else {
$group = new User_group();
$oprofile->group_id = $group->insert();
if (!$oprofile->group_id) {
- throw new ServerException("Can't save local profile");
+ // @todo i18n FIXME: add i18n.
+ throw new ServerException("Can't save local profile.");
}
}
$ok = $oprofile->insert();
if (!$ok) {
- throw new ServerException("Can't save OStatus profile");
+ // @todo i18n FIXME: add i18n.
+ throw new ServerException("Can't save OStatus profile.");
}
$avatar = self::getActivityObjectAvatar($object, $hints);
if ($uri !== false) {
if (is_null($uri)) {
// Negative cache entry
+ // @todo i18n FIXME: add i18n.
throw new Exception('Not a valid webfinger address.');
}
$oprofile = Ostatus_profile::staticGet('uri', $uri);
// Save negative cache entry so we don't waste time looking it up again.
// @fixme distinguish temporary failures?
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), null);
+ // @todo i18n FIXME: add i18n.
throw new Exception('Not a valid webfinger address.');
}
if (!$profile_id) {
common_log_db_error($profile, 'INSERT', __FILE__);
- throw new Exception("Couldn't save profile for '$addr'");
+ // @todo i18n FIXME: add i18n and use sprintf for parameter.
+ throw new Exception("Couldn't save profile for '$addr'.");
}
$oprofile = new Ostatus_profile();
if (!$result) {
common_log_db_error($oprofile, 'INSERT', __FILE__);
- throw new Exception("Couldn't save ostatus_profile for '$addr'");
+ // @todo i18n FIXME: add i18n and use sprintf for parameter.
+ throw new Exception("Couldn't save ostatus_profile for '$addr'.");
}
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri);
return $oprofile;
}
+ // @todo i18n FIXME: add i18n and use sprintf for parameter.
throw new Exception("Couldn't find a valid profile for '$addr'");
}
parent::__construct($message);
}
}
-
}
}
- throw new Exception('Unable to find services for '. $id);
+ // @todo Needs i18n.
+ throw new Exception('Unable to find services for '. $id '.');
}
public static function getService($links, $service) {
} else {
$domain = parse_url($uri, PHP_URL_HOST);
}
-
+
$url = 'http://'. $domain .'/.well-known/host-meta';
$xrd = Discovery::fetchXrd($url);
const ENCODING = 'base64url';
const NS = 'http://salmon-protocol.org/ns/magic-env';
-
+
private function normalizeUser($user_id)
{
if (substr($user_id, 0, 5) == 'http:' ||
$keypair = $parts[1];
}
}
-
+
if ($keypair) {
return $keypair;
}
}
}
- throw new Exception('Unable to locate signer public key');
+ throw new Exception('Unable to locate signer public key.');
}
'sig' => $signature_alg->sign($armored_text),
'alg' => $signature_alg->getName()
);
-
-
+
}
public function toXML($env) {
$xs->element('me:alg', null, $env['alg']);
$xs->element('me:sig', null, $env['sig']);
$xs->elementEnd('me:env');
-
+
$string = $xs->getString();
common_debug($string);
return $string;
}
-
+
public function unfold($env)
{
$dom = new DOMDocument();
return $dom->saveXML();
}
-
+
public function getAuthor($text) {
$doc = new DOMDocument();
if (!$doc->loadXML($text)) {
}
}
}
-
+
public function checkAuthor($text, $signer_uri)
{
return ($this->getAuthor($text) == $signer_uri);
}
-
+
public function verify($env)
{
if ($env['alg'] != 'RSA-SHA256') {
common_log(LOG_DEBUG, "Salmon error: ".$e->getMessage());
return false;
}
-
+
$verifier = Magicsig::fromString($keypair);
if (!$verifier) {
common_log(LOG_DEBUG, "Salmon error: unable to parse keypair");
return false;
}
-
+
return $verifier->verify($env['data'], $env['sig']);
}
const REL_SALMON = 'salmon';
const REL_MENTIONED = 'mentioned';
- // XXX: these are deprecated
+ // XXX: these are deprecated
const NS_REPLIES = "http://salmon-protocol.org/ns/salmon-replies";
const NS_MENTIONS = "http://salmon-protocol.org/ns/salmon-mention";
-
+
/**
* Sign and post the given Atom entry as a Salmon message.
*
// No keypair yet, let's generate one.
$magickey = new Magicsig();
$magickey->generate($user->id);
- }
+ }
} else {
- throw new Exception("Salmon invalid actor for signing");
+ // @todo i18n FIXME: added i18n and use sprintf when using parameters.
+ throw new Exception("Salmon invalid actor for signing.");
}
try {
public function verifyMagicEnv($text)
{
$magic_env = new MagicEnvelope();
-
+
$env = $magic_env->parse($text);
return $magic_env->verify($env);
}
if (empty($_SERVER['CONTENT_TYPE']) || $_SERVER['CONTENT_TYPE'] != 'application/magic-envelope+xml') {
- $this->clientError(_m('Salmon requires application/magic-envelope+xml'));
+ $this->clientError(_m('Salmon requires "application/magic-envelope+xml".'));
}
$xml = file_get_contents('php://input');
assert(is_string($data['entry']));
$actor = Profile::staticGet($data['actor']);
-
+
$salmon = new Salmon();
$salmon->post($data['salmonuri'], $data['entry'], $actor);
class XRD
{
const XML_NS = 'http://www.w3.org/2000/xmlns/';
-
+
const XRD_NS = 'http://docs.oasis-open.org/ns/xri/xrd-1.0';
const HOST_META_NS = 'http://host-meta.net/xrd/1.0';
-
+
public $expires;
public $subject;
public $host;
public $alias = array();
-
+
public $types = array();
-
+
public $links = array();
-
+
public static function parse($xml)
{
$xrd = new XRD();
error_reporting($old);
if (!$ok) {
- throw new Exception("Invalid XML");
+ throw new Exception("Invalid XML.");
}
$xrd_element = $dom->getElementsByTagName('XRD')->item(0);
if (!$xrd_element) {
- throw new Exception("Invalid XML, missing XRD root");
+ throw new Exception("Invalid XML, missing XRD root.");
}
// Check for host-meta host
case 'Subject':
$xrd->subject = $node->nodeValue;
break;
-
+
case 'Alias':
$xrd->alias[] = $node->nodeValue;
break;
if ($this->host) {
$xs->element('hm:Host', array('xmlns:hm' => XRD::HOST_META_NS), $this->host);
}
-
+
if ($this->expires) {
$xs->element('Expires', null, $this->expires);
}
}
$xs->elementEnd('Link');
}
-
+
$xs->elementEnd('XRD');
return $xs->getString();
{
return array();
}
-
+
function parseLink($element)
{
$link = array();
return $link;
}
}
-
class XrdAction extends Action
{
-
public $uri;
-
+
public $user;
public $xrd;
-
+
function handle()
{
$nick = $this->user->nickname;
echo "$uri matched query, but we don't recognize it.\n";
continue;
}
-
+
if ($dry) {
echo " - skipping\n";
} else {
} else {
echo "done.\n";
}
-
}
Event::handle('StartFeedSubReceive', array($sub, $feed));
-
$nickname = get_option_value('n', 'nickname');
$user = User::staticGet('nickname', $nickname);
if (empty($user)) {
- throw new Exception("Can't find user with nickname '$nickname'");
+ throw new Exception("Can't find user with nickname '$nickname'.");
}
updateOStatus($user);
} else if (have_option('a', 'all')) {
</style>
<link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://leuksman.com/log/xmlrpc.php?rsd" />
-<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://leuksman.com/log/wp-includes/wlwmanifest.xml" />
+<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://leuksman.com/log/wp-includes/wlwmanifest.xml" />
<link rel='index' title='leĊksman' href='http://leuksman.com/log' />
<meta name="generator" content="WordPress 2.8.6" />
</head>
$me = $this->getProfileUri();
return $this->checkSubscription($profile_uri, $me);
}
-
+
protected function checkSubscription($subscriber, $subscribed)
{
// Using FOAF as the API methods for checking the social graph
$tester = new OStatusTester($a, $b);
$tester->run();
-