From d4f1637f8a20d9e4ac059930b7ba444473f5047b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 28 Jun 2009 14:45:33 -0400 Subject: fallback for www. addresses --- classes/Status_network.php | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'classes') diff --git a/classes/Status_network.php b/classes/Status_network.php index f8d6756b6..8726096e3 100644 --- a/classes/Status_network.php +++ b/classes/Status_network.php @@ -132,6 +132,13 @@ class Status_network extends DB_DataObject } } else { $sn = self::memGet('hostname', strtolower($servername)); + + if (empty($sn)) { + // Try for a no-www address + if (strncasecmp($servername, 'www.', 4)) { + $sn = self::memGet('hostname', strtolower(substr($servername, 4))); + } + } } if (!empty($sn)) { -- cgit v1.2.3-54-g00ecf From 166e4a4b58a02438825706e52d1aa3207c33505b Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 28 Jun 2009 14:48:19 -0400 Subject: bad string compare in Status_network --- classes/Status_network.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'classes') diff --git a/classes/Status_network.php b/classes/Status_network.php index 8726096e3..dbd722e88 100644 --- a/classes/Status_network.php +++ b/classes/Status_network.php @@ -135,7 +135,7 @@ class Status_network extends DB_DataObject if (empty($sn)) { // Try for a no-www address - if (strncasecmp($servername, 'www.', 4)) { + if (0 == strncasecmp($servername, 'www.', 4)) { $sn = self::memGet('hostname', strtolower(substr($servername, 4))); } } -- cgit v1.2.3-54-g00ecf From d03b8c4276e5bd3822289a8b5c94be60cb90ef75 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 29 Jun 2009 10:22:17 -0400 Subject: show section with admins in sidebar of group --- actions/showgroup.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ classes/User_group.php | 24 ++++++++++++++++++++++++ 2 files changed, 68 insertions(+) (limited to 'classes') diff --git a/actions/showgroup.php b/actions/showgroup.php index b6a0f4844..ce11d574e 100644 --- a/actions/showgroup.php +++ b/actions/showgroup.php @@ -331,6 +331,7 @@ class ShowgroupAction extends GroupDesignAction { $this->showMembers(); $this->showStatistics(); + $this->showAdmins(); $cloud = new GroupTagCloudSection($this, $this->group); $cloud->show(); } @@ -369,6 +370,18 @@ class ShowgroupAction extends GroupDesignAction $this->elementEnd('div'); } + /** + * Show list of admins + * + * @return void + */ + + function showAdmins() + { + $adminSection = new GroupAdminSection($this, $this->group); + $adminSection->show(); + } + /** * Show some statistics * @@ -423,3 +436,34 @@ class ShowgroupAction extends GroupDesignAction $this->elementEnd('div'); } } + +class GroupAdminSection extends ProfileSection +{ + var $group; + + function __construct($out, $group) + { + parent::__construct($out); + $this->group = $group; + } + + function getProfiles() + { + return $this->group->getAdmins(); + } + + function title() + { + return _('Admins'); + } + + function divId() + { + return 'group_admins'; + } + + function moreUrl() + { + return null; + } +} \ No newline at end of file diff --git a/classes/User_group.php b/classes/User_group.php index 9b4b01ead..27b444705 100644 --- a/classes/User_group.php +++ b/classes/User_group.php @@ -126,6 +126,30 @@ class User_group extends Memcached_DataObject return $members; } + function getAdmins($offset=0, $limit=null) + { + $qry = + 'SELECT profile.* ' . + 'FROM profile JOIN group_member '. + 'ON profile.id = group_member.profile_id ' . + 'WHERE group_member.group_id = %d ' . + 'AND group_member.is_admin = 1 ' . + 'ORDER BY group_member.modified ASC '; + + if ($limit != null) { + if (common_config('db','type') == 'pgsql') { + $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset; + } else { + $qry .= ' LIMIT ' . $offset . ', ' . $limit; + } + } + + $admins = new Profile(); + + $admins->query(sprintf($qry, $this->id)); + return $admins; + } + function getBlocked($offset=0, $limit=null) { $qry = -- cgit v1.2.3-54-g00ecf From 4e6cd427577f55e024fac26b5cdab6c15ba9f97f Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 30 Jun 2009 11:50:16 -0400 Subject: conversation code changes --- actions/conversation.php | 41 ++++++++++++++++++++--------------------- classes/Notice.php | 2 +- 2 files changed, 21 insertions(+), 22 deletions(-) (limited to 'classes') diff --git a/actions/conversation.php b/actions/conversation.php index 654a670f5..79197da2d 100644 --- a/actions/conversation.php +++ b/actions/conversation.php @@ -107,17 +107,11 @@ class ConversationAction extends Action function showContent() { - $offset = ($this->page-1) * NOTICES_PER_PAGE; - $limit = NOTICES_PER_PAGE + 1; - - $notices = Notice::conversationStream($this->id, $offset, $limit); + $notices = Notice::conversationStream($this->id); $ct = new ConversationTree($notices, $this); $cnt = $ct->show(); - - $this->pagination($this->page > 1, $cnt > NOTICES_PER_PAGE, - $this->page, 'conversation', array('id' => $this->id)); } } @@ -148,6 +142,25 @@ class ConversationTree extends NoticeList { $cnt = 0; + $this->_buildTree(); + + $this->out->elementStart('div', array('id' =>'notices_primary')); + $this->out->element('h2', null, _('Notices')); + $this->out->elementStart('ol', array('class' => 'notices xoxo')); + + if (array_key_exists('root', $this->tree)) { + $rootid = $this->tree['root'][0]; + $this->showNoticePlus($rootid); + } + + $this->out->elementEnd('ol'); + $this->out->elementEnd('div'); + + return $cnt; + } + + function _buildTree() + { $this->tree = array(); $this->table = array(); @@ -168,20 +181,6 @@ class ConversationTree extends NoticeList $this->tree[$notice->reply_to] = array($notice->id); } } - - $this->out->elementStart('div', array('id' =>'notices_primary')); - $this->out->element('h2', null, _('Notices')); - $this->out->elementStart('ol', array('class' => 'notices xoxo')); - - if (array_key_exists('root', $this->tree)) { - $rootid = $this->tree['root'][0]; - $this->showNoticePlus($rootid); - } - - $this->out->elementEnd('ol'); - $this->out->elementEnd('div'); - - return $cnt; } /** diff --git a/classes/Notice.php b/classes/Notice.php index 502cc57b8..2ba2f31b1 100644 --- a/classes/Notice.php +++ b/classes/Notice.php @@ -795,7 +795,7 @@ class Notice extends Memcached_DataObject $notice->selectAdd(); // clears it $notice->selectAdd('id'); - $notice->whereAdd('conversation = '.$id); + $notice->conversation = $id; $notice->orderBy('id DESC'); -- cgit v1.2.3-54-g00ecf