]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/leavegroup.php
Merge branch 'geonamesxml' into 0.9.x
[quix0rs-gnu-social.git] / actions / leavegroup.php
index 587208b36a1768e4268296a8f47db96477c94c58..08fce150980eb406fce36bf46ceff307bf66ba32 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * Laconica, the distributed open-source microblogging tool
+ * StatusNet, the distributed open-source microblogging tool
  *
  * Leave a group
  *
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  * @category  Group
- * @package   Laconica
- * @author    Evan Prodromou <evan@controlyourself.ca>
- * @copyright 2008-2009 Control Yourself, Inc.
+ * @package   StatusNet
+ * @author    Evan Prodromou <evan@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);
 }
 
@@ -38,10 +38,10 @@ if (!defined('LACONICA')) {
  * for users.
  *
  * @category Group
- * @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 LeavegroupAction extends Action
@@ -56,13 +56,8 @@ class LeavegroupAction extends Action
     {
         parent::prepare($args);
 
-        if (!common_config('inboxes','enabled')) {
-            $this->serverError(_('Inboxes must be enabled for groups to work'));
-            return false;
-        }
-
         if (!common_logged_in()) {
-            $this->clientError(_('You must be logged in to join a group.'));
+            $this->clientError(_('You must be logged in to leave a group.'));
             return false;
         }
 
@@ -73,26 +68,26 @@ class LeavegroupAction extends Action
 
         if ($nickname_arg != $nickname) {
             $args = array('nickname' => $nickname);
-            common_redirect(common_local_url('editgroup', $args), 301);
+            common_redirect(common_local_url('leavegroup', $args), 301);
             return false;
         }
 
         if (!$nickname) {
-            $this->clientError(_('No nickname'), 404);
+            $this->clientError(_('No nickname.'), 404);
             return false;
         }
 
         $this->group = User_group::staticGet('nickname', $nickname);
 
         if (!$this->group) {
-            $this->clientError(_('No such group'), 404);
+            $this->clientError(_('No such group.'), 404);
             return false;
         }
 
         $cur = common_current_user();
 
-        if (!$cur->isMember($group)) {
-            $this->clientError(_('You are not a member of that group'), 403);
+        if (!$cur->isMember($this->group)) {
+            $this->clientError(_('You are not a member of that group.'), 403);
             return false;
         }
 
@@ -147,7 +142,8 @@ class LeavegroupAction extends Action
             $this->elementEnd('html');
         } else {
             common_redirect(common_local_url('groupmembers', array('nickname' =>
-                                                                   $this->group->nickname)));
+                                                                   $this->group->nickname)),
+                            303);
         }
     }
-}
\ No newline at end of file
+}