]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/editgroup.php
Changed all $config[][] calls to common_config()
[quix0rs-gnu-social.git] / actions / editgroup.php
index 82b78cc5c7ac596b75fcb9ef48b1f663fa9b5b48..e7e79040a4811622473f1296e52da72b90420bcc 100644 (file)
@@ -88,7 +88,12 @@ class EditgroupAction extends Action
             return false;
         }
 
-        $this->group = User_group::staticGet('nickname', $nickname);
+        $groupid = $this->trimmed('groupid');
+        if ($groupid) {
+            $this->group = User_group::staticGet('id', $groupid);
+        } else {
+            $this->group = User_group::staticGet('nickname', $nickname);
+        }
 
         if (!$this->group) {
             $this->clientError(_('No such group'), 404);
@@ -97,7 +102,7 @@ class EditgroupAction extends Action
 
         $cur = common_current_user();
 
-        if (!$cur->isAdmin($group)) {
+        if (!$cur->isAdmin($this->group)) {
             $this->clientError(_('You must be an admin to edit the group'), 403);
             return false;
         }
@@ -155,6 +160,13 @@ class EditgroupAction extends Action
 
     function trySave()
     {
+        $cur = common_current_user();
+        if (!$cur->isAdmin($this->group)) {
+            $this->clientError(_('You must be an admin to edit the group'), 403);
+            return;
+        }
+
+
         $nickname    = common_canonical_nickname($this->trimmed('nickname'));
         $fullname    = $this->trimmed('fullname');
         $homepage    = $this->trimmed('homepage');
@@ -179,13 +191,13 @@ class EditgroupAction extends Action
                                         array('http', 'https')))) {
             $this->showForm(_('Homepage is not a valid URL.'));
             return;
-        } else if (!is_null($fullname) && strlen($fullname) > 255) {
+        } else if (!is_null($fullname) && mb_strlen($fullname) > 255) {
             $this->showForm(_('Full name is too long (max 255 chars).'));
             return;
-        } else if (!is_null($description) && strlen($description) > 140) {
+        } else if (!is_null($description) && mb_strlen($description) > 140) {
             $this->showForm(_('description is too long (max 140 chars).'));
             return;
-        } else if (!is_null($location) && strlen($location) > 255) {
+        } else if (!is_null($location) && mb_strlen($location) > 255) {
             $this->showForm(_('Location is too long (max 255 chars).'));
             return;
         }
@@ -222,4 +234,5 @@ class EditgroupAction extends Action
                 $group != false &&
                 $group->id != $this->group->id);
     }
-}
\ No newline at end of file
+}
+