X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Fgroups.php;h=8aacff8b0ecd1cd2efe86de5b35a6a7b90312f03;hb=d8d9edfc990a20f67421e40a7d3055a58697a002;hp=b0bf7cfc2af57417f09e59940df24bbd31380fef;hpb=6e2f04583728714ff937eb1fa3ab34e99bcdb6a6;p=quix0rs-gnu-social.git diff --git a/actions/groups.php b/actions/groups.php index b0bf7cfc2a..8aacff8b0e 100644 --- a/actions/groups.php +++ b/actions/groups.php @@ -1,6 +1,6 @@ . * * @category Personal - * @package Laconica - * @author Evan Prodromou - * @author Sarven Capadisli - * @copyright 2008-2009 Control Yourself, Inc. + * @package StatusNet + * @author Evan Prodromou + * @author Sarven Capadisli + * @copyright 2008-2009 StatusNet, Inc. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ -if (!defined('LACONICA')) { +if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); } @@ -40,10 +40,10 @@ require_once INSTALLDIR.'/lib/grouplist.php'; * Show the latest groups on the site * * @category Personal - * @package Laconica - * @author Evan Prodromou + * @package StatusNet + * @author Evan Prodromou * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 - * @link http://laconi.ca/ + * @link http://status.net/ */ class GroupsAction extends Action @@ -51,7 +51,7 @@ class GroupsAction extends Action var $page = null; var $profile = null; - function isReadOnly() + function isReadOnly($args) { return true; } @@ -100,23 +100,30 @@ class GroupsAction extends Action function showContent() { - $this->elementStart('p', array('id' => 'new_group')); - $this->element('a', array('href' => common_local_url('newgroup'), - 'class' => 'more'), - _('Create a new group')); - $this->elementEnd('p'); + if (common_logged_in()) { + $this->elementStart('p', array('id' => 'new_group')); + $this->element('a', array('href' => common_local_url('newgroup'), + 'class' => 'more'), + _('Create a new group')); + $this->elementEnd('p'); + } $offset = ($this->page-1) * GROUPS_PER_PAGE; - $limit = GROUPS_PER_PAGE + 1; + $limit = GROUPS_PER_PAGE + 1; + + $qry = 'SELECT user_group.* '. + 'from user_group join local_group on user_group.id = local_group.group_id '. + 'order by user_group.created desc '. + 'limit ' . $limit . ' offset ' . $offset; $groups = new User_group(); - $groups->orderBy('created DESC'); - $groups->limit($offset, $limit); - if ($groups->find()) { - $gl = new GroupList($groups, null, $this); - $cnt = $gl->show(); - } + $cnt = 0; + + $groups->query($qry); + + $gl = new GroupList($groups, null, $this); + $cnt = $gl->show(); $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE, $this->page, 'groups'); @@ -129,24 +136,4 @@ class GroupsAction extends Action $gbm = new GroupsByMembersSection($this); $gbm->show(); } - - /** - * Output document relationship links - * - * @return void - */ - function showRelationshipLinks() - { - // Machine-readable pagination - if ($this->page > 1) { - $this->element('link', array('rel' => 'next', - 'href' => common_local_url('groups', - array('page' => $this->page - 1)), - 'title' => _('Next Groups'))); - } - $this->element('link', array('rel' => 'prev', - 'href' => common_local_url('groups', - array('page' => $this->page + 1)), - 'title' => _('Previous Groups'))); - } }