From 55aa68b9418e407c2894b55289a9d384706f9c59 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Sat, 9 Jan 2016 14:13:19 +0100 Subject: [PATCH] CancelGroupForm gets same typing as Join and Leave --- lib/cancelgroupform.php | 22 +++++++++------------- lib/groupaction.php | 2 +- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/cancelgroupform.php b/lib/cancelgroupform.php index f4a44b5b5b..cfab7550c0 100644 --- a/lib/cancelgroupform.php +++ b/lib/cancelgroupform.php @@ -28,11 +28,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} - -require_once INSTALLDIR.'/lib/form.php'; +if (!defined('GNUSOCIAL')) { exit(1); } /** * Form for leaving a group @@ -58,10 +54,11 @@ class CancelGroupForm extends Form /** * Constructor * - * @param HTMLOutputter $out output channel - * @param group $group group to leave + * @param HTMLOutputter $out output channel + * @param User_group $group group to leave + * @param Profile $profile User profile this is meant for */ - function __construct($out=null, $group=null, $profile=null) + function __construct(HTMLOutputter $out=null, User_group $group=null, Profile $profile=null) { parent::__construct($out); @@ -76,7 +73,7 @@ class CancelGroupForm extends Form */ function id() { - return 'group-cancel-' . $this->group->id; + return 'group-cancel-' . $this->group->getID(); } /** @@ -97,11 +94,10 @@ class CancelGroupForm extends Form function action() { $params = array(); - if ($this->profile) { - $params['profile_id'] = $this->profile->id; + if ($this->profile instanceof Profile) { + $params['profile_id'] = $this->profile->getID(); } - return common_local_url('cancelgroup', - array('id' => $this->group->id), $params); + return common_local_url('cancelgroup', array('id' => $this->group->getID()), $params); } /** diff --git a/lib/groupaction.php b/lib/groupaction.php index 39d4804481..0886460737 100644 --- a/lib/groupaction.php +++ b/lib/groupaction.php @@ -85,7 +85,7 @@ class GroupAction extends Action $this->group = User_group::getKV('id', $local->group_id); - if (!$this->group) { + if (!$this->group instanceof User_group) { // TRANS: Client error displayed if no local group with a given name was found requesting group page. $this->clientError(_('No such group.'), 404); }