summaryrefslogtreecommitdiff
path: root/classes/User.php
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2010-03-08 17:22:23 -0500
committerCraig Andrews <candrews@integralblue.com>2010-03-08 17:22:23 -0500
commit714d920faea302b55857cc3bec4e9e6160ea136a (patch)
treecffa5ee7a3261ad24b272cb3ced16a6c1dcafad1 /classes/User.php
parentc187bf55974347f7ddb4f28714af57861dce8f08 (diff)
parent51a245f18c1e4a830c5eb94f3e60c6b4b3e560ee (diff)
Merge branch '0.9.x' into 1.0.x
Conflicts: classes/statusnet.ini db/statusnet.sql lib/jabber.php lib/xmppmanager.php
Diffstat (limited to 'classes/User.php')
-rw-r--r--classes/User.php67
1 files changed, 20 insertions, 47 deletions
diff --git a/classes/User.php b/classes/User.php
index 0f84ed813..15ec4ad94 100644
--- a/classes/User.php
+++ b/classes/User.php
@@ -201,6 +201,7 @@ class User extends Memcached_DataObject
if(! User::allowed_nickname($nickname)){
common_log(LOG_WARNING, sprintf("Attempted to register a nickname that is not allowed: %s", $profile->nickname),
__FILE__);
+ return false;
}
$profile->profileurl = common_profile_url($nickname);
@@ -451,28 +452,28 @@ class User extends Memcached_DataObject
return $user;
}
- function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+ function getReplies($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
{
- $ids = Reply::stream($this->id, $offset, $limit, $since_id, $before_id, $since);
+ $ids = Reply::stream($this->id, $offset, $limit, $since_id, $before_id);
return Notice::getStreamByIds($ids);
}
- function getTaggedNotices($tag, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null) {
+ function getTaggedNotices($tag, $offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0) {
$profile = $this->getProfile();
if (!$profile) {
return null;
} else {
- return $profile->getTaggedNotices($tag, $offset, $limit, $since_id, $before_id, $since);
+ return $profile->getTaggedNotices($tag, $offset, $limit, $since_id, $before_id);
}
}
- function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+ function getNotices($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
{
$profile = $this->getProfile();
if (!$profile) {
return null;
} else {
- return $profile->getNotices($offset, $limit, $since_id, $before_id, $since);
+ return $profile->getNotices($offset, $limit, $since_id, $before_id);
}
}
@@ -482,24 +483,24 @@ class User extends Memcached_DataObject
return Notice::getStreamByIds($ids);
}
- function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+ function noticesWithFriends($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
{
- return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, $since, false);
+ return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, false);
}
- function noticeInbox($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+ function noticeInbox($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
{
- return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, $since, true);
+ return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, true);
}
- function friendsTimeline($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+ function friendsTimeline($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
{
- return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, $since, false);
+ return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, false);
}
- function ownFriendsTimeline($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0, $since=null)
+ function ownFriendsTimeline($offset=0, $limit=NOTICES_PER_PAGE, $since_id=0, $before_id=0)
{
- return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, $since, true);
+ return Inbox::streamNotices($this->id, $offset, $limit, $since_id, $before_id, true);
}
function blowFavesCache()
@@ -607,28 +608,8 @@ class User extends Memcached_DataObject
function getGroups($offset=0, $limit=null)
{
- $qry =
- 'SELECT user_group.* ' .
- 'FROM user_group JOIN group_member '.
- 'ON user_group.id = group_member.group_id ' .
- 'WHERE group_member.profile_id = %d ' .
- 'ORDER BY group_member.created DESC ';
-
- if ($offset>0 && !is_null($limit)) {
- if ($offset) {
- if (common_config('db','type') == 'pgsql') {
- $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
- } else {
- $qry .= ' LIMIT ' . $offset . ', ' . $limit;
- }
- }
- }
-
- $groups = new User_group();
-
- $cnt = $groups->query(sprintf($qry, $this->id));
-
- return $groups;
+ $profile = $this->getProfile();
+ return $profile->getGroups($offset, $limit);
}
function getSubscriptions($offset=0, $limit=null)
@@ -784,7 +765,7 @@ class User extends Memcached_DataObject
return Notice::getStreamByIds($ids);
}
- function _repeatedByMeDirect($offset, $limit, $since_id, $max_id, $since)
+ function _repeatedByMeDirect($offset, $limit, $since_id, $max_id)
{
$notice = new Notice();
@@ -808,10 +789,6 @@ class User extends Memcached_DataObject
$notice->whereAdd('id <= ' . $max_id);
}
- if (!is_null($since)) {
- $notice->whereAdd('created > \'' . date('Y-m-d H:i:s', $since) . '\'');
- }
-
$ids = array();
if ($notice->find()) {
@@ -831,12 +808,12 @@ class User extends Memcached_DataObject
$ids = Notice::stream(array($this, '_repeatsOfMeDirect'),
array(),
'user:repeats_of_me:'.$this->id,
- $offset, $limit, $since_id, $max_id, null);
+ $offset, $limit, $since_id, $max_id);
return Notice::getStreamByIds($ids);
}
- function _repeatsOfMeDirect($offset, $limit, $since_id, $max_id, $since)
+ function _repeatsOfMeDirect($offset, $limit, $since_id, $max_id)
{
$qry =
'SELECT DISTINCT original.id AS id ' .
@@ -851,10 +828,6 @@ class User extends Memcached_DataObject
$qry .= 'AND original.id <= ' . $max_id . ' ';
}
- if (!is_null($since)) {
- $qry .= 'AND original.modified > \'' . date('Y-m-d H:i:s', $since) . '\' ';
- }
-
// NOTE: we sort by fave time, not by notice time!
$qry .= 'ORDER BY original.id DESC ';