I used this hacky sed-command (run it from your GNU Social root, or change the first grep's path to where it actually lies) to do a rough fix on all ::staticGet calls and rename them to ::getKV
sed -i -s -e '/DataObject::staticGet/I!s/::staticGet/::getKV/Ig' $(grep -R ::staticGet `pwd`/* | grep -v -e '^extlib' | grep -v DataObject:: |grep -v "function staticGet"|cut -d: -f1 |sort |uniq)
If you're applying this, remember to change the Managed_DataObject and Memcached_DataObject function definitions of staticGet to getKV!
This might of course take some getting used to, or modification fo StatusNet plugins, but the result is that all the static calls (to staticGet) are now properly made without breaking PHP Strict Standards. Standards are there to be followed (and they caused some very bad confusion when used with get_called_class)
Reasonably any plugin or code that tests for the definition of 'GNUSOCIAL' or similar will take this change into consideration.
$tagged_id = $this->arg('tagged');
- $this->tagged = Profile::staticGet('id', $tagged_id);
+ $this->tagged = Profile::getKV('id', $tagged_id);
if (empty($this->tagged)) {
// TRANS: Client error displayed trying to perform an action related to a non-existing profile.
}
$id = $this->arg('peopletag_id');
- $this->peopletag = Profile_list::staticGet('id', $id);
+ $this->peopletag = Profile_list::getKV('id', $id);
if (empty($this->peopletag)) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->peopletag->tag);
if (!$ptag) {
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if ($user) {
$this->clientError(
// TRANS: Client error displayed when an unknown error occurs when adding a user to a list.
{
parent::prepare($args);
$nickname = $this->trimmed('nickname');
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error when user not found for an rss related action.
throw new ClientException(_('No conversation ID.'));
}
- $this->conversation = Conversation::staticGet('id', $convId);
+ $this->conversation = Conversation::getKV('id', $convId);
if (empty($this->conversation)) {
// TRANS: Client exception thrown when referring to a non-existing conversation ID (%d).
parent::prepare($args);
$this->user = $this->auth_user;
- $this->notice = Notice::staticGet($this->arg('id'));
+ $this->notice = Notice::getKV($this->arg('id'));
if ($this->notice->repeat_of != '' ) {
common_log(LOG_DEBUG, 'Trying to Fave '.$this->notice->id.', repeat of '.$this->notice->repeat_of);
common_log(LOG_DEBUG, 'Will Fave '.$this->notice->repeat_of.' instead');
$real_notice_id = $this->notice->repeat_of;
- $this->notice = Notice::staticGet($real_notice_id);
+ $this->notice = Notice::getKV($real_notice_id);
}
return true;
*/
function notify($fave, $notice, $user)
{
- $other = User::staticGet('id', $notice->profile_id);
+ $other = User::getKV('id', $notice->profile_id);
if ($other && $other->id != $user->id) {
if ($other->email && $other->emailnotifyfav) {
mail_notify_fave($other, $user, $notice);
parent::prepare($args);
$this->user = $this->auth_user;
- $this->notice = Notice::staticGet($this->arg('id'));
+ $this->notice = Notice::getKV($this->arg('id'));
if ($this->notice->repeat_of != '' ) {
common_log(LOG_DEBUG, 'Trying to unFave '.$this->notice->id);
common_log(LOG_DEBUG, 'Will unFave '.$this->notice->repeat_of.' instead');
$real_notice_id = $this->notice->repeat_of;
- $this->notice = Notice::staticGet($real_notice_id);
+ $this->notice = Notice::getKV($real_notice_id);
}
return true;
$target_screen_name = $this->trimmed('target_screen_name');
if (!empty($source_id)) {
- $this->source = User::staticGet($source_id);
+ $this->source = User::getKV($source_id);
} elseif (!empty($source_screen_name)) {
- $this->source = User::staticGet('nickname', $source_screen_name);
+ $this->source = User::getKV('nickname', $source_screen_name);
} else {
$this->source = $this->auth_user;
}
if (!empty($target_id)) {
- $this->target = User::staticGet($target_id);
+ $this->target = User::getKV($target_id);
} elseif (!empty($target_screen_name)) {
- $this->target = User::staticGet('nickname', $target_screen_name);
+ $this->target = User::getKV('nickname', $target_screen_name);
}
return true;
*/
function groupNicknameExists($nickname)
{
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (!empty($local)) {
return true;
}
- $alias = Group_alias::staticGet('alias', $nickname);
+ $alias = Group_alias::getKV('alias', $nickname);
if (!empty($alias)) {
return true;
if (!empty($this->nickname) && ($this->nickname != $orig->nickname)) {
common_log(LOG_INFO, "Saving local group info.");
- $local = Local_group::staticGet('group_id', $this->group->id);
+ $local = Local_group::getKV('group_id', $this->group->id);
$local->setNickname($this->nickname);
}
function nicknameExists($nickname)
{
- $group = Local_group::staticGet('nickname', $nickname);
+ $group = Local_group::getKV('nickname', $nickname);
if (!empty($group) &&
$group->group_id != $this->group->id) {
return true;
}
- $alias = Group_alias::staticGet('alias', $nickname);
+ $alias = Group_alias::getKV('alias', $nickname);
if (!empty($alias) &&
$alias->group_id != $this->group->id) {
$this->group = $this->getTargetGroup($this->arg('id'));
if (empty($this->group)) {
- $alias = Group_alias::staticGet(
+ $alias = Group_alias::getKV(
'alias',
common_canonical_nickname($this->arg('id'))
);
$stream = new TagNoticeStream(substr($q, 1), $this->auth_profile);
} else if ($this->isAnURL($q)) {
$canon = File_redirection::_canonUrl($q);
- $file = File::staticGet('url', $canon);
+ $file = File::getKV('url', $canon);
if (!empty($file)) {
$stream = new FileNoticeStream($file, $this->auth_profile);
}
$this->notice_id = (int)$this->arg('id');
}
- $this->notice = Notice::staticGet((int)$this->notice_id);
+ $this->notice = Notice::getKV((int)$this->notice_id);
return true;
}
$id = $this->trimmed('id');
- $this->original = Notice::staticGet('id', $id);
+ $this->original = Notice::getKV('id', $id);
if (empty($this->original)) {
// TRANS: Client error displayed trying to repeat a non-existing notice through the API.
$id = $this->trimmed('id');
- $this->original = Notice::staticGet('id', $id);
+ $this->original = Notice::getKV('id', $id);
if (empty($this->original)) {
// TRANS: Client error displayed trying to display redents of a non-exiting notice.
$this->notice_id = (int)$this->arg('id');
}
- $this->notice = Notice::staticGet((int)$this->notice_id);
+ $this->notice = Notice::getKV((int)$this->notice_id);
return true;
}
// XXX: Twitter just sets a 404 header and doens't bother
// to return an err msg
- $deleted = Deleted_notice::staticGet($this->notice_id);
+ $deleted = Deleted_notice::getKV($this->notice_id);
if (!empty($deleted)) {
$this->clientError(
if (!empty($this->in_reply_to_status_id)) {
// Check whether notice actually exists
- $reply = Notice::staticGet($this->in_reply_to_status_id);
+ $reply = Notice::getKV($this->in_reply_to_status_id);
if ($reply) {
$reply_to = $this->in_reply_to_status_id;
common_debug("Note ID is {$note->id}");
if (!empty($note->id)) {
- $notice = Notice::staticGet('uri', trim($note->id));
+ $notice = Notice::getKV('uri', trim($note->id));
if (!empty($notice)) {
// TRANS: Client error displayed when using another format than AtomPub.
if (!empty($profile)) {
$options['replies'][] = $uri;
} else {
- $group = User_group::staticGet('uri', $uri);
+ $group = User_group::getKV('uri', $uri);
if (!empty($group)) {
$options['groups'][] = $group->id;
} else {
// @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;
function prepare($args)
{
parent::prepare($args);
- $this->user = User::staticGet('nickname', $this->arg('screen_name'));
+ $this->user = User::getKV('nickname', $this->arg('screen_name'));
$this->size = $this->arg('size');
return true;
// XXX: email field deprecated in Twitter's API
if (!empty($email)) {
- $this->user = User::staticGet('email', $email);
+ $this->user = User::getKV('email', $email);
} else {
$this->user = $this->getTargetUser($this->arg('id'));
}
$nickname_arg = $this->trimmed('nickname');
$id = intval($this->arg('id'));
if ($id) {
- $this->group = User_group::staticGet('id', $id);
+ $this->group = User_group::getKV('id', $id);
} else if ($nickname_arg) {
$nickname = common_canonical_nickname($nickname_arg);
return false;
}
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (!$local) {
// TRANS: Client error displayed when trying to leave a non-local group.
return false;
}
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
} else {
// TRANS: Client error displayed when trying to leave a group without providing a group name or group ID.
$this->clientError(_('No nickname or ID.'), 404);
}
if ($this->arg('profile_id')) {
if ($cur->isAdmin($this->group)) {
- $this->profile = Profile::staticGet('id', $this->arg('profile_id'));
+ $this->profile = Profile::getKV('id', $this->arg('profile_id'));
} else {
// TRANS: Client error displayed trying to approve group membership while not a group administrator.
$this->clientError(_('Only group admin can approve or cancel join requests.'), 403);
return false;
}
if ($this->arg('profile_id')) {
- $this->profile = Profile::staticGet('id', $this->arg('profile_id'));
+ $this->profile = Profile::getKV('id', $this->arg('profile_id'));
} else {
// TRANS: Client error displayed trying to approve subscriptionswithout specifying a profile to approve.
$this->clientError(_('Must specify a profile.'));
{
parent::prepare($argarray);
- $this->_profile = Profile::staticGet('id', $this->trimmed('profile'));
+ $this->_profile = Profile::getKV('id', $this->trimmed('profile'));
if (empty($this->_profile)) {
// TRANS: Client exception thrown when requesting a favorite feed for a non-existing profile.
return;
}
- $notice = Notice::staticGet('uri', $note->id);
+ $notice = Notice::getKV('uri', $note->id);
if (empty($notice)) {
// XXX: import from listed URL or something
*/
function notify($fave, $notice, $user)
{
- $other = User::staticGet('id', $notice->profile_id);
+ $other = User::getKV('id', $notice->profile_id);
if ($other && $other->id != $user->id) {
if ($other->email && $other->emailnotifyfav) {
mail_notify_fave($other, $user, $notice);
$profileId = $this->trimmed('profile');
- $this->_profile = Profile::staticGet('id', $profileId);
+ $this->_profile = Profile::getKV('id', $profileId);
if (empty($this->_profile)) {
// TRANS: Client exception.
return;
}
- $group = User_group::staticGet('uri', $groupObj->id);
+ $group = User_group::getKV('uri', $groupObj->id);
if (empty($group)) {
// XXX: import from listed URL or something
$profileId = $this->trimmed('profile');
$noticeId = $this->trimmed('notice');
- $this->_profile = Profile::staticGet('id', $profileId);
+ $this->_profile = Profile::getKV('id', $profileId);
if (empty($this->_profile)) {
// TRANS: Client exception.
throw new ClientException(_('No such profile.'), 404);
}
- $this->_notice = Notice::staticGet('id', $noticeId);
+ $this->_notice = Notice::getKV('id', $noticeId);
if (empty($this->_notice)) {
// TRANS: Client exception thrown when referencing a non-existing notice.
$profileId = $this->trimmed('profile');
- $this->_profile = Profile::staticGet('id', $profileId);
+ $this->_profile = Profile::getKV('id', $profileId);
if (empty($this->_profile)) {
// TRANS: Client exception.
$groupId = $this->trimmed('group');
- $this->_group = User_group::staticGet('id', $groupId);
+ $this->_group = User_group::getKV('id', $groupId);
if (empty($this->_group)) {
// TRANS: Client exception thrown when referencing a non-existing group.
parent::prepare($argarray);
$subscriberId = $this->trimmed('subscriber');
- $this->_subscriber = Profile::staticGet('id', $subscriberId);
+ $this->_subscriber = Profile::getKV('id', $subscriberId);
if (empty($this->_subscriber)) {
// TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID.
$subscribedId = $this->trimmed('subscribed');
- $this->_subscribed = Profile::staticGet('id', $subscribedId);
+ $this->_subscribed = Profile::getKV('id', $subscribedId);
if (empty($this->_subscribed)) {
// TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID.
$subscriber = $this->trimmed('subscriber');
- $this->_profile = Profile::staticGet('id', $subscriber);
+ $this->_profile = Profile::getKV('id', $subscriber);
if (empty($this->_profile)) {
// TRANS: Client exception thrown when trying to display a subscription for a non-existing profile ID.
parent::prepare($args);
if ($id = $this->trimmed('attachment')) {
- $this->attachment = File::staticGet($id);
+ $this->attachment = File::getKV($id);
}
if (empty($this->attachment)) {
*/
function showCore()
{
- $file_thumbnail = File_thumbnail::staticGet('file_id', $this->attachment->id);
+ $file_thumbnail = File_thumbnail::getKV('file_id', $this->attachment->id);
if (empty($file_thumbnail->url)) {
return;
}
return;
}
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (!$user) {
// TRANS: Client error displayed trying to get an avatar for a non-existing user.
$this->clientError(_('No such user.'));
return false;
}
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (!$local) {
// TRANS: Client error displayed when requesting a list of blocked users for a non-local group.
return false;
}
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
if (!$this->group) {
// TRANS: Client error displayed when requesting a list of blocked users for a non-existing group.
$nickname_arg = $this->trimmed('nickname');
$id = intval($this->arg('id'));
if ($id) {
- $this->group = User_group::staticGet('id', $id);
+ $this->group = User_group::getKV('id', $id);
} else if ($nickname_arg) {
$nickname = common_canonical_nickname($nickname_arg);
return false;
}
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (!$local) {
// TRANS: Client error displayed when trying to leave a non-local group.
return false;
}
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
} else {
// TRANS: Client error displayed when trying to leave a group without providing a group name or group ID.
$this->clientError(_('No nickname or ID.'), 404);
}
if ($this->arg('profile_id')) {
if ($cur->isAdmin($this->group)) {
- $this->profile = Profile::staticGet('id', $this->arg('profile_id'));
+ $this->profile = Profile::getKV('id', $this->arg('profile_id'));
} else {
// TRANS: Client error displayed when trying to approve or cancel a group join request without
// TRANS: being a group administrator.
return;
}
- $other = Profile::staticGet('id', $other_id);
+ $other = Profile::getKV('id', $other_id);
if (!$other) {
// TRANS: Client error displayed when trying to leave a non-existing group.
$this->clientError(_('No confirmation code.'));
return;
}
- $confirm = Confirm_address::staticGet('code', $code);
+ $confirm = Confirm_address::getKV('code', $code);
if (!$confirm) {
// TRANS: Client error displayed when providing a non-existing confirmation code in the contact address confirmation action.
$this->clientError(_('Confirmation code not found.'));
if ($type == 'sms') {
$cur->carrier = ($confirm->address_extra)+0;
- $carrier = Sms_carrier::staticGet($cur->carrier);
+ $carrier = Sms_carrier::getKV($cur->carrier);
$cur->smsemail = $carrier->toEmailAddress($cur->sms);
}
}
$id = (int)$this->arg('id');
- $this->app = Oauth_application::staticGet('id', $id);
+ $this->app = Oauth_application::getKV('id', $id);
if (empty($this->app)) {
// TRANS: Client error displayed trying to delete an application that does not exist.
$nickname_arg = $this->trimmed('nickname');
$id = intval($this->arg('id'));
if ($id) {
- $this->group = User_group::staticGet('id', $id);
+ $this->group = User_group::getKV('id', $id);
} else if ($nickname_arg) {
$nickname = common_canonical_nickname($nickname_arg);
return false;
}
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (!$local) {
// TRANS: Client error when trying to delete a non-local group.
return false;
}
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
} else {
// TRANS: Client error when trying to delete a group without providing a nickname or ID for the group.
$this->clientError(_('No nickname or ID.'), 404);
}
$notice_id = $this->trimmed('notice');
- $this->notice = Notice::staticGet($notice_id);
+ $this->notice = Notice::getKV($notice_id);
if (!$this->notice) {
// TRANS: Error message displayed trying to delete a non-existing notice.
return false;
}
- $this->user = User::staticGet('id', $this->profile->id);
+ $this->user = User::getKV('id', $this->profile->id);
if (empty($this->user)) {
// TRANS: Client error displayed when trying to delete a non-local user.
return;
}
$id = $this->trimmed('notice');
- $notice = Notice::staticGet($id);
+ $notice = Notice::getKV($id);
$token = $this->trimmed('token-'.$notice->id);
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
$id = (int)$this->arg('id');
- $this->app = Oauth_application::staticGet($id);
- $this->owner = User::staticGet($this->app->owner);
+ $this->app = Oauth_application::getKV($id);
+ $this->owner = User::getKV($this->app->owner);
$cur = common_current_user();
if ($cur->id != $this->owner->id) {
*/
function nameExists($name)
{
- $newapp = Oauth_application::staticGet('name', $name);
+ $newapp = Oauth_application::getKV('name', $name);
if (empty($newapp)) {
return false;
} else {
$groupid = $this->trimmed('groupid');
if ($groupid) {
- $this->group = User_group::staticGet('id', $groupid);
+ $this->group = User_group::getKV('id', $groupid);
} else {
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if ($local) {
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
}
}
if ($nickname != $orig->nickname) {
common_log(LOG_INFO, "Saving local group info.");
- $local = Local_group::staticGet('group_id', $this->group->id);
+ $local = Local_group::getKV('group_id', $this->group->id);
$local->setNickname($nickname);
}
function nicknameExists($nickname)
{
- $group = Local_group::staticGet('nickname', $nickname);
+ $group = Local_group::getKV('nickname', $nickname);
if (!empty($group) &&
$group->group_id != $this->group->id) {
return true;
}
- $alias = Group_alias::staticGet('alias', $nickname);
+ $alias = Group_alias::getKV('alias', $nickname);
if (!empty($alias) &&
$alias->group_id != $this->group->id) {
$user = null;
if ($id) {
- $this->peopletag = Profile_list::staticGet('id', $id);
+ $this->peopletag = Profile_list::getKV('id', $id);
if (!empty($this->peopletag)) {
- $user = User::staticGet('id', $this->peopletag->tagger);
+ $user = User::getKV('id', $this->peopletag->tagger);
}
} else {
if (!$tagger) {
return false;
}
- $user = User::staticGet('nickname', $tagger);
+ $user = User::getKV('nickname', $tagger);
$this->peopletag = Profile_list::pkeyGet(array('tagger' => $user->id, 'tag' => $tag));
}
{
$user = common_current_user();
- $other = User::staticGet('email', $email);
+ $other = User::getKV('email', $email);
if (!$other) {
return false;
return;
}
$id = $this->trimmed('notice');
- $notice = Notice::staticGet($id);
+ $notice = Notice::getKV($id);
$token = $this->trimmed('token-'.$notice->id);
if (!$token || $token != common_session_token()) {
// TRANS: Client error displayed when the session token does not match or is not given.
*/
function notify($notice, $user)
{
- $other = User::staticGet('id', $notice->profile_id);
+ $other = User::getKV('id', $notice->profile_id);
if ($other && $other->id != $user->id) {
if ($other->email && $other->emailnotifyfav) {
mail_notify_fave($other, $user, $notice);
parent::prepare($args);
$nickname = $this->trimmed('nickname');
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when trying to get the RSS feed with favorites of a user that does not exist.
// TRANS: Client error displayed when no notice ID was given trying do display a file.
$this->clientError(_('No notice ID.'));
}
- $notice = Notice::staticGet('id', $this->id);
+ $notice = Notice::getKV('id', $this->id);
if (empty($notice)) {
// TRANS: Client error displayed when an invalid notice ID was given trying do display a file.
$this->clientError(_('No notice.'));
return false;
}
- $this->user = User::staticGet('nickname', $this->nickname);
+ $this->user = User::getKV('nickname', $this->nickname);
if (!$this->user) {
// TRANS: Client error displayed when requesting Friends of a Friend feed for an object that is not a user.
if ($sub->find()) {
while ($sub->fetch()) {
- $profile = Profile::staticGet('id', $sub->subscriber);
+ $profile = Profile::getKV('id', $sub->subscriber);
if (empty($profile)) {
common_debug('Got a bad subscription: '.print_r($sub,true));
continue;
if ($local == 'local') {
$foaf_url = common_local_url('foaf', array('nickname' => $nickname));
}
- $profile = Profile::staticGet($id);
+ $profile = Profile::getKV($id);
$this->elementStart('Agent', array('rdf:about' => $uri));
if ($type == BOTH) {
$this->element('knows', array('rdf:resource' => $this->user->uri));
if ($sub->find()) {
while ($sub->fetch()) {
- $profile = Profile::staticGet('id', $sub->subscribed);
+ $profile = Profile::getKV('id', $sub->subscribed);
if (empty($profile)) {
common_debug('Got a bad subscription: '.print_r($sub,true));
continue;
return false;
}
- $local = Local_group::staticGet('nickname', $this->nickname);
+ $local = Local_group::getKV('nickname', $this->nickname);
if (!$local) {
// TRANS: Client error displayed when requesting Friends of a Friend feed for a non-local group.
return false;
}
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
if (!$this->group) {
// TRANS: Client error displayed when requesting Friends of a Friend feed for a nickname that is not a group.
$this->clientError(_('No profile specified.'));
return false;
}
- $this->profile = Profile::staticGet('id', $id);
+ $this->profile = Profile::getKV('id', $id);
if (empty($this->profile)) {
// TRANS: Client error displayed trying to block a user from a group while specifying a non-existing profile.
$this->clientError(_('No profile with that ID.'));
$this->clientError(_('No group specified.'));
return false;
}
- $this->group = User_group::staticGet('id', $group_id);
+ $this->group = User_group::getKV('id', $group_id);
if (empty($this->group)) {
// TRANS: Client error displayed trying to block a user from a group while specifying a non-existing group.
$this->clientError(_('No such group.'));
common_debug("Got ID $id");
- $this->group = User_group::staticGet('id', $id);
+ $this->group = User_group::getKV('id', $id);
if (!$this->group) {
// TRANS: Client error displayed referring to a group's permalink for a non-existing group ID.
$groupid = $this->trimmed('groupid');
if ($groupid) {
- $this->group = User_group::staticGet('id', $groupid);
+ $this->group = User_group::getKV('id', $groupid);
} else {
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if ($local) {
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
}
}
return false;
}
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (!$local) {
// TRANS: Client error displayed when trying to view group members for a non-existing group.
return false;
}
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
if (!$this->group) {
// TRANS: Client error displayed when trying to view group members for an object that is not a group.
return false;
}
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (!$local) {
// TRANS: Client error displayed when requesting a group RSS feed for group that does not exist.
return false;
}
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
if (!$this->group) {
// TRANS: Client error displayed when requesting a group RSS feed for an object that is not a group.
$this->clientError(_('No profile specified.'));
return false;
}
- $this->profile = Profile::staticGet('id', $id);
+ $this->profile = Profile::getKV('id', $id);
if (empty($this->profile)) {
// TRANS: Client error displayed when trying to unblock a user from a group without providing an existing profile.
$this->clientError(_('No profile with that ID.'));
$this->clientError(_('No group specified.'));
return false;
}
- $this->group = User_group::staticGet('id', $group_id);
+ $this->group = User_group::getKV('id', $group_id);
if (empty($this->group)) {
// TRANS: Client error displayed when trying to unblock a user from a non-existing group.
$this->clientError(_('No such group.'));
foreach ($addresses as $email) {
$email = common_canonical_email($email);
- $other = User::staticGet('email', $email);
+ $other = User::getKV('email', $email);
if ($other) {
if ($user->isSubscribed($other)) {
$this->already[] = $other;
$nickname_arg = $this->trimmed('nickname');
$id = intval($this->arg('id'));
if ($id) {
- $this->group = User_group::staticGet('id', $id);
+ $this->group = User_group::getKV('id', $id);
} else if ($nickname_arg) {
$nickname = common_canonical_nickname($nickname_arg);
return false;
}
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (!$local) {
// TRANS: Client error displayed when trying to join a non-local group.
return false;
}
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
} else {
// TRANS: Client error displayed when trying to join a group without providing a group name or group ID.
$this->clientError(_('No nickname or ID.'), 404);
$nickname_arg = $this->trimmed('nickname');
$id = intval($this->arg('id'));
if ($id) {
- $this->group = User_group::staticGet('id', $id);
+ $this->group = User_group::getKV('id', $id);
} else if ($nickname_arg) {
$nickname = common_canonical_nickname($nickname_arg);
return false;
}
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (!$local) {
// TRANS: Client error displayed when trying to leave a non-local group.
return false;
}
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
} else {
// TRANS: Client error displayed when trying to leave a group without providing a group name or group ID.
$this->clientError(_('No nickname or ID.'), 404);
$this->clientError(_('No profile specified.'));
return false;
}
- $this->profile = Profile::staticGet('id', $id);
+ $this->profile = Profile::getKV('id', $id);
if (empty($this->profile)) {
// TRANS: Client error displayed when specifying an invalid profile ID on the Make Admin page.
$this->clientError(_('No profile with that ID.'));
$this->clientError(_('No group specified.'));
return false;
}
- $this->group = User_group::staticGet('id', $group_id);
+ $this->group = User_group::getKV('id', $group_id);
if (empty($this->group)) {
// TRANS: Client error displayed when providing an invalid group ID on the Make Admin page.
$this->clientError(_('No such group.'));
parent::handle($args);
$nickname = common_canonical_nickname($this->arg('nickname'));
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (!$user) {
// TRANS: Client error displayed trying to make a micro summary without providing a valid user.
*/
function nameExists($name)
{
- $app = Oauth_application::staticGet('name', $name);
+ $app = Oauth_application::getKV('name', $name);
return !empty($app);
}
}
function nicknameExists($nickname)
{
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (!empty($local)) {
return true;
}
- $alias = Group_alias::staticGet('alias', $nickname);
+ $alias = Group_alias::getKV('alias', $nickname);
if (!empty($alias)) {
return true;
if ($this->to) {
- $this->other = User::staticGet('id', $this->to);
+ $this->other = User::getKV('id', $this->to);
if (!$this->other) {
// TRANS: Client error displayed trying to send a direct message to a non-existing user.
if (!$content) {
$replyto = $this->trimmed('replyto');
$inreplyto = $this->trimmed('inreplyto');
- $profile = Profile::staticGet('nickname', $replyto);
+ $profile = Profile::getKV('nickname', $replyto);
if ($profile) {
$content = '@' . $profile->nickname . ' ';
}
}
$user = common_current_user();
- $other = User::staticGet('nickname', $this->arg('nickname'));
+ $other = User::getKV('nickname', $this->arg('nickname'));
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
common_redirect(common_local_url('showstream',
return false;
}
- $app = Oauth_application::staticGet('id', $appUser->application_id);
+ $app = Oauth_application::getKV('id', $appUser->application_id);
$datastore = new ApiStatusNetOAuthDataStore();
$datastore->revoke_token($appUser->token, 1);
case 'shownotice':
$oembed['type']='link';
$id = $proxy_args['notice'];
- $notice = Notice::staticGet($id);
+ $notice = Notice::getKV($id);
if(empty($notice)){
// TRANS: Server error displayed in oEmbed action when notice not found.
// TRANS: %s is a notice.
break;
case 'attachment':
$id = $proxy_args['attachment'];
- $attachment = File::staticGet($id);
+ $attachment = File::getKV($id);
if(empty($attachment)){
// TRANS: Server error displayed in oEmbed action when attachment not found.
// TRANS: %d is an attachment ID.
$this->serverError(sprintf(_('Attachment %s not found.'),$id), 404);
}
- if(empty($attachment->filename) && $file_oembed = File_oembed::staticGet('file_id', $attachment->id)){
+ if(empty($attachment->filename) && $file_oembed = File_oembed::getKV('file_id', $attachment->id)){
// Proxy the existing oembed information
$oembed['type']=$file_oembed->type;
$oembed['provider']=$file_oembed->provider;
{
$user = common_current_user();
- $osp = Old_school_prefs::staticGet('user_id', $user->id);
+ $osp = Old_school_prefs::getKV('user_id', $user->id);
$orig = null;
if (!empty($osp)) {
return false;
}
- $this->user = User::staticGet('id', $id);
+ $this->user = User::getKV('id', $id);
if (empty($this->user)) {
// TRANS: Client error displayed trying to use "one time password login" without using an existing user.
return false;
}
- $this->lt = Login_token::staticGet('user_id', $id);
+ $this->lt = Login_token::getKV('user_id', $id);
if (empty($this->lt)) {
// TRANS: Client error displayed trying to use "one time password login" without requesting a login token.
return false;
}
- $user = User::staticGet('nickname', $tagger);
+ $user = User::getKV('nickname', $tagger);
if (!$user) {
// TRANS: Client error displayed when referring to non-existing user.
return false;
}
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
return false;
}
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
return false;
}
- $user = User::staticGet('nickname', $tagger);
+ $user = User::getKV('nickname', $tagger);
if (!$user) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
return false;
}
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (!$user) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
}
$id = $this->arg('peopletag_id');
- $this->peopletag = Profile_list::staticGet('id', $id);
+ $this->peopletag = Profile_list::getKV('id', $id);
if (empty($this->peopletag)) {
// TRANS: Client error displayed trying to reference a non-existing list.
$exists = false;
- $prefs = User_location_prefs::staticGet('user_id', $user->id);
+ $prefs = User_location_prefs::getKV('user_id', $user->id);
if (empty($prefs)) {
$prefs = new User_location_prefs();
function nicknameExists($nickname)
{
$user = common_current_user();
- $other = User::staticGet('nickname', $nickname);
+ $other = User::getKV('nickname', $nickname);
if (!$other) {
return false;
} else {
common_debug("Peopletag id $id by user id $tagger_id");
- $this->peopletag = Profile_list::staticGet('id', $id);
+ $this->peopletag = Profile_list::getKV('id', $id);
if (!$this->peopletag) {
// TRANS: Client error displayed trying to reference a non-existing list.
return false;
}
- $user = User::staticGet('id', $tagger_id);
+ $user = User::getKV('id', $tagger_id);
if (!$user) {
// remote peopletag, permanently redirect
common_redirect($this->peopletag->permalink(), 301);
function checkCode()
{
$code = $this->trimmed('code');
- $confirm = Confirm_address::staticGet('code', $code);
+ $confirm = Confirm_address::getKV('code', $code);
if (!$confirm) {
// TRANS: Client error displayed when password recovery code is not correct.
return;
}
- $user = User::staticGet($confirm->user_id);
+ $user = User::getKV($confirm->user_id);
if (!$user) {
// TRANS: Server error displayed trying to recover password without providing a user.
common_ensure_session();
$user_id = $_SESSION['tempuser'];
if ($user_id) {
- $user = User::staticGet($user_id);
+ $user = User::getKV($user_id);
}
return $user;
}
throw new ClientException(_('No id parameter.'));
}
- $this->file = File::staticGet('id', $this->id);
+ $this->file = File::getKV('id', $this->id);
if (empty($this->file)) {
// TRANS: Client exception thrown when an invalid ID parameter was provided for a file.
}
if (!empty($this->code)) {
- $this->invite = Invitation::staticGet('code', $this->code);
+ $this->invite = Invitation::getKV('code', $this->code);
if (empty($this->invite)) {
// TRANS: Client error displayed when trying to register to an invite-only site without a valid invitation.
$this->clientError(_('Sorry, invalid invitation code.'));
$code = $this->trimmed('code');
if ($code) {
- $invite = Invitation::staticGet($code);
+ $invite = Invitation::getKV($code);
}
if (common_config('site', 'inviteonly') && !($code && $invite)) {
*/
function nicknameExists($nickname)
{
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
return is_object($user);
}
if (!$email || strlen($email) == 0) {
return false;
}
- $user = User::staticGet('email', $email);
+ $user = User::getKV('email', $email);
return is_object($user);
}
$invite = null;
if ($code) {
- $invite = Invitation::staticGet($code);
+ $invite = Invitation::getKV($code);
}
if (common_config('site', 'inviteonly') && !($code && $invite)) {
$tagged_id = $this->arg('tagged');
- $this->tagged = Profile::staticGet('id', $tagged_id);
+ $this->tagged = Profile::getKV('id', $tagged_id);
if (empty($this->tagged)) {
// TRANS: Client error displayed when referring to a non-existing profile.
}
$id = $this->arg('peopletag_id');
- $this->peopletag = Profile_list::staticGet('id', $id);
+ $this->peopletag = Profile_list::getKV('id', $id);
if (empty($this->peopletag)) {
// TRANS: Client error displayed trying to reference a non-existing list.
$this->peopletag->tag);
if (!$ptag) {
- $user = User::staticGet('id', $this->tagged->id);
+ $user = User::getKV('id', $this->tagged->id);
if ($user) {
$this->clientError(
// TRANS: Client error displayed when an unknown error occurs while delisting a user.
return false;
}
- $this->notice = Notice::staticGet('id', $id);
+ $this->notice = Notice::getKV('id', $id);
if (empty($this->notice)) {
// TRANS: Client error displayed when trying to repeat a non-existing notice.
$nickname = common_canonical_nickname($this->arg('nickname'));
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when trying to reply to a non-exsting user.
{
parent::prepare($args);
$nickname = $this->trimmed('nickname');
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when providing a non-existing nickname in a RSS 1.0 action.
return false;
}
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (empty($this->user)) {
// TRANS: Client error.
$id = (int)$this->arg('id');
- $this->application = Oauth_application::staticGet($id);
- $this->owner = User::staticGet($this->application->owner);
+ $this->application = Oauth_application::getKV($id);
+ $this->owner = User::getKV($this->application->owner);
if (!common_logged_in()) {
// TRANS: Client error displayed trying to display an OAuth application while not logged in.
$this->elementStart('div', 'entity_statistics');
$defaultAccess = ($this->application->access_type & Oauth_application::$writeAccess)
? 'read-write' : 'read-only';
- $profile = Profile::staticGet($this->application->owner);
+ $profile = Profile::getKV($this->application->owner);
$appUsers = new Oauth_application_user();
$appUsers->application_id = $this->application->id;
$nickname = common_canonical_nickname($this->arg('nickname'));
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when trying to display favourite notices for a non-existing user.
$this->page = 1;
$id = $this->trimmed('message');
- $this->message = Message::staticGet('id', $id);
+ $this->message = Message::getKV('id', $id);
if (!$this->message) {
// TRANS: Client error displayed requesting a single message that does not exist.
return false;
}
- $this->user = User::staticGet('id', $this->profile->id);
+ $this->user = User::getKV('id', $this->profile->id);
$this->avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
{
$id = $this->arg('notice');
- $notice = Notice::staticGet('id', $id);
+ $notice = Notice::getKV('id', $id);
if (empty($notice)) {
// Did we used to have it, and it got deleted?
- $deleted = Deleted_notice::staticGet($id);
+ $deleted = Deleted_notice::getKV($id);
if (!empty($deleted)) {
// TRANS: Client error displayed trying to show a deleted notice.
$this->clientError(_('Notice deleted.'), 410);
*/
function extraHead()
{
- $user = User::staticGet($this->profile->id);
+ $user = User::getKV($this->profile->id);
if (!$user) {
return;
return false;
}
- $user = User::staticGet('nickname', $tagger);
+ $user = User::getKV('nickname', $tagger);
if (!$user) {
// TRANS: Client error displayed trying to perform an action related to a non-existing user.
} else {
$confirm = $this->getConfirmation();
if ($confirm) {
- $carrier = Sms_carrier::staticGet($confirm->address_extra);
+ $carrier = Sms_carrier::getKV($confirm->address_extra);
$this->element('p', 'form_unconfirmed',
$confirm->address . ' (' . $carrier->name . ')');
$this->element('p', 'form_guide',
return;
}
- $carrier = Sms_carrier::staticGet($carrier_id);
+ $carrier = Sms_carrier::getKV($carrier_id);
mail_confirm_sms($confirm->code,
$user->nickname,
{
$user = common_current_user();
- $other = User::staticGet('sms', $sms);
+ $other = User::getKV('sms', $sms);
if (!$other) {
return false;
return false;
}
- $this->profile = Profile::staticGet('id', $id);
+ $this->profile = Profile::getKV('id', $id);
if (!$this->profile) {
// TRANS: Client error displayed trying a change a subscription for a non-existant profile ID.
$other_id = $this->arg('subscribeto');
- $this->other = Profile::staticGet('id', $other_id);
+ $this->other = Profile::getKV('id', $other_id);
if (empty($this->other)) {
// TRANS: Client error displayed trying to subscribe to a non-existing profile.
$id = intval($this->arg('id'));
if ($id) {
- $this->peopletag = Profile_list::staticGet('id', $id);
+ $this->peopletag = Profile_list::getKV('id', $id);
} else {
// TRANS: Client error displayed when trying to perform an action without providing an ID.
$this->clientError(_('No ID given.'), 404);
return false;
}
- $this->tagger = Profile::staticGet('id', $this->peopletag->tagger);
+ $this->tagger = Profile::getKV('id', $this->peopletag->tagger);
return true;
}
if (!$id) {
$this->profile = false;
} else {
- $this->profile = Profile::staticGet('id', $id);
+ $this->profile = Profile::getKV('id', $id);
if (!$this->profile) {
// TRANS: Client error displayed when referring to non-existing profile ID.
function prepare($args) {
parent::prepare($args);
$tag = common_canonical_tag($this->trimmed('tag'));
- $this->tag = Notice_tag::staticGet('tag', $tag);
+ $this->tag = Notice_tag::getKV('tag', $tag);
if (!$this->tag) {
// TRANS: Client error when requesting a tag feed for a non-existing tag.
$this->clientError(_('No such tag.'));
return;
}
- $other = Profile::staticGet('id', $other_id);
+ $other = Profile::getKV('id', $other_id);
if (!$other) {
// TRANS: Client error displayed when trying to unsubscribe while providing a non-existing profile ID.
$id = intval($this->arg('id'));
if ($id) {
- $this->peopletag = Profile_list::staticGet('id', $id);
+ $this->peopletag = Profile_list::getKV('id', $id);
} else {
// TRANS: Client error displayed when trying to perform an action without providing an ID.
$this->clientError(_('No ID given.'), 404);
return false;
}
- $this->tagger = Profile::staticGet('id', $this->peopletag->tagger);
+ $this->tagger = Profile::getKV('id', $this->peopletag->tagger);
return true;
}
// Validate default subscription
if (!empty($values['newuser']['default'])) {
- $defuser = User::staticGet('nickname', trim($values['newuser']['default']));
+ $defuser = User::getKV('nickname', trim($values['newuser']['default']));
if (empty($defuser)) {
$this->clientError(
sprintf(
// TRANS: Client error displayed trying to find a user by ID without providing an ID.
$this->clientError(_('No ID.'));
}
- $user = User::staticGet($id);
+ $user = User::getKV($id);
if (!$user) {
// TRANS: Client error displayed trying to find a user by ID for a non-existing ID.
$this->clientError(_('No such user.'));
return false;
}
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed requesting groups for a non-existing user.
{
parent::prepare($args);
$nickname = $this->trimmed('nickname');
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
$this->tag = $this->trimmed('tag');
if (!$this->user) {
// @fixme if domain checking is added, ensure that it will not
// cause problems with sites that have changed domains!
$nick = common_canonical_nickname($nick);
- $this->user = User::staticGet('nickname', $nick);
+ $this->user = User::getKV('nickname', $nick);
}
} else {
- $this->user = User::staticGet('uri', $this->uri);
+ $this->user = User::getKV('uri', $this->uri);
if (empty($this->user)) {
// try and get it by profile url
- $profile = Profile::staticGet('profileurl', $this->uri);
+ $profile = Profile::getKV('profileurl', $this->uri);
if (!empty($profile)) {
- $this->user = User::staticGet('id', $profile->id);
+ $this->user = User::getKV('id', $profile->id);
}
}
}
function delete()
{
- $profile = Profile::staticGet('id', $this->user_id);
- $notice = Notice::staticGet('id', $this->notice_id);
+ $profile = Profile::getKV('id', $this->user_id);
+ $notice = Notice::getKV('id', $this->notice_id);
$result = null;
function asActivity()
{
- $notice = Notice::staticGet('id', $this->notice_id);
+ $notice = Notice::getKV('id', $this->notice_id);
if (!$notice) {
throw new Exception("Fave for non-existent notice: " . $this->notice_id);
}
- $profile = Profile::staticGet('id', $this->user_id);
+ $profile = Profile::getKV('id', $this->user_id);
if (!$profile) {
throw new Exception("Fave by non-existent profile: " . $this->user_id);
// I don't know why we have to keep doing this but I'm adding this last check to avoid
// uniqueness bugs.
- $x = File::staticGet('url', $given_url);
+ $x = File::getKV('url', $given_url);
if (empty($x)) {
$x = new File;
&& (('text/html' === substr($redir_data['type'], 0, 9) || 'application/xhtml+xml' === substr($redir_data['type'], 0, 21)))
&& ($oembed_data = File_oembed::_getOembed($given_url))) {
- $fo = File_oembed::staticGet('file_id', $this->id);
+ $fo = File_oembed::getKV('file_id', $this->id);
if (empty($fo)) {
File_oembed::saveNew($oembed_data, $this->id);
if (empty($given_url)) return -1; // error, no url to process
$given_url = File_redirection::_canonUrl($given_url);
if (empty($given_url)) return -1; // error, no url to process
- $file = File::staticGet('url', $given_url);
+ $file = File::getKV('url', $given_url);
if (empty($file)) {
- $file_redir = File_redirection::staticGet('url', $given_url);
+ $file_redir = File_redirection::getKV('url', $given_url);
if (empty($file_redir)) {
// @fixme for new URLs this also looks up non-redirect data
// such as target content type, size, etc, which we need
}
if (empty($x)) {
- $x = File::staticGet('id', $file_id);
+ $x = File::getKV('id', $file_id);
if (empty($x)) {
// @todo FIXME: This could possibly be a clearer message :)
// TRANS: Server exception thrown when... Robin thinks something is impossible!
if(in_array($mimetype,$notEnclosureMimeTypes)){
// Never treat generic HTML links as an enclosure type!
// But if we have oEmbed info, we'll consider it golden.
- $oembed = File_oembed::staticGet('file_id',$this->id);
+ $oembed = File_oembed::getKV('file_id',$this->id);
if($oembed && in_array($oembed->type, array('photo', 'video'))){
$mimetype = strtolower($oembed->mimetype);
$semicolon = strpos($mimetype,';');
*/
function getThumbnail()
{
- return File_thumbnail::staticGet('file_id', $this->id);
+ return File_thumbnail::getKV('file_id', $this->id);
}
/**
$file_oembed->url = $data->url;
$given_url = File_redirection::_canonUrl($file_oembed->url);
if (! empty($given_url)){
- $file = File::staticGet('url', $given_url);
+ $file = File::getKV('url', $given_url);
if (empty($file)) {
- $file_redir = File_redirection::staticGet('url', $given_url);
+ $file_redir = File_redirection::getKV('url', $given_url);
if (empty($file_redir)) {
$redir_data = File_redirection::where($given_url);
$file_oembed->mimetype = $redir_data['type'];
}
$file_oembed->insert();
if (!empty($data->thumbnail_url) || ($data->type == 'photo')) {
- $ft = File_thumbnail::staticGet('file_id', $file_id);
+ $ft = File_thumbnail::getKV('file_id', $file_id);
if (!empty($ft)) {
common_log(LOG_WARNING, "Strangely, a File_thumbnail object exists for new file $file_id",
__FILE__);
*/
public function where($in_url, $discover=true) {
// let's see if we know this...
- $a = File::staticGet('url', $in_url);
+ $a = File::getKV('url', $in_url);
if (!empty($a)) {
// this is a direct link to $a->url
return $a->url;
} else {
- $b = File_redirection::staticGet('url', $in_url);
+ $b = File_redirection::getKV('url', $in_url);
if (!empty($b)) {
// this is a redirect to $b->file_id
- $a = File::staticGet('id', $b->file_id);
+ $a = File::getKV('id', $b->file_id);
return $a->url;
}
}
if (!empty($short_url) && $short_url != $long_url) {
$short_url = (string)$short_url;
// store it
- $file = File::staticGet('url', $long_url);
+ $file = File::getKV('url', $long_url);
if (empty($file)) {
// Check if the target URL is itself a redirect...
$redir_data = File_redirection::where($long_url);
}
} else if (is_string($redir_data)) {
// The file is a known redirect target.
- $file = File::staticGet('url', $redir_data);
+ $file = File::getKV('url', $redir_data);
if (empty($file)) {
// @fixme should we save a new one?
// this case was triggering sometimes for redirects
} else {
$file_id = $file->id;
}
- $file_redir = File_redirection::staticGet('url', $short_url);
+ $file_redir = File_redirection::getKV('url', $short_url);
if (empty($file_redir)) {
$file_redir = new File_redirection;
$file_redir->url = $short_url;
$f2p->post_id = $notice_id;
$f2p->insert();
- $f = File::staticGet($file_id);
+ $f = File::getKV($file_id);
if (!empty($f)) {
$f->blowCache();
function delete()
{
- $f = File::staticGet('id', $this->file_id);
+ $f = File::getKV('id', $this->file_id);
if (!empty($f)) {
$f->blowCache();
}
function getUser()
{
- return User::staticGet($this->user_id);
+ return User::getKV($this->user_id);
}
// Make sure we only ever delete one record at a time
function getMember()
{
- $member = Profile::staticGet('id', $this->profile_id);
+ $member = Profile::getKV('id', $this->profile_id);
if (empty($member)) {
// TRANS: Exception thrown providing an invalid profile ID.
function getGroup()
{
- $group = User_group::staticGet('id', $this->group_id);
+ $group = User_group::getKV('id', $this->group_id);
if (empty($group)) {
// TRANS: Exception thrown providing an invalid group ID.
*/
public function notify()
{
- $joiner = Profile::staticGet('id', $this->profile_id);
- $group = User_group::staticGet('id', $this->group_id);
+ $joiner = Profile::getKV('id', $this->profile_id);
+ $group = User_group::getKV('id', $this->group_id);
mail_notify_group_join_pending($group, $joiner);
}
}
function getMember()
{
- $member = Profile::staticGet('id', $this->profile_id);
+ $member = Profile::getKV('id', $this->profile_id);
if (empty($member)) {
// TRANS: Exception thrown providing an invalid profile ID.
function getGroup()
{
- $group = User_group::staticGet('id', $this->group_id);
+ $group = User_group::getKV('id', $this->group_id);
if (empty($group)) {
// TRANS: Exception thrown providing an invalid group ID.
function makeNew($user)
{
- $login_token = Login_token::staticGet('user_id', $user->id);
+ $login_token = Login_token::getKV('user_id', $user->id);
if (!empty($login_token)) {
$login_token->delete();
* @return get_called_class() object if found, or null for no hits
*
*/
- static function staticGet($k,$v=NULL)
+ static function getKV($k,$v=NULL)
{
- return parent::staticGet(get_called_class(),$k,$v);
+ return parent::getKV(get_called_class(),$k,$v);
}
* @param mixed $v key field value, or leave out for primary key lookup
* @return mixed Memcached_DataObject subtype or false
*/
- static function staticGet($cls, $k, $v=null)
+ static function getKV($cls, $k, $v=null)
{
if (is_null($v)) {
$v = $k;
}
/**
- * @todo FIXME: Should this return false on lookup fail to match staticGet?
+ * @todo FIXME: Should this return false on lookup fail to match getKV?
*/
function pkeyGet($cls, $kv)
{
'delete',
'update',
'find');
- $ignoreStatic = array('staticGet',
+ $ignoreStatic = array('getKV',
'pkeyGet',
'cachedQuery');
$here = get_class($this); // if we get confused
function getFrom()
{
- return Profile::staticGet('id', $this->from_profile);
+ return Profile::getKV('id', $this->from_profile);
}
function getTo()
{
- return Profile::staticGet('id', $this->to_profile);
+ return Profile::getKV('id', $this->to_profile);
}
static function saveNew($from, $to, $content, $source) {
- $sender = Profile::staticGet('id', $from);
+ $sender = Profile::getKV('id', $from);
if (!$sender->hasRight(Right::NEWMESSAGE)) {
// TRANS: Client exception thrown when a user tries to send a direct message while being banned from sending them.
throw new ClientException(_('You are banned from sending direct messages.'));
}
- $user = User::staticGet('id', $sender->id);
+ $user = User::getKV('id', $sender->id);
$msg = new Message();
function notify()
{
- $from = User::staticGet('id', $this->from_profile);
- $to = User::staticGet('id', $this->to_profile);
+ $from = User::getKV('id', $this->from_profile);
+ $to = User::getKV('id', $this->to_profile);
mail_notify_message($this, $from, $to);
}
$ns->code = $this->source;
break;
default:
- $ns = Notice_source::staticGet($this->source);
+ $ns = Notice_source::getKV($this->source);
if (!$ns) {
$ns = new Notice_source();
$ns->code = $this->source;
- $app = Oauth_application::staticGet('name', $this->source);
+ $app = Oauth_application::getKV('name', $this->source);
if ($app) {
$ns->name = $app->name;
$ns->url = $app->source_url;
$act->time = strtotime($this->created);
$act->link = $this->url;
- $profile = Profile::staticGet('id', $this->from_profile);
+ $profile = Profile::getKV('id', $this->from_profile);
if (empty($profile)) {
throw new Exception(sprintf("Sender profile not found: %d", $this->from_profile));
$ctx = new ActivityContext();
- $rprofile = Profile::staticGet('id', $this->to_profile);
+ $rprofile = Profile::getKV('id', $this->to_profile);
if (empty($rprofile)) {
throw new Exception(sprintf("Receiver profile not found: %d", $this->to_profile));
function getProfile()
{
if (is_int($this->_profile) && $this->_profile == -1) {
- $this->_setProfile(Profile::staticGet('id', $this->profile_id));
+ $this->_setProfile(Profile::getKV('id', $this->profile_id));
if (empty($this->_profile)) {
// TRANS: Server exception thrown when a user profile for a notice cannot be found.
// @fixme we have some cases where things get re-run and so the
// insert fails.
- $deleted = Deleted_notice::staticGet('id', $this->id);
+ $deleted = Deleted_notice::getKV('id', $this->id);
if (!$deleted) {
- $deleted = Deleted_notice::staticGet('uri', $this->uri);
+ $deleted = Deleted_notice::getKV('uri', $this->uri);
}
if (!$deleted) {
$is_local = Notice::LOCAL_PUBLIC;
}
- $profile = Profile::staticGet('id', $profile_id);
- $user = User::staticGet('id', $profile_id);
+ $profile = Profile::getKV('id', $profile_id);
+ $user = User::getKV('id', $profile_id);
if ($user) {
// Use the local user's shortening preferences, if applicable.
$final = $user->shortenLinks($content);
// Check for a private one
- $repeat = Notice::staticGet('id', $repeat_of);
+ $repeat = Notice::getKV('id', $repeat_of);
if (empty($repeat)) {
// TRANS: Client exception thrown in notice when trying to repeat a missing or deleted notice.
// Force the scope for private groups
foreach ($groups as $groupId) {
- $group = User_group::staticGet('id', $groupId);
+ $group = User_group::getKV('id', $groupId);
if (!empty($group)) {
if ($group->force_scope) {
$notice->scope |= Notice::GROUP_SCOPE;
self::blow('notice:list-ids:repeat_of:%d', $this->repeat_of);
}
- $original = Notice::staticGet('id', $this->repeat_of);
+ $original = Notice::getKV('id', $this->repeat_of);
if (!empty($original)) {
- $originalUser = User::staticGet('id', $original->profile_id);
+ $originalUser = User::getKV('id', $original->profile_id);
if (!empty($originalUser)) {
$this->blowStream('user:repeats_of_me:%d', $originalUser->id);
}
}
- $profile = Profile::staticGet($this->profile_id);
+ $profile = Profile::getKV($this->profile_id);
if (!empty($profile)) {
$profile->blowNoticeCount();
if ($lastStr !== false) {
$window = explode(',', $lastStr);
$lastID = $window[0];
- $lastNotice = Notice::staticGet('id', $lastID);
+ $lastNotice = Notice::getKV('id', $lastID);
if (empty($lastNotice) // just weird
|| strtotime($lastNotice->created) >= strtotime($this->created)) {
$c->delete($lastKey);
}
static function checkDupes($profile_id, $content) {
- $profile = Profile::staticGet($profile_id);
+ $profile = Profile::getKV($profile_id);
if (empty($profile)) {
return false;
}
}
static function checkEditThrottle($profile_id) {
- $profile = Profile::staticGet($profile_id);
+ $profile = Profile::getKV($profile_id);
if (empty($profile)) {
return false;
}
$originalProfile = null;
if ($this->repeat_of) {
// Check blocks against the original notice's poster as well.
- $original = Notice::staticGet('id', $this->repeat_of);
+ $original = Notice::getKV('id', $this->repeat_of);
if ($original) {
$originalProfile = $original->getProfile();
}
foreach ($ni as $id => $source) {
try {
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (empty($user) ||
$user->hasBlocked($profile) ||
($originalProfile && $user->hasBlocked($originalProfile))) {
$groups = array();
foreach (array_unique($group_ids) as $id) {
- $group = User_group::staticGet('id', $id);
+ $group = User_group::getKV('id', $id);
if ($group) {
common_log(LOG_ERR, "Local delivery to group id $id, $group->nickname");
$result = $this->addToGroupInbox($group);
return;
}
- $sender = Profile::staticGet($this->profile_id);
+ $sender = Profile::getKV($this->profile_id);
foreach (array_unique($uris) as $uri) {
return array();
}
- $sender = Profile::staticGet($this->profile_id);
+ $sender = Profile::getKV($this->profile_id);
$replied = array();
// Don't save replies from blocked profile to local user
- $mentioned_user = User::staticGet('id', $mentioned->id);
+ $mentioned_user = User::getKV('id', $mentioned->id);
if (!empty($mentioned_user) && $mentioned_user->hasBlocked($sender)) {
continue;
}
$recipientIds = $this->getReplies();
foreach ($recipientIds as $recipientId) {
- $user = User::staticGet('id', $recipientId);
+ $user = User::getKV('id', $recipientId);
if (!empty($user)) {
mail_notify_attn($user, $this);
}
$act->verb = $this->verb;
if ($this->repeat_of) {
- $repeated = Notice::staticGet('id', $this->repeat_of);
+ $repeated = Notice::getKV('id', $this->repeat_of);
if (!empty($repeated)) {
$act->objects[] = $repeated->asActivity($cur);
}
$ctx = new ActivityContext();
if (!empty($this->reply_to)) {
- $reply = Notice::staticGet('id', $this->reply_to);
+ $reply = Notice::getKV('id', $this->reply_to);
if (!empty($reply)) {
$ctx->replyToID = $reply->uri;
$ctx->replyToUrl = $reply->bestUrl();
$conv = null;
if (!empty($this->conversation)) {
- $conv = Conversation::staticGet('id', $this->conversation);
+ $conv = Conversation::getKV('id', $this->conversation);
if (!empty($conv)) {
$ctx->conversation = $conv->uri;
}
$reply_ids = $this->getReplies();
foreach ($reply_ids as $id) {
- $rprofile = Profile::staticGet('id', $id);
+ $rprofile = Profile::getKV('id', $id);
if (!empty($rprofile)) {
$ctx->attention[] = $rprofile->getUri();
$ctx->attentionType[$rprofile->getUri()] = ActivityObject::PERSON;
$repeat = null;
if (!empty($this->repeat_of)) {
- $repeat = Notice::staticGet('id', $this->repeat_of);
+ $repeat = Notice::getKV('id', $this->repeat_of);
if (!empty($repeat)) {
$ctx->forwardID = $repeat->uri;
$ctx->forwardUrl = $repeat->bestUrl();
$act->source->updated = self::utcDate($notice->created);
}
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if (!empty($user)) {
$act->source->links['license'] = common_config('license', 'url');
// return it if it does
if (!empty($reply_to)) {
- $reply_notice = Notice::staticGet('id', $reply_to);
+ $reply_notice = Notice::getKV('id', $reply_to);
if (!empty($reply_notice)) {
return $reply_notice;
}
// Figure out who that is.
- $sender = Profile::staticGet('id', $profile_id);
+ $sender = Profile::getKV('id', $profile_id);
if (empty($sender)) {
return null;
}
*/
function repeat($repeater_id, $source)
{
- $author = Profile::staticGet('id', $this->profile_id);
+ $author = Profile::getKV('id', $this->profile_id);
// TRANS: Message used to repeat a notice. RT is the abbreviation of 'retweet'.
// TRANS: %1$s is the repeated user's name, %2$s is the repeated notice.
// have to wait
Event::handle('StartNoticeDistribute', array($this));
- $user = User::staticGet('id', $this->profile_id);
+ $user = User::getKV('id', $this->profile_id);
if (!empty($user)) {
Inbox::insertNotice($user->id, $this->id);
}
$ns->code = $this->source;
break;
default:
- $ns = Notice_source::staticGet($this->source);
+ $ns = Notice_source::getKV($this->source);
if (!$ns) {
$ns = new Notice_source();
$ns->code = $this->source;
- $app = Oauth_application::staticGet('name', $this->source);
+ $app = Oauth_application::getKV('name', $this->source);
if ($app) {
$ns->name = $app->name;
$ns->url = $app->source_url;
return false;
}
- $notice = Notice::staticGet('id', $id);
+ $notice = Notice::getKV('id', $id);
if ($notice) {
return $notice->created;
}
- $deleted = Deleted_notice::staticGet('id', $id);
+ $deleted = Deleted_notice::getKV('id', $id);
if ($deleted) {
return $deleted->created;
}
if (empty($this->reply_to)) {
$this->_original = null;
} else {
- $this->_original = Notice::staticGet('id', $this->reply_to);
+ $this->_original = Notice::getKV('id', $this->reply_to);
}
}
return $this->_original;
function getConsumer()
{
- return Consumer::staticGet('consumer_key', $this->consumer_key);
+ return Consumer::getKV('consumer_key', $this->consumer_key);
}
static function maxDesc()
function getUser()
{
if (is_int($this->_user) && $this->_user == -1) {
- $this->_user = User::staticGet('id', $this->id);
+ $this->_user = User::getKV('id', $this->id);
}
return $this->_user;
$lists = array();
foreach ($ids as $id) {
- $list = Profile_list::staticGet('id', $id);
+ $list = Profile_list::getKV('id', $id);
if (!empty($list) &&
($showPrivate || !$list->private)) {
$profiles = array();
while ($subs->fetch()) {
- $profile = Profile::staticGet($subs->subscribed);
+ $profile = Profile::getKV($subs->subscribed);
if ($profile) {
$profiles[] = $profile;
}
$profiles = array();
while ($subs->fetch()) {
- $profile = Profile::staticGet($subs->subscriber);
+ $profile = Profile::getKV($subs->subscriber);
if ($profile) {
$profiles[] = $profile;
}
$sub->find();
while ($sub->fetch()) {
- $other = Profile::staticGet('id', $sub->subscribed);
+ $other = Profile::getKV('id', $sub->subscribed);
if (empty($other)) {
continue;
}
$subd->find();
while ($subd->fetch()) {
- $other = Profile::staticGet('id', $subd->subscriber);
+ $other = Profile::getKV('id', $subd->subscriber);
if (empty($other)) {
continue;
}
if (Event::handle('StartGetProfileUri', array($this, &$uri))) {
// check for a local user first
- $user = User::staticGet('id', $this->id);
+ $user = User::getKV('id', $this->id);
if (!empty($user)) {
$uri = $user->uri;
$feed = null;
if (Event::handle('StartProfileGetAtomFeed', array($this, &$feed))) {
- $user = User::staticGet('id', $this->id);
+ $user = User::getKV('id', $this->id);
if (!empty($user)) {
$feed = common_local_url('ApiTimelineUser', array('id' => $user->id,
'format' => 'atom'));
if (Event::handle('StartGetProfileFromURI', array($uri, &$profile))) {
// Get a local user or remote (OMB 0.1) profile
- $user = User::staticGet('uri', $uri);
+ $user = User::getKV('uri', $uri);
if (!empty($user)) {
$profile = $user->getProfile();
}
function getTagger()
{
- return Profile::staticGet('id', $this->tagger);
+ return Profile::getKV('id', $this->tagger);
}
/**
if (!isset($mainpage) || empty($mainpage)) {
$orig = clone($ptag);
- $user = User::staticGet('id', $ptag->tagger);
+ $user = User::getKV('id', $ptag->tagger);
if(!empty($user)) {
$ptag->mainpage = common_local_url('showprofiletag', array('tag' => $ptag->tag, 'tagger' => $user->nickname));
} else {
return $ptag;
}
- $tagger_profile = Profile::staticGet('id', $tagger);
- $tagged_profile = Profile::staticGet('id', $tagged);
+ $tagger_profile = Profile::getKV('id', $tagger);
+ $tagged_profile = Profile::getKV('id', $tagged);
if (Event::handle('StartTagProfile', array($tagger_profile, $tagged_profile, $tag))) {
throw new Exception(_('Adding list subscription failed.'));
}
- $ptag = Profile_list::staticGet('id', $peopletag->id);
+ $ptag = Profile_list::getKV('id', $peopletag->id);
$ptag->subscriberCount(true);
Event::handle('EndSubscribePeopletag', array($peopletag, $profile));
$subs->find();
while($subs->fetch()) {
- $profile = Profile::staticGet('id', $subs->profile_id);
+ $profile = Profile::getKV('id', $subs->profile_id);
Event::handle('StartUnsubscribePeopletag', array($profile_list, $profile));
// Delete anyway
$subs->delete();
function hasRight($right)
{
- $profile = Profile::staticGet($this->id);
+ $profile = Profile::getKV($this->id);
if ($profile) {
return $profile->hasright($right);
} else {
{
self::logdeb("Fetching session '$id'");
- $session = Session::staticGet('id', $id);
+ $session = Session::getKV('id', $id);
if (empty($session)) {
self::logdeb("Couldn't find '$id'");
{
self::logdeb("Writing session '$id'");
- $session = Session::staticGet('id', $id);
+ $session = Session::getKV('id', $id);
if (empty($session)) {
self::logdeb("'$id' doesn't yet exist; inserting.");
{
self::logdeb("Deleting session $id");
- $session = Session::staticGet('id', $id);
+ $session = Session::getKV('id', $id);
if (empty($session)) {
self::logdeb("Can't find '$id' to delete.");
public $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
/* Static get */
- static function staticGet($k,$v=NULL) {
+ static function getKV($k,$v=NULL) {
+ // TODO: This must probably be turned into a non-static call
$i = DB_DataObject::staticGet('Status_network',$k,$v);
// Don't use local process cache; if we're fetching multiple
static function memGet($k, $v)
{
if (!self::$cache) {
- return self::staticGet($k, $v);
+ return self::getKV($k, $v);
}
$ck = self::cacheKey($k, $v);
$sn = self::$cache->get($ck);
if (empty($sn)) {
- $sn = self::staticGet($k, $v);
+ $sn = self::getKV($k, $v);
if (!empty($sn)) {
self::$cache->set($ck, clone($sn));
}
$this->_connect();
}
+ /* the code above is auto generated do not remove the tag below */
+ ###END_AUTOCODE
+
/* Static get */
- function staticGet($k,$v=null)
+ static function getKV($k,$v=null)
{
+ // TODO: This probably has to be converted to a non-static call
$i = DB_DataObject::staticGet('Status_network_tag',$k,$v);
// Don't use local process cache; if we're fetching multiple
return $i;
}
- /* the code above is auto generated do not remove the tag below */
- ###END_AUTOCODE
-
-
function pkeyGet($kv)
{
return Memcached_DataObject::pkeyGet('Status_network_tag', $kv);
}
if (Event::handle('StartSubscribe', array($subscriber, $other))) {
- $otherUser = User::staticGet('id', $other->id);
+ $otherUser = User::getKV('id', $other->id);
if ($otherUser && $otherUser->subscribe_policy == User::SUBSCRIBE_POLICY_MODERATE && !$force) {
$sub = Subscription_queue::saveNew($subscriber, $other);
$sub->notify();
function notifyEmail()
{
- $subscribedUser = User::staticGet('id', $this->subscribed);
+ $subscribedUser = User::getKV('id', $this->subscribed);
if (!empty($subscribedUser)) {
- $subscriber = Profile::staticGet('id', $this->subscriber);
+ $subscriber = Profile::getKV('id', $this->subscriber);
mail_subscribe_notify_profile($subscribedUser, $subscriber);
}
function asActivity()
{
- $subscriber = Profile::staticGet('id', $this->subscriber);
- $subscribed = Profile::staticGet('id', $this->subscribed);
+ $subscriber = Profile::getKV('id', $this->subscriber);
+ $subscribed = Profile::getKV('id', $this->subscribed);
if (empty($subscriber)) {
throw new Exception(sprintf(_('No profile for the subscriber: %d'), $this->subscriber));
*/
public function complete()
{
- $subscriber = Profile::staticGet('id', $this->subscriber);
- $subscribed = Profile::staticGet('id', $this->subscribed);
+ $subscriber = Profile::getKV('id', $this->subscriber);
+ $subscribed = Profile::getKV('id', $this->subscribed);
$sub = Subscription::start($subscriber, $subscribed, Subscription::FORCE);
if ($sub) {
$this->delete();
*/
public function abort()
{
- $subscriber = Profile::staticGet('id', $this->subscriber);
- $subscribed = Profile::staticGet('id', $this->subscribed);
+ $subscriber = Profile::getKV('id', $this->subscriber);
+ $subscribed = Profile::getKV('id', $this->subscribed);
if (Event::handle('StartCancelSubscription', array($subscriber, $subscribed))) {
$this->delete();
Event::handle('EndCancelSubscription', array($subscriber, $subscribed));
*/
public function notify()
{
- $other = Profile::staticGet('id', $this->subscriber);
- $listenee = User::staticGet('id', $this->subscribed);
+ $other = Profile::getKV('id', $this->subscriber);
+ $listenee = User::getKV('id', $this->subscribed);
mail_subscribe_pending_notify_profile($listenee, $other);
}
}
function getProfile()
{
if (is_int($this->_profile) && $this->_profile == -1) { // invalid but distinct from null
- $this->_profile = Profile::staticGet('id', $this->id);
+ $this->_profile = Profile::getKV('id', $this->id);
if (empty($this->_profile)) {
throw new UserNoProfileException($this);
}
function getCarrier()
{
- return Sms_carrier::staticGet('id', $this->carrier);
+ return Sms_carrier::getKV('id', $this->carrier);
}
/**
// Users who respond to invite email have proven their ownership of that address
if (!empty($code)) {
- $invite = Invitation::staticGet($code);
+ $invite = Invitation::getKV($code);
if ($invite && $invite->address && $invite->address_type == 'email' && $invite->address == $email) {
$user->email = $invite->address;
}
$defnick = common_config('newuser', 'default');
if (!empty($defnick)) {
- $defuser = User::staticGet('nickname', $defnick);
+ $defuser = User::getKV('nickname', $defnick);
if (empty($defuser)) {
common_log(LOG_WARNING, sprintf("Default user %s does not exist.", $defnick),
__FILE__);
$welcome = common_config('newuser', 'welcome');
if (!empty($welcome)) {
- $welcomeuser = User::staticGet('nickname', $welcome);
+ $welcomeuser = User::getKV('nickname', $welcome);
if (empty($welcomeuser)) {
common_log(LOG_WARNING, sprintf("Welcome user %s does not exist.", $defnick),
__FILE__);
if ($invites->find()) {
while ($invites->fetch()) {
- $other = User::staticGet($invites->user_id);
+ $other = User::getKV($invites->user_id);
subs_subscribe_to($other, $this);
}
}
$share = common_config('location', 'sharedefault');
// Check if user has a personal setting for this
- $prefs = User_location_prefs::staticGet('user_id', $this->id);
+ $prefs = User_location_prefs::getKV('user_id', $this->id);
if (!empty($prefs)) {
$share = $prefs->share_location;
$pr->limit(1);
if ($pr->find(true)) {
- $owner = User::staticGet('id', $pr->profile_id);
+ $owner = User::getKV('id', $pr->profile_id);
} else {
$owner = null;
}
$nickname = common_config('singleuser', 'nickname');
if (!empty($nickname)) {
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
}
// if there was no nickname or no user by that nickname,
static function recoverPassword($nore)
{
- $user = User::staticGet('email', common_canonical_email($nore));
+ $user = User::getKV('email', common_canonical_email($nore));
if (!$user) {
try {
- $user = User::staticGet('nickname', common_canonical_nickname($nore));
+ $user = User::getKV('nickname', common_canonical_nickname($nore));
} catch (NicknameException $e) {
// invalid
}
$confirm_email->address_type = 'email';
$confirm_email->find();
if ($confirm_email->fetch()) {
- $user = User::staticGet($confirm_email->user_id);
+ $user = User::getKV($confirm_email->user_id);
} else {
$confirm_email = null;
}
function streamModeOnly()
{
if (common_config('oldschool', 'enabled')) {
- $osp = Old_school_prefs::staticGet('user_id', $this->id);
+ $osp = Old_school_prefs::getKV('user_id', $this->id);
if (!empty($osp)) {
return $osp->stream_mode_only;
}
function conversationTree()
{
if (common_config('oldschool', 'enabled')) {
- $osp = Old_school_prefs::staticGet('user_id', $this->id);
+ $osp = Old_school_prefs::getKV('user_id', $this->id);
if (!empty($osp)) {
return $osp->conversation_tree;
}
function streamNicknames()
{
if (common_config('oldschool', 'enabled')) {
- $osp = Old_school_prefs::staticGet('user_id', $this->id);
+ $osp = Old_school_prefs::getKV('user_id', $this->id);
if (!empty($osp)) {
return $osp->stream_nicknames;
}
// If not, check local groups.
- $group = Local_group::staticGet('nickname', $nickname);
+ $group = Local_group::getKV('nickname', $nickname);
if (!empty($group)) {
- return User_group::staticGet('id', $group->group_id);
+ return User_group::getKV('id', $group->group_id);
}
- $alias = Group_alias::staticGet('alias', $nickname);
+ $alias = Group_alias::getKV('alias', $nickname);
if (!empty($alias)) {
- return User_group::staticGet('id', $alias->group_id);
+ return User_group::getKV('id', $alias->group_id);
}
return null;
}
static function register($fields) {
if (!empty($fields['userid'])) {
- $profile = Profile::staticGet('id', $fields['userid']);
+ $profile = Profile::getKV('id', $fields['userid']);
if ($profile && !$profile->hasRight(Right::CREATEGROUP)) {
common_log(LOG_WARNING, "Attempted group creation from banned user: " . $profile->nickname);
// or we'll miss clearing some cache keys; that can make it hard
// to create a new group with one of those names or aliases.
$this->setAliases(array());
- $local = Local_group::staticGet('group_id', $this->id);
+ $local = Local_group::getKV('group_id', $this->id);
if ($local) {
$local->delete();
}
return null;
}
- $prefs = User_urlshortener_prefs::staticGet('user_id', $user->id);
+ $prefs = User_urlshortener_prefs::getKV('user_id', $user->id);
return $prefs;
}
{
parent::__construct($out);
$this->profile = $profile;
- $this->user = User::staticGet('id', $profile->id);
+ $this->user = User::getKV('id', $profile->id);
}
function avatar()
// if logo is an uploaded file, try to fall back to HTTPS file URL
$httpUrl = common_config('site', 'logo');
if (!empty($httpUrl)) {
- $f = File::staticGet('url', $httpUrl);
+ $f = File::getKV('url', $httpUrl);
if (!empty($f) && !empty($f->filename)) {
// this will handle the HTTPS case
$logoUrl = File::url($f->filename);
}
$other = $activity->actor;
- $otherUser = User::staticGet('uri', $other->id);
+ $otherUser = User::getKV('uri', $other->id);
if (!empty($otherUser)) {
$otherProfile = $otherUser->getProfile();
$uri = $activity->objects[0]->id;
- $group = User_group::staticGet('uri', $uri);
+ $group = User_group::getKV('uri', $uri);
if (empty($group)) {
$oprofile = Ostatus_profile::ensureActivityObjectProfile($activity->objects[0]);
$sourceUri = $note->id;
- $notice = Notice::staticGet('uri', $sourceUri);
+ $notice = Notice::getKV('uri', $sourceUri);
if (!empty($notice)) {
// Maintain direct reply associations
// @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;
// Is the recipient a local user?
- $user = User::staticGet('uri', $recipient);
+ $user = User::getKV('uri', $recipient);
if ($user) {
// @fixme sender verification, spam etc?
// Is the recipient a local group?
// @fixme uri on user_group isn't reliable yet
- // $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();
{
list ($act, $sink, $userURI, $remoteURI) = $data;
- $user = User::staticGet('uri', $userURI);
+ $user = User::getKV('uri', $userURI);
$remote = Profile::fromURI($remoteURI);
try {
"{$act->actor->id} to {$remote->nickname}.");
// push it, then delete local
$sink->postActivity($act);
- $notice = Notice::staticGet('uri', $act->objects[0]->id);
+ $notice = Notice::getKV('uri', $act->objects[0]->id);
if (!empty($notice)) {
$fave = Fave::pkeyGet(array('user_id' => $user->id,
'notice_id' => $notice->id));
"{$act->actor->id} to {$remote->nickname}.");
// XXX: send a reshare, not a post
$sink->postActivity($act);
- $notice = Notice::staticGet('uri', $act->objects[0]->id);
+ $notice = Notice::getKV('uri', $act->objects[0]->id);
if (!empty($notice)) {
$notice->delete();
}
"Moving group join of {$act->objects[0]->id} by ".
"{$act->actor->id} to {$remote->nickname}.");
$sink->postActivity($act);
- $group = User_group::staticGet('uri', $act->objects[0]->id);
+ $group = User_group::getKV('uri', $act->objects[0]->id);
if (!empty($group)) {
$user->leaveGroup($group);
}
Subscription::cancel($user->getProfile(), $other);
}
} else {
- $otherUser = User::staticGet('uri', $act->actor->id);
+ $otherUser = User::getKV('uri', $act->actor->id);
if (!empty($otherUser)) {
$this->log(LOG_INFO,
"Changing sub to {$act->objects[0]->id}".
$object->title = $ptag->tag;
$object->summary = $ptag->description;
$object->link = $ptag->homeUrl();
- $object->owner = Profile::staticGet('id', $ptag->tagger);
+ $object->owner = Profile::getKV('id', $ptag->tagger);
$object->poco = PoCo::fromProfile($object->owner);
Event::handle('EndActivityObjectFromPeopletag', array($ptag, &$object));
}
$base = $this->twitterSimpleStatusArray($notice, $include_user);
if (!empty($notice->repeat_of)) {
- $original = Notice::staticGet('id', $notice->repeat_of);
+ $original = Notice::getKV('id', $notice->repeat_of);
if (!empty($original)) {
$original_array = $this->twitterSimpleStatusArray($original, $include_user);
$base['retweeted_status'] = $original_array;
$replier_profile = null;
if ($notice->reply_to) {
- $reply = Notice::staticGet(intval($notice->reply_to));
+ $reply = Notice::getKV(intval($notice->reply_to));
if ($reply) {
$replier_profile = $reply->getProfile();
}
function twitterListArray($list)
{
- $profile = Profile::staticGet('id', $list->tagger);
+ $profile = Profile::getKV('id', $list->tagger);
$twitter_list = array();
$twitter_list['id'] = $list->id;
if (empty($id)) {
// Twitter supports these other ways of passing the user ID
if (self::is_decimal($this->arg('id'))) {
- return User::staticGet($this->arg('id'));
+ return User::getKV($this->arg('id'));
} else if ($this->arg('id')) {
$nickname = common_canonical_nickname($this->arg('id'));
- return User::staticGet('nickname', $nickname);
+ return User::getKV('nickname', $nickname);
} else if ($this->arg('user_id')) {
// This is to ensure that a non-numeric user_id still
// overrides screen_name even if it doesn't get used
if (self::is_decimal($this->arg('user_id'))) {
- return User::staticGet('id', $this->arg('user_id'));
+ return User::getKV('id', $this->arg('user_id'));
}
} else if ($this->arg('screen_name')) {
$nickname = common_canonical_nickname($this->arg('screen_name'));
- return User::staticGet('nickname', $nickname);
+ return User::getKV('nickname', $nickname);
} else {
// Fall back to trying the currently authenticated user
return $this->auth_user;
}
} else if (self::is_decimal($id)) {
- return User::staticGet($id);
+ return User::getKV($id);
} else {
$nickname = common_canonical_nickname($id);
- return User::staticGet('nickname', $nickname);
+ return User::getKV('nickname', $nickname);
}
}
// Twitter supports these other ways of passing the user ID
if (self::is_decimal($this->arg('id'))) {
- return Profile::staticGet($this->arg('id'));
+ return Profile::getKV($this->arg('id'));
} else if ($this->arg('id')) {
// Screen names currently can only uniquely identify a local user.
$nickname = common_canonical_nickname($this->arg('id'));
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
return $user ? $user->getProfile() : null;
} else if ($this->arg('user_id')) {
// This is to ensure that a non-numeric user_id still
// overrides screen_name even if it doesn't get used
if (self::is_decimal($this->arg('user_id'))) {
- return Profile::staticGet('id', $this->arg('user_id'));
+ return Profile::getKV('id', $this->arg('user_id'));
}
} else if ($this->arg('screen_name')) {
$nickname = common_canonical_nickname($this->arg('screen_name'));
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
return $user ? $user->getProfile() : null;
}
} else if (self::is_decimal($id)) {
- return Profile::staticGet($id);
+ return Profile::getKV($id);
} else {
$nickname = common_canonical_nickname($id);
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
return $user ? $user->getProfile() : null;
}
}
{
if (empty($id)) {
if (self::is_decimal($this->arg('id'))) {
- return User_group::staticGet('id', $this->arg('id'));
+ return User_group::getKV('id', $this->arg('id'));
} else if ($this->arg('id')) {
return User_group::getForNickname($this->arg('id'));
} else if ($this->arg('group_id')) {
// This is to ensure that a non-numeric group_id still
// overrides group_name even if it doesn't get used
if (self::is_decimal($this->arg('group_id'))) {
- return User_group::staticGet('id', $this->arg('group_id'));
+ return User_group::getKV('id', $this->arg('group_id'));
}
} else if ($this->arg('group_name')) {
return User_group::getForNickname($this->arg('group_name'));
}
} else if (self::is_decimal($id)) {
- return User_group::staticGet('id', $id);
+ return User_group::getKV('id', $id);
} else {
return User_group::getForNickname($id);
}
if($id) {
if (is_numeric($id)) {
- $list = Profile_list::staticGet('id', $id);
+ $list = Profile_list::getKV('id', $id);
// only if the list with the id belongs to the tagger
if(empty($list) || $list->tagger != $tagger->id) {
}
- $appUser = Oauth_application_user::staticGet('token', $access_token);
+ $appUser = Oauth_application_user::getKV('token', $access_token);
if (!empty($appUser)) {
// If access_type == 0 we have either a request token
// Set the auth user
if (Event::handle('StartSetApiUser', array(&$user))) {
- $user = User::staticGet('id', $appUser->profile_id);
+ $user = User::getKV('id', $appUser->profile_id);
if (!empty($user)) {
if (!$user->hasRight(Right::API)) {
// TRANS: Authorization exception thrown when a user without API access tries to access the API.
function showConnection()
{
- $app = Oauth_application::staticGet('id', $this->connection->application_id);
+ $app = Oauth_application::getKV('id', $this->connection->application_id);
$this->out->elementStart(
'li',
function __construct($list, $cur = null, $indent = true) {
parent::__construct($cur, $indent);
$this->list = $list;
- $this->tagger = Profile::staticGet('id', $list->tagger);
+ $this->tagger = Profile::getKV('id', $list->tagger);
// TRANS: Title in atom list notice feed. %1$s is a list name, %2$s is a tagger's nickname.
$title = sprintf(_('Timeline for people in list %1$s by %2$s'), $list->tag, $this->tagger->nickname);
{
parent::__construct($out);
$this->attachment = $attachment;
- $this->oembed = File_oembed::staticGet('file_id', $this->attachment->id);
+ $this->oembed = File_oembed::getKV('file_id', $this->attachment->id);
}
function title() {
*/
function getThumbInfo()
{
- $thumbnail = File_thumbnail::staticGet('file_id', $this->attachment->id);
+ $thumbnail = File_thumbnail::getKV('file_id', $this->attachment->id);
if ($thumbnail) {
$maxWidth = common_config('attachments', 'thumb_width');
$maxHeight = common_config('attachments', 'thumb_height');
{
if($provider_name == $this->provider_name && $this->autoregistration){
$suggested_nickname = $this->suggestNicknameForUsername($nickname);
- $test_user = User::staticGet('nickname', $suggested_nickname);
+ $test_user = User::getKV('nickname', $suggested_nickname);
if($test_user) {
//someone already exists with the suggested nickname, so used the passed nickname
$suggested_nickname = common_nicknamize($nickname);
}
- $test_user = User::staticGet('nickname', $suggested_nickname);
+ $test_user = User::getKV('nickname', $suggested_nickname);
if($test_user) {
//someone already exists with the suggested nickname
//not much else we can do
if($user_username->find() && $user_username->fetch()){
$authenticated = $this->checkPassword($user_username->username, $password);
if($authenticated){
- $authenticatedUser = User::staticGet('id', $user_username->user_id);
+ $authenticatedUser = User::getKV('id', $user_username->user_id);
return false;
}
}else{
//$nickname is the username used to login
//$suggested_nickname is the nickname the auth provider suggests for that username
$suggested_nickname = $this->suggestNicknameForUsername($nickname);
- $user = User::staticGet('nickname', $suggested_nickname);
+ $user = User::getKV('nickname', $suggested_nickname);
if($user){
//make sure this user isn't claimed
$user_username = new User_username();
if(substr($this->other,0,1)=='#'){
// A specific notice_id #123
- $notice = Notice::staticGet(substr($arg,1));
+ $notice = Notice::getKV(substr($arg,1));
if (!$notice) {
// TRANS: Command exception text shown when a notice ID is requested that does not exist.
throw new CommandException(_('Notice with that id does not exist.'));
if (Validate::uri($this->other)) {
// A specific notice by URI lookup
- $notice = Notice::staticGet('uri', $arg);
+ $notice = Notice::getKV('uri', $arg);
}
if (!$notice) {
{
$user = null;
if (Event::handle('StartCommandGetUser', array($this, $arg, &$user))) {
- $user = User::staticGet('nickname', Nickname::normalize($arg));
+ $user = User::getKV('nickname', Nickname::normalize($arg));
}
Event::handle('EndCommandGetUser', array($this, $arg, &$user));
if (!$user){
// @fixme favorite notification should be triggered
// at a lower level
- $other = User::staticGet('id', $notice->profile_id);
+ $other = User::getKV('id', $notice->profile_id);
if ($other && $other->id != $this->user->id) {
if ($other->email && $other->emailnotifyfav) {
$target = $this->getProfile($this->other);
- $remote = Remote_profile::staticGet('id', $target->id);
+ $remote = Remote_profile::getKV('id', $target->id);
if ($remote) {
// TRANS: Command exception text shown when trying to subscribe to an OMB profile using the subscribe command.
throw new CommandException(_("Can't subscribe to OMB profiles by command."));
return true;
}
- $user = User::staticGet('id', $user->id);
+ $user = User::getKV('id', $user->id);
if (!$user) {
common_log(LOG_INFO, "User {$user->nickname} was deleted before we got here.");
return true;
function userFromAuthor($author)
{
- $user = User::staticGet('uri', $author->id);
+ $user = User::getKV('uri', $author->id);
if (empty($user)) {
$attrs =
return false;
}
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when trying to perform a gallery action with an unknown user.
return false;
}
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (!$local) {
- $alias = Group_alias::staticGet('alias', $nickname);
+ $alias = Group_alias::getKV('alias', $nickname);
if ($alias) {
$args = array('id' => $alias->group_id);
if ($this->page != 1) {
}
}
- $this->group = User_group::staticGet('id', $local->group_id);
+ $this->group = User_group::getKV('id', $local->group_id);
if (!$this->group) {
// TRANS: Client error displayed if no local group with a given name was found requesting group page.
{
$user_im_prefs = $this->getUserImPrefsFromScreenname($screenname);
if($user_im_prefs){
- $user = User::staticGet('id', $user_im_prefs->user_id);
+ $user = User::getKV('id', $user_im_prefs->user_id);
$user_im_prefs->free();
return $user;
}else{
$ni = $notice->whoGets();
foreach ($ni as $user_id => $reason) {
- $user = User::staticGet($user_id);
+ $user = User::getKV($user_id);
if (empty($user)) {
// either not a local user, or just not found
continue;
function onStartEnqueueNotice($notice, &$transports)
{
- $profile = Profile::staticGet($notice->profile_id);
+ $profile = Profile::getKV($notice->profile_id);
if (!$profile) {
common_log(LOG_WARNING, 'Refusing to broadcast notice with ' .
$profile = Profile::current();
}
// Note: we don't use CachingNoticeStream since RawInboxNoticeStream
- // uses Inbox::staticGet(), which is cached.
+ // uses Inbox::getKV(), which is cached.
parent::__construct(new RawInboxNoticeStream($user), $profile);
}
}
function __construct($user)
{
$this->user = $user;
- $this->inbox = Inbox::staticGet('user_id', $user->id);
+ $this->inbox = Inbox::getKV('user_id', $user->id);
}
/**
$replier_profile = null;
if ($this->notice->reply_to) {
- $reply = Notice::staticGet(intval($this->notice->reply_to));
+ $reply = Notice::getKV(intval($this->notice->reply_to));
if ($reply) {
$replier_profile = $reply->getProfile();
}
case 'api':
break;
default:
- $ns = Notice_source::staticGet($source);
+ $ns = Notice_source::getKV($source);
if ($ns) {
$source_name = '<a href="' . $ns->url . '">' . $ns->name . '</a>';
}
function mail_notify_message($message, $from=null, $to=null)
{
if (is_null($from)) {
- $from = User::staticGet('id', $message->from_profile);
+ $from = User::getKV('id', $message->from_profile);
}
if (is_null($to)) {
- $to = User::staticGet('id', $message->to_profile);
+ $to = User::getKV('id', $message->to_profile);
}
if (is_null($to->email) || !$to->emailnotifymsg) {
$admin = $group->getAdmins();
while ($admin->fetch()) {
// We need a local user for email notifications...
- $adminUser = User::staticGet('id', $admin->id);
+ $adminUser = User::getKV('id', $admin->id);
// @fixme check for email preference?
if ($adminUser && $adminUser->email) {
// use the recipient's localization
$admin = $group->getAdmins();
while ($admin->fetch()) {
// We need a local user for email notifications...
- $adminUser = User::staticGet('id', $admin->id);
+ $adminUser = User::getKV('id', $admin->id);
// @fixme check for email preference?
if ($adminUser && $adminUser->email) {
// use the recipient's localization
parent::prepare($args);
$nickname = common_canonical_nickname($this->arg('nickname'));
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
$this->page = $this->trimmed('page');
if (!$this->page) {
}
$from = $froms[0];
$addr = common_canonical_email($from['address']);
- $user = User::staticGet('email', $addr);
+ $user = User::getKV('email', $addr);
if (!$user) {
- $user = User::staticGet('smsemail', $addr);
+ $user = User::getKV('smsemail', $addr);
}
return $user;
}
function maybeAddRedir($file_id, $url)
{
- $file_redir = File_redirection::staticGet('url', $url);
+ $file_redir = File_redirection::getKV('url', $url);
if (empty($file_redir)) {
$this->out->element('span', 'device', $source_name);
break;
default:
- $ns = Notice_source::staticGet($source);
+ $ns = Notice_source::getKV($source);
if ($ns) {
$this->out->elementStart('span', 'device');
$this->out->element('a', array('href' => $ns->url,
$uri = $target->uri;
$original = null;
if (!empty($activity->context->replyToID)) {
- $original = Notice::staticGet('uri',
+ $original = Notice::getKV('uri',
$activity->context->replyToID);
}
if (!in_array($uri, $activity->context->attention) &&
if (empty($this->to_profile) &&
!empty($this->inreplyto)) {
- $notice = Notice::staticGet('id', $this->inreplyto);
+ $notice = Notice::getKV('id', $this->inreplyto);
if (!empty($notice)) {
$this->to_profile = $notice->getProfile();
}
{
parent::__construct($out);
if (!empty($notice->repeat_of)) {
- $original = Notice::staticGet('id', $notice->repeat_of);
+ $original = Notice::getKV('id', $notice->repeat_of);
if (empty($original)) { // could have been deleted
$this->notice = $notice;
} else {
function showContext()
{
if ($this->notice->hasConversation()) {
- $conv = Conversation::staticGet(
+ $conv = Conversation::getKV(
'id',
$this->notice->conversation
);
{
if (!empty($this->repeat)) {
- $repeater = Profile::staticGet('id', $this->repeat->profile_id);
+ $repeater = Profile::getKV('id', $this->repeat->profile_id);
$attrs = array('href' => $repeater->profileurl,
'class' => 'url');
parent::__construct($out);
$this->peopletag = $peopletag;
- $this->tagger = Profile::staticGet('id', $peopletag->tagger);
+ $this->tagger = Profile::getKV('id', $peopletag->tagger);
}
/**
$tag = $this->action->trimmed('tag');
if ($nickname) {
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
$user_profile = $user->getProfile();
if ($tag) {
parent::__construct($out);
$this->peopletag = $peopletag;
$this->current = $current;
- $this->profile = Profile::staticGet('id', $this->peopletag->tagger);
+ $this->profile = Profile::getKV('id', $this->peopletag->tagger);
}
/**
return false;
}
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when calling a profile action without specifying a user.
return false;
}
- $this->profile = Profile::staticGet('id', $id);
+ $this->profile = Profile::getKV('id', $id);
if (!$this->profile) {
// TRANS: Client error displayed when trying to change user options without specifying an existing user to work on.
function impossibleStream()
{
- $user = User::staticGet('id', $this->streamProfile->id);
+ $user = User::getKV('id', $this->streamProfile->id);
// If it's a private stream, and no user or not a subscriber
return true;
}
- $sn = Status_network::staticGet('nickname', $nickname);
+ $sn = Status_network::getKV('nickname', $nickname);
if (empty($sn)) {
return false;
throw new Exception("No such site nickname '$nickname'");
{
function lookup_consumer($consumerKey)
{
- $con = Consumer::staticGet('consumer_key', $consumerKey);
+ $con = Consumer::getKV('consumer_key', $consumerKey);
if (!$con) {
common_debug('Request token found.', __FILE__);
// find the app and profile associated with this token
- $tokenAssoc = Oauth_token_association::staticGet('token', $rt->tok);
+ $tokenAssoc = Oauth_token_association::getKV('token', $rt->tok);
if (!$tokenAssoc) {
throw new Exception(
*/
protected function updateSiteConfig($nickname)
{
- $sn = Status_network::staticGet('nickname', $nickname);
+ $sn = Status_network::getKV('nickname', $nickname);
if ($sn) {
$this->switchSite($nickname);
if (!in_array($nickname, $this->sites)) {
// Collapse repeats into their originals...
if ($notice->repeat_of) {
- $orig = Notice::staticGet('id', $notice->repeat_of);
+ $orig = Notice::getKV('id', $notice->repeat_of);
if ($orig) {
$notice = $orig;
}
// TRANS: Reference to the logged in user in favourite list.
array_unshift($links, _m('FAVELIST', 'You'));
} else {
- $profile = Profile::staticGet('id', $id);
+ $profile = Profile::getKV('id', $id);
if ($profile) {
$links[] = sprintf('<a href="%s">%s</a>',
htmlspecialchars($profile->profileurl),
}
break;
case 'profile':
- $profile = Profile::staticGet('id', $value);
+ $profile = Profile::getKV('id', $value);
$options['replies'] = array($profile->getUri());
if ($private) {
$options['scope'] = Notice::ADDRESSEE_SCOPE;
if (Event::handle('StartCheckPassword', array($nickname, $password, &$authenticatedUser))) {
if (common_is_email($nickname)) {
- $user = User::staticGet('email', common_canonical_email($nickname));
+ $user = User::getKV('email', common_canonical_email($nickname));
} else {
- $user = User::staticGet('nickname', common_canonical_nickname($nickname));
+ $user = User::getKV('nickname', common_canonical_nickname($nickname));
}
if (!empty($user)) {
return true;
} else if (is_string($user)) {
$nickname = $user;
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
} else if (!($user instanceof User)) {
return false;
}
return null;
}
- $rm = Remember_me::staticGet('code', $code);
+ $rm = Remember_me::getKV('code', $code);
if (!$rm) {
common_log(LOG_WARNING, 'No such remember code: ' . $code);
return null;
}
- $user = User::staticGet('id', $rm->user_id);
+ $user = User::getKV('id', $rm->user_id);
if (!$user) {
common_log(LOG_WARNING, 'No such user for rememberme: ' . $rm->user_id);
common_ensure_session();
$id = isset($_SESSION['userid']) ? $_SESSION['userid'] : false;
if ($id) {
- $user = User::staticGet($id);
+ $user = User::getKV($id);
if ($user) {
$_cur = $user;
return $_cur;
{
$mentions = array();
- $sender = Profile::staticGet('id', $notice->profile_id);
+ $sender = Profile::getKV('id', $notice->profile_id);
if (empty($sender)) {
return $mentions;
// Is it a reply?
if (!empty($notice) && !empty($notice->reply_to)) {
- $originalNotice = Notice::staticGet('id', $notice->reply_to);
+ $originalNotice = Notice::getKV('id', $notice->reply_to);
if (!empty($originalNotice)) {
- $originalAuthor = Profile::staticGet('id', $originalNotice->profile_id);
+ $originalAuthor = Profile::getKV('id', $originalNotice->profile_id);
$ids = $originalNotice->getReplies();
foreach ($ids as $id) {
- $repliedTo = Profile::staticGet('id', $id);
+ $repliedTo = Profile::getKV('id', $id);
if (!empty($repliedTo)) {
$originalMentions[$repliedTo->nickname] = $repliedTo;
}
}
if (!empty($mentioned)) {
- $user = User::staticGet('id', $mentioned->id);
+ $user = User::getKV('id', $mentioned->id);
if ($user) {
$url = common_local_url('userbyid', array('id' => $user->id));
// Check to see whether this is a known "attachment" URL.
- $f = File::staticGet('url', $longurl);
+ $f = File::getKV('url', $longurl);
if (empty($f)) {
if (common_config('attachments', 'process_links')) {
$is_attachment = true;
$attachment_id = $f->id;
- $thumb = File_thumbnail::staticGet('file_id', $f->id);
+ $thumb = File_thumbnail::getKV('file_id', $f->id);
if (!empty($thumb)) {
$has_thumb = true;
}
*/
function common_group_link($sender_id, $nickname)
{
- $sender = Profile::staticGet($sender_id);
+ $sender = Profile::getKV($sender_id);
$group = User_group::getForNickname($nickname, $sender);
if ($sender && $group && $sender->isMember($group)) {
$attrs = array('href' => $group->permalink(),
return $recipient;
}
// If this is a local user, try to find a local user with that nickname.
- $sender = User::staticGet($sender->id);
+ $sender = User::getKV($sender->id);
if ($sender) {
- $recipient_user = User::staticGet('nickname', $nickname);
+ $recipient_user = User::getKV('nickname', $nickname);
if ($recipient_user) {
return $recipient_user->getProfile();
}
if (!empty($profile)) {
if (Event::handle('StartCommonProfileURI', array($profile, &$uri))) {
- $user = User::staticGet($profile->id);
+ $user = User::getKV($profile->id);
if (!empty($user)) {
$uri = $user->uri;
}
{
// Only do this if config is enabled
if(!$this->StopLike) return true;
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if (!empty($user)) {
- $author = Profile::staticGet('id', $notice->profile_id);
+ $author = Profile::getKV('id', $notice->profile_id);
// TRANS: Text for "stopped liking" item in activity plugin.
// TRANS: %1$s is a profile URL, %2$s is a profile name,
// TRANS: %3$s is a notice URL, %4$s is an author name.
{
switch ($notice->verb) {
case ActivityVerb::FAVORITE:
- $fave = Fave::staticGet('uri', $notice->uri);
+ $fave = Fave::getKV('uri', $notice->uri);
if (!empty($fave)) {
- $notice = Notice::staticGet('id', $fave->notice_id);
+ $notice = Notice::getKV('id', $fave->notice_id);
if (!empty($notice)) {
$cur = common_current_user();
$target = $notice->asActivity($cur);
// FIXME: do something here
break;
case ActivityVerb::JOIN:
- $mem = Group_member::staticGet('uri', $notice->uri);
+ $mem = Group_member::getKV('uri', $notice->uri);
if (!empty($mem)) {
$group = $mem->getGroup();
$activity->objects = array(ActivityObject::fromGroup($group));
// FIXME: ????
break;
case ActivityVerb::FOLLOW:
- $sub = Subscription::staticGet('uri', $notice->uri);
+ $sub = Subscription::getKV('uri', $notice->uri);
if (!empty($sub)) {
- $profile = Profile::staticGet('id', $sub->subscribed);
+ $profile = Profile::getKV('id', $sub->subscribed);
if (!empty($profile)) {
$activity->objects = array(ActivityObject::fromProfile($profile));
}
$notice = $this->nli->notice;
$out = $this->nli->out;
- $mem = Group_member::staticGet('uri', $notice->uri);
+ $mem = Group_member::getKV('uri', $notice->uri);
if (!empty($mem)) {
$out->elementStart('div', 'join-activity');
}
function onNoticeDeleteRelated($notice) {
- $score = Spam_score::staticGet('notice_id', $notice->id);
+ $score = Spam_score::getKV('notice_id', $notice->id);
if (!empty($score)) {
$score->delete();
}
if (!empty($notice)) {
- $score = Spam_score::staticGet('notice_id', $notice->id);
+ $score = Spam_score::getKV('notice_id', $notice->id);
if (empty($score)) {
// If it's empty, we can train it.
if ($this->hideSpam) {
if ($bResult) {
- $score = Spam_score::staticGet('notice_id', $notice->id);
+ $score = Spam_score::getKV('notice_id', $notice->id);
if (!empty($score) && $score->is_spam) {
if (empty($profile) ||
function save($notice, $result) {
$orig = null;
- $score = Spam_score::staticGet('notice_id', $notice->id);
+ $score = Spam_score::getKV('notice_id', $notice->id);
if (empty($score)) {
$score = new Spam_score();
if ($score->find()) {
while ($score->fetch()) {
- $notice = Notice::staticGet('id', $score->notice_id);
+ $notice = Notice::getKV('id', $score->notice_id);
if (!empty($notice)) {
$orig = clone($score);
$score->notice_created = $notice->created;
printfnq("Testing user %s\n", $user->nickname);
- $profile = Profile::staticGet('id', $user->id);
+ $profile = Profile::getKV('id', $user->id);
if ($profile->isSilenced()) {
printfnq("Already silenced %s\n", $user->nickname);
printfnq("Testing user %s\n", $user->nickname);
- $profile = Profile::staticGet('id', $user->id);
+ $profile = Profile::getKV('id', $user->id);
$str = new ProfileNoticeStream($profile, $profile);
printfnq("Training user %s\n", $user->nickname);
- $profile = Profile::staticGet('id', $user->id);
+ $profile = Profile::getKV('id', $user->id);
$str = new ProfileNoticeStream($profile, $profile);
$id = $this->trimmed('notice');
- $this->notice = Notice::staticGet('id', $id);
+ $this->notice = Notice::getKV('id', $id);
if (empty($this->notice)) {
throw new ClientException(_("No such notice."));
$parts = explode('-', $anon);
$id = $parts[1];
// Do Profile lookup by ID instead of nickname for safety/performance
- $profile = Profile::staticGet('id', $id);
+ $profile = Profile::getKV('id', $id);
} else {
$profile = AnonymousFavePlugin::createAnonProfile();
// Obfuscate so it's hard to figure out the Profile ID
*/
function hasAnonFaving($item)
{
- $profile = Profile::staticGet('id', $item->notice->profile_id);
+ $profile = Profile::getKV('id', $item->notice->profile_id);
if (in_array($profile->nickname, $this->restricted)) {
return false;
}
*/
static function ensureTally($noticeID)
{
- $tally = Fave_tally::staticGet('notice_id', $noticeID);
+ $tally = Fave_tally::getKV('notice_id', $noticeID);
if (!$tally) {
$tally = new Fave_tally();
}
$id = $this->trimmed('notice');
- $notice = Notice::staticGet($id);
+ $notice = Notice::getKV($id);
$token = $this->trimmed('token-' . $notice->id);
if (!$token || $token != common_session_token()) {
}
$id = $this->trimmed('notice');
- $notice = Notice::staticGet($id);
+ $notice = Notice::getKV($id);
$token = $this->trimmed('token-' . $notice->id);
if (empty($token) || $token != common_session_token()) {
*/
function checkPassword($username, $password) {
- $user = User::staticGet('nickname', common_canonical_nickname($username));
+ $user = User::getKV('nickname', common_canonical_nickname($username));
// crypt cuts the second parameter to its appropriate length based on hash scheme
if (!empty($user) && $user->password === crypt($password, $user->password)) {
return false;
}
- $user = User::staticGet('nickname', $username);
+ $user = User::getKV('nickname', $username);
if (empty($user)) {
return false;
}
$instr = _m('Note you will initially be "sandboxed" so your posts will not appear in the public timeline.');
if (isset($this->contact)) {
- $contactuser = User::staticGet('nickname', $this->contact);
+ $contactuser = User::getKV('nickname', $this->contact);
if (!empty($contactuser)) {
$contactlink = "@<a href=\"$contactuser->uri\">$contactuser->nickname</a>";
// TRANS: User instructions after registration.
$toInsert = array_diff($newPatterns, $oldPatterns);
foreach ($toDelete as $pattern) {
- $nb = Homepage_blacklist::staticGet('pattern', $pattern);
+ $nb = Homepage_blacklist::getKV('pattern', $pattern);
if (!empty($nb)) {
$nb->delete();
}
static function ensurePattern($pattern)
{
- $hb = Homepage_blacklist::staticGet('pattern', $pattern);
+ $hb = Homepage_blacklist::getKV('pattern', $pattern);
if (empty($nb)) {
$hb = new Homepage_blacklist();
$toInsert = array_diff($newPatterns, $oldPatterns);
foreach ($toDelete as $pattern) {
- $nb = Nickname_blacklist::staticGet('pattern', $pattern);
+ $nb = Nickname_blacklist::getKV('pattern', $pattern);
if (!empty($nb)) {
$nb->delete();
}
static function ensurePattern($pattern)
{
- $nb = Nickname_blacklist::staticGet('pattern', $pattern);
+ $nb = Nickname_blacklist::getKV('pattern', $pattern);
if (empty($nb)) {
$nb = new Nickname_blacklist();
static function fromNotice($notice)
{
- return Blog_entry::staticGet('uri', $notice->uri);
+ return Blog_entry::getKV('uri', $notice->uri);
}
function getNotice()
{
- return Notice::staticGet('uri', $this->uri);
+ return Notice::getKV('uri', $this->uri);
}
function asActivityObject()
{
$this->id = $this->trimmed('id');
- $this->entry = Blog_entry::staticGet('id', $this->id);
+ $this->entry = Blog_entry::getKV('id', $this->id);
if (empty($this->entry)) {
// TRANS: Client exception thrown when referring to a non-existing blog entry.
*/
static function getByNotice($notice)
{
- return self::staticGet('uri', $notice->uri);
+ return self::getKV('uri', $notice->uri);
}
/**
}
if (array_key_exists('uri', $options)) {
- $other = Bookmark::staticGet('uri', $options['uri']);
+ $other = Bookmark::getKV('uri', $options['uri']);
if (!empty($other)) {
// TRANS: Client exception thrown when trying to save a new bookmark that already exists.
throw new ClientException(_m('Bookmark already exists.'));
// Use user's preferences for short URLs, if possible
try {
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
$shortUrl = File_redirection::makeShort($url,
empty($user) ? null : $user);
if (!empty($other)) {
$options['replies'][] = $replyURI;
} else {
- $group = User_group::staticGet('uri', $replyURI);
+ $group = User_group::getKV('uri', $replyURI);
if (!empty($group)) {
$options['groups'][] = $replyURI;
}
// @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;
{
assert($obj->type == ActivityObject::BOOKMARK);
- $bm = Bookmark::staticGet('uri', $obj->id);
+ $bm = Bookmark::getKV('uri', $obj->id);
if (empty($bm)) {
throw new ServerException("Unknown bookmark: " . $obj->id);
throw new ClientException(_('Invalid URL.'), 400);
}
- $f = File::staticGet('url', $this->url);
+ $f = File::getKV('url', $this->url);
if (empty($url)) {
$f = File::processNew($this->url);
// How about now?
if (!empty($f)) {
- $this->oembed = File_oembed::staticGet('file_id', $f->id);
+ $this->oembed = File_oembed::getKV('file_id', $f->id);
if (!empty($this->oembed)) {
$this->title = $this->oembed->title;
}
- $this->thumbnail = File_thumbnail::staticGet('file_id', $f->id);
+ $this->thumbnail = File_thumbnail::getKV('file_id', $f->id);
}
return true;
$out->elementStart('ul', array('class' => 'bookmark-tags'));
foreach ($replies as $reply) {
- $other = Profile::staticGet('id', $reply);
+ $other = Profile::getKV('id', $reply);
if (!empty($other)) {
$out->elementStart('li');
$out->element('a', array('rel' => 'tag',
$nickname = $nickname[1]['nickname'];
}
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when trying to display bookmarks for a non-existing user.
parent::prepare($args);
$nickname = $this->trimmed('nickname');
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when trying to get the RSS feed with bookmarks of a user that does not exist.
*/
function handle($data)
{
- $profile = Profile::staticGet('id', $data['profile_id']);
+ $profile = Profile::getKV('id', $data['profile_id']);
try {
$saved = Bookmark::saveNew($profile,
{
parent::prepare($argarray);
- $this->file = File::staticGet('id', $this->trimmed('id'));
+ $this->file = File::getKV('id', $this->trimmed('id'));
if (empty($this->file)) {
// TRANS: Client exception thrown when an unknown URL is provided.
{
$this->id = $this->trimmed('id');
- $this->bookmark = Bookmark::staticGet('id', $this->id);
+ $this->bookmark = Bookmark::getKV('id', $this->id);
if (empty($this->bookmark)) {
// TRANS: Client exception thrown when referring to a non-existing bookmark.
throw new ClientException(_m('No such bookmark.'), 404);
}
- $notice = Notice::staticGet('uri', $this->bookmark->uri);
+ $notice = Notice::getKV('uri', $this->bookmark->uri);
if (empty($notice)) {
// Did we used to have it, and it got deleted?
{
if (get_class($action) == 'ShownoticeAction') {
- $profile = Profile::staticGet('id', $action->notice->profile_id);
+ $profile = Profile::getKV('id', $action->notice->profile_id);
if ($this->isAllowedRichEdit($profile)) {
return;
}
- $profile = Profile::staticGet('id', $noticeListItem->notice->profile_id);
+ $profile = Profile::getKV('id', $noticeListItem->notice->profile_id);
if ($this->isAllowedRichEdit($profile)) {
$noticeUrl = $noticeListItem->notice->bestUrl();
private function isAllowedRichEdit($profile)
{
if ($this->restricted) {
- $user = User::staticGet($profile->id);
+ $user = User::getKV($profile->id);
return !empty($user) && $user->hasRole('richedit');
} else {
return true;
}
try {
- $sn = Status_network::staticGet('nickname', $nickname);
+ $sn = Status_network::getKV('nickname', $nickname);
} catch (Exception $e) {
$this->log(LOG_ERR, $e->getMessage());
return;
static function nicknameAvailable($nickname)
{
- $sn = Status_network::staticGet('nickname', $nickname);
+ $sn = Status_network::getKV('nickname', $nickname);
if (!empty($sn)) {
return false;
}
- $usn = Unavailable_status_network::staticGet('nickname', $nickname);
+ $usn = Unavailable_status_network::getKV('nickname', $nickname);
if (!empty($usn)) {
return false;
}
$snt = Status_network_tag::withTag('domain='.$domain);
while ($snt->fetch()) {
- $sn = Status_network::staticGet('site_id', $snt->site_id);
+ $sn = Status_network::getKV('site_id', $snt->site_id);
if (!empty($sn)) {
return $sn;
}
StatusNet::switchSite($sn->nickname);
- $user = User::staticGet('email', $email);
+ $user = User::getKV('email', $email);
return !empty($user);
}
StatusNet::switchSite($sn->nickname);
- $user = User::staticGet('email', $email);
+ $user = User::getKV('email', $email);
if (empty($user)) {
throw new ClientException(_('No such user.'));
// Re-fetch; stupid auto-increment integer isn't working
- $sn = Status_network::staticGet('nickname', $sn->nickname);
+ $sn = Status_network::getKV('nickname', $sn->nickname);
if (empty($sn)) {
throw new ServerException("Created {$this->nickname} status_network and could not find it again.");
{
if(strpos($nickname, '@'))
{
- $user = User::staticGet('email',$nickname);
+ $user = User::getKV('email',$nickname);
if($user && isset($user->email))
{
if(common_check_user($user->nickname,$password))
static function registerEmail($email)
{
- $old = User::staticGet('email', $email);
+ $old = User::getKV('email', $email);
if (!empty($old)) {
// TRANS: Error text when trying to register with an already registered e-mail address.
$n = 0;
- while (User::staticGet('nickname', $nickname)) {
+ while (User::getKV('nickname', $nickname)) {
$n++;
$nickname = $original . $n;
}
throw new ClientException(_m('No confirmation code.'));
}
- $this->invitation = Invitation::staticGet('code', $this->code);
+ $this->invitation = Invitation::getKV('code', $this->code);
if (!empty($this->invitation)) {
if (!empty($this->invitation->registered_user_id)) {
}
} else {
- $this->confirmation = Confirm_address::staticGet('code', $this->code);
+ $this->confirmation = Confirm_address::getKV('code', $this->code);
if (empty($this->confirmation)) {
// TRANS: Client exception thrown when given confirmation code was not issued.
}
$this->state = self::NEWREGISTER;
} else {
- $this->invitation = Invitation::staticGet('code', $this->code);
+ $this->invitation = Invitation::getKV('code', $this->code);
if (!empty($this->invitation)) {
if (!empty($this->invitation->registered_user_id)) {
// TRANS: Client exception trown when using an invitation multiple times.
$this->state = self::CONFIRMINVITE;
} else {
$this->state = self::CONFIRMREGISTER;
- $this->confirmation = Confirm_address::staticGet('code', $this->code);
+ $this->confirmation = Confirm_address::getKV('code', $this->code);
if (empty($this->confirmation)) {
// TRANS: Client exception thrown when given confirmation code was not issued.
$inviterurl = null;
if ($type == UserInviteReminderHandler::INVITE_REMINDER) {
- $user = User::staticGet($object->user_id);
+ $user = User::getKV($object->user_id);
if (!empty($user)) {
$profile = $user->getProfile();
$inviter = $profile->getBestName();
if (!empty($user)) {
- $ess = Email_summary_status::staticGet('user_id', $user->id);
+ $ess = Email_summary_status::getKV('user_id', $user->id);
if (empty($ess)) {
*/
static function getSendSummary($user_id)
{
- $ess = Email_summary_status::staticGet('user_id', $user_id);
+ $ess = Email_summary_status::getKV('user_id', $user_id);
if (!empty($ess)) {
return $ess->send_summary;
*/
static function getLastSummaryID($user_id)
{
- $ess = Email_summary_status::staticGet('user_id', $user_id);
+ $ess = Email_summary_status::getKV('user_id', $user_id);
if (!empty($ess)) {
return $ess->last_summary_id;
{
// Skip if they've asked not to get summaries
- $ess = Email_summary_status::staticGet('user_id', $user_id);
+ $ess = Email_summary_status::getKV('user_id', $user_id);
if (!empty($ess) && !$ess->send_summary) {
common_log(LOG_INFO, sprintf('Not sending email summary for user %s by request.', $user_id));
$since_id = $ess->last_summary_id;
}
- $user = User::staticGet('id', $user_id);
+ $user = User::getKV('id', $user_id);
if (empty($user)) {
common_log(LOG_INFO, sprintf('Not sending email summary for user %s; no such user.', $user_id));
'style' => 'border: none; border-collapse: collapse;', 'cellpadding' => '6'));
while ($notice->fetch()) {
- $profile = Profile::staticGet('id', $notice->profile_id);
+ $profile = Profile::getKV('id', $notice->profile_id);
if (empty($profile)) {
continue;
common_date_string($notice->created));
$out->elementEnd('a');
if ($notice->hasConversation()) {
- $conv = Conversation::staticGet('id', $notice->conversation);
+ $conv = Conversation::getKV('id', $notice->conversation);
$convurl = $conv->uri;
if (!empty($convurl)) {
$out->text(' ');
function handle($notice)
{
- $profile = Profile::staticGet($notice->profile_id);
+ $profile = Profile::getKV($notice->profile_id);
$this->log(LOG_INFO, "Posting Notice ".$notice->id." from ".$profile->nickname);
case RSVP::POSITIVE:
case RSVP::NEGATIVE:
case RSVP::POSSIBLE:
- $happening = Happening::staticGet('uri', $happeningObj->id);
+ $happening = Happening::getKV('uri', $happeningObj->id);
if (empty($happening)) {
// FIXME: save the event
// TRANS: Exception thrown when trying to RSVP for an unknown event.
static function saveNew($profile, $start_time, $end_time, $title, $location, $description, $url, $options=array())
{
if (array_key_exists('uri', $options)) {
- $other = Happening::staticGet('uri', $options['uri']);
+ $other = Happening::getKV('uri', $options['uri']);
if (!empty($other)) {
// TRANS: Client exception thrown when trying to create an event that already exists.
throw new ClientException(_m('Event already exists.'));
function getNotice()
{
- return Notice::staticGet('uri', $this->uri);
+ return Notice::getKV('uri', $this->uri);
}
static function fromNotice($notice)
{
- return Happening::staticGet('uri', $notice->uri);
+ return Happening::getKV('uri', $notice->uri);
}
function getRSVPs()
function saveNew($profile, $event, $verb, $options=array())
{
if (array_key_exists('uri', $options)) {
- $other = RSVP::staticGet('uri', $options['uri']);
+ $other = RSVP::getKV('uri', $options['uri']);
if (!empty($other)) {
// TRANS: Client exception thrown when trying to save an already existing RSVP ("please respond").
throw new ClientException(_m('RSVP already exists.'));
function getNotice()
{
- $notice = Notice::staticGet('uri', $this->uri);
+ $notice = Notice::getKV('uri', $this->uri);
if (empty($notice)) {
// TRANS: Server exception thrown when requesting a non-exsting notice for an RSVP ("please respond").
// TRANS: %s is the RSVP with the missing notice.
static function fromNotice($notice)
{
- return RSVP::staticGet('uri', $notice->uri);
+ return RSVP::getKV('uri', $notice->uri);
}
static function forEvent($event)
RSVP::POSSIBLE => array());
foreach ($ids as $id) {
- $rsvp = RSVP::staticGet('id', $id);
+ $rsvp = RSVP::getKV('id', $id);
if (!empty($rsvp)) {
$verb = self::verbFor($rsvp->response);
$rsvps[$verb][] = $rsvp;
function getProfile()
{
- $profile = Profile::staticGet('id', $this->profile_id);
+ $profile = Profile::getKV('id', $this->profile_id);
if (empty($profile)) {
// TRANS: Exception thrown when requesting a non-existing profile.
// TRANS: %s is the ID of the non-existing profile.
function getEvent()
{
- $event = Happening::staticGet('id', $this->event_id);
+ $event = Happening::getKV('id', $this->event_id);
if (empty($event)) {
// TRANS: Exception thrown when requesting a non-existing event.
// TRANS: %s is the ID of the non-existing event.
function asHTML()
{
- $event = Happening::staticGet('id', $this->event_id);
+ $event = Happening::getKV('id', $this->event_id);
return self::toHTML($this->getProfile(),
$event,
function asString()
{
- $event = Happening::staticGet('id', $this->event_id);
+ $event = Happening::getKV('id', $this->event_id);
return self::toString($this->getProfile(),
$event,
throw new ClientException(_m('No such RSVP.'));
}
- $this->rsvp = RSVP::staticGet('id', $rsvpId);
+ $this->rsvp = RSVP::getKV('id', $rsvpId);
if (empty($this->rsvp)) {
// TRANS: Client exception thrown when referring to a non-existing RSVP ("please respond") item.
throw new ClientException(_m('No such RSVP.'));
}
- $this->event = Happening::staticGet('id', $this->rsvp->event_id);
+ $this->event = Happening::getKV('id', $this->rsvp->event_id);
if (empty($this->event)) {
// TRANS: Client exception thrown when referring to a non-existing event.
throw new ClientException(_m('No such event.'));
}
- $this->event = Happening::staticGet('id', $eventId);
+ $this->event = Happening::getKV('id', $eventId);
if (empty($this->event)) {
// TRANS: Client exception thrown when referring to a non-existing event.
{
$this->id = $this->trimmed('id');
- $this->event = Happening::staticGet('id', $this->id);
+ $this->event = Happening::getKV('id', $this->id);
if (empty($this->event)) {
// TRANS: Client exception thrown when referring to a non-existing event.
{
$this->id = $this->trimmed('id');
- $this->rsvp = RSVP::staticGet('id', $this->id);
+ $this->rsvp = RSVP::getKV('id', $this->id);
if (empty($this->rsvp)) {
// TRANS: Client exception thrown when referring to a non-existing RSVP.
}
function onEndShowAccountProfileBlock(HTMLOutputter $out, Profile $profile) {
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if ($user) {
$url = common_local_url('profiledetail', array('nickname' => $user->nickname));
// TRANS: Link text on user profile page leading to extended profile page.
return;
}
- $invite = Invitation::staticGet($code);
+ $invite = Invitation::getKV($code);
if (empty($invite)) {
// TRANS: Client error trying to register with an invalid invitation code.
return;
}
- if (User::staticGet('nickname', $nickname)) {
+ if (User::getKV('nickname', $nickname)) {
// TRANS: Form validation error displayed when picking a nickname that is already in use.
$this->showForm(_m('Nickname already in use. Try another one.'));
return;
return;
}
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
$this->tryLinkUser($user);
return false;
}
- if (User::staticGet('nickname', $str)) {
+ if (User::getKV('nickname', $str)) {
return false;
}
function isNewEmail($email)
{
// we shouldn't have to validate the format
- $result = User::staticGet('email', $email);
+ $result = User::getKV('email', $email);
if (empty($result)) {
return true;
*/
static function saveNew($notice_id, $item_id)
{
- $n2i = Notice_to_item::staticGet('notice_id', $notice_id);
+ $n2i = Notice_to_item::getKV('notice_id', $notice_id);
if (!empty($n2i)) {
return $n2i;
}
- $n2i = Notice_to_item::staticGet('item_id', $item_id);
+ $n2i = Notice_to_item::getKV('item_id', $item_id);
if (!empty($n2i)) {
return $n2i;
*/
static function facebookStatusId($notice)
{
- $n2i = Notice_to_item::staticGet('notice_id', $notice->id);
+ $n2i = Notice_to_item::getKV('notice_id', $notice->id);
if (empty($n2i)) {
return null;
*/
function streamRemove()
{
- $n2i = Notice_to_item::staticGet('notice_id', $this->notice->id);
+ $n2i = Notice_to_item::getKV('notice_id', $this->notice->id);
if (!empty($this->flink) && !empty($n2i)) {
try {
*/
function like()
{
- $n2i = Notice_to_item::staticGet('notice_id', $this->notice->id);
+ $n2i = Notice_to_item::getKV('notice_id', $this->notice->id);
if (!empty($this->flink) && !empty($n2i)) {
try {
*/
function unLike()
{
- $n2i = Notice_to_item::staticGet('notice_id', $this->notice->id);
+ $n2i = Notice_to_item::getKV('notice_id', $this->notice->id);
if (!empty($this->flink) && !empty($n2i)) {
try {
static function followEveryone($user_id)
{
- $ufep = self::staticGet('user_id', $user_id);
+ $ufep = self::getKV('user_id', $user_id);
if (empty($ufep)) {
return true;
static function savePref($user_id, $followEveryone)
{
- $ufep = self::staticGet('user_id', $user_id);
+ $ufep = self::getKV('user_id', $user_id);
if (empty($ufep)) {
$ufep = new User_followeveryone_prefs();
public static function getByNotice($notice)
{
- return self::staticGet('uri', $notice->uri);
+ return self::getKV('uri', $notice->uri);
}
public function getNotice()
{
- return Notice::staticGet('uri', $this->uri);
+ return Notice::getKV('uri', $this->uri);
}
public static function schemaDef()
function onEndNoticeAsActivity($notice, &$activity)
{
common_log(LOG_INFO, 'photo plugin: EndNoticeAsActivity');
- $photo = GNUsocialPhoto::staticGet('notice_id', $notice->id);
+ $photo = GNUsocialPhoto::getKV('notice_id', $notice->id);
if(!$photo) {
common_log(LOG_INFO, 'not a photo.');
return true;
function onStartShowNoticeItem($action)
{
- $photo = GNUsocialPhoto::staticGet('notice_id', $action->notice->id);
+ $photo = GNUsocialPhoto::getKV('notice_id', $action->notice->id);
if($photo) {
$action->out->elementStart('div', 'entry-title');
$action->showAuthor();
$args = $this->returnToArgs();
$this->user = common_current_user();
$this->photoid = $args[1]['photoid'];
- $this->photo = GNUsocialPhoto::staticGet('id', $this->photoid);
+ $this->photo = GNUsocialPhoto::getKV('id', $this->photoid);
return true;
}
$profile_id = $cur->id;
- $album = GNUsocialPhotoAlbum::staticGet('album_id', $this->trimmed('album'));
+ $album = GNUsocialPhotoAlbum::getKV('album_id', $this->trimmed('album'));
if ($album->profile_id != $profile_id) {
$this->showForm(_('Error: This is not your album!'));
return;
//For redirection
$oldalbum = $this->album_id;
- $notice = Notice::staticGet('id', $this->photo->notice_id);
+ $notice = Notice::getKV('id', $this->photo->notice_id);
$this->photo->delete();
$args = $this->returnToArgs();
$this->photoid = $args[1]['photoid'];
- $this->photo = GNUsocialPhoto::staticGet('id', $this->photoid);
- $this->notice = Notice::staticGet('id', $this->photo->notice_id);
+ $this->photo = GNUsocialPhoto::getKV('id', $this->photoid);
+ $this->notice = Notice::getKV('id', $this->photo->notice_id);
- $this->user = Profile::staticGet('id', $this->notice->profile_id);
+ $this->user = Profile::getKV('id', $this->notice->profile_id);
$notices = Notice::conversationStream((int)$this->notice->conversation, null, null);
$this->conversation = new ConversationTree($notices, $this);
if (common_valid_profile_tag($username) == 0) {
$this->user = null;
} else {
- $this->user = Profile::staticGet('nickname', $username);
+ $this->user = Profile::getKV('nickname', $username);
}
return true;
}
function showAlbum($album_id)
{
- $album = GNUSocialPhotoAlbum::staticGet('album_id', $album_id);
+ $album = GNUSocialPhotoAlbum::getKV('album_id', $album_id);
if (!$album) {
return;
}
$thumb_uri = 'http://' . common_config('site', 'server') . '/file/thumb.' . $filename;
$profile_id = $cur->id;
- $album = GNUsocialPhotoAlbum::staticGet('album_id', $this->trimmed('album'));
+ $album = GNUsocialPhotoAlbum::getKV('album_id', $this->trimmed('album'));
if ($album->profile_id != $profile_id) {
$this->showForm(_('Error: This is not your album!'));
return;
if(empty($cur)) return;
$album_id = $this->trimmed('album');
- $album = GNUsocialPhotoAlbum::staticGet('album_id', $album_id);
+ $album = GNUsocialPhotoAlbum::getKV('album_id', $album_id);
if (empty($album)) {
$this->showForm(_('This album does not exist or has been deleted.'));
return;
}
//Check if the album has any photos in it before deleting
- $photos = GNUsocialPhoto::staticGet('album_id', $album_id);
+ $photos = GNUsocialPhoto::getKV('album_id', $album_id);
if(empty($photos)) {
$album->delete();
$this->showForm(_('Album deleted'), true);
function getPageLink()
{
- $profile = Profile::StaticGet('id', $this->profile_id);
+ $profile = Profile::getKV('id', $this->profile_id);
return '/' . $profile->nickname . '/photos/' . $this->album_id;
}
function getThumbUri()
{
- $photo = GNUsocialPhoto::staticGet('album_id', $this->album_id);
+ $photo = GNUsocialPhoto::getKV('album_id', $this->album_id);
if (empty($photo))
return '/theme/default/default-avatar-profile.png'; //For now...
return $photo->thumb_uri;
static function newAlbum($profile_id, $album_name, $album_description)
{
//TODO: Should use foreign key instead...
- if (!Profile::staticGet('id', $profile_id)){
+ if (!Profile::getKV('id', $profile_id)){
//Is this a bit extreme?
throw new ServerException(_m('No such user exists with id ' . $profile_id . ', couldn\'t create album.'));
}
parent::prepare($args);
$args = $this->returnToArgs();
- $this->profile = Profile::staticGet('nickname', $args[1]['nickname']);
+ $this->profile = Profile::getKV('nickname', $args[1]['nickname']);
//die(print_r($this->profile));
gnusocial_profile_merge($this->profile);
$this->avatar = $this->profile->getAvatar(96);
function saveSettings()
{
- $field = GNUsocialProfileExtensionField::staticGet('id', $this->trimmed('id'));
+ $field = GNUsocialProfileExtensionField::getKV('id', $this->trimmed('id'));
if (!$field)
$field = new GNUsocialProfileExtensionField();
$field->title = $this->trimmed('title');
$fieldsettitle = _("New Profile Field");
//Edit a field
if ($this->out->trimmed('edit')) {
- $field = GNUsocialProfileExtensionField::staticGet('id', $this->out->trimmed('edit'));
+ $field = GNUsocialProfileExtensionField::getKV('id', $this->out->trimmed('edit'));
$title = $field->title;
$description = $field->description;
$type = $field->type;
public static function getByNotice($notice)
{
- return self::staticGet('uri', $notice->uri);
+ return self::getKV('uri', $notice->uri);
}
public function getNotice()
{
- return Notice::staticGet('uri', $this->uri);
+ return Notice::getKV('uri', $this->uri);
}
public static function schemaDef()
{
OwnerDesignAction::prepare($args);
$this->id = $this->trimmed('id');
- $this->vid = Video::staticGet('id', $this->id);
+ $this->vid = Video::getKV('id', $this->id);
if (empty($this->vid)) {
throw new ClientException(_('No such video.'), 404);
throw new ClientException(_('No such video'), 404);
}
- $this->user = User::staticGet('id', $this->vid->profile_id);
+ $this->user = User::getKV('id', $this->vid->profile_id);
if (empty($this->user)) {
throw new ClientException(_('No such user.'), 404);
$gps = null;
if (!empty($form->group)) {
- $gps = Group_privacy_settings::staticGet('group_id', $form->group->id);
+ $gps = Group_privacy_settings::getKV('group_id', $form->group->id);
}
$form->out->elementStart('li');
$gps = null;
if (!empty($action->group)) {
- $gps = Group_privacy_settings::staticGet('group_id', $action->group->id);
+ $gps = Group_privacy_settings::getKV('group_id', $action->group->id);
}
$orig = null;
"but group ".$group->nickname." does not allow them.");
}
- $user = User::staticGet('id', $notice->profile_id);
+ $user = User::getKV('id', $notice->profile_id);
if (empty($user)) {
common_log(LOG_WARNING,
function distribute()
{
- $group = User_group::staticGet('id', $this->to_group);
+ $group = User_group::getKV('id', $this->to_group);
$member = $group->getMembers();
function getGroup()
{
- $group = User_group::staticGet('id', $this->to_group);
+ $group = User_group::getKV('id', $this->to_group);
if (empty($group)) {
// TRANS: Exception thrown when trying to send group private message to a non-existing group.
throw new ServerException(_m('No group for group message.'));
function getSender()
{
- $sender = Profile::staticGet('id', $this->from_profile);
+ $sender = Profile::getKV('id', $this->from_profile);
if (empty($sender)) {
// TRANS: Exception thrown when trying to send group private message without having a sender.
throw new ServerException(_m('No sender for group message.'));
function notifyByMail()
{
- $to = User::staticGet('id', $this->to_profile);
+ $to = User::getKV('id', $this->to_profile);
if (empty($to) || is_null($to->email) || !$to->emailnotifymsg) {
return true;
}
- $gm = Group_message::staticGet('id', $this->group_message_id);
+ $gm = Group_message::getKV('id', $this->group_message_id);
- $from_profile = Profile::staticGet('id', $gm->from_profile);
+ $from_profile = Profile::getKV('id', $gm->from_profile);
$group = $gm->getGroup();
function forGroup($group)
{
- $gps = Group_privacy_settings::staticGet('group_id', $group->id);
+ $gps = Group_privacy_settings::getKV('group_id', $group->id);
if (empty($gps)) {
// make a fake one with defaults
return false;
}
- $localGroup = Local_group::staticGet('nickname', $nickname);
+ $localGroup = Local_group::getKV('nickname', $nickname);
if (empty($localGroup)) {
// TRANS: Client exception thrown when trying to view group inbox for non-existing group.
throw new ClientException(_m('No such group.'), 404);
}
- $this->group = User_group::staticGet('id', $localGroup->group_id);
+ $this->group = User_group::getKV('id', $localGroup->group_id);
if (empty($this->group)) {
// TRANS: Client exception thrown when trying to view group inbox for non-existing group.
return false;
}
- $localGroup = Local_group::staticGet('nickname', $nickname);
+ $localGroup = Local_group::getKV('nickname', $nickname);
if (empty($localGroup)) {
// TRANS: Client exception thrown when trying to send a private group message to a non-existing group.
throw new ClientException(_m('No such group.'), 404);
}
- $this->group = User_group::staticGet('id', $localGroup->group_id);
+ $this->group = User_group::getKV('id', $localGroup->group_id);
if (empty($this->group)) {
// TRANS: Client exception thrown when trying to send a private group message to a non-existing group.
$id = $this->trimmed('id');
- $this->gm = Group_message::staticGet('id', $id);
+ $this->gm = Group_message::getKV('id', $id);
if (empty($this->gm)) {
// TRANS: Client exception thrown when trying to view a non-existing group private message.
throw new ClientException(_m('No such message.'), 404);
}
- $this->group = User_group::staticGet('id', $this->gm->to_group);
+ $this->group = User_group::getKV('id', $this->gm->to_group);
if (empty($this->group)) {
// TRANS: Server exception thrown when trying to view group private messages for a non-exsting group.
throw new ClientException(_m('Cannot read message.'), 403);
}
- $this->sender = Profile::staticGet('id', $this->gm->from_profile);
+ $this->sender = Profile::getKV('id', $this->gm->from_profile);
if (empty($this->sender)) {
// TRANS: Server exception thrown when trying to view a group private message without a sender.
return false;
}
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed when referring to a non-existing user.
$arr['source'] = $arr['source'];
if (!empty($notice->reply_to)) {
- $reply_to = Notice::staticGet('id', $notice->reply_to);
+ $reply_to = Notice::getKV('id', $notice->reply_to);
if (!empty($reply_to)) {
$arr['in_reply_to_status_url'] = $reply_to->bestUrl();
}
$action->element('td', null, sprintf(($ml->is_grant) ? _('+%s') : _('-%s'), $ml->role));
$action->elementStart('td');
if ($ml->moderator_id) {
- $mod = Profile::staticGet('id', $ml->moderator_id);
+ $mod = Profile::getKV('id', $ml->moderator_id);
if (empty($mod)) {
$action->text(_('[unknown]'));
} else {
*/
protected function showProfileOptions(HTMLOutputter $out, $profile)
{
- $isRemote = !(User::staticGet('id', $profile->id));
+ $isRemote = !(User::getKV('id', $profile->id));
if ($isRemote) {
$target = common_local_url('remoteprofile', array('id' => $profile->id));
// TRANS: Label for access to remote profile options.
$id = $this->arg('id');
$this->user = false;
- $this->profile = Profile::staticGet('id', $id);
+ $this->profile = Profile::getKV('id', $id);
if (!$this->profile) {
// TRANS: Error message displayed when referring to a user without a profile.
return false;
}
- $user = User::staticGet('id', $this->profile->id);
+ $user = User::getKV('id', $this->profile->id);
if ($user) {
// This is a local user -- send to their regular profile.
$url = common_local_url('showstream', array('nickname' => $user->nickname));
*/
function onNoticeDeleteRelated($notice)
{
- $nt = Notice_title::staticGet('notice_id', $notice->id);
+ $nt = Notice_title::getKV('notice_id', $notice->id);
if (!empty($nt)) {
$nt->delete();
*/
static function fromNotice($notice)
{
- $nt = Notice_title::staticGet('notice_id', $notice->id);
+ $nt = Notice_title::getKV('notice_id', $notice->id);
if (empty($nt)) {
return null;
} else {
*/
function onStartGetProfileUri($profile, &$uri)
{
- $remote = Remote_profile::staticGet('id', $this->id);
+ $remote = Remote_profile::getKV('id', $this->id);
if (!empty($remote)) {
$uri = $remote->uri;
return false;
*/
function onStartShowProfileListSubscribeButton($action)
{
- $remote = Remote_profile::staticGet('id', $action->profile->id);
+ $remote = Remote_profile::getKV('id', $action->profile->id);
if (empty($remote)) {
false;
}
// OMB 0.1 doesn't have a mechanism for local-server-
// originated subscription.
- $omb01 = Remote_profile::staticGet('id', $other_id);
+ $omb01 = Remote_profile::getKV('id', $other_id);
if (!empty($omb01)) {
throw new ClientException(
// OMB 0.1 doesn't have a mechanism for local-server-
// originated tag.
- $omb01 = Remote_profile::staticGet('id', $tagged_profile->id);
+ $omb01 = Remote_profile::getKV('id', $tagged_profile->id);
if (!empty($omb01)) {
$this->clientError(
// OMB 0.1 doesn't have a mechanism for local-server-
// originated tag.
- $omb01 = Remote_profile::staticGet('id', $ptag->tagged);
+ $omb01 = Remote_profile::getKV('id', $ptag->tagged);
if (!empty($omb01)) {
$this->clientError(
*/
function onStartGetProfileFromURI($uri, &$profile)
{
- $remote_profile = Remote_profile::staticGet('uri', $uri);
+ $remote_profile = Remote_profile::getKV('uri', $uri);
if (!empty($remote_profile)) {
- $profile = Profile::staticGet('id', $remote_profile->profile_id);
+ $profile = Profile::getKV('id', $remote_profile->profile_id);
return false;
}
*/
function onStartCommonProfileURI($profile, &$uri)
{
- $remote = Remote_profile::staticGet($profile->id);
+ $remote = Remote_profile::getKV($profile->id);
if ($remote) {
$uri = $remote->uri;
return false;
/* Create user objects for both users. Do it early for request
validation. */
- $user = User::staticGet('uri', $service->getListeneeURI());
+ $user = User::getKV('uri', $service->getListeneeURI());
if (!$user) {
// TRANS: Client error displayed when subscribing to a remote profile that does not exist.
return;
}
- $other = User::staticGet('uri', $service->getListenerURI());
+ $other = User::getKV('uri', $service->getListenerURI());
if ($other) {
// TRANS: Client error displayed when subscribing to a remote profile that is a local profile.
return;
}
- $remote = Remote_profile::staticGet('uri', $service->getListenerURI());
+ $remote = Remote_profile::getKV('uri', $service->getListenerURI());
if ($remote) {
// Note remote profile may not have been saved yet.
// @fixme not convinced this is correct at all!
- $profile = Profile::staticGet($remote->id);
+ $profile = Profile::getKV($remote->id);
if ($user->hasBlocked($profile)) {
// TRANS: Client error displayed when subscribing to a remote profile that is blocked form subscribing to.
/* The service URLs are not accessible from datastore, so setting them
after insertion of the profile. */
- $remote = Remote_profile::staticGet('uri', $service->getListenerURI());
+ $remote = Remote_profile::getKV('uri', $service->getListenerURI());
$orig_remote = clone($remote);
$remote->postnoticeurl =
return;
}
- $user = User::staticGet('nickname', $this->nickname);
+ $user = User::getKV('nickname', $this->nickname);
$this->profile_url = $this->trimmed('profile_url');
if ($service->getServiceURI(OAUTH_ENDPOINT_REQUEST) ==
common_local_url('requesttoken') ||
- User::staticGet('uri', $service->getRemoteUserURI())) {
+ User::getKV('uri', $service->getRemoteUserURI())) {
// TRANS: Form validation error on page for remote subscribe.
$this->showForm(_('That is a local profile! Login to subscribe.'));
return;
$nickname = $_GET['omb_listenee_nickname'];
$profile = $_GET['omb_listenee_profile'];
- $user = User::staticGet('uri', $listener);
+ $user = User::getKV('uri', $listener);
if (!$user) {
// TRANS: Exception thrown when no valid user is found for an authorisation request.
// TRANS: %s is a listener URI.
$listenee));
}
- $other = User::staticGet('uri', $listenee);
+ $other = User::getKV('uri', $listenee);
if ($other) {
// TRANS: Exception thrown when listenee URI is a local user for an authorisation request.
// TRANS: %s is a listenee URI.
$listenee));
}
- $remote = Remote_profile::staticGet('uri', $listenee);
+ $remote = Remote_profile::getKV('uri', $listenee);
if ($remote) {
$sub = new Subscription();
$sub->subscriber = $user->id;
{
parent::prepare($args);
$nickname = $this->trimmed('nickname');
- $this->user = User::staticGet('nickname', $nickname);
+ $this->user = User::getKV('nickname', $nickname);
if (!$this->user) {
// TRANS: Client error displayed providing a non-existing nickname.
$this->clientError(_('No such user.'));
function omb_broadcast_profile($profile)
{
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if (!$user) {
return false;
function notice_to_omb_notice($notice)
{
/* Create an OMB_Notice for $notice. */
- $user = User::staticGet('id', $notice->profile_id);
+ $user = User::getKV('id', $notice->profile_id);
if (!$user) {
return null;
// We keep a record of who's contacted us
function lookup_consumer($consumer_key)
{
- $con = Consumer::staticGet('consumer_key', $consumer_key);
+ $con = Consumer::getKV('consumer_key', $consumer_key);
if (!$con) {
$con = new Consumer();
$con->consumer_key = $consumer_key;
common_debug('request token "'.$rt->tok.'" updated', __FILE__);
// Update subscription
// XXX: mixing levels here
- $sub = Subscription::staticGet('token', $rt->tok);
+ $sub = Subscription::getKV('token', $rt->tok);
if (!$sub) {
return null;
}
public function getProfile($identifier_uri) {
/* getProfile is only used for remote profiles by libomb.
@TODO: Make it work with local ones anyway. */
- $remote = Remote_profile::staticGet('uri', $identifier_uri);
+ $remote = Remote_profile::getKV('uri', $identifier_uri);
if (!$remote) throw new Exception('No such remote profile');
- $profile = Profile::staticGet('id', $remote->id);
+ $profile = Profile::getKV('id', $remote->id);
if (!$profile) throw new Exception('No profile for remote user');
require_once dirname(__FILE__) . '/omb.php';
$omb_profile->getProfileURL()) {
throw new Exception('Not implemented');
} else {
- $remote = Remote_profile::staticGet('uri', $omb_profile->getIdentifierURI());
+ $remote = Remote_profile::getKV('uri', $omb_profile->getIdentifierURI());
if ($remote) {
$exists = true;
- $profile = Profile::staticGet($remote->id);
+ $profile = Profile::getKV($remote->id);
$orig_remote = clone($remote);
$orig_profile = clone($profile);
// XXX: compare current postNotice and updateProfile URLs to the ones
* @access public
**/
public function saveNotice(&$omb_notice) {
- if (Notice::staticGet('uri', $omb_notice->getIdentifierURI())) {
+ if (Notice::getKV('uri', $omb_notice->getIdentifierURI())) {
// TRANS: Exception thrown when a notice is denied because it has been sent before.
throw new Exception(_('Duplicate notice.'));
}
$author_uri = $omb_notice->getAuthor()->getIdentifierURI();
common_log(LOG_DEBUG, $author_uri, __FILE__);
- $author = Remote_profile::staticGet('uri', $author_uri);
+ $author = Remote_profile::getKV('uri', $author_uri);
if (!$author) {
- $author = User::staticGet('uri', $author_uri);
+ $author = User::getKV('uri', $author_uri);
}
if (!$author) {
throw new Exception('No such user.');
private function _getAnyProfile($uri)
{
- $user = Remote_profile::staticGet('uri', $uri);
+ $user = Remote_profile::getKV('uri', $uri);
if (!$user) {
- $user = User::staticGet('uri', $uri);
+ $user = User::getKV('uri', $uri);
}
if (!$user) {
throw new Exception('No such user.');
if ($subscribed instanceof User) {
mail_subscribe_notify_profile($subscribed,
- Profile::staticGet($subscriber->id));
+ Profile::getKV($subscriber->id));
}
}
}
function is_remote($notice)
{
- $user = User::staticGet($notice->profile_id);
+ $user = User::getKV($notice->profile_id);
return is_null($user);
}
}
*/
function onStartFeedSubReceive($feedsub, $feed)
{
- $oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
+ $oprofile = Ostatus_profile::getKV('feeduri', $feedsub->uri);
if ($oprofile) {
$oprofile->processFeed($feed, 'push');
} else {
*/
function onFeedSubSubscriberCount($feedsub, &$count)
{
- $oprofile = Ostatus_profile::staticGet('feeduri', $feedsub->uri);
+ $oprofile = Ostatus_profile::getKV('feeduri', $feedsub->uri);
if ($oprofile) {
$count += $oprofile->subscriberCount();
}
*/
function onStartSubscribe($subscriber, $other)
{
- $user = User::staticGet('id', $subscriber->id);
+ $user = User::getKV('id', $subscriber->id);
if (empty($user)) {
return true;
}
- $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $other->id);
if (empty($oprofile)) {
return true;
*/
function onEndSubscribe($subscriber, $other)
{
- $user = User::staticGet('id', $subscriber->id);
+ $user = User::getKV('id', $subscriber->id);
if (empty($user)) {
return true;
}
- $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $other->id);
if (empty($oprofile)) {
return true;
*/
function onEndUnsubscribe($profile, $other)
{
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if (empty($user)) {
return true;
}
- $oprofile = Ostatus_profile::staticGet('profile_id', $other->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $other->id);
if (empty($oprofile)) {
return true;
*/
function onStartJoinGroup($group, $profile)
{
- $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
+ $oprofile = Ostatus_profile::getKV('group_id', $group->id);
if ($oprofile) {
if (!$oprofile->subscribe()) {
// TRANS: Exception thrown when setup of remote group membership fails.
*/
function onEndLeaveGroup($group, $profile)
{
- $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
+ $oprofile = Ostatus_profile::getKV('group_id', $group->id);
if ($oprofile) {
// Drop the PuSH subscription if there are no other subscribers.
$oprofile->garbageCollect();
function onStartSubscribePeopletag($peopletag, $user)
{
- $oprofile = Ostatus_profile::staticGet('peopletag_id', $peopletag->id);
+ $oprofile = Ostatus_profile::getKV('peopletag_id', $peopletag->id);
if ($oprofile) {
if (!$oprofile->subscribe()) {
// TRANS: Exception thrown when setup of remote list subscription fails.
}
$sub = $user->getProfile();
- $tagger = Profile::staticGet($peopletag->tagger);
+ $tagger = Profile::getKV($peopletag->tagger);
$act = new Activity();
$act->id = TagURI::mint('subscribe_peopletag:%d:%d:%s',
function onEndUnsubscribePeopletag($peopletag, $user)
{
- $oprofile = Ostatus_profile::staticGet('peopletag_id', $peopletag->id);
+ $oprofile = Ostatus_profile::getKV('peopletag_id', $peopletag->id);
if ($oprofile) {
// Drop the PuSH subscription if there are no other subscribers.
$oprofile->garbageCollect();
- $sub = Profile::staticGet($user->id);
- $tagger = Profile::staticGet($peopletag->tagger);
+ $sub = Profile::getKV($user->id);
+ $tagger = Profile::getKV($peopletag->tagger);
$act = new Activity();
$act->id = TagURI::mint('unsubscribe_peopletag:%d:%d:%s',
*/
function onEndFavorNotice(Profile $profile, Notice $notice)
{
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if (empty($user)) {
return true;
}
- $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $notice->profile_id);
if (empty($oprofile)) {
return true;
*/
function onEndTagProfile($ptag)
{
- $oprofile = Ostatus_profile::staticGet('profile_id', $ptag->tagged);
+ $oprofile = Ostatus_profile::getKV('profile_id', $ptag->tagged);
if (empty($oprofile)) {
return true;
$act = new Activity();
$tagger = $plist->getTagger();
- $tagged = Profile::staticGet('id', $ptag->tagged);
+ $tagged = Profile::getKV('id', $ptag->tagged);
$act->verb = ActivityVerb::TAG;
$act->id = TagURI::mint('tag_profile:%d:%d:%s',
*/
function onEndUntagProfile($ptag)
{
- $oprofile = Ostatus_profile::staticGet('profile_id', $ptag->tagged);
+ $oprofile = Ostatus_profile::getKV('profile_id', $ptag->tagged);
if (empty($oprofile)) {
return true;
$act = new Activity();
$tagger = $plist->getTagger();
- $tagged = Profile::staticGet('id', $ptag->tagged);
+ $tagged = Profile::getKV('id', $ptag->tagged);
$act->verb = ActivityVerb::UNTAG;
$act->id = TagURI::mint('untag_profile:%d:%d:%s',
*/
function onEndDisfavorNotice(Profile $profile, Notice $notice)
{
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if (empty($user)) {
return true;
}
- $oprofile = Ostatus_profile::staticGet('profile_id', $notice->profile_id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $notice->profile_id);
if (empty($oprofile)) {
return true;
function onStartGetProfileUri($profile, &$uri)
{
- $oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $profile->id);
if (!empty($oprofile)) {
$uri = $oprofile->uri;
return false;
function onStartUserGroupPermalink($group, &$url)
{
- $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
+ $oprofile = Ostatus_profile::getKV('group_id', $group->id);
if ($oprofile) {
// @fixme this should probably be in the user_group table
// @fixme this uri not guaranteed to be a profile page
*/
function onEndBroadcastProfile(Profile $profile)
{
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
// Find foreign accounts I'm subscribed to that support Salmon pings.
//
{
if (!common_logged_in()) {
- $profileUser = User::staticGet('id', $item->profile->id);
+ $profileUser = User::getKV('id', $item->profile->id);
if (!empty($profileUser)) {
*/
public static function localGroupFromUrl($url)
{
- $group = User_group::staticGet('uri', $url);
+ $group = User_group::getKV('uri', $url);
if ($group) {
- $local = Local_group::staticGet('group_id', $group->id);
+ $local = Local_group::getKV('group_id', $group->id);
if ($local) {
return $group->id;
}
public function onStartProfileGetAtomFeed($profile, &$feed)
{
- $oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $profile->id);
if (empty($oprofile)) {
return true;
// Don't want to do Web-based discovery on our own server,
// so we check locally first.
- $user = User::staticGet('uri', $uri);
+ $user = User::getKV('uri', $uri);
if (!empty($user)) {
$profile = $user->getProfile();
'href' => $salmon_url);
// Get this user's keypair
- $magickey = Magicsig::staticGet('user_id', $user->id);
+ $magickey = Magicsig::getKV('user_id', $user->id);
if (!$magickey) {
// No keypair yet, let's generate one.
$magickey = new Magicsig();
$this->clientError(_m('No ID.'));
}
- $this->group = User_group::staticGet('id', $id);
+ $this->group = User_group::getKV('id', $id);
if (empty($this->group)) {
// TRANS: Client error.
$this->target = $this->group;
- $oprofile = Ostatus_profile::staticGet('group_id', $id);
+ $oprofile = Ostatus_profile::getKV('group_id', $id);
if ($oprofile) {
// TRANS: Client error.
$this->clientError(_m('Cannot accept remote posts for a remote group.'));
function targetProfile()
{
if ($this->nickname) {
- $user = User::staticGet('nickname', $this->nickname);
+ $user = User::getKV('nickname', $this->nickname);
if ($user) {
return common_local_url('userbyid', array('id' => $user->id));
} else {
$this->clientError(_m('No such user.'));
}
} else if ($this->group) {
- $group = Local_group::staticGet('nickname', $this->group);
+ $group = Local_group::getKV('nickname', $this->group);
if ($group) {
return common_local_url('groupbyid', array('id' => $group->group_id));
} else {
$this->clientError(_m('No such group.'));
}
} else if ($this->peopletag && $this->tagger) {
- $user = User::staticGet('nickname', $this->tagger);
+ $user = User::getKV('nickname', $this->tagger);
if (empty($user)) {
// TRANS: Client error.
$this->clientError(_m('No such user.'));
$this->clientError(_m('No ID.'));
}
- $this->peopletag = Profile_list::staticGet('id', $id);
+ $this->peopletag = Profile_list::getKV('id', $id);
if (empty($this->peopletag)) {
// TRANS: Client error displayed when referring to a non-existing list.
$this->clientError(_m('No such list.'));
}
- $oprofile = Ostatus_profile::staticGet('peopletag_id', $id);
+ $oprofile = Ostatus_profile::getKV('peopletag_id', $id);
if (!empty($oprofile)) {
// TRANS: Client error displayed when trying to send a message to a remote list.
throw new ServerException(_m('Empty or invalid feed id.'), 400);
}
- $feedsub = FeedSub::staticGet('id', $feedid);
+ $feedsub = FeedSub::getKV('id', $feedid);
if (!$feedsub) {
// TRANS: Server exception. %s is a feed ID.
throw new ServerException(sprintf(_m('Unknown PuSH feed id %s'),$feedid), 400);
throw new ClientException(sprintf(_m('Bad hub.mode "$s".',$mode)), 404);
}
- $feedsub = FeedSub::staticGet('uri', $topic);
+ $feedsub = FeedSub::getKV('uri', $topic);
if (!$feedsub) {
// TRANS: Client exception. %s is an invalid feed name.
throw new ClientException(sprintf(_m('Bad hub.topic feed "%s".'),$topic), 404);
throw new ClientException(sprintf(_m('Invalid hub.secret "%s". It must be under 200 bytes.'),$secret));
}
- $sub = HubSub::staticGet($topic, $callback);
+ $sub = HubSub::getKV($topic, $callback);
if (!$sub) {
// Creating a new one!
$sub = new HubSub();
$groupFeed = common_local_url('ApiTimelineGroup', $params);
if ($feed == $userFeed) {
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (!$user) {
// TRANS: Client exception. %s is a feed URL.
throw new ClientException(sprintt(_m('Invalid hub.topic "%s". User does not exist.'),$feed));
}
}
if ($feed == $groupFeed) {
- $user = User_group::staticGet('id', $id);
+ $user = User_group::getKV('id', $id);
if (!$user) {
// TRANS: Client exception. %s is a feed URL.
throw new ClientException(sprintf(_m('Invalid hub.topic "%s". Group does not exist.'),$feed));
$listFeed = common_local_url('ApiTimelineList', $params);
if ($feed == $listFeed) {
- $list = Profile_list::staticGet('id', $id);
- $user = User::staticGet('id', $user);
+ $list = Profile_list::getKV('id', $id);
+ $user = User::getKV('id', $user);
if (!$list || !$user || $list->tagger != $user->id) {
// TRANS: Client exception. %s is a feed URL.
throw new ClientException(sprintf(_m('Invalid hub.topic %s; list does not exist.'),$feed));
*/
protected function getSub($feed, $callback)
{
- return HubSub::staticGet($feed, $callback);
+ return HubSub::getKV($feed, $callback);
}
}
$this->clientError(_m('No ID.'));
}
- $this->user = User::staticGet('id', $id);
+ $this->user = User::getKV('id', $id);
if (empty($this->user)) {
// TRANS: Client error displayed when referring to a non-existing user.
$context = $this->activity->context;
if (!empty($context->replyToID)) {
- $notice = Notice::staticGet('uri', $context->replyToID);
+ $notice = Notice::getKV('uri', $context->replyToID);
if (empty($notice)) {
// TRANS: Client exception.
throw new ClientException(_m('In reply to unknown notice.'));
throw new ClientException(_m('Not to anyone in reply to anything.'));
}
- $existing = Notice::staticGet('uri', $this->activity->objects[0]->id);
+ $existing = Notice::getKV('uri', $this->activity->objects[0]->id);
if (!empty($existing)) {
common_log(LOG_ERR, "Not saving notice '{$existing->uri}'; already exists.");
return false;
}
// this is a peopletag
- $tagged = User::staticGet('uri', $this->activity->objects[0]->id);
+ $tagged = User::getKV('uri', $this->activity->objects[0]->id);
if (empty($tagged)) {
// TRANS: Client exception.
return false;
}
// this is a peopletag
- $tagged = User::staticGet('uri', $this->activity->objects[0]->id);
+ $tagged = User::getKV('uri', $this->activity->objects[0]->id);
if (empty($tagged)) {
// TRANS: Client exception.
throw new ClientException(_m('Cannot handle that kind of object for liking/faving.'));
}
- $notice = Notice::staticGet('uri', $object->id);
+ $notice = Notice::getKV('uri', $object->id);
if (empty($notice)) {
// TRANS: Client exception. %s is an object ID.
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 static function ensureFeed($feeduri)
{
- $current = self::staticGet('uri', $feeduri);
+ $current = self::getKV('uri', $feeduri);
if ($current) {
return $current;
}
throw new ClientException(sprintf(_m('Hub subscriber verification returned HTTP %s.'),$status));
}
- $old = HubSub::staticGet($this->topic, $this->callback);
+ $old = HubSub::getKV($this->topic, $this->callback);
if ($mode == 'subscribe') {
if ($old) {
$this->update($old);
// destroy the result data for the parent query.
// @fixme use clone() again when it's safe to copy an
// individual item from a multi-item query again.
- $sub = HubSub::staticGet($this->topic, $this->callback);
+ $sub = HubSub::getKV($this->topic, $this->callback);
$data = array('sub' => $sub,
'atom' => $atom,
'retries' => $retries);
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();
*/
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 (?)
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.'));
// 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
while (count($pushCallbacks) && $n < self::ROLLING_BATCH) {
$n++;
$callback = array_shift($pushCallbacks);
- $sub = HubSub::staticGet($topic, $callback);
+ $sub = HubSub::getKV($topic, $callback);
if (!$sub) {
common_log(LOG_ERR, "Skipping PuSH delivery for deleted(?) consumer $callback on $topic");
continue;
assert($notice instanceof Notice);
$this->notice = $notice;
- $this->user = User::staticGet('id', $notice->profile_id);
+ $this->user = User::getKV('id', $notice->profile_id);
try {
$profile = $this->notice->getProfile();
$this->pushUser();
foreach ($notice->getGroups() as $group) {
- $oprofile = Ostatus_profile::staticGet('group_id', $group->id);
+ $oprofile = Ostatus_profile::getKV('group_id', $group->id);
if ($oprofile) {
$this->pingReply($oprofile);
} else {
}
foreach ($notice->getReplies() as $profile_id) {
- $oprofile = Ostatus_profile::staticGet('profile_id', $profile_id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $profile_id);
if ($oprofile) {
$this->pingReply($oprofile);
}
}
if (!empty($this->notice->reply_to)) {
- $replyTo = Notice::staticGet('id', $this->notice->reply_to);
+ $replyTo = Notice::getKV('id', $this->notice->reply_to);
if (!empty($replyTo)) {
foreach($replyTo->getReplies() as $profile_id) {
- $oprofile = Ostatus_profile::staticGet('profile_id', $profile_id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $profile_id);
if ($oprofile) {
$this->pingReply($oprofile);
}
}
foreach ($notice->getProfileTags() as $ptag) {
- $oprofile = Ostatus_profile::staticGet('peopletag_id', $ptag->id);
+ $oprofile = Ostatus_profile::getKV('peopletag_id', $ptag->id);
if (!$oprofile) {
$this->pushPeopletag($ptag);
}
function groupFeedForNotice($group_id)
{
- $group = User_group::staticGet('id', $group_id);
+ $group = User_group::getKV('id', $group_id);
$atom = new AtomGroupNoticeFeed($group);
$atom->addEntryFromNotice($this->notice);
$post = $data['post'];
$hmac = $data['hmac'];
- $feedsub = FeedSub::staticGet('id', $feedsub_id);
+ $feedsub = FeedSub::getKV('id', $feedsub_id);
if ($feedsub) {
try {
$feedsub->receive($post, $hmac);
{
$magic_env = new $class();
- $user = User::staticGet('id', $actor->id);
+ $user = User::getKV('id', $actor->id);
if ($user->id) {
// Use local key
- $magickey = Magicsig::staticGet('user_id', $user->id);
+ $magickey = Magicsig::getKV('user_id', $user->id);
if (!$magickey) {
// No keypair yet, let's generate one.
$magickey = new Magicsig();
assert(is_string($data['salmonuri']));
assert(is_string($data['entry']));
- $actor = Profile::staticGet($data['actor']);
+ $actor = Profile::getKV($data['actor']);
$salmon = new Salmon();
$salmon->post($data['salmonuri'], $data['entry'], $actor);
'href' => $salmon_url);
// Get this user's keypair
- $magickey = Magicsig::staticGet('user_id', $this->user->id);
+ $magickey = Magicsig::getKV('user_id', $this->user->id);
if (!$magickey) {
// No keypair yet, let's generate one.
$magickey = new Magicsig();
echo " - skipping\n";
} else {
echo " - removing bogus ostatus_profile entry...";
- $evil = Ostatus_profile::staticGet('uri', $uri);
+ $evil = Ostatus_profile::getKV('uri', $uri);
$evil->delete();
echo " ok\n";
}
echo " - skipping\n";
} else {
echo " - removing bogus ostatus_profile entry...";
- $evil = Ostatus_profile::staticGet('uri', $uri);
+ $evil = Ostatus_profile::getKV('uri', $uri);
$evil->delete();
echo " ok\n";
}
$uri = $group->uri;
if (preg_match('!/group/(\d+)/id!', $uri, $matches)) {
$id = intval($matches[1]);
- $local = Local_group::staticGet('group_id', $id);
+ $local = Local_group::getKV('group_id', $id);
if ($local) {
$nick = $local->nickname;
} else {
echo " - skipping\n";
} else {
echo " - removing bogus user_group entry...";
- $evil = User_group::staticGet('id', $group->id);
+ $evil = User_group::getKV('id', $group->id);
$evil->delete();
echo " ok\n";
}
$uri = $oprofile->uri;
if (preg_match('!/group/(\d+)/id!', $oprofile->uri, $matches)) {
$id = intval($matches[1]);
- $group = Local_group::staticGet('group_id', $id);
+ $group = Local_group::getKV('group_id', $id);
if ($group) {
$nick = $group->nickname;
} else {
echo "group $id ($nick) hidden by $uri";
} else if (preg_match('!/user/(\d+)!', $uri, $matches)) {
$id = intval($matches[1]);
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if ($user) {
$nick = $user->nickname;
} else {
$feedurl = $args[0];
-$sub = FeedSub::staticGet('uri', $feedurl);
+$sub = FeedSub::getKV('uri', $feedurl);
if (!$sub) {
print "Feed $feedurl is not subscribed.\n";
exit(1);
print "Could not confirm.\n";
}
-$sub2 = FeedSub::staticGet('uri', $feedurl);
+$sub2 = FeedSub::getKV('uri', $feedurl);
print "\n";
print "New state:\n";
$count = have_option('count') ? intval(get_option_value('count')) : 0;
-$sub = FeedSub::staticGet('uri', $feedurl);
+$sub = FeedSub::getKV('uri', $feedurl);
if (!$sub) {
print "Feed $feedurl is not subscribed.\n";
exit(1);
}
function fixProfile($uri) {
- $oprofile = Ostatus_profile::staticGet('uri', $uri);
+ $oprofile = Ostatus_profile::getKV('uri', $uri);
if (!$oprofile) {
print "No OStatus remote profile known for URI $uri\n";
$uri = $args[0];
-$oprofile = Ostatus_profile::staticGet('uri', $uri);
+$oprofile = Ostatus_profile::getKV('uri', $uri);
if (!$oprofile) {
print "No OStatus remote profile known for URI $uri\n";
print "Could not confirm.\n";
}
-$o2 = Ostatus_profile::staticGet('uri', $uri);
+$o2 = Ostatus_profile::getKV('uri', $uri);
print "\n";
print "New profile state:\n";
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (empty($user)) {
throw new Exception("Can't find user with id '$id'.");
}
updateOStatus($user);
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (empty($user)) {
throw new Exception("Can't find user with nickname '$nickname'.");
}
$rps = array();
while ($sp->fetch()) {
- $remote = Remote_profile::staticGet('id', $sp->id);
+ $remote = Remote_profile::getKV('id', $sp->id);
if (!empty($remote)) {
$rps[] = clone($sp);
$notice_id = get_option_value('--notice');
-$notice = Notice::staticGet('id', $notice_id);
+$notice = Notice::getKV('id', $notice_id);
$profile = $notice->getProfile();
$entry = $notice->asAtomEntry(true);
{
$userId = $object;
- $user = User::staticGet($userId);
+ $user = User::getKV($userId);
common_log(LOG_INFO, "Making backup file for user ".$user->nickname);
function onOtherAccountProfiles($profile, &$links)
{
- $prefs = User_openid_prefs::staticGet('user_id', $profile->id);
+ $prefs = User_openid_prefs::getKV('user_id', $profile->id);
if (empty($prefs) || !$prefs->hide_profile_link) {
if (common_config('site', 'inviteonly')) {
$code = $_SESSION['invitecode'];
if ($code) {
- $invite = Invitation::staticGet($code);
+ $invite = Invitation::getKV($code);
if ($invite && $invite->address_type == 'email') {
return $invite->address;
return;
}
- $invite = Invitation::staticGet($code);
+ $invite = Invitation::getKV($code);
if (empty($invite)) {
// TRANS: OpenID plugin message. No new user registration is allowed on the site without an invitation code, and the one provided was not valid.
return;
}
- if (User::staticGet('nickname', $nickname)) {
+ if (User::getKV('nickname', $nickname)) {
// TRANS: OpenID plugin message. The entered new user name is already used.
$this->showForm(_m('Nickname already in use. Try another one.'));
return;
// They're legit!
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
list($display, $canonical, $sreg) = $this->getSavedValues();
if (!User::allowed_nickname($str)) {
return false;
}
- if (User::staticGet('nickname', $str)) {
+ if (User::getKV('nickname', $str)) {
return false;
}
return true;
function oid_get_user($openid_url)
{
$user = null;
- $oid = User_openid::staticGet('canonical', $openid_url);
+ $oid = User_openid::getKV('canonical', $openid_url);
if ($oid) {
- $user = User::staticGet('id', $oid->user_id);
+ $user = User::getKV('id', $oid->user_id);
}
return $user;
}
'value' => _m('BUTTON','Remove')));
$this->elementEnd('fieldset');
- $prefs = User_openid_prefs::staticGet('user_id', $user->id);
+ $prefs = User_openid_prefs::getKV('user_id', $user->id);
$this->elementStart('fieldset');
$this->element('legend', null, _m('LEGEND','Preferences'));
{
$openid_url = $this->trimmed('openid_url');
- $oid = User_openid::staticGet('canonical', $openid_url);
+ $oid = User_openid::getKV('canonical', $openid_url);
if (!$oid) {
// TRANS: Form validation error for a non-existing OpenID.
}
$orig = null;
- $prefs = User_openid_prefs::staticGet('user_id', $cur->id);
+ $prefs = User_openid_prefs::getKV('user_id', $cur->id);
if (empty($prefs)) {
$prefs = new User_openid_prefs();
*/
static function getByNotice($notice)
{
- return self::staticGet('uri', $notice->uri);
+ return self::getKV('uri', $notice->uri);
}
function getOptions()
function getNotice()
{
- return Notice::staticGet('uri', $this->uri);
+ return Notice::getKV('uri', $this->uri);
}
function bestUrl()
// TRANS: Exception thrown trying to respond to a poll without a poll reference.
throw new Exception(_m('Invalid poll response: No poll reference.'));
}
- $poll = Poll::staticGet('uri', $pollUri);
+ $poll = Poll::getKV('uri', $pollUri);
if (!$poll) {
// TRANS: Exception thrown trying to respond to a non-existing poll.
throw new Exception(_m('Invalid poll response: Poll is unknown.'));
function onEndNoticeWhoGets($notice, &$ni) {
if ($notice->object_type == self::POLL_RESPONSE_OBJECT) {
foreach ($ni as $id => $source) {
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (!empty($user)) {
- $pollPrefs = User_poll_prefs::staticGet('user_id', $user->id);
+ $pollPrefs = User_poll_prefs::getKV('user_id', $user->id);
if (!empty($pollPrefs) && ($pollPrefs->hide_responses)) {
unset($ni[$id]);
}
*/
static function getByNotice($notice)
{
- return self::staticGet('uri', $notice->uri);
+ return self::getKV('uri', $notice->uri);
}
/**
*/
function getNotice()
{
- return Notice::staticGet('uri', $this->uri);
+ return Notice::getKV('uri', $this->uri);
}
function bestUrl()
*/
function getPoll()
{
- return Poll::staticGet('id', $this->poll_id);
+ return Poll::getKV('id', $this->poll_id);
}
/**
* Save a new poll notice
{
$user = common_current_user();
- $prefs = User_poll_prefs::staticGet('user_id', $user->id);
+ $prefs = User_poll_prefs::getKV('user_id', $user->id);
$form = new PollPrefsForm($this, $prefs);
{
$user = common_current_user();
- $upp = User_poll_prefs::staticGet('user_id', $user->id);
+ $upp = User_poll_prefs::getKV('user_id', $user->id);
$orig = null;
if (!empty($upp)) {
}
$id = $this->trimmed('id');
- $this->poll = Poll::staticGet('id', $id);
+ $this->poll = Poll::getKV('id', $id);
if (empty($this->poll)) {
// TRANS: Client exception thrown trying to respond to a non-existing poll.
throw new ClientException(_m('Invalid or missing poll.'), 404);
{
$this->id = $this->trimmed('id');
- $this->poll = Poll::staticGet('id', $this->id);
+ $this->poll = Poll::getKV('id', $this->id);
if (empty($this->poll)) {
// TRANS: Client exception thrown trying to view a non-existing poll.
);
break;
case Answer::ObjectType:
- $question = QnA_Question::staticGet('uri', $questionObj->id);
+ $question = QnA_Question::getKV('uri', $questionObj->id);
if (empty($question)) {
// FIXME: save the question
// TRANS: Exception thrown when answering a non-existing question.
$class .= ' limited-scope';
}
- $question = QnA_Question::staticGet('uri', $nli->notice->uri);
+ $question = QnA_Question::getKV('uri', $nli->notice->uri);
if (!empty($question->closed)) {
$class .= ' closed';
$cls = array('hentry', 'notice', 'answer');
- $answer = QnA_Answer::staticGet('uri', $nli->notice->uri);
+ $answer = QnA_Answer::getKV('uri', $nli->notice->uri);
if (!empty($answer) && !empty($answer->best)) {
$cls[] = 'best';
}
$id = substr($this->trimmed('id'), 9);
- $this->question = QnA_Question::staticGet('id', $id);
+ $this->question = QnA_Question::getKV('id', $id);
if (empty($this->question)) {
// TRANS: Client exception thrown trying to respond to a non-existing question.
throw new ClientException(_m('Invalid or missing question.'), 404);
$id = substr($this->trimmed('id'), 9);
- $this->question = QnA_Question::staticGet('id', $id);
+ $this->question = QnA_Question::getKV('id', $id);
if (empty($this->question)) {
throw new ClientException(
$id = substr($this->trimmed('id'), 7);
- $this->answer = QnA_Answer::staticGet('id', $id);
+ $this->answer = QnA_Answer::getKV('id', $id);
$this->question = $this->answer->getQuestion();
if (empty($this->answer) || empty($this->question)) {
$this->id = $this->trimmed('id');
- $this->answer = QnA_Answer::staticGet('id', $this->id);
+ $this->answer = QnA_Answer::getKV('id', $this->id);
if (empty($this->answer)) {
// TRANS: Client exception thrown when requesting a non-existing answer.
throw new ClientException(_m('No question for this answer.'), 404);
}
- $this->notice = Notice::staticGet('uri', $this->answer->uri);
+ $this->notice = Notice::getKV('uri', $this->answer->uri);
if (empty($this->notice)) {
// TRANS: Did we used to have it, and it got deleted?
throw new ClientException(_m('No such answer.'), 404);
}
- $this->user = User::staticGet('id', $this->answer->profile_id);
+ $this->user = User::getKV('id', $this->answer->profile_id);
if (empty($this->user)) {
// TRANS: Client exception thrown when requesting answer data for a non-existing user.
$this->id = $this->trimmed('id');
- $this->question = QnA_Question::staticGet('id', $this->id);
+ $this->question = QnA_Question::getKV('id', $this->id);
if (empty($this->question)) {
// TRANS: Client exception thrown trying to view a non-existing question.
throw new ClientException(_m('No such question notice.'), 404);
}
- $this->user = User::staticGet('id', $this->question->profile_id);
+ $this->user = User::getKV('id', $this->question->profile_id);
if (empty($this->user)) {
// TRANS: Client exception thrown trying to view a question of a non-existing user.
}
$id = $this->trimmed('id');
- $this->question = QnA_Question::staticGet('id', $id);
+ $this->question = QnA_Question::getKV('id', $id);
if (empty($this->question)) {
// TRANS: Client exception thrown trying to respond to a non-existing question.
throw new ClientException(_m('Invalid or missing question.'), 404);
*/
static function getByNotice($notice)
{
- $answer = self::staticGet('uri', $notice->uri);
+ $answer = self::getKV('uri', $notice->uri);
if (empty($answer)) {
throw new Exception("No answer with URI {$notice->uri}");
}
*/
function getNotice()
{
- return Notice::staticGet('uri', $this->uri);
+ return Notice::getKV('uri', $this->uri);
}
static function fromNotice($notice)
{
- return QnA_Answer::staticGet('uri', $notice->uri);
+ return QnA_Answer::getKV('uri', $notice->uri);
}
function bestUrl()
*/
function getQuestion()
{
- $question = QnA_Question::staticGet('id', $this->question_id);
+ $question = QnA_Question::getKV('id', $this->question_id);
if (empty($question)) {
// TRANS: Exception thown when getting a question with a non-existing ID.
// TRANS: %s is the non-existing question ID.
function getProfile()
{
- $profile = Profile::staticGet('id', $this->profile_id);
+ $profile = Profile::getKV('id', $this->profile_id);
if (empty($profile)) {
// TRANS: Exception thown when getting a profile with a non-existing ID.
// TRANS: %s is the non-existing profile ID.
*/
static function getByNotice($notice)
{
- return self::staticGet('uri', $notice->uri);
+ return self::getKV('uri', $notice->uri);
}
function getNotice()
{
- return Notice::staticGet('uri', $this->uri);
+ return Notice::getKV('uri', $this->uri);
}
function bestUrl()
function getProfile()
{
- $profile = Profile::staticGet('id', $this->profile_id);
+ $profile = Profile::getKV('id', $this->profile_id);
if (empty($profile)) {
// TRANS: Exception trown when getting a profile for a non-existing ID.
// TRANS: %s is the provided profile ID.
static function fromNotice($notice)
{
- return QnA_Question::staticGet('uri', $notice->uri);
+ return QnA_Question::getKV('uri', $notice->uri);
}
function asHTML()
$valid = '%^' . $path . '(?<id>.*)\.rss$%';
if (preg_match($valid, $feed, $matches)) {
- $user = User::staticGet('id', $matches['id']);
+ $user = User::getKV('id', $matches['id']);
if (!empty($user)) {
return $user;
}
var $created; // datestamp()
var $modified; // timestamp() not_null default_CURRENT_TIMESTAMP
- function staticGet($k,$v=NULL) { return DB_DataObject::staticGet('DataObjects_Grp',$k,$v); }
+ static function getKV($k,$v=NULL) { return DB_DataObject::staticGet('DataObjects_Grp',$k,$v); }
function table()
{
return true;
}
- $user = User::staticGet('id', $notice->profile_id);
+ $user = User::getKV('id', $notice->profile_id);
if (!empty($user)) {
$paths[] = array('showstream', $user->nickname, null);
$ni = $notice->whoGets();
foreach (array_keys($ni) as $user_id) {
- $user = User::staticGet('id', $user_id);
+ $user = User::getKV('id', $user_id);
$paths[] = array('all', $user->nickname, null);
}
if ($reply->find()) {
while ($reply->fetch()) {
- $user = User::staticGet('id', $reply->profile_id);
+ $user = User::getKV('id', $reply->profile_id);
if (!empty($user)) {
$paths[] = array('replies', $user->nickname, null);
}
if ($gi->find()) {
while ($gi->fetch()) {
- $ug = User_group::staticGet('id', $gi->group_id);
+ $ug = User_group::getKV('id', $gi->group_id);
$paths[] = array('showgroup', $ug->nickname, null);
}
}
if (is_null($channel->user_id)) {
$profile = null;
} else {
- $profile = Profile::staticGet('id', $channel->user_id);
+ $profile = Profile::getKV('id', $channel->user_id);
}
if ($notice->inScope($profile)) {
$this->log(LOG_INFO,
// Add needed repeat data
if (!empty($notice->repeat_of)) {
- $original = Notice::staticGet('id', $notice->repeat_of);
+ $original = Notice::getKV('id', $notice->repeat_of);
if (!empty($original)) {
$arr['retweeted_status']['url'] = $original->bestUrl();
$arr['retweeted_status']['html'] = htmlspecialchars($original->rendered);
$convurl = null;
if ($notice->hasConversation()) {
- $conv = Conversation::staticGet(
+ $conv = Conversation::getKV(
'id',
$notice->conversation
);
$keys = $rc->fetchAll();
foreach ($keys as $key) {
- $rc = Realtime_channel::staticGet('channel_key', $key);
+ $rc = Realtime_channel::getKV('channel_key', $key);
if (!empty($rc)) {
printfv("Deleting realtime channel '$key'\n");
$rc->delete();
throw new ClientException(_m('No channel key argument.'));
}
- $this->channel = Realtime_channel::staticGet('channel_key', $this->channelKey);
+ $this->channel = Realtime_channel::getKV('channel_key', $this->channelKey);
if (empty($this->channel)) {
// TRANS: Client exception thrown when referring to a non-existing channel.
throw new ClientException(_m('No channel key argument.'));
}
- $this->channel = Realtime_channel::staticGet('channel_key', $this->channelKey);
+ $this->channel = Realtime_channel::getKV('channel_key', $this->channelKey);
if (empty($this->channel)) {
// TRANS: Client exception thrown when referring to a non-existing channel.
if ($this->silenced) {
$ids = Registration_ip::usersByIP($ipaddress);
foreach ($ids as $id) {
- $profile = Profile::staticGet('id', $id);
+ $profile = Profile::getKV('id', $id);
if ($profile && $profile->isSilenced()) {
// TRANS: Exception thrown when attempting to register from an IP address from which silenced users have registered.
throw new Exception(_m('A banned user has registered from this address.'));
return true;
}
- $ri = Registration_ip::staticGet('user_id', $profile->id);
+ $ri = Registration_ip::getKV('user_id', $profile->id);
if (empty($ri)) {
return true;
continue;
}
- $other = Profile::staticGet('id', $id);
+ $other = Profile::getKV('id', $id);
if (empty($other)) {
continue;
*/
function onStartNoticeSave($notice)
{
- $user = User::staticGet('id', $notice->profile_id);
+ $user = User::getKV('id', $notice->profile_id);
if (!empty($user)) { // it's a remote notice
if (!$this->validated($user)) {
// TRANS: Client exception thrown when trying to post notices before validating an e-mail address.
{
if ($right == Right::CREATEGROUP ||
($this->disallowLogin && ($right == Right::WEBLOGIN || $right == Right::API))) {
- $user = User::staticGet('id', $profile->id);
+ $user = User::getKV('id', $profile->id);
if ($user && !$this->validated($user)) {
$result = false;
return false;
$this->code = $this->trimmed('code');
- $this->confirm = Confirm_address::staticGet('code', $this->code);
+ $this->confirm = Confirm_address::getKV('code', $this->code);
if (empty($this->confirm)) {
// TRANS: Client exception thrown when trying to register with a non-existing confirmation code.
return;
}
- $this->user = User::staticGet('id', $this->confirm->user_id);
+ $this->user = User::getKV('id', $this->confirm->user_id);
if (empty($this->user)) {
// TRANS: Client exception thrown when trying to register with a confirmation code that is not connected with a user.
$parts = explode('@', $email);
$nickname = common_nicknamize($parts[0]);
-$user = User::staticGet('nickname', $nickname);
+$user = User::getKV('nickname', $nickname);
if (!empty($user)) {
$confirm = new Confirm_address();
*/
static function inc($user_id)
{
- $gc = User_greeting_count::staticGet('user_id', $user_id);
+ $gc = User_greeting_count::getKV('user_id', $user_id);
if (empty($gc)) {
$gc = new User_greeting_count();
static function updateCount($d, $n)
{
- $snc = Sitemap_notice_count::staticGet('notice_date', DB_DataObject_Cast::date($d));
+ $snc = Sitemap_notice_count::getKV('notice_date', DB_DataObject_Cast::date($d));
if (empty($snc)) {
// TRANS: Exception
static function updateCount($d, $n)
{
- $suc = Sitemap_user_count::staticGet('registration_date', DB_DataObject_Cast::date($d));
+ $suc = Sitemap_user_count::getKV('registration_date', DB_DataObject_Cast::date($d));
if (empty($suc)) {
// TRANS: Exception thrown when a registration date cannot be found.
$ids = array();
foreach ($nicks as $nick) {
// not the most efficient way for a big list!
- $user = User::staticGet('nickname', $nick);
+ $user = User::getKV('nickname', $nick);
if ($user) {
$ids[] = intval($user->id);
}
protected function validateProfile($id)
{
$id = intval($id);
- $profile = Profile::staticGet('id', $id);
+ $profile = Profile::getKV('id', $id);
if ($profile && $profile->id != $this->user->id) {
return $profile;
}
if ($this->delete) {
$mirror->delete();
- $oprofile = Ostatus_profile::staticGet('profile_id', $this->profile->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $this->profile->id);
if ($oprofile) {
$oprofile->garbageCollect();
}
function showFeedForm($mirror)
{
- $profile = Profile::staticGet('id', $mirror->subscribed);
+ $profile = Profile::getKV('id', $mirror->subscribed);
if ($profile) {
$form = new EditMirrorForm($this, $profile);
$form->show();
*/
public function mirrorNotice($notice)
{
- $profile = Profile::staticGet('id', $this->subscriber);
+ $profile = Profile::getKV('id', $this->subscriber);
if (!$profile) {
common_log(LOG_ERR, "SubMirror plugin skipping auto-repeat of notice $notice->id for missing user $profile->id");
return false;
{
// Ok this is a bit of a hack. ;)
if (class_exists('Ostatus_profile')) {
- $oprofile = Ostatus_profile::staticGet('profile_id', $profile->id);
+ $oprofile = Ostatus_profile::getKV('profile_id', $profile->id);
if ($oprofile) {
return $oprofile->feeduri;
}
if (empty($notice_id)) {
throw new Exception("Invalid notice_id $notice_id");
}
- $n2s = Notice_to_status::staticGet('notice_id', $notice_id);
+ $n2s = Notice_to_status::getKV('notice_id', $notice_id);
if (!empty($n2s)) {
return $n2s;
if (empty($status_id)) {
throw new Exception("Invalid status_id $status_id");
}
- $n2s = Notice_to_status::staticGet('status_id', $status_id);
+ $n2s = Notice_to_status::getKV('status_id', $status_id);
if (!empty($n2s)) {
return $n2s;
*/
function onStartDeleteOwnNotice(User $user, Notice $notice)
{
- $n2s = Notice_to_status::staticGet('notice_id', $notice->id);
+ $n2s = Notice_to_status::getKV('notice_id', $notice->id);
if (!empty($n2s)) {
// Get associated user and subscribe her
- $friend_user = User::staticGet('id', $friend_flink->user_id);
+ $friend_user = User::getKV('id', $friend_flink->user_id);
if (!empty($friend_user)) {
$result = subs_subscribe_to($user, $friend_user);
}
}
} else {
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
$users = array($user->id);
}
$output = array();
foreach ($users as $id) {
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (!$user) {
throw new Exception("No user for id $id");
}
}
-$user = User::staticGet('nickname', $nickname);
+$user = User::getKV('nickname', $nickname);
global $myuser;
$myuser = $user;
function is_twitter_notice($id)
{
- $n2s = Notice_to_status::staticGet('notice_id', $id);
+ $n2s = Notice_to_status::getKV('notice_id', $id);
return (!empty($n2s));
}
if (!empty($flink) && TwitterOAuthClient::isPackedToken($flink->credentials)) {
if (is_twitter_bound($notice, $flink)) {
if (!empty($notice->repeat_of) && is_twitter_notice($notice->repeat_of)) {
- $retweet = retweet_notice($flink, Notice::staticGet('id', $notice->repeat_of));
+ $retweet = retweet_notice($flink, Notice::getKV('id', $notice->repeat_of));
if (is_object($retweet)) {
Notice_to_status::saveNew($notice->id, twitter_id($retweet));
return true;
function twitter_status_id($notice)
{
- $n2s = Notice_to_status::staticGet('notice_id', $notice->id);
+ $n2s = Notice_to_status::getKV('notice_id', $notice->id);
if (empty($n2s)) {
return null;
} else {
$params['long'] = $notice->lon;
}
if (!empty($notice->reply_to) && is_twitter_notice($notice->reply_to)) {
- $reply = Notice::staticGet('id', $notice->reply_to);
+ $reply = Notice::getKV('id', $notice->reply_to);
$params['in_reply_to_status_id'] = twitter_status_id($reply);
}
return $params;
if (common_config('site', 'inviteonly')) {
$code = $_SESSION['invitecode'];
if ($code) {
- $invite = Invitation::staticGet($code);
+ $invite = Invitation::getKV($code);
if ($invite && $invite->address_type == 'email') {
return $invite->address;
return;
}
- $invite = Invitation::staticGet($code);
+ $invite = Invitation::getKV($code);
if (empty($invite)) {
// TRANS: Client error displayed when trying to create a new user with an invalid invitation code.
return;
}
- if (User::staticGet('nickname', $nickname)) {
+ if (User::getKV('nickname', $nickname)) {
// TRANS: Client error displayed when trying to create a new user with a username that is already in use.
$this->showForm(_m('Nickname already in use. Try another one.'));
return;
return;
}
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (!empty($user)) {
common_debug('TwitterBridge Plugin - ' .
if (!User::allowed_nickname($str)) {
return false;
}
- if (User::staticGet('nickname', $str)) {
+ if (User::getKV('nickname', $str)) {
return false;
}
return true;
$statusUri = $this->makeStatusURI($status->user->screen_name, $statusId);
// check to see if we've already imported the status
- $n2s = Notice_to_status::staticGet('status_id', $statusId);
+ $n2s = Notice_to_status::getKV('status_id', $statusId);
if (!empty($n2s)) {
common_log(
$this->name() .
" - Ignoring duplicate import: {$statusId}"
);
- return Notice::staticGet('id', $n2s->notice_id);
+ return Notice::getKV('id', $n2s->notice_id);
}
// If it's a retweet, save it as a repeat!
$replyTo = twitter_id($status, 'in_reply_to_status_id');
if (!empty($replyTo)) {
common_log(LOG_INFO, "Status {$statusId} is a reply to status {$replyTo}");
- $n2s = Notice_to_status::staticGet('status_id', $replyTo);
+ $n2s = Notice_to_status::getKV('status_id', $replyTo);
if (empty($n2s)) {
common_log(LOG_INFO, "Couldn't find local notice for status {$replyTo}");
} else {
- $reply = Notice::staticGet('id', $n2s->notice_id);
+ $reply = Notice::getKV('id', $n2s->notice_id);
if (empty($reply)) {
common_log(LOG_INFO, "Couldn't find local notice for status {$replyTo}");
} else {
/**
- * Look up a Profile by profileurl field. Profile::staticGet() was
+ * Look up a Profile by profileurl field. Profile::getKV() was
* not working consistently.
*
* @param string $nickname local nickname of the Twitter user
// check for remote profile
- $remote_pro = Remote_profile::staticGet('uri', $profileurl);
+ $remote_pro = Remote_profile::getKV('uri', $profileurl);
if (empty($remote_pro)) {
$remote_pro = new Remote_profile();
common_debug($this->name() . " - Updating avatar: $size");
- $profile = Profile::staticGet($profile_id);
+ $profile = Profile::getKV($profile_id);
if (empty($profile)) {
common_debug($this->name() . " - Couldn't get profile: $profile_id!");
foreach ($status->entities->user_mentions as $mention) {
$flink = Foreign_link::getByForeignID($mention->id, TWITTER_SERVICE);
if (!empty($flink)) {
- $user = User::staticGet('id', $flink->user_id);
+ $user = User::getKV('id', $flink->user_id);
if (!empty($user)) {
$reply = new Reply();
$reply->notice_id = $notice->id;
if ($ufp->find()) {
while ($ufp->fetch()) {
- $profile = Profile::staticGet('id', $ufp->profile_id);
+ $profile = Profile::getKV('id', $ufp->profile_id);
if (!empty($profile)) {
$profiles[] = $profile;
}
if ($ufp->find()) { // XXX: this should always happen
while ($ufp->fetch()) {
- $user = User::staticGet('id', $ufp->user_id);
+ $user = User::getKV('id', $ufp->user_id);
if (!empty($user)) { // XXX: this would also be unusual
$flaggers[] = clone($user);
}
$profileId = $this->findImportedUser($data['orig_id']);
if ($profileId) {
- return Profile::staticGet('id', $profileId);
+ return Profile::getKV('id', $profileId);
} else {
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if ($user) {
common_log(LOG_WARN, "Copying Yammer profile info onto existing user $nickname");
$profile = $user->getProfile();
$groupId = $this->findImportedGroup($data['orig_id']);
if ($groupId) {
- return User_group::staticGet('id', $groupId);
+ return User_group::getKV('id', $groupId);
} else {
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if ($local) {
common_log(LOG_WARN, "Copying Yammer group info onto existing group $nickname");
- $group = User_group::staticGet('id', $local->group_id);
+ $group = User_group::getKV('id', $local->group_id);
$this->savePropertiesOn($group, $data['options'],
array('fullname', 'description'));
} else {
$noticeId = $this->findImportedNotice($data['orig_id']);
if ($noticeId) {
- return Notice::staticGet('id', $noticeId);
+ return Notice::getKV('id', $noticeId);
} else {
- $notice = Notice::staticGet('uri', $data['options']['uri']);
+ $notice = Notice::getKV('uri', $data['options']['uri']);
$content = $data['content'];
- $user = User::staticGet($data['profile']);
+ $user = User::getKV($data['profile']);
// Fetch file attachments and add the URLs...
$uploads = array();
// Save "likes" as favorites...
foreach ($data['faves'] as $nickname) {
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if ($user) {
Fave::addNew($user->getProfile(), $notice);
}
$options['groups'] = array($groupId);
// @fixme if we see a group link inline, don't add this?
- $group = User_group::staticGet('id', $groupId);
+ $group = User_group::getKV('id', $groupId);
if ($group) {
$content .= ' !' . $group->nickname;
}
private function findImportedUser($origId)
{
- $map = Yammer_user::staticGet('id', $origId);
+ $map = Yammer_user::getKV('id', $origId);
return $map ? $map->user_id : null;
}
private function findImportedGroup($origId)
{
- $map = Yammer_group::staticGet('id', $origId);
+ $map = Yammer_group::getKV('id', $origId);
return $map ? $map->group_id : null;
}
private function findImportedNotice($origId)
{
- $map = Yammer_notice::staticGet('id', $origId);
+ $map = Yammer_notice::getKV('id', $origId);
return $map ? $map->notice_id : null;
}
*/
public static function init()
{
- $state = Yammer_state::staticGet('id', 1);
+ $state = Yammer_state::getKV('id', 1);
if (!$state) {
$state = self::initState();
}
$this->state->state = 'save-messages';
} else {
foreach ($messages as $item) {
- $stub = Yammer_notice_stub::staticGet($item['id']);
+ $stub = Yammer_notice_stub::getKV($item['id']);
if (!$stub) {
Yammer_notice_stub::record($item['id'], $item);
}
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (empty($user)) {
print "Can't find user with ID $id\n";
exit(1);
}
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (empty($user)) {
print "Can't find user with nickname '$nickname'\n";
exit(1);
function clear_jabber($id)
{
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if ($user && $user->jabber) {
echo "clearing user $id's user.jabber, was: $user->jabber";
if (have_option('dry-run')) {
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (empty($user)) {
print "Can't find user with ID $id\n";
exit(1);
}
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (empty($user)) {
print "Can't find user with nickname '$nickname'\n";
exit(1);
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (empty($user)) {
throw new Exception("Can't find user with id '$id'.");
}
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (empty($user)) {
throw new Exception("Can't find user with nickname '$nickname'");
}
// Pick a random user to be the admin
$n = rand(0, max($j - 1, 0));
- $user = User::staticGet('nickname', sprintf('%s%d', $userprefix, $n));
+ $user = User::getKV('nickname', sprintf('%s%d', $userprefix, $n));
$group = User_group::register(array('nickname' => sprintf('%s%d', $groupprefix, $i),
'local' => true,
$options = array('scope' => Notice::defaultScope());
$n = rand(0, $i - 1);
- $user = User::staticGet('nickname', sprintf('%s%d', $userprefix, $n));
+ $user = User::getKV('nickname', sprintf('%s%d', $userprefix, $n));
$is_reply = rand(0, 1);
global $userprefix;
$n = rand(0, $i - 1);
- $user = User::staticGet('nickname', sprintf('%s%d', $userprefix, $n));
+ $user = User::getKV('nickname', sprintf('%s%d', $userprefix, $n));
$content = testNoticeContent();
$fromnick = sprintf('%s%d', $userprefix, $f);
- $from = User::staticGet('nickname', $fromnick);
+ $from = User::getKV('nickname', $fromnick);
if (empty($from)) {
throw new Exception("Can't find user '$fromnick'.");
$tunic = sprintf('%s%d', $userprefix, $t);
- $to = User::staticGet('nickname', $tunic);
+ $to = User::getKV('nickname', $tunic);
if (empty($to)) {
throw new Exception("Can't find user '$tunic'.");
$userNick = sprintf('%s%d', $userprefix, $userNumber);
- $user = User::staticGet('nickname', $userNick);
+ $user = User::getKV('nickname', $userNick);
if (empty($user)) {
throw new Exception("Can't find user '$fromnick'.");
$groupNick = sprintf('%s%d', $groupprefix, $groupNumber);
- $group = User_group::staticGet('nickname', $groupNick);
+ $group = User_group::getKV('nickname', $groupNick);
if (empty($group)) {
throw new Exception("Can't find group '$groupNick'.");
$userNick = sprintf('%s%d', $userprefix, $userNumber);
- $user = User::staticGet('nickname', $userNick);
+ $user = User::getKV('nickname', $userNick);
if (empty($user)) {
throw new Exception("Can't find user '$userNick'.");
$otherNick = sprintf('%s%d', $userprefix, $otherNumber);
- $other = User::staticGet('nickname', $otherNick);
+ $other = User::getKV('nickname', $otherNick);
if (empty($other)) {
throw new Exception("Can't find user '$otherNick'.");
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
- $group = User_group::staticGet('id', $id);
+ $group = User_group::getKV('id', $id);
if (empty($group)) {
print "Can't find group with ID $id\n";
exit(1);
}
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
- $local = Local_group::staticGet('nickname', $nickname);
+ $local = Local_group::getKV('nickname', $nickname);
if (empty($local)) {
print "Can't find group with nickname '$nickname'\n";
exit(1);
}
- $group = User_group::staticGet('id', $local->group_id);
+ $group = User_group::getKV('id', $local->group_id);
} else {
print "You must provide either an ID or a nickname.\n";
print "\n";
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (empty($user)) {
print "Can't find user with ID $id\n";
exit(1);
}
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (empty($user)) {
print "Can't find user with nickname '$nickname'\n";
exit(1);
$sub = get_blocked_subs();
$count = $sub->N;
while ($sub->fetch()) {
- $subber = Profile::staticGet('id', $sub->subscriber);
- $subbed = Profile::staticGet('id', $sub->subscribed);
+ $subber = Profile::getKV('id', $sub->subscriber);
+ $subbed = Profile::getKV('id', $sub->subscribed);
if (!$subber || !$subbed) {
print "Bogus entry! $sub->subscriber subbed to $sub->subscribed\n";
continue;
continue;
}
- $notice = Notice::staticGet('id', $id);
+ $notice = Notice::getKV('id', $id);
$notice->decache();
$notice->free();
continue;
}
- $profile = Profile::staticGet('id', $id);
+ $profile = Profile::getKV('id', $id);
$profile->decache();
$profile->free();
continue;
}
- $user_group = User_group::staticGet('id', $id);
+ $user_group = User_group::getKV('id', $id);
$user_group->decache();
$user_group->free();
continue;
}
- $message = Message::staticGet('id', $id);
+ $message = Message::getKV('id', $id);
$message->decache();
$message->free();
exit(1);
}
-$notice = Notice::staticGet('id', $noticeId);
+$notice = Notice::getKV('id', $noticeId);
if (empty($notice)) {
print "Invalid notice id $noticeId\n";
exit(1);
$lgroup = null;
if (have_option('G', 'group-id')) {
$gid = get_option_value('G', 'group-id');
- $lgroup = Local_group::staticGet('group_id', $gid);
+ $lgroup = Local_group::getKV('group_id', $gid);
} else if (have_option('g', 'group')) {
$gnick = get_option_value('g', 'group');
- $lgroup = Local_group::staticGet('nickname', $gnick);
+ $lgroup = Local_group::getKV('nickname', $gnick);
}
if (empty($lgroup)) {
throw new Exception("No such local group: $gnick");
}
- $group = User_group::staticGet('id', $lgroup->group_id);
+ $group = User_group::getKV('id', $lgroup->group_id);
$user->joinGroup($group);
print "OK\n";
} catch (Exception $e) {
$lgroup = null;
if (have_option('G', 'group-id')) {
$gid = get_option_value('G', 'group-id');
- $lgroup = Local_group::staticGet('group_id', $gid);
+ $lgroup = Local_group::getKV('group_id', $gid);
} else if (have_option('g', 'group')) {
$gnick = get_option_value('g', 'group');
- $lgroup = Local_group::staticGet('nickname', $gnick);
+ $lgroup = Local_group::getKV('nickname', $gnick);
}
if (empty($lgroup)) {
throw new Exception("No such local group: $gnick");
}
- $group = User_group::staticGet('id', $lgroup->group_id);
+ $group = User_group::getKV('id', $lgroup->group_id);
$user->leaveGroup($group);
print "OK\n";
} catch (Exception $e) {
try {
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (empty($user)) {
throw new Exception("No user named '$nickname'.");
}
- $group = User_group::staticGet('nickname', $groupname);
+ $group = User_group::getKV('nickname', $groupname);
if (empty($group)) {
throw new Exception("No group named '$groupname'.");
try {
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (!empty($user)) {
throw new Exception("A user named '$nickname' already exists.");
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (empty($user)) {
print "Can't find user with ID $id\n";
exit(1);
}
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (empty($user)) {
print "Can't find user with nickname '$nickname'\n";
exit(1);
exit(1);
}
-$user = User::staticGet('nickname', $nickname);
+$user = User::getKV('nickname', $nickname);
if (!$user) {
print "No such user '$nickname'.\n";
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
- $profile = Profile::staticGet('id', $id);
+ $profile = Profile::getKV('id', $id);
if (empty($profile)) {
print "Can't find local or remote profile with ID $id\n";
exit(1);
}
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (empty($user)) {
print "Can't find local user with nickname '$nickname'\n";
exit(1);
foreach ($ids as $id) {
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (!$user) {
common_log(LOG_WARNING, 'No such user: ' . $id);
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (empty($user)) {
throw new Exception("Can't find user with id '$id'.");
}
updateLocation($user);
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (empty($user)) {
throw new Exception("Can't find user with nickname '$nickname'");
}
while ($group->fetch()) {
try {
printfv("Updating group {$group->nickname}...");
- $orig = User_group::staticGet('id', $group->id);
+ $orig = User_group::getKV('id', $group->id);
if (!empty($group->original_logo)) {
$group->original_logo = Avatar::url(basename($group->original_logo));
$group->homepage_logo = Avatar::url(basename($group->homepage_logo));
if (empty($notice->reply_to)) {
$notice->conversation = $notice->id;
} else {
- $reply = Notice::staticGet('id', $notice->reply_to);
+ $reply = Notice::getKV('id', $notice->reply_to);
if (empty($reply)) {
$notice->conversation = $notice->id;
if ($group->find()) {
while ($group->fetch()) {
- $orig = User_group::staticGet('id', $group->id);
+ $orig = User_group::getKV('id', $group->id);
$group->uri = $group->getUri();
$group->update($orig);
}
if ($notice->find()) {
while ($notice->fetch()) {
try {
- $orig = Notice::staticGet('id', $notice->id);
+ $orig = Notice::getKV('id', $notice->id);
$notice->verb = ActivityVerb::SHARE;
$notice->object_type = ActivityObject::ACTIVITY;
$notice->update($orig);
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
- $user = User::staticGet('id', $id);
+ $user = User::getKV('id', $id);
if (empty($user)) {
print "Can't find user with ID $id\n";
exit(1);
}
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (empty($user)) {
print "Can't find user with nickname '$nickname'\n";
exit(1);
if (empty($unconfirmed_email->user_id)) {
print "No users with email $user->email\n";
} else {
- $user=User::staticGet('id', $unconfirmed_email->user_id);
+ $user=User::getKV('id', $unconfirmed_email->user_id);
print "Unconfirmed Address: $user->id $user->nickname\n";
}
exit(0);
if (have_option('i', 'id')) {
$id = get_option_value('i', 'id');
- $profile = Profile::staticGet('id', $id);
+ $profile = Profile::getKV('id', $id);
if (empty($profile)) {
print "Can't find user with ID $id\n";
exit(1);
}
} else if (have_option('n', 'nickname')) {
$nickname = get_option_value('n', 'nickname');
- $user = User::staticGet('nickname', $nickname);
+ $user = User::getKV('nickname', $nickname);
if (empty($user)) {
print "Can't find user with nickname '$nickname'\n";
exit(1);
$reply = Notice::saveNew($this->author1->id, $text, 'test', array('uri' => null, 'reply_to' => $orig->id));
- $conv = Conversation::staticGet('id', $reply->conversation);
+ $conv = Conversation::getKV('id', $reply->conversation);
$entry = $reply->asAtomEntry();
function setUp()
{
- $user = User::staticGet('nickname', 'userrightstestuser');
+ $user = User::getKV('nickname', 'userrightstestuser');
if ($user) {
// Leftover from a broken test run?
$profile = $user->getProfile();