public $created;
public $modified;
- public /*static*/ function staticGet($k, $v=null)
- {
- return parent::staticGet(__CLASS__, $k, $v);
- }
-
/**
* Return table definition for Schema setup and DB_DataObject usage.
*
public function localProfile()
{
if ($this->profile_id) {
- return Profile::staticGet('id', $this->profile_id);
+ return Profile::getKV('id', $this->profile_id);
}
return null;
}
public function localGroup()
{
if ($this->group_id) {
- return User_group::staticGet('id', $this->group_id);
+ return User_group::getKV('id', $this->group_id);
}
return null;
}
public function localPeopletag()
{
if ($this->peopletag_id) {
- return Profile_list::staticGet('id', $this->peopletag_id);
+ return Profile_list::getKV('id', $this->peopletag_id);
}
return null;
}
*/
public function garbageCollect()
{
- $feedsub = FeedSub::staticGet('uri', $this->feeduri);
+ $feedsub = FeedSub::getKV('uri', $this->feeduri);
return $feedsub->garbageCollect();
}
$sourceUri = $activity->id;
- $dupe = Notice::staticGet('uri', $sourceUri);
+ $dupe = Notice::getKV('uri', $sourceUri);
if ($dupe) {
common_log(LOG_INFO, "OStatus: ignoring duplicate post: $sourceUri");
return $dupe;
// Maintain direct reply associations
// @todo FIXME: What about conversation ID?
if (!empty($activity->context->replyToID)) {
- $orig = Notice::staticGet('uri',
+ $orig = Notice::getKV('uri',
$activity->context->replyToID);
if (!empty($orig)) {
$options['reply_to'] = $orig->id;
// protecting against duplicate saves. It isn't required to be a URL;
// tag: URIs for instance are found in Google Buzz feeds.
$sourceUri = $note->id;
- $dupe = Notice::staticGet('uri', $sourceUri);
+ $dupe = Notice::getKV('uri', $sourceUri);
if ($dupe) {
common_log(LOG_INFO, "OStatus: ignoring duplicate post: $sourceUri");
return $dupe;
// Maintain direct reply associations
// @todo FIXME: What about conversation ID?
if (!empty($activity->context->replyToID)) {
- $orig = Notice::staticGet('uri',
+ $orig = Notice::getKV('uri',
$activity->context->replyToID);
if (!empty($orig)) {
$options['reply_to'] = $orig->id;
$replies = array();
foreach (array_unique($attention_uris) as $recipient) {
// Is the recipient a local user?
- $user = User::staticGet('uri', $recipient);
+ $user = User::getKV('uri', $recipient);
if ($user) {
// @todo FIXME: Sender verification, spam etc?
$replies[] = $recipient;
}
// Is the recipient a local group?
- // $group = User_group::staticGet('uri', $recipient);
+ // $group = User_group::getKV('uri', $recipient);
$id = OStatusPlugin::localGroupFromUrl($recipient);
if ($id) {
- $group = User_group::staticGet('id', $id);
+ $group = User_group::getKV('id', $id);
if ($group) {
// Deliver to all members of this local group if allowed.
$profile = $sender->localProfile();
// Check if they've got an LRDD header
- $lrdd = LinkHeader::getLink($response, 'lrdd', 'application/xrd+xml');
-
- if (!empty($lrdd)) {
-
- $xrd = Discovery::fetchXrd($lrdd);
+ $lrdd = LinkHeader::getLink($response, 'lrdd');
+ try {
+ $xrd = new XML_XRD();
+ $xrd->loadFile($lrdd);
$xrdHints = DiscoveryHints::fromXRD($xrd);
-
$hints = array_merge($hints, $xrdHints);
+ } catch (Exception $e) {
+ // No hints available from XRD
}
// If discovery found a feedurl (probably from LRDD), use it.
*/
static function getFromProfileURL($profile_url)
{
- $profile = Profile::staticGet('profileurl', $profile_url);
+ $profile = Profile::getKV('profileurl', $profile_url);
if (empty($profile)) {
return null;
// Is it a known Ostatus profile?
- $oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $profile->id);
if (!empty($oprofile)) {
return $oprofile;
// Is it a local user?
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if (!empty($user)) {
// @todo i18n FIXME: use sprintf and add i18n (?)
// http://status.net/open-source/issues/2663
chmod(Avatar::path($filename), 0644);
- $profile = $this->localProfile();
-
- if (!empty($profile)) {
- $profile->setOriginal($filename);
- }
+ $self->setOriginal($filename);
$orig = clone($this);
$this->avatar = $url;
}
if ($url) {
$opts = array('allowed_schemes' => array('http', 'https'));
- if (Validate::uri($url, $opts)) {
+ if (common_valid_http_url($url)) {
return $url;
}
}
protected static function getActivityObjectProfile($object)
{
$uri = self::getActivityObjectProfileURI($object);
- return Ostatus_profile::staticGet('uri', $uri);
+ return Ostatus_profile::getKV('uri', $uri);
}
/**
throw new Exception(_m('No profile URI.'));
}
- $user = User::staticGet('uri', $homeuri);
+ $user = User::getKV('uri', $homeuri);
if ($user) {
// TRANS: Exception.
throw new Exception(_m('Local user cannot be referenced as remote.'));
throw new Exception(_m('Local group cannot be referenced as remote.'));
}
- $ptag = Profile_list::staticGet('uri', $homeuri);
+ $ptag = Profile_list::getKV('uri', $homeuri);
if ($ptag) {
- $local_user = User::staticGet('id', $ptag->tagger);
+ $local_user = User::getKV('id', $ptag->tagger);
if (!empty($local_user)) {
// TRANS: Exception.
throw new Exception(_m('Local list cannot be referenced as remote.'));
$profile->profileurl = $object->link;
} else if (array_key_exists('profileurl', $hints)) {
$profile->profileurl = $hints['profileurl'];
- } else if (Validate::uri($object->id, array('allowed_schemes' => array('http', 'https')))) {
+ } else if (common_valid_http_url($object->id)) {
$profile->profileurl = $object->id;
}
// TRANS: Exception.
throw new Exception(_m('Not a valid webfinger address.'));
}
- $oprofile = Ostatus_profile::staticGet('uri', $uri);
+ $oprofile = Ostatus_profile::getKV('uri', $uri);
if (!empty($oprofile)) {
return $oprofile;
}
}
// Try looking it up
- $oprofile = Ostatus_profile::staticGet('uri', 'acct:'.$addr);
+ $oprofile = Ostatus_profile::getKV('uri', 'acct:'.$addr);
if (!empty($oprofile)) {
self::cacheSet(sprintf('ostatus_profile:webfinger:%s', $addr), $oprofile->uri);
// First, try to query it
- $oprofile = Ostatus_profile::staticGet('uri', $uri);
+ $oprofile = Ostatus_profile::getKV('uri', $uri);
// If unfound, do discovery stuff