1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-05-17 00:08:17 +03:00

фикс управления блогами и топиками

This commit is contained in:
Mzhelskiy Maxim 2008-10-18 12:32:24 +00:00
parent 4e79ec3c1a
commit be22a58b56
7 changed files with 66 additions and 6 deletions

View file

@ -98,7 +98,7 @@ class ActionTopic extends Action {
$bIsAdministratorBlog=$oBlogUser ? $oBlogUser->getIsAdministrator() : false;
$bIsModeratorBlog=$oBlogUser ? $oBlogUser->getIsModerator() : false;
if ($oTopic->getUserId()!=$this->oUserCurrent->getId() and !$this->oUserCurrent->isAdministrator() and !$bIsAdministratorBlog and !$bIsModeratorBlog) {
if ($oTopic->getUserId()!=$this->oUserCurrent->getId() and !$this->oUserCurrent->isAdministrator() and !$bIsAdministratorBlog and !$bIsModeratorBlog and $oTopic->getBlogOwnerId()!=$this->oUserCurrent->getId()) {
return parent::EventNotFound();
}
/**
@ -428,7 +428,7 @@ class ActionTopic extends Action {
$bIsAdministratorBlog=$oBlogUser ? $oBlogUser->getIsAdministrator() : false;
$bIsModeratorBlog=$oBlogUser ? $oBlogUser->getIsModerator() : false;
if (!$this->Blog_GetRelationBlogUserByBlogIdAndUserId($oBlog->getId(),$this->oUserCurrent->getId()) and !$this->oUserCurrent->isAdministrator() and !$bIsAdministratorBlog and !$bIsModeratorBlog) {
if (!$this->Blog_GetRelationBlogUserByBlogIdAndUserId($oBlog->getId(),$this->oUserCurrent->getId()) and !$this->oUserCurrent->isAdministrator() and !$bIsAdministratorBlog and !$bIsModeratorBlog and $oTopic->getBlogOwnerId()!=$this->oUserCurrent->getId()) {
if ($oBlog->getOwnerId()!=$this->oUserCurrent->getId()) {
$this->Message_AddErrorSingle('Вы не состоите в этом блоге!','Ошибка');
return false;

View file

@ -135,6 +135,9 @@ class TopicEntity_Topic extends Entity
public function getUserIsBlogModerator() {
return $this->_aData['user_is_blog_moderator'];
}
public function getBlogOwnerId() {
return $this->_aData['blog_owner_id'];
}
/***************************************************************************************************************************************************
* методы расширения типов топика

View file

@ -168,6 +168,7 @@ class Mapper_Topic extends Mapper {
b.blog_type as blog_type,
b.blog_url as blog_url,
b.blog_title as blog_title,
b.user_owner_id as blog_owner_id,
IF(tv.topic_id IS NULL,0,1) as user_is_vote,
tv.vote_delta as user_vote_delta,
IF(tqv.topic_id IS NULL,0,1) as user_question_is_vote,
@ -285,7 +286,8 @@ class Mapper_Topic extends Mapper {
t.*,
b.blog_title as blog_title,
b.blog_type as blog_type,
b.blog_url as blog_url
b.blog_url as blog_url,
b.user_owner_id as blog_owner_id
FROM
".DB_TABLE_TOPIC." as t,
".DB_TABLE_BLOG." as b

View file

@ -21,7 +21,7 @@ mysql_query("set collation_connection='utf8_bin'",$link);
/**
* Конвертирует топики из старой структуры в новую
*/
/*
$sql = "SELECT
*
FROM
@ -37,4 +37,58 @@ while ($row=mysql_fetch_assoc($res)) {
";
mysql_query($sql2,$link);
}
*/
/**
* Конвертируем комментариии в новую структуру
* Если комментариев много, то может занять много времени
*/
$sql = "SELECT res.* FROM (
SELECT
c.*,
t.topic_title as topic_title,
t.topic_count_comment as topic_count_comment,
u.user_profile_avatar as user_profile_avatar,
u.user_profile_avatar_type as user_profile_avatar_type,
u.user_login as user_login,
b.blog_title as blog_title,
b.blog_type as blog_type,
b.blog_url as blog_url,
u_owner.user_login as blog_owner_login
FROM
".DB_TABLE_TOPIC_COMMENT." as c,
".DB_TABLE_TOPIC." as t,
".DB_TABLE_USER." as u,
".DB_TABLE_BLOG." as b,
".DB_TABLE_USER." as u_owner
WHERE
c.comment_id=(SELECT comment_id FROM ".DB_TABLE_TOPIC_COMMENT." WHERE topic_id=t.topic_id AND t.topic_publish=1 ORDER BY comment_date DESC LIMIT 0,1)
AND
c.comment_delete = 0
AND
c.topic_id=t.topic_id
AND
t.topic_publish = 1
AND
c.user_id=u.user_id
AND
t.blog_id=b.blog_id
AND
b.user_owner_id=u_owner.user_id
ORDER by c.comment_date desc limit 0, 50
) as res
ORDER BY comment_date asc
";
$res=mysql_query($sql,$link);
while ($row=mysql_fetch_assoc($res)) {
//var_dump($row);
$sql2 = "INSERT INTO ".DB_TABLE_TOPIC_COMMENT_ONLINE."
(topic_id,comment_id)
values(".$row['topic_id'].",'".mysql_escape_string($row['comment_id'])."')
";
mysql_query($sql2,$link);
}
?>

View file

@ -123,6 +123,7 @@ var msgNoticeBox=new Roar({
<A href="{$DIR_WEB_ROOT}/page/about/">О проекте</A>
<A href="{$DIR_WEB_ROOT}/page/download/">Скачать</A>
<A href="http://trac.assembla.com/livestreet/timeline" target="_blank" style="color: #d00;">SVN</A>
<A href="http://test.livestreet.ru" target="_blank" style="color: #d00;">DEMO</A>
</DIV>
<!--
<DIV class=submenu>

View file

@ -10,7 +10,7 @@
<img src="{$DIR_STATIC_SKIN}/img/topic_unpublish.gif" border="0" title="топик находится в черновиках">
{/if}
{$oTopic->getTitle()|escape:'html'}
{if $oUserCurrent and ( $oUserCurrent->getId()==$oTopic->getUserId() or $oUserCurrent->isAdministrator() or $oTopic->getUserIsBlogAdministrator() or $oTopic->getUserIsBlogModerator())}
{if $oUserCurrent and ( $oUserCurrent->getId()==$oTopic->getUserId() or $oUserCurrent->isAdministrator() or $oTopic->getUserIsBlogAdministrator() or $oTopic->getUserIsBlogModerator() or $oTopic->getBlogOwnerId()==$oUserCurrent->getId())}
<a href="{$DIR_WEB_ROOT}/{$oTopic->getType()}/edit/{$oTopic->getId()}/" title="отредактировать топик"><img src="{$DIR_STATIC_SKIN}/img/blog_edit.gif" border="0" title="отредактировать топик"></a>
{/if}
<a href="{$DIR_WEB_ROOT}/rss/comments/{$oTopic->getId()}/" title="RSS лента"><IMG height=12 src="{$DIR_STATIC_SKIN}/img/rss_small.gif" width=12></a>

View file

@ -14,7 +14,7 @@
{/if}
<a href="{if $oTopic->getType()=='link'}{$DIR_WEB_ROOT}/link/go/{$oTopic->getId()}/{else}{$oTopic->getUrl()}{/if}" class="headline_l">{$oTopic->getTitle()|escape:'html'}</a>
{if $oUserCurrent and ($oUserCurrent->getId()==$oTopic->getUserId() or $oUserCurrent->isAdministrator() or $oTopic->getUserIsBlogAdministrator() or $oTopic->getUserIsBlogModerator())}
{if $oUserCurrent and ($oUserCurrent->getId()==$oTopic->getUserId() or $oUserCurrent->isAdministrator() or $oTopic->getUserIsBlogAdministrator() or $oTopic->getUserIsBlogModerator() or $oTopic->getBlogOwnerId()==$oUserCurrent->getId())}
<a href="{$DIR_WEB_ROOT}/{$oTopic->getType()}/edit/{$oTopic->getId()}/" title="отредактировать топик"><img src="{$DIR_STATIC_SKIN}/img/blog_edit.gif" border="0" title="отредактировать топик"></a>
{/if}