]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/deletegroup.php
Merge remote-tracking branch 'upstream/master' into social-master
[quix0rs-gnu-social.git] / actions / deletegroup.php
index 62fff00c4821600d5bde2759078a5e9867faab15..87f518eb41ca22b702cae9db8b5479bd32012785 100644 (file)
@@ -55,20 +55,19 @@ class DeletegroupAction extends RedirectingAction
      * @fixme merge common setup code with other group actions
      * @fixme allow group admins to delete their own groups
      */
-    function prepare($args)
+    function prepare(array $args=array())
     {
         parent::prepare($args);
 
         if (!common_logged_in()) {
             // TRANS: Client error when trying to delete group while not logged in.
             $this->clientError(_('You must be logged in to delete a group.'));
-            return false;
         }
 
         $nickname_arg = $this->trimmed('nickname');
         $id = intval($this->arg('id'));
         if ($id) {
-            $this->group = User_group::staticGet('id', $id);
+            $this->group = User_group::getKV('id', $id);
         } else if ($nickname_arg) {
             $nickname = common_canonical_nickname($nickname_arg);
 
@@ -77,35 +76,30 @@ class DeletegroupAction extends RedirectingAction
             if ($nickname_arg != $nickname) {
                 $args = array('nickname' => $nickname);
                 common_redirect(common_local_url('leavegroup', $args), 301);
-                return false;
             }
 
-            $local = Local_group::staticGet('nickname', $nickname);
+            $local = Local_group::getKV('nickname', $nickname);
 
             if (!$local) {
                 // TRANS: Client error when trying to delete a non-local group.
                 $this->clientError(_('No such group.'), 404);
-                return false;
             }
 
-            $this->group = User_group::staticGet('id', $local->group_id);
+            $this->group = User_group::getKV('id', $local->group_id);
         } else {
             // TRANS: Client error when trying to delete a group without providing a nickname or ID for the group.
             $this->clientError(_('No nickname or ID.'), 404);
-            return false;
         }
 
         if (!$this->group) {
             // TRANS: Client error when trying to delete a non-existing group.
             $this->clientError(_('No such group.'), 404);
-            return false;
         }
 
         $cur = common_current_user();
         if (!$cur->hasRight(Right::DELETEGROUP)) {
             // TRANS: Client error when trying to delete a group without having the rights to delete it.
             $this->clientError(_('You are not allowed to delete this group.'), 403);
-            return false;
         }
 
         return true;
@@ -120,7 +114,7 @@ class DeletegroupAction extends RedirectingAction
      *
      * @return void
      */
-    function handle($args)
+    function handle(array $args=array())
     {
         parent::handle($args);
         if ($_SERVER['REQUEST_METHOD'] == 'POST') {
@@ -162,22 +156,23 @@ class DeletegroupAction extends RedirectingAction
             $this->elementStart('body');
             // @fixme add a sensible AJAX response form!
             $this->elementEnd('body');
-            $this->elementEnd('html');
+            $this->endHTML();
         } else {
             // @fixme if we could direct to the page on which this group
             // would have shown... that would be awesome
-            common_redirect(common_local_url('groups'),
-                            303);
+            common_redirect(common_local_url('groups'), 303);
         }
     }
 
     function title() {
-        // TRANS: Title.
+        // TRANS: Title of delete group page.
         return _('Delete group');
     }
 
     function showContent() {
         $this->areYouSureForm();
+        $block = new GroupProfileBlock($this, $this->group);
+        $block->show();
     }
 
     /**
@@ -201,8 +196,8 @@ class DeletegroupAction extends RedirectingAction
         // TRANS: Form legend for deleting a group.
         $this->element('legend', _('Delete group'));
         if (Event::handle('StartDeleteGroupForm', array($this, $this->group))) {
-            // TRANS: Warning in form for deleleting a group.
             $this->element('p', null,
+                           // TRANS: Warning in form for deleleting a group.
                            _('Are you sure you want to delete this group? '.
                              'This will clear all data about the group from the '.
                              'database, without a backup. ' .
@@ -221,14 +216,14 @@ class DeletegroupAction extends RedirectingAction
                       'submit form_action-primary',
                       'no',
                       // TRANS: Submit button title for 'No' when deleting a group.
-                      _('Do not delete this group'));
+                      _('Do not delete this group.'));
         $this->submit('form_action-yes',
                       // TRANS: Button label on the delete group form.
                       _m('BUTTON','Yes'),
                       'submit form_action-secondary',
                       'yes',
                       // TRANS: Submit button title for 'Yes' when deleting a group.
-                      _('Delete this group'));
+                      _('Delete this group.'));
         $this->elementEnd('fieldset');
         $this->elementEnd('form');
     }