1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-02 22:45:02 +03:00

Blog types

This commit is contained in:
Xmk 2013-05-12 08:53:10 +06:00
parent d241d54367
commit 42ab43d99f
2 changed files with 39 additions and 1 deletions

View file

@ -600,7 +600,7 @@ class ActionBlog extends Action {
/**
* Проверяем доступные типы блога для создания
*/
if (!in_array(getRequestStr('blog_type'),array('open','close'))) {
if (!$this->Blog_IsAllowBlogType(getRequestStr('blog_type'))) {
$this->Message_AddError($this->Lang_Get('blog_create_type_error'),$this->Lang_Get('error'));
$bOk=false;
}

View file

@ -41,6 +41,14 @@ class ModuleBlog extends Module {
* Забаненный в блоге пользователь
*/
const BLOG_USER_ROLE_BAN = -4;
/**
* Список типов блога
*
* @var array
*/
protected $aBlogTypes=array(
'open','close'
);
/**
* Объект маппера
@ -63,6 +71,36 @@ class ModuleBlog extends Module {
$this->oMapperBlog=Engine::GetMapper(__CLASS__);
$this->oUserCurrent=$this->User_GetUserCurrent();
}
/**
* Возвращает список типов блога
*
* @return array
*/
public function GetBlogTypes() {
return $this->aBlogTypes;
}
/**
* Добавляет в новый тип блога
*
* @param string $sType Новый тип
* @return bool
*/
public function AddBlogType($sType) {
if (!in_array($sType,$this->aBlogTypes)) {
$this->aBlogTypes[]=$sType;
return true;
}
return false;
}
/**
* Проверяет разрешен ли данный тип блога
*
* @param string $sType Тип
* @return bool
*/
public function IsAllowBlogType($sType) {
return in_array($sType,$this->aBlogTypes);
}
/**
* Получает дополнительные данные(объекты) для блогов по их ID
*