Issue #121 - use correct Group ID and strict User_group typing
This commit is contained in:
parent
d1e609a886
commit
fbec7c4e75
@ -29,9 +29,7 @@
|
|||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET')) {
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form for deleting a group
|
* Form for deleting a group
|
||||||
@ -58,9 +56,9 @@ class DeleteGroupForm extends Form
|
|||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param HTMLOutputter $out output channel
|
* @param HTMLOutputter $out output channel
|
||||||
* @param group $group group to join
|
* @param User_group $group group to join
|
||||||
*/
|
*/
|
||||||
function __construct($out=null, $group=null)
|
function __construct(HTMLOutputter $out=null, User_group $group=null)
|
||||||
{
|
{
|
||||||
parent::__construct($out);
|
parent::__construct($out);
|
||||||
|
|
||||||
@ -74,7 +72,7 @@ class DeleteGroupForm extends Form
|
|||||||
*/
|
*/
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'group-delete-' . $this->group->id;
|
return 'group-delete-' . $this->group->getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,14 +92,13 @@ class DeleteGroupForm extends Form
|
|||||||
*/
|
*/
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('deletegroup',
|
return common_local_url('deletegroup', array('id' => $this->group->getID()));
|
||||||
array('id' => $this->group->id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function formData()
|
function formData()
|
||||||
{
|
{
|
||||||
$this->out->hidden($this->id() . '-returnto-action', 'groupbyid', 'returnto-action');
|
$this->out->hidden($this->id() . '-returnto-action', 'groupbyid', 'returnto-action');
|
||||||
$this->out->hidden($this->id() . '-returnto-id', $this->group->id, 'returnto-id');
|
$this->out->hidden($this->id() . '-returnto-id', $this->group->getID(), 'returnto-id');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,11 +28,7 @@
|
|||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/form.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form for joining a group
|
* Form for joining a group
|
||||||
@ -57,9 +53,9 @@ class JoinForm extends Form
|
|||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param HTMLOutputter $out output channel
|
* @param HTMLOutputter $out output channel
|
||||||
* @param group $group group to join
|
* @param User_group $group group to join
|
||||||
*/
|
*/
|
||||||
function __construct($out=null, $group=null)
|
function __construct(HTMLOutputter $out=null, User_group $group=null)
|
||||||
{
|
{
|
||||||
parent::__construct($out);
|
parent::__construct($out);
|
||||||
|
|
||||||
@ -73,7 +69,7 @@ class JoinForm extends Form
|
|||||||
*/
|
*/
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'group-join-' . $this->group->id;
|
return 'group-join-' . $this->group->getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,8 +89,7 @@ class JoinForm extends Form
|
|||||||
*/
|
*/
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('joingroup',
|
return common_local_url('joingroup', array('id' => $this->group->getID()));
|
||||||
array('id' => $this->group->id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,11 +28,7 @@
|
|||||||
* @link http://status.net/
|
* @link http://status.net/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!defined('STATUSNET') && !defined('LACONICA')) {
|
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/form.php';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Form for leaving a group
|
* Form for leaving a group
|
||||||
@ -58,9 +54,9 @@ class LeaveForm extends Form
|
|||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param HTMLOutputter $out output channel
|
* @param HTMLOutputter $out output channel
|
||||||
* @param group $group group to leave
|
* @param User_group $group group to leave
|
||||||
*/
|
*/
|
||||||
function __construct($out=null, $group=null)
|
function __construct(HTMLOutputter $out=null, User_group $group=null)
|
||||||
{
|
{
|
||||||
parent::__construct($out);
|
parent::__construct($out);
|
||||||
|
|
||||||
@ -74,7 +70,7 @@ class LeaveForm extends Form
|
|||||||
*/
|
*/
|
||||||
function id()
|
function id()
|
||||||
{
|
{
|
||||||
return 'group-leave-' . $this->group->id;
|
return 'group-leave-' . $this->group->getID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -94,8 +90,7 @@ class LeaveForm extends Form
|
|||||||
*/
|
*/
|
||||||
function action()
|
function action()
|
||||||
{
|
{
|
||||||
return common_local_url('leavegroup',
|
return common_local_url('leavegroup', array('id' => $this->group->getID()));
|
||||||
array('id' => $this->group->id));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -196,7 +196,7 @@ class SortableGroupListItem extends SortableSubscriptionListItem
|
|||||||
$r2args['action'] = $action;
|
$r2args['action'] = $action;
|
||||||
if ($cur instanceof User && $cur->hasRight(Right::DELETEGROUP)) {
|
if ($cur instanceof User && $cur->hasRight(Right::DELETEGROUP)) {
|
||||||
$this->out->elementStart('li', 'entity_delete');
|
$this->out->elementStart('li', 'entity_delete');
|
||||||
$df = new DeleteGroupForm($this->out, $this->profile, $r2args);
|
$df = new DeleteGroupForm($this->out, $this->profile->getGroup(), $r2args);
|
||||||
$df->show();
|
$df->show();
|
||||||
$this->out->elementEnd('li');
|
$this->out->elementEnd('li');
|
||||||
}
|
}
|
||||||
@ -224,10 +224,10 @@ class SortableGroupListItem extends SortableSubscriptionListItem
|
|||||||
// XXX: special-case for user looking at own
|
// XXX: special-case for user looking at own
|
||||||
// subscriptions page
|
// subscriptions page
|
||||||
if ($user->isMember($this->profile->getGroup())) {
|
if ($user->isMember($this->profile->getGroup())) {
|
||||||
$lf = new LeaveForm($this->out, $this->profile);
|
$lf = new LeaveForm($this->out, $this->profile->getGroup());
|
||||||
$lf->show();
|
$lf->show();
|
||||||
} else if (!Group_block::isBlocked($this->profile, $user->getProfile())) {
|
} else if (!Group_block::isBlocked($this->profile->getGroup(), $user->getProfile())) {
|
||||||
$jf = new JoinForm($this->out, $this->profile);
|
$jf = new JoinForm($this->out, $this->profile->getGroup());
|
||||||
$jf->show();
|
$jf->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user