mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-07-01 05:55:02 +03:00
This commit is contained in:
parent
d6ef266711
commit
883b179b48
|
@ -252,11 +252,12 @@ class ActionBlog extends Action {
|
|||
/**
|
||||
* Явлется ли авторизованный пользователь хозяином блога, либо его администратором
|
||||
*/
|
||||
$oBlogUser=$this->Blog_GetRelationBlogUserByBlogIdAndUserId($oBlog->getId(),$this->oUserCurrent->getId());
|
||||
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oBlog->getId(),$this->oUserCurrent->getId());
|
||||
$bIsAdministratorBlog=$oBlogUser ? $oBlogUser->getIsAdministrator() : false;
|
||||
if ($oBlog->getOwnerId()!=$this->oUserCurrent->getId() and !$this->oUserCurrent->isAdministrator() and !$bIsAdministratorBlog) {
|
||||
return parent::EventNotFound();
|
||||
}
|
||||
|
||||
$this->Viewer_AddHtmlTitle($oBlog->getTitle());
|
||||
$this->Viewer_AddHtmlTitle($this->Lang_Get('blog_edit'));
|
||||
|
||||
|
@ -362,7 +363,7 @@ class ActionBlog extends Action {
|
|||
/**
|
||||
* Явлется ли авторизованный пользователь хозяином блога, либо его администратором
|
||||
*/
|
||||
$oBlogUser=$this->Blog_GetRelationBlogUserByBlogIdAndUserId($oBlog->getId(),$this->oUserCurrent->getId());
|
||||
$oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oBlog->getId(),$this->oUserCurrent->getId());
|
||||
$bIsAdministratorBlog=$oBlogUser ? $oBlogUser->getIsAdministrator() : false;
|
||||
if ($oBlog->getOwnerId()!=$this->oUserCurrent->getId() and !$this->oUserCurrent->isAdministrator() and !$bIsAdministratorBlog) {
|
||||
return parent::EventNotFound();
|
||||
|
@ -377,7 +378,7 @@ class ActionBlog extends Action {
|
|||
$aUserRank=array();
|
||||
}
|
||||
foreach ($aUserRank as $sUserId => $sRank) {
|
||||
if (!($oBlogUser=$this->Blog_GetRelationBlogUserByBlogIdAndUserId($oBlog->getId(),$sUserId))) {
|
||||
if (!($oBlogUser=$this->Blog_GetBlogUserByBlogIdAndUserId($oBlog->getId(),$sUserId))) {
|
||||
$this->Message_AddError($this->Lang_Get('system_error'),$this->Lang_Get('error'));
|
||||
break;
|
||||
}
|
||||
|
@ -403,7 +404,7 @@ class ActionBlog extends Action {
|
|||
/**
|
||||
* Получаем список подписчиков блога
|
||||
*/
|
||||
$aBlogUsers=$this->Blog_GetRelationBlog($oBlog->getId());
|
||||
$aBlogUsers=$this->Blog_GetBlogUsersByBlogId($oBlog->getId());
|
||||
|
||||
$this->Viewer_AddHtmlTitle($oBlog->getTitle());
|
||||
$this->Viewer_AddHtmlTitle($this->Lang_Get('blog_admin'));
|
||||
|
|
|
@ -171,9 +171,9 @@ class LsBlog extends Module {
|
|||
* @return unknown
|
||||
*/
|
||||
public function GetBlogById($sBlogId) {
|
||||
$aBlogs=$this->GetBlogsAdditionalData($sId);
|
||||
if (isset($aBlogs[$sId])) {
|
||||
return $aBlogs[$sId];
|
||||
$aBlogs=$this->GetBlogsAdditionalData($sBlogId);
|
||||
if (isset($aBlogs[$sBlogId])) {
|
||||
return $aBlogs[$sBlogId];
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
@ -497,15 +497,12 @@ class LsBlog extends Module {
|
|||
* @param unknown_type $iLimit
|
||||
* @return unknown
|
||||
*/
|
||||
public function GetBlogsRating($iCurrPage,$iPerPage) {
|
||||
$s1=-1;
|
||||
if ($this->oUserCurrent) {
|
||||
$s1=$this->oUserCurrent->getId();
|
||||
}
|
||||
if (false === ($data = $this->Cache_Get("blog_rating_{$iCurrPage}_{$iPerPage}_$s1"))) {
|
||||
public function GetBlogsRating($iCurrPage,$iPerPage) {
|
||||
if (false === ($data = $this->Cache_Get("blog_rating_{$iCurrPage}_{$iPerPage}"))) {
|
||||
$data = array('collection'=>$this->oMapperBlog->GetBlogsRating($iCount,$iCurrPage,$iPerPage),'count'=>$iCount);
|
||||
$this->Cache_Set($data, "blog_rating_{$iCurrPage}_{$iPerPage}_$s1", array("blog_update","blog_new"), 60*15);
|
||||
$this->Cache_Set($data, "blog_rating_{$iCurrPage}_{$iPerPage}", array("blog_update","blog_new"), 60*15);
|
||||
}
|
||||
$data['collection']=$this->GetBlogsAdditionalData($data['collection']);
|
||||
return $data;
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -298,40 +298,19 @@ class Mapper_Blog extends Mapper {
|
|||
|
||||
|
||||
|
||||
public function GetBlogsRating(&$iCount,$iCurrPage,$iPerPage) {
|
||||
$iCurrentUserId=-1;
|
||||
if (is_object($this->oUserCurrent)) {
|
||||
$iCurrentUserId=$this->oUserCurrent->getId();
|
||||
}
|
||||
public function GetBlogsRating(&$iCount,$iCurrPage,$iPerPage) {
|
||||
$sql = "SELECT
|
||||
b.*,
|
||||
u.user_profile_avatar as user_profile_avatar,
|
||||
u.user_profile_avatar_type as user_profile_avatar_type,
|
||||
u.user_login as user_login,
|
||||
IF(bu.blog_id IS NULL,0,1) as current_user_is_join
|
||||
b.blog_id
|
||||
FROM
|
||||
".DB_TABLE_BLOG." as b
|
||||
|
||||
LEFT JOIN (
|
||||
SELECT
|
||||
blog_id
|
||||
FROM ".DB_TABLE_BLOG_USER."
|
||||
WHERE user_id = ?d
|
||||
) AS bu ON b.blog_id = bu.blog_id,
|
||||
|
||||
".DB_TABLE_USER." as u
|
||||
".DB_TABLE_BLOG." as b
|
||||
WHERE
|
||||
b.blog_type<>'personal'
|
||||
AND
|
||||
b.user_owner_id=u.user_id
|
||||
b.blog_type<>'personal'
|
||||
ORDER by b.blog_rating desc
|
||||
LIMIT ?d, ?d
|
||||
;
|
||||
";
|
||||
LIMIT ?d, ?d ";
|
||||
$aReturn=array();
|
||||
if ($aRows=$this->oDb->selectPage($iCount,$sql,$iCurrentUserId,($iCurrPage-1)*$iPerPage, $iPerPage)) {
|
||||
if ($aRows=$this->oDb->selectPage($iCount,$sql,($iCurrPage-1)*$iPerPage, $iPerPage)) {
|
||||
foreach ($aRows as $aRow) {
|
||||
$aReturn[]=new BlogEntity_Blog($aRow);
|
||||
$aReturn[]=$aRow['blog_id'];
|
||||
}
|
||||
}
|
||||
return $aReturn;
|
||||
|
|
|
@ -17,14 +17,15 @@
|
|||
</thead>
|
||||
<tbody>
|
||||
{foreach from=$aBlogUsers item=oBlogUser}
|
||||
{assign var="oUser" value=$oBlogUser->getUser()}
|
||||
<tr>
|
||||
<td class="username"><a href="{$DIR_WEB_ROOT}/{$ROUTE_PAGE_PROFILE}/{$oBlogUser->getUserLogin()}/">{$oBlogUser->getUserLogin()}</a></td>
|
||||
{if $oBlogUser->getUserId()==$oUserCurrent->getId()}
|
||||
<td class="username"><a href="{$DIR_WEB_ROOT}/{$ROUTE_PAGE_PROFILE}/{$oUser->getLogin()}/">{$oUser->getLogin()}</a></td>
|
||||
{if $oUser->getId()==$oUserCurrent->getId()}
|
||||
<td colspan="3" align="center">{$aLang.blog_admin_users_current_administrator}</td>
|
||||
{else}
|
||||
<td><input type="radio" name="user_rank[{$oBlogUser->getUserId()}]" value="administrator" {if $oBlogUser->getIsAdministrator()}checked{/if}/></td>
|
||||
<td><input type="radio" name="user_rank[{$oBlogUser->getUserId()}]" value="moderator" {if $oBlogUser->getIsModerator()}checked{/if}/></td>
|
||||
<td><input type="radio" name="user_rank[{$oBlogUser->getUserId()}]" value="reader" {if !$oBlogUser->getIsAdministrator() and !$oBlogUser->getIsModerator()}checked{/if}/></td>
|
||||
<td><input type="radio" name="user_rank[{$oUser->getId()}]" value="administrator" {if $oBlogUser->getIsAdministrator()}checked{/if}/></td>
|
||||
<td><input type="radio" name="user_rank[{$oUser->getId()}]" value="moderator" {if $oBlogUser->getIsModerator()}checked{/if}/></td>
|
||||
<td><input type="radio" name="user_rank[{$oUser->getId()}]" value="reader" {if !$oBlogUser->getIsAdministrator() and !$oBlogUser->getIsModerator()}checked{/if}/></td>
|
||||
{/if}
|
||||
</tr>
|
||||
{/foreach}
|
||||
|
|
|
@ -12,14 +12,15 @@
|
|||
|
||||
<tbody>
|
||||
{foreach from=$aBlogs item=oBlog}
|
||||
{assign var="oUserOwner" value=$oBlog->getOwner()}
|
||||
<tr>
|
||||
<td class="name">
|
||||
<a href="{$DIR_WEB_ROOT}/{$ROUTE_PAGE_BLOG}/{$oBlog->getUrl()}/"><img src="{$oBlog->getAvatarPath(24)}" alt="" /></a>
|
||||
<a href="{$DIR_WEB_ROOT}/{$ROUTE_PAGE_BLOG}/{$oBlog->getUrl()}/" class="title">{$oBlog->getTitle()|escape:'html'}</a><br />
|
||||
{$aLang.blogs_owner}: <a href="{$DIR_WEB_ROOT}/{$ROUTE_PAGE_PROFILE}/{$oBlog->getUserLogin()}/" class="author">{$oBlog->getUserLogin()}</a>
|
||||
{$aLang.blogs_owner}: <a href="{$DIR_WEB_ROOT}/{$ROUTE_PAGE_PROFILE}/{$oUserOwner->getLogin()}/" class="author">{$oUserOwner->getLogin()}</a>
|
||||
</td>
|
||||
{if $oUserCurrent}
|
||||
<td class="join {if $oBlog->getCurrentUserIsJoin()}active{/if}">
|
||||
<td class="join {if $oBlog->getUserIsJoin()}active{/if}">
|
||||
{if $oUserCurrent->getId()!=$oBlog->getOwnerId()}
|
||||
<a href="#" onclick="ajaxJoinLeaveBlog(this,{$oBlog->getId()}); return false;"></a>
|
||||
{/if}
|
||||
|
|
Loading…
Reference in a new issue