]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - classes/User_group.php
Add README with intallation/upgrade instructions to the Facebook Bridge plugin
[quix0rs-gnu-social.git] / classes / User_group.php
index 60217e960ed7460f7545a8075edca48a7f2c4403..68f61cb7f48a104b43aae7b84fcf5ba4503d7ca3 100644 (file)
@@ -100,15 +100,10 @@ class User_group extends Memcached_DataObject
         $inbox->selectAdd();
         $inbox->selectAdd('notice_id');
 
-        if ($since_id != 0) {
-            $inbox->whereAdd('notice_id > ' . $since_id);
-        }
-
-        if ($max_id != 0) {
-            $inbox->whereAdd('notice_id <= ' . $max_id);
-        }
+        Notice::addWhereSinceId($inbox, $since_id, 'notice_id');
+        Notice::addWhereMaxId($inbox, $max_id, 'notice_id');
 
-        $inbox->orderBy('notice_id DESC');
+        $inbox->orderBy('created DESC, notice_id DESC');
 
         if (!is_null($offset)) {
             $inbox->limit($offset, $limit);
@@ -481,6 +476,16 @@ class User_group extends Memcached_DataObject
     }
 
     static function register($fields) {
+        if (!empty($fields['userid'])) {
+            $profile = Profile::staticGet('id', $fields['userid']);
+            if ($profile && !$profile->hasRight(Right::CREATEGROUP)) {
+                common_log(LOG_WARNING, "Attempted group creation from banned user: " . $profile->nickname);
+
+                // TRANS: Client exception thrown when a user tries to create a group while banned.
+                throw new ClientException(_('You are not allowed to create groups on this site.'), 403);
+            }
+        }
+
         // MAGICALLY put fields into current scope
 
         extract($fields);