mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-05 07:54:24 +03:00
fix Issue #188
This commit is contained in:
parent
23f1b0b2ef
commit
d997b52c36
|
@ -311,10 +311,20 @@ class ModuleACL extends Module {
|
||||||
/**
|
/**
|
||||||
* Если модер или админ блога
|
* Если модер или админ блога
|
||||||
*/
|
*/
|
||||||
|
if ($this->User_GetUserCurrent() and $this->User_GetUserCurrent()->getId()==$oUser->getId()) {
|
||||||
|
/**
|
||||||
|
* Для авторизованного пользователя данный код будет работать быстрее
|
||||||
|
*/
|
||||||
|
if ($oTopic->getBlog()->getUserIsAdministrator() or $oTopic->getBlog()->getUserIsModerator()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oTopic->getBlogId(),$oUser->getId());
|
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oTopic->getBlogId(),$oUser->getId());
|
||||||
if ($oBlogUser and ($oBlogUser->getIsModerator() or $oBlogUser->getIsAdministrator())) {
|
if ($oBlogUser and ($oBlogUser->getIsModerator() or $oBlogUser->getIsAdministrator())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -340,10 +350,19 @@ class ModuleACL extends Module {
|
||||||
/**
|
/**
|
||||||
* Если модер или админ блога
|
* Если модер или админ блога
|
||||||
*/
|
*/
|
||||||
|
if ($this->User_GetUserCurrent() and $this->User_GetUserCurrent()->getId()==$oUser->getId()) {
|
||||||
|
/**
|
||||||
|
* Для авторизованного пользователя данный код будет работать быстрее
|
||||||
|
*/
|
||||||
|
if ($oTopic->getBlog()->getUserIsAdministrator() or $oTopic->getBlog()->getUserIsModerator()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oTopic->getBlogId(),$oUser->getId());
|
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oTopic->getBlogId(),$oUser->getId());
|
||||||
if ($oBlogUser and ($oBlogUser->getIsModerator() or $oBlogUser->getIsAdministrator())) {
|
if ($oBlogUser and ($oBlogUser->getIsModerator() or $oBlogUser->getIsAdministrator())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -394,6 +394,39 @@ class ModuleTopic_EntityTopic extends Entity {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Проверяет разрешение на удаление топика у текущего пользователя
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getIsAllowDelete() {
|
||||||
|
if ($oUser=$this->User_GetUserCurrent()) {
|
||||||
|
return $this->ACL_IsAllowDeleteTopic($this,$oUser);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Проверяет разрешение на редактирование топика у текущего пользователя
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getIsAllowEdit() {
|
||||||
|
if ($oUser=$this->User_GetUserCurrent()) {
|
||||||
|
return $this->ACL_IsAllowEditTopic($this,$oUser);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* Проверяет разрешение на какое-либо действие для топика у текущего пользователя
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function getIsAllowAction() {
|
||||||
|
if ($this->User_GetUserCurrent()) {
|
||||||
|
return $this->getIsAllowEdit() || $this->getIsAllowDelete();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Возвращает количество добавивших топик в избранное
|
* Возвращает количество добавивших топик в избранное
|
||||||
*
|
*
|
||||||
|
|
|
@ -36,14 +36,16 @@
|
||||||
{date_format date=$oTopic->getDateAdd() format="j F Y, H:i"}
|
{date_format date=$oTopic->getDateAdd() format="j F Y, H:i"}
|
||||||
</time>
|
</time>
|
||||||
|
|
||||||
|
{if $oTopic->getIsAllowAction()}
|
||||||
<ul class="actions">
|
<ul class="actions">
|
||||||
{if $oUserCurrent and ($oUserCurrent->getId()==$oTopic->getUserId() or $oUserCurrent->isAdministrator() or $oBlog->getUserIsAdministrator() or $oBlog->getUserIsModerator() or $oBlog->getOwnerId()==$oUserCurrent->getId())}
|
{if $oTopic->getIsAllowEdit()}
|
||||||
<li><a href="{$oTopic->getUrlEdit()}" title="{$aLang.topic_edit}" class="actions-edit">{$aLang.topic_edit}</a></li>
|
<li><a href="{$oTopic->getUrlEdit()}" title="{$aLang.topic_edit}" class="actions-edit">{$aLang.topic_edit}</a></li>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if $oUserCurrent and ($oUserCurrent->isAdministrator() or $oBlog->getUserIsAdministrator() or $oBlog->getOwnerId()==$oUserCurrent->getId())}
|
{if $oTopic->getIsAllowDelete()}
|
||||||
<li><a href="{router page='topic'}delete/{$oTopic->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}" title="{$aLang.topic_delete}" onclick="return confirm('{$aLang.topic_delete_confirm}');" class="actions-delete">{$aLang.topic_delete}</a></li>
|
<li><a href="{router page='topic'}delete/{$oTopic->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}" title="{$aLang.topic_delete}" onclick="return confirm('{$aLang.topic_delete_confirm}');" class="actions-delete">{$aLang.topic_delete}</a></li>
|
||||||
{/if}
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
|
@ -29,13 +29,13 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{if $oUserCurrent and ($oUserCurrent->getId()==$oTopic->getUserId() or $oUserCurrent->isAdministrator() or $oBlog->getUserIsAdministrator() or $oBlog->getUserIsModerator() or $oBlog->getOwnerId()==$oUserCurrent->getId())}
|
{if $oTopic->getIsAllowAction()}
|
||||||
<ul class="topic-actions">
|
<ul class="topic-actions">
|
||||||
{if $oUserCurrent and ($oUserCurrent->getId()==$oTopic->getUserId() or $oUserCurrent->isAdministrator() or $oBlog->getUserIsAdministrator() or $oBlog->getUserIsModerator() or $oBlog->getOwnerId()==$oUserCurrent->getId())}
|
{if $oTopic->getIsAllowEdit()}
|
||||||
<li class="edit"><i class="icon-synio-actions-edit"></i><a href="{$oTopic->getUrlEdit()}" title="{$aLang.topic_edit}" class="actions-edit">{$aLang.topic_edit}</a></li>
|
<li class="edit"><i class="icon-synio-actions-edit"></i><a href="{$oTopic->getUrlEdit()}" title="{$aLang.topic_edit}" class="actions-edit">{$aLang.topic_edit}</a></li>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
{if $oUserCurrent and ($oUserCurrent->isAdministrator() or $oBlog->getUserIsAdministrator() or $oBlog->getOwnerId()==$oUserCurrent->getId())}
|
{if $oTopic->getIsAllowDelete()}
|
||||||
<li class="delete"><i class="icon-synio-actions-delete"></i><a href="{router page='topic'}delete/{$oTopic->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}" title="{$aLang.topic_delete}" onclick="return confirm('{$aLang.topic_delete_confirm}');" class="actions-delete">{$aLang.topic_delete}</a></li>
|
<li class="delete"><i class="icon-synio-actions-delete"></i><a href="{router page='topic'}delete/{$oTopic->getId()}/?security_ls_key={$LIVESTREET_SECURITY_KEY}" title="{$aLang.topic_delete}" onclick="return confirm('{$aLang.topic_delete_confirm}');" class="actions-delete">{$aLang.topic_delete}</a></li>
|
||||||
{/if}
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
Loading…
Reference in a new issue