1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Fix typos

This commit is contained in:
Tim Düsterhus 2013-06-22 18:28:50 +02:00
parent e6e4cb5225
commit 9848b5820b
5 changed files with 78 additions and 76 deletions

View File

@ -13,64 +13,64 @@
<h1>{lang}chat.acp.suspension.list{/lang}</h1>
</header>
{if $objects|count}
<form method="post" action="{link controller='ChatSuspensionList' application='chat'}{/link}">
<div class="container containerPadding marginTop">
<fieldset>
<legend>{lang}wcf.global.filter{/lang}</legend>
<dl>
<dd>
<label><input type="checkbox" id="displayRevoked" name="displayRevoked" value="1"{if $displayRevoked} checked="checked"{/if} /> {lang}chat.acp.suspension.displayRevoked{/lang}</label>
</dd>
</dl>
<dl>
<dt><label for="username">{lang}wcf.user.username{/lang}</label></dt>
<dd>
<input type="text" id="username" name="username" class="medium" value="{$username}" />
</dd>
</dl>
<dl>
<dt><label for="issuerUsername">{lang}chat.acp.suspension.issuer{/lang}</label></dt>
<dd>
<input type="text" id="issuerUsername" name="issuerUsername" class="medium" value="{$issuerUsername}" />
</dd>
</dl>
<dl>
<dt><label for="roomID">{lang}chat.general.room{/lang}</label></dt>
<dd>
<select id="roomID" name="roomID">
<option value="-1"{if $roomID == -1} selected="selected"{/if}></option>
<option value="0"{if $roomID == 0} selected="selected"{/if}>{lang}chat.room.global{/lang}</option>
<option value="" disabled="disabled">-------------</option>
{foreach from=$availableRooms key=id item=room}
<option value="{$id}" {if $roomID == $id}selected="selected"{/if}>{$room}</option>
{/foreach}
</select>
</dd>
</dl>
<dl>
<dt><label for="suspensionType">{lang}chat.acp.suspension.type{/lang}</label></dt>
<dd>
<select id="suspensionType" name="suspensionType">
<option value=""{if $suspensionType == null} selected="selected"{/if}></option>
<option value="{'\chat\data\suspension\Suspension::TYPE_MUTE'|constant}"{if $suspensionType == '\chat\data\suspension\Suspension::TYPE_MUTE'|constant} selected="selected"{/if}>{lang}chat.suspension.{'\chat\data\suspension\Suspension::TYPE_MUTE'|constant}{/lang}</option>
<option value="{'\chat\data\suspension\Suspension::TYPE_BAN'|constant}"{if $suspensionType == '\chat\data\suspension\Suspension::TYPE_BAN'|constant} selected="selected"{/if}>{lang}chat.suspension.{'\chat\data\suspension\Suspension::TYPE_BAN'|constant}{/lang}</option>
</select>
</dd>
</dl>
</fieldset>
</div>
<div class="formSubmit">
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
</div>
</form>
<form method="post" action="{link controller='ChatSuspensionList' application='chat'}{/link}">
<div class="container containerPadding marginTop">
<fieldset>
<legend>{lang}wcf.global.filter{/lang}</legend>
<dl>
<dd>
<label><input type="checkbox" id="displayRevoked" name="displayRevoked" value="1"{if $displayRevoked} checked="checked"{/if} /> {lang}chat.acp.suspension.displayRevoked{/lang}</label>
</dd>
</dl>
<dl>
<dt><label for="username">{lang}wcf.user.username{/lang}</label></dt>
<dd>
<input type="text" id="username" name="username" class="medium" value="{$username}" />
</dd>
</dl>
<dl>
<dt><label for="issuerUsername">{lang}chat.acp.suspension.issuer{/lang}</label></dt>
<dd>
<input type="text" id="issuerUsername" name="issuerUsername" class="medium" value="{$issuerUsername}" />
</dd>
</dl>
<dl>
<dt><label for="roomID">{lang}chat.general.room{/lang}</label></dt>
<dd>
<select id="roomID" name="roomID">
<option value="-1"{if $roomID == -1} selected="selected"{/if}></option>
<option value="0"{if $roomID == 0} selected="selected"{/if}>{lang}chat.room.global{/lang}</option>
<option value="" disabled="disabled">-------------</option>
{foreach from=$availableRooms key=id item=room}
<option value="{$id}" {if $roomID == $id}selected="selected"{/if}>{$room}</option>
{/foreach}
</select>
</dd>
</dl>
<dl>
<dt><label for="suspensionType">{lang}chat.acp.suspension.type{/lang}</label></dt>
<dd>
<select id="suspensionType" name="suspensionType">
<option value=""{if $suspensionType == null} selected="selected"{/if}></option>
<option value="{'\chat\data\suspension\Suspension::TYPE_MUTE'|constant}"{if $suspensionType == '\chat\data\suspension\Suspension::TYPE_MUTE'|constant} selected="selected"{/if}>{lang}chat.suspension.{'\chat\data\suspension\Suspension::TYPE_MUTE'|constant}{/lang}</option>
<option value="{'\chat\data\suspension\Suspension::TYPE_BAN'|constant}"{if $suspensionType == '\chat\data\suspension\Suspension::TYPE_BAN'|constant} selected="selected"{/if}>{lang}chat.suspension.{'\chat\data\suspension\Suspension::TYPE_BAN'|constant}{/lang}</option>
</select>
</dd>
</dl>
</fieldset>
</div>
<div class="formSubmit">
<input type="submit" value="{lang}wcf.global.button.submit{/lang}" accesskey="s" />
</div>
</form>
{if $objects|count}
{capture assign=additionalParameters}{*
*}{if $userID}&userID={$userID}{/if}{*
*}{if $issuerUserID}&issuerUserID={$issuerUserID}{/if}{*

View File

@ -48,24 +48,24 @@ public function canEnter(\wcf\data\user\User $user = null) {
if ($ph->getPermission($this, 'mod.canAlwaysEnter')) return true;
if ($ph->getPermission($this, 'mod.canBan')) return true;
$canEnter = $ph->getPermission($this, 'user.canEnter');
if (!$ph->getPermission($this, 'user.canEnter')) return false;
$suspensions = Suspension::getSuspensionsForUser($user->getDecoratedObject());
// room suspension
if ($canEnter && isset($suspensions[$this->roomID][Suspension::TYPE_BAN])) {
if (isset($suspensions[$this->roomID][Suspension::TYPE_BAN])) {
if ($suspensions[$this->roomID][Suspension::TYPE_BAN]->isValid()) {
$canEnter = false;
return false;
}
}
// global suspension
if ($canEnter && isset($suspensions[null][Suspension::TYPE_BAN])) {
if (isset($suspensions[null][Suspension::TYPE_BAN])) {
if ($suspensions[null][Suspension::TYPE_BAN]->isValid()) {
$canEnter = false;
return false;
}
}
return $canEnter;
return true;
}
/**
@ -86,24 +86,24 @@ public function canWrite(\wcf\data\user\User $user = null) {
if ($ph->getPermission($this, 'mod.canAlwaysWrite')) return true;
if ($ph->getPermission($this, 'mod.canMute')) return true;
$canEnter = $ph->getPermission($this, 'user.canWrite');
if (!$ph->getPermission($this, 'user.canWrite')) return false;
$suspensions = Suspension::getSuspensionsForUser($user->getDecoratedObject());
// room suspension
if ($canEnter && isset($suspensions[$this->roomID][Suspension::TYPE_MUTE])) {
if (isset($suspensions[$this->roomID][Suspension::TYPE_MUTE])) {
if ($suspensions[$this->roomID][Suspension::TYPE_MUTE]->isValid()) {
$canWrite = false;
return false;
}
}
// global suspension
if ($canEnter && isset($suspensions[null][Suspension::TYPE_MUTE])) {
if (isset($suspensions[null][Suspension::TYPE_MUTE])) {
if ($suspensions[null][Suspension::TYPE_MUTE]->isValid()) {
$canWrite = false;
return false;
}
}
return $canWrite;
return true;
}
/**

View File

@ -44,10 +44,12 @@ public function isVisible($user = null) {
if ($user === null) $user = WCF::getUser();
$user = new \wcf\data\user\UserProfile($user);
$ph = new \chat\system\permission\PermissionHandler($user->getDecoratedObject());
if ($user->getPermission('admin.chat.canManageSuspensions')) return true;
if ($user->getPermission('mod.chat.canG'.$this->type)) return true;
if (!$this->room) return false;
if (!$this->roomID) return false;
if ($ph->getPermission($this->getRoom(), 'mod.can'.ucfirst($this->type))) return true;
return false;
}

View File

@ -89,15 +89,15 @@ public function executeAction() {
public function checkPermission() {
parent::checkPermission();
$this->room = $this->commandHandler->getRoom();
if (WCF::getSession()->getPermission('admin.chat.canManageSuspensions')) return;
$this->room = $this->commandHandler->getRoom();
$ph = new \chat\system\permission\PermissionHandler();
if (static::IS_GLOBAL) {
WCF::getSession()->checkPermission('mod.chat.canG'.static::SUSPENSION_TYPE);
WCF::getSession()->checkPermissions((array) 'mod.chat.canG'.static::SUSPENSION_TYPE);
}
else {
if (!WCF::getSession()->checkPermission('mod.chat.canG'.static::SUSPENSION_TYPE)) {
if (!WCF::getSession()->getPermission('mod.chat.canG'.static::SUSPENSION_TYPE)) {
if (!$ph->getPermission($this->room, 'mod.can'.ucfirst(static::SUSPENSION_TYPE))) {
throw new \wcf\system\exception\PermissionDeniedException();
}

View File

@ -58,15 +58,15 @@ public function executeAction() {
public function checkPermission() {
parent::checkPermission();
$this->room = $this->commandHandler->getRoom();
if (WCF::getSession()->getPermission('admin.chat.canManageSuspensions')) return;
$this->room = $this->commandHandler->getRoom();
$ph = new \chat\system\permission\PermissionHandler();
if (static::IS_GLOBAL) {
WCF::getSession()->checkPermission('mod.chat.canG'.static::SUSPENSION_TYPE);
WCF::getSession()->checkPermission((array) 'mod.chat.canG'.static::SUSPENSION_TYPE);
}
else {
if (!WCF::getSession()->checkPermission('mod.chat.canG'.static::SUSPENSION_TYPE)) {
if (!WCF::getSession()->getPermission('mod.chat.canG'.static::SUSPENSION_TYPE)) {
if (!$ph->getPermission($this->room, 'mod.can'.ucfirst(static::SUSPENSION_TYPE))) {
throw new \wcf\system\exception\PermissionDeniedException();
}