]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/groups.php
Merge branch 'master' into 0.9.x
[quix0rs-gnu-social.git] / actions / groups.php
index 3d62843ed678d54d08c9fd3ccb5ca897568a5c75..8aacff8b0ecd1cd2efe86de5b35a6a7b90312f03 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * Latest groups information
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Personal
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @author    Sarven Capadisli <csarven@controlyourself.ca>
- * @copyright 2008-2009 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@status.net>
+ * @author    Sarven Capadisli <csarven@status.net>
+ * @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 <evan@controlyourself.ca>
+ * @package  StatusNet
+ * @author   Evan Prodromou <evan@status.net>
  * @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
@@ -109,17 +109,21 @@ class GroupsAction extends Action
         }
 
         $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);
 
         $cnt = 0;
-        if ($groups->find()) {
-            $gl = new GroupList($groups, null, $this);
-            $cnt = $gl->show();
-        }
+
+        $groups->query($qry);
+
+        $gl = new GroupList($groups, null, $this);
+        $cnt = $gl->show();
 
         $this->pagination($this->page > 1, $cnt > GROUPS_PER_PAGE,
                           $this->page, 'groups');