Created
January 13, 2014 19:01
-
-
Save beautyfree/8406024 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class PluginCloseprofile_ActionProfile extends PluginCloseprofile_Inherit_ActionProfile { | |
/** | |
* Проверка корректности профиля | |
*/ | |
protected function CheckUserProfile() { | |
if(parent::CheckUserProfile() === false) return false; | |
/** | |
* Смотрим свой профиль | |
*/ | |
if($this->oUserCurrent and $this->oUserCurrent->getId()==$this->oUserProfile->getId()) { | |
return true; | |
} | |
/** | |
* Профиль админа | |
*/ | |
if($this->oUserProfile->isAdministrator()) { | |
return true; | |
} | |
/** | |
* Чужой профиль | |
*/ | |
// Зареганным показываем своих | |
if($this->oUserCurrent) { | |
$aOpenBlogsProfile = $this->Blog_GetAccessibleBlogsByUser($this->oUserProfile); | |
$aOpenBlogsCurrent = $this->Blog_GetAccessibleBlogsByUser($this->oUserCurrent); | |
if(count(array_intersect($aOpenBlogsProfile,$aOpenBlogsCurrent)) == 0) return false; | |
// Незареганным нет если в закрытых | |
} else { | |
$aOpenBlogs = $this->Blog_GetAccessibleBlogsByUser($this->oUserProfile); | |
if(count($aOpenBlogs) > 0) return false; | |
} | |
return true; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment