From d24ed193e7b19b50f7304790820c945e46ac2c95 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Sun, 15 Nov 2009 16:00:29 +0100 Subject: add forms for silence, sandbox, delete user --- lib/userprofile.php | 44 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 38 insertions(+), 6 deletions(-) (limited to 'lib/userprofile.php') diff --git a/lib/userprofile.php b/lib/userprofile.php index 4f9d4984f..4321a2f93 100644 --- a/lib/userprofile.php +++ b/lib/userprofile.php @@ -283,22 +283,54 @@ class UserProfile extends Widget } } + // return-to args, so we don't have to keep re-writing them + + $r2args = array('action' => 'showstream', + 'nickname' => $this->profile->nickname); + // block/unblock $blocked = $cur->hasBlocked($this->profile); $this->out->elementStart('li', 'entity_block'); if ($blocked) { - $ubf = new UnblockForm($this->out, $this->profile, - array('action' => 'showstream', - 'nickname' => $this->profile->nickname)); + $ubf = new UnblockForm($this->out, $this->profile, $r2args); $ubf->show(); } else { - $bf = new BlockForm($this->out, $this->profile, - array('action' => 'showstream', - 'nickname' => $this->profile->nickname)); + $bf = new BlockForm($this->out, $this->profile, $r2args); $bf->show(); } $this->out->elementEnd('li'); + + if ($cur->hasRight(Right::SANDBOXUSER)) { + $this->out->elementStart('li', 'entity_sandbox'); + if ($this->user->isSandboxed()) { + $usf = new UnSandboxForm($this->out, $this->profile, $r2args); + $usf->show(); + } else { + $sf = new SandboxForm($this->out, $this->profile, $r2args); + $sf->show(); + } + $this->out->elementEnd('li'); + } + + if ($cur->hasRight(Right::SILENCEUSER)) { + $this->out->elementStart('li', 'entity_silence'); + if ($this->user->isSilenced()) { + $usf = new UnSilenceForm($this->out, $this->profile, $r2args); + $usf->show(); + } else { + $sf = new SilenceForm($this->out, $this->profile, $r2args); + $sf->show(); + } + $this->out->elementEnd('li'); + } + + if ($cur->hasRight(Right::DELETEUSER)) { + $this->out->elementStart('li', 'entity_delete'); + $df = DeleteUserForm($this->out, $this->profile, $r2args); + $df->show(); + $this->out->elementEnd('li'); + } } } -- cgit v1.2.3-54-g00ecf