Fix case insensitivity of method_exists() function
For BBCodeList\Structure
This commit is contained in:
parent
a8e580cde6
commit
fd5dda5aef
31 changed files with 80 additions and 80 deletions
|
@ -61,14 +61,14 @@ class Structure extends Model
|
|||
|
||||
foreach ($bbcode as $cur) {
|
||||
if ($this->tag === $cur['tag']) {
|
||||
return $this->setAttrs($cur);
|
||||
return $this->setModelAttrs($cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function fromString(string $data): Structure
|
||||
{
|
||||
return $this->setAttrs(\json_decode($data, true, 512, \JSON_THROW_ON_ERROR));
|
||||
return $this->setModelAttrs(\json_decode($data, true, 512, \JSON_THROW_ON_ERROR));
|
||||
}
|
||||
|
||||
public function toString(): string
|
||||
|
@ -142,14 +142,14 @@ class Structure extends Model
|
|||
|
||||
protected function gettype(): string
|
||||
{
|
||||
$type = $this->getAttr('type');
|
||||
$type = $this->getModelAttr('type');
|
||||
|
||||
return \is_string($type) ? $type : 'inline';
|
||||
}
|
||||
|
||||
protected function getparents(): array
|
||||
{
|
||||
$parents = $this->getAttr('parents');
|
||||
$parents = $this->getModelAttr('parents');
|
||||
|
||||
if (\is_array($parents)) {
|
||||
return $parents;
|
||||
|
@ -163,36 +163,36 @@ class Structure extends Model
|
|||
protected function setrecursive($value): void
|
||||
{
|
||||
$value = empty($value) ? null : true;
|
||||
$this->setAttr('recursive', $value);
|
||||
$this->setModelAttr('recursive', $value);
|
||||
}
|
||||
|
||||
protected function settext_only($value): void
|
||||
{
|
||||
$value = empty($value) ? null : true;
|
||||
$this->setAttr('text_only', $value);
|
||||
$this->setModelAttr('text_only', $value);
|
||||
}
|
||||
|
||||
protected function settags_only($value): void
|
||||
{
|
||||
$value = empty($value) ? null : true;
|
||||
$this->setAttr('tags_only', $value);
|
||||
$this->setModelAttr('tags_only', $value);
|
||||
}
|
||||
|
||||
protected function setpre($value): void
|
||||
{
|
||||
$value = empty($value) ? null : true;
|
||||
$this->setAttr('pre', $value);
|
||||
$this->setModelAttr('pre', $value);
|
||||
}
|
||||
|
||||
protected function setsingle($value): void
|
||||
{
|
||||
$value = empty($value) ? null : true;
|
||||
$this->setAttr('single', $value);
|
||||
$this->setModelAttr('single', $value);
|
||||
}
|
||||
|
||||
protected function getauto(): bool
|
||||
{
|
||||
$auto = $this->getAttr('auto');
|
||||
$auto = $this->getModelAttr('auto');
|
||||
|
||||
if (\is_bool($auto)) {
|
||||
return $auto;
|
||||
|
@ -206,13 +206,13 @@ class Structure extends Model
|
|||
protected function setauto($value): void
|
||||
{
|
||||
$value = ! empty($value);
|
||||
$this->setAttr('auto', $value);
|
||||
$this->setModelAttr('auto', $value);
|
||||
}
|
||||
|
||||
protected function setself_nesting($value): void
|
||||
{
|
||||
$value = (int) $value < 1 ? false : (int) $value;
|
||||
$this->setAttr('self_nesting', $value);
|
||||
$this->setModelAttr('self_nesting', $value);
|
||||
}
|
||||
|
||||
protected function getBBAttr(string $name, array $fields): mixed
|
||||
|
@ -255,7 +255,7 @@ class Structure extends Model
|
|||
|
||||
protected function setBBAttr(string $name, mixed $data, array $fields): void
|
||||
{
|
||||
$attrs = $this->getAttr('attrs');
|
||||
$attrs = $this->getModelAttr('attrs');
|
||||
|
||||
if (
|
||||
empty($data['allowed'])
|
||||
|
@ -289,7 +289,7 @@ class Structure extends Model
|
|||
$attrs[$name] = empty($result) ? true : $result;
|
||||
}
|
||||
|
||||
$this->setAttr('attrs', $attrs);
|
||||
$this->setModelAttr('attrs', $attrs);
|
||||
}
|
||||
|
||||
protected function getno_attr(): mixed
|
||||
|
@ -314,7 +314,7 @@ class Structure extends Model
|
|||
|
||||
protected function getother_attrs(): array
|
||||
{
|
||||
$attrs = $this->getAttr('attrs');
|
||||
$attrs = $this->getModelAttr('attrs');
|
||||
|
||||
if (! \is_array($attrs)) {
|
||||
return [];
|
||||
|
|
|
@ -38,7 +38,7 @@ class Config extends DataModel
|
|||
}
|
||||
}
|
||||
|
||||
$this->setAttrs($config);
|
||||
$this->setModelAttrs($config);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ class Install extends Method
|
|||
*/
|
||||
public function install(): Config
|
||||
{
|
||||
$this->model->setAttrs($this->c->forConfig);
|
||||
$this->model->setModelAttrs($this->c->forConfig);
|
||||
|
||||
return $this->model;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ class Save extends Method
|
|||
return $this->model;
|
||||
}
|
||||
|
||||
$values = $this->model->getAttrs();
|
||||
$values = $this->model->getModelAttrs();
|
||||
|
||||
foreach ($modified as $name) {
|
||||
if (\array_key_exists($name, $values)) {
|
||||
|
|
|
@ -42,7 +42,7 @@ class Cookie extends Model
|
|||
'time' => 31536000,
|
||||
];
|
||||
|
||||
$this->setAttrs($options);
|
||||
$this->setModelAttrs($options);
|
||||
$this->init();
|
||||
$this->noSet = true;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class DBMap extends Model
|
|||
}
|
||||
}
|
||||
|
||||
$this->setAttrs($map);
|
||||
$this->setModelAttrs($map);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -29,12 +29,12 @@ class DataModel extends Model
|
|||
* Сбрасывает вычисленные свойства
|
||||
* Флаги модификации свойст сброшены
|
||||
*/
|
||||
public function setAttrs(array $attrs): Model
|
||||
public function setModelAttrs(array $attrs): Model
|
||||
{
|
||||
$this->zModFlags = [];
|
||||
$this->zTrackFlags = [];
|
||||
|
||||
return parent::setAttrs($attrs);
|
||||
return parent::setModelAttrs($attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -142,7 +142,7 @@ class DataModel extends Model
|
|||
{
|
||||
// без вычисления
|
||||
if (\str_starts_with($name, '__')) {
|
||||
return $this->getAttr(\substr($name, 2));
|
||||
return $this->getModelAttr(\substr($name, 2));
|
||||
// с вычислениями
|
||||
} else {
|
||||
return parent::__get($name);
|
||||
|
|
|
@ -89,7 +89,7 @@ class Forum extends DataModel
|
|||
protected function getsubforums(): array
|
||||
{
|
||||
$sub = [];
|
||||
$attr = $this->getAttr('subforums');
|
||||
$attr = $this->getModelAttr('subforums');
|
||||
|
||||
if (\is_array($attr)) {
|
||||
foreach ($attr as $id) {
|
||||
|
@ -106,7 +106,7 @@ class Forum extends DataModel
|
|||
protected function getdescendants(): array
|
||||
{
|
||||
$all = [];
|
||||
$attr = $this->getAttr('descendants');
|
||||
$attr = $this->getModelAttr('descendants');
|
||||
|
||||
if (\is_array($attr)) {
|
||||
foreach ($attr as $id) {
|
||||
|
@ -242,7 +242,7 @@ class Forum extends DataModel
|
|||
*/
|
||||
protected function getmoderators(): array
|
||||
{
|
||||
$attr = $this->getAttr('moderators');
|
||||
$attr = $this->getModelAttr('moderators');
|
||||
|
||||
if (
|
||||
empty($attr)
|
||||
|
@ -278,7 +278,7 @@ class Forum extends DataModel
|
|||
*/
|
||||
public function modAdd(User ...$users): void
|
||||
{
|
||||
$attr = $this->getAttr('moderators');
|
||||
$attr = $this->getModelAttr('moderators');
|
||||
|
||||
if (
|
||||
empty($attr)
|
||||
|
@ -303,7 +303,7 @@ class Forum extends DataModel
|
|||
*/
|
||||
public function modDelete(User ...$users): void
|
||||
{
|
||||
$attr = $this->getAttr('moderators');
|
||||
$attr = $this->getModelAttr('moderators');
|
||||
|
||||
if (
|
||||
empty($attr)
|
||||
|
@ -328,7 +328,7 @@ class Forum extends DataModel
|
|||
*/
|
||||
protected function gettree(): Forum
|
||||
{
|
||||
$attr = $this->getAttr('tree');
|
||||
$attr = $this->getModelAttr('tree');
|
||||
|
||||
if (empty($attr)) { //????
|
||||
$numT = (int) $this->num_topics;
|
||||
|
@ -362,7 +362,7 @@ class Forum extends DataModel
|
|||
'newMessages' => $fnew,
|
||||
]);
|
||||
|
||||
$this->setAttr('tree', $attr);
|
||||
$this->setModelAttr('tree', $attr);
|
||||
}
|
||||
|
||||
return $attr;
|
||||
|
@ -457,9 +457,9 @@ class Forum extends DataModel
|
|||
/**
|
||||
* Возвращает значения свойств в массиве
|
||||
*/
|
||||
public function getAttrs(): array
|
||||
public function getModelAttrs(): array
|
||||
{
|
||||
$data = parent::getAttrs();
|
||||
$data = parent::getModelAttrs();
|
||||
|
||||
$data['moderators'] = empty($data['moderators']) || ! \is_array($data['moderators'])
|
||||
? ''
|
||||
|
|
|
@ -34,7 +34,7 @@ class Forums extends Manager
|
|||
*/
|
||||
public function create(array $attrs = []): Forum
|
||||
{
|
||||
return $this->c->ForumModel->setAttrs($attrs);
|
||||
return $this->c->ForumModel->setModelAttrs($attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ class Save extends Action
|
|||
return $forum;
|
||||
}
|
||||
|
||||
$values = $forum->getAttrs();
|
||||
$values = $forum->getModelAttrs();
|
||||
$fields = $this->c->dbMap->forums;
|
||||
$set = $vars = [];
|
||||
|
||||
|
@ -88,7 +88,7 @@ class Save extends Action
|
|||
throw new RuntimeException('The model has ID');
|
||||
}
|
||||
|
||||
$attrs = $forum->getAttrs();
|
||||
$attrs = $forum->getModelAttrs();
|
||||
$fields = $this->c->dbMap->forums;
|
||||
$set = $set2 = $vars = [];
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class Groups extends Manager
|
|||
*/
|
||||
public function create(array $attrs = []): Group
|
||||
{
|
||||
return $this->c->GroupModel->setAttrs($attrs);
|
||||
return $this->c->GroupModel->setModelAttrs($attrs);
|
||||
}
|
||||
|
||||
public function getList(): array
|
||||
|
|
|
@ -31,7 +31,7 @@ class Save extends Action
|
|||
return $group;
|
||||
}
|
||||
|
||||
$values = $group->getAttrs();
|
||||
$values = $group->getModelAttrs();
|
||||
$fields = $this->c->dbMap->groups;
|
||||
|
||||
$set = $vars = [];
|
||||
|
@ -77,7 +77,7 @@ class Save extends Action
|
|||
throw new RuntimeException('The model has ID');
|
||||
}
|
||||
|
||||
$attrs = $group->getAttrs();
|
||||
$attrs = $group->getModelAttrs();
|
||||
$fields = $this->c->dbMap->groups;
|
||||
|
||||
$set = $set2 = $vars = [];
|
||||
|
|
|
@ -88,7 +88,7 @@ class Model
|
|||
* Устанавливает значение для свойства
|
||||
* Без вычислений, но со сбросом зависимых свойст и вычисленного значения
|
||||
*/
|
||||
public function setAttr(string $name, mixed $value): Model
|
||||
public function setModelAttr(string $name, mixed $value): Model
|
||||
{
|
||||
$this->unsetCalc($name);
|
||||
$this->zAttrs[$name] = $value;
|
||||
|
@ -100,7 +100,7 @@ class Model
|
|||
* Устанавливает значения для свойств
|
||||
* Сбрасывает вычисленные свойства
|
||||
*/
|
||||
public function setAttrs(array $attrs): Model
|
||||
public function setModelAttrs(array $attrs): Model
|
||||
{
|
||||
$this->zAttrs = $attrs; //????
|
||||
$this->zAttrsCalc = [];
|
||||
|
@ -142,7 +142,7 @@ class Model
|
|||
* Возвращает значение свойства
|
||||
* Без вычислений
|
||||
*/
|
||||
public function getAttr(string $name, mixed $default = null): mixed
|
||||
public function getModelAttr(string $name, mixed $default = null): mixed
|
||||
{
|
||||
return \array_key_exists($name, $this->zAttrs) ? $this->zAttrs[$name] : $default;
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ class Model
|
|||
* Возвращает значения свойств в массиве
|
||||
* Без вычислений
|
||||
*/
|
||||
public function getAttrs(): array
|
||||
public function getModelAttrs(): array
|
||||
{
|
||||
return $this->zAttrs;
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ class PBlock extends Model
|
|||
|
||||
public function init(User $user): void
|
||||
{
|
||||
$this->setAttrs([]);
|
||||
$this->setModelAttrs([]);
|
||||
|
||||
$this->repository = [];
|
||||
$this->user = $user;
|
||||
|
|
|
@ -97,9 +97,9 @@ class PM extends Model
|
|||
{
|
||||
switch ($type) {
|
||||
case Cnst::PTOPIC:
|
||||
return $this->c->PTopicModel->setAttrs($attrs);
|
||||
return $this->c->PTopicModel->setModelAttrs($attrs);
|
||||
case Cnst::PPOST:
|
||||
return $this->c->PPostModel->setAttrs($attrs);
|
||||
return $this->c->PPostModel->setModelAttrs($attrs);
|
||||
default:
|
||||
throw new InvalidArgumentException("Wrong type: {$type}");
|
||||
}
|
||||
|
@ -403,7 +403,7 @@ class PM extends Model
|
|||
$area = Cnst::ACTION_CURRENT;
|
||||
}
|
||||
|
||||
$this->setAttr('area', $area);
|
||||
$this->setModelAttr('area', $area);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ class Save extends Method
|
|||
return $model;
|
||||
}
|
||||
|
||||
$values = $model->getAttrs();
|
||||
$values = $model->getModelAttrs();
|
||||
$fields = $this->c->dbMap->{$table};
|
||||
|
||||
$set = $vars = [];
|
||||
|
@ -83,7 +83,7 @@ class Save extends Method
|
|||
throw new InvalidArgumentException('Bad model');
|
||||
}
|
||||
|
||||
$attrs = $model->getAttrs();
|
||||
$attrs = $model->getModelAttrs();
|
||||
$fields = $this->c->dbMap->{$table};
|
||||
|
||||
$set = $set2 = $vars = [];
|
||||
|
|
|
@ -437,10 +437,10 @@ abstract class Page extends Model
|
|||
*/
|
||||
public function settitles(string|array $value): void
|
||||
{
|
||||
$attr = $this->getAttr('titles', []);
|
||||
$attr = $this->getModelAttr('titles', []);
|
||||
$attr[] = $value;
|
||||
|
||||
$this->setAttr('titles', $attr);
|
||||
$this->setModelAttr('titles', $attr);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -449,7 +449,7 @@ abstract class Page extends Model
|
|||
*/
|
||||
public function setfIswev(array $value): void
|
||||
{
|
||||
$attr = $this->getAttr('fIswev', []);
|
||||
$attr = $this->getModelAttr('fIswev', []);
|
||||
|
||||
if (
|
||||
isset($value[0], $value[1])
|
||||
|
@ -461,7 +461,7 @@ abstract class Page extends Model
|
|||
$attr = \array_merge_recursive($attr, $value); // ???? добавить проверку?
|
||||
}
|
||||
|
||||
$this->setAttr('fIswev', $attr) ;
|
||||
$this->setModelAttr('fIswev', $attr) ;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -26,7 +26,7 @@ class Polls extends Manager
|
|||
*/
|
||||
public function create(array $attrs = []): Poll
|
||||
{
|
||||
return $this->c->PollModel->setAttrs($attrs);
|
||||
return $this->c->PollModel->setModelAttrs($attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -45,7 +45,7 @@ class Polls extends Manager
|
|||
$poll = $this->create($data);
|
||||
} else {
|
||||
$poll = $this->Load->load($id);
|
||||
$data = $poll instanceof Poll ? $poll->getAttrs() : null; // ????
|
||||
$data = $poll instanceof Poll ? $poll->getModelAttrs() : null; // ????
|
||||
|
||||
$this->c->Cache->set("poll{$id}", $data);
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ class Posts extends Manager
|
|||
*/
|
||||
public function create(array $attrs = []): Post
|
||||
{
|
||||
return $this->c->PostModel->setAttrs($attrs);
|
||||
return $this->c->PostModel->setModelAttrs($attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,7 @@ class Save extends Action
|
|||
return $post;
|
||||
}
|
||||
|
||||
$values = $post->getAttrs();
|
||||
$values = $post->getModelAttrs();
|
||||
$fields = $this->c->dbMap->posts;
|
||||
$set = $vars = [];
|
||||
|
||||
|
@ -70,7 +70,7 @@ class Save extends Action
|
|||
throw new RuntimeException('The model has ID');
|
||||
}
|
||||
|
||||
$attrs = $post->getAttrs();
|
||||
$attrs = $post->getModelAttrs();
|
||||
$fields = $this->c->dbMap->posts;
|
||||
$set = $set2 = $vars = [];
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ abstract class Driver extends Model
|
|||
throw new RuntimeException("Invalid name: {$name}");
|
||||
}
|
||||
|
||||
$this->setAttr('name', $name);
|
||||
$this->setModelAttr('name', $name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -29,7 +29,7 @@ class Reports extends Manager
|
|||
*/
|
||||
public function create(array $attrs = []): Report
|
||||
{
|
||||
return $this->c->ReportModel->setAttrs($attrs);
|
||||
return $this->c->ReportModel->setModelAttrs($attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,7 +33,7 @@ class Save extends Action
|
|||
return $report;
|
||||
}
|
||||
|
||||
$values = $report->getAttrs();
|
||||
$values = $report->getModelAttrs();
|
||||
$fields = $this->c->dbMap->reports;
|
||||
$set = $vars = [];
|
||||
|
||||
|
@ -74,7 +74,7 @@ class Save extends Action
|
|||
|
||||
$report->created = \time();
|
||||
|
||||
$attrs = $report->getAttrs();
|
||||
$attrs = $report->getModelAttrs();
|
||||
$fields = $this->c->dbMap->reports;
|
||||
$set = $set2 = $vars = [];
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ class Profile extends Rules
|
|||
*/
|
||||
public function setUser(User $curUser): Profile
|
||||
{
|
||||
$this->setAttrs([]);
|
||||
$this->setModelAttrs([]);
|
||||
|
||||
$this->ready = true;
|
||||
$this->user = $this->c->user;
|
||||
|
|
|
@ -22,7 +22,7 @@ class Users extends Rules
|
|||
*/
|
||||
public function init(): Users
|
||||
{
|
||||
$this->setAttrs([]);
|
||||
$this->setModelAttrs([]);
|
||||
|
||||
$this->ready = true;
|
||||
$this->user = $this->c->user;
|
||||
|
|
|
@ -31,7 +31,7 @@ class Save extends Action
|
|||
return $topic;
|
||||
}
|
||||
|
||||
$values = $topic->getAttrs();
|
||||
$values = $topic->getModelAttrs();
|
||||
$fields = $this->c->dbMap->topics;
|
||||
$set = $vars = [];
|
||||
|
||||
|
@ -70,7 +70,7 @@ class Save extends Action
|
|||
throw new RuntimeException('The model has ID');
|
||||
}
|
||||
|
||||
$attrs = $topic->getAttrs();
|
||||
$attrs = $topic->getModelAttrs();
|
||||
$fields = $this->c->dbMap->topics;
|
||||
$set = $set2 = $vars = [];
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ class Topics extends Manager
|
|||
*/
|
||||
public function create(array $attrs = []): Topic
|
||||
{
|
||||
return $this->c->TopicModel->setAttrs($attrs);
|
||||
return $this->c->TopicModel->setModelAttrs($attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -34,7 +34,7 @@ class Save extends Action
|
|||
return $user;
|
||||
}
|
||||
|
||||
$values = $user->getAttrs();
|
||||
$values = $user->getModelAttrs();
|
||||
|
||||
if ($user->isGuest) {
|
||||
$fields = $this->c->dbMap->online;
|
||||
|
@ -115,7 +115,7 @@ class Save extends Action
|
|||
// вычисление username_normal для нового пользователя
|
||||
$user->username_normal = $this->manager->normUsername($user->username);
|
||||
|
||||
$attrs = $user->getAttrs();
|
||||
$attrs = $user->getModelAttrs();
|
||||
$fields = $this->c->dbMap->users;
|
||||
$set = $set2 = $vars = [];
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ class User extends DataModel
|
|||
protected function getlanguage(): string
|
||||
{
|
||||
$langs = $this->c->Func->getLangs();
|
||||
$lang = $this->getAttr('language');
|
||||
$lang = $this->getModelAttr('language');
|
||||
|
||||
if (
|
||||
empty($lang)
|
||||
|
@ -140,7 +140,7 @@ class User extends DataModel
|
|||
protected function getstyle(): string
|
||||
{
|
||||
$styles = $this->c->Func->getStyles();
|
||||
$style = $this->getAttr('style');
|
||||
$style = $this->getModelAttr('style');
|
||||
|
||||
if (
|
||||
$this->isGuest
|
||||
|
@ -180,7 +180,7 @@ class User extends DataModel
|
|||
*/
|
||||
protected function getavatar(): ?string
|
||||
{
|
||||
$file = $this->getAttr('avatar');
|
||||
$file = $this->getModelAttr('avatar');
|
||||
|
||||
if (! empty($file)) {
|
||||
$file = $this->c->config->o_avatars_dir . '/' . $file;
|
||||
|
@ -199,7 +199,7 @@ class User extends DataModel
|
|||
*/
|
||||
public function deleteAvatar(): void
|
||||
{
|
||||
$file = $this->getAttr('avatar');
|
||||
$file = $this->getModelAttr('avatar');
|
||||
|
||||
if (! empty($file)) {
|
||||
$path = $this->c->DIR_PUBLIC . "{$this->c->config->o_avatars_dir}/{$file}";
|
||||
|
@ -313,7 +313,7 @@ class User extends DataModel
|
|||
*/
|
||||
protected function getdisp_topics(): int
|
||||
{
|
||||
$attr = $this->getAttr('disp_topics');
|
||||
$attr = $this->getModelAttr('disp_topics');
|
||||
|
||||
if ($attr < 10) {
|
||||
$attr = $this->c->config->i_disp_topics_default;
|
||||
|
@ -327,7 +327,7 @@ class User extends DataModel
|
|||
*/
|
||||
protected function getdisp_posts(): int
|
||||
{
|
||||
$attr = $this->getAttr('disp_topics');
|
||||
$attr = $this->getModelAttr('disp_topics');
|
||||
|
||||
if ($attr < 10) {
|
||||
$attr = $this->c->config->i_disp_posts_default;
|
||||
|
@ -384,15 +384,15 @@ class User extends DataModel
|
|||
/**
|
||||
* Возвращает значения свойств в массиве
|
||||
*/
|
||||
public function getAttrs(): array
|
||||
public function getModelAttrs(): array
|
||||
{
|
||||
foreach (['email_normal', 'username_normal'] as $key) {
|
||||
if (isset($this->zModFlags[$key])) {
|
||||
$this->setAttr($key, $this->$key);
|
||||
$this->setModelAttr($key, $this->$key);
|
||||
}
|
||||
}
|
||||
|
||||
return parent::getAttrs();
|
||||
return parent::getModelAttrs();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -28,7 +28,7 @@ class Users extends Manager
|
|||
*/
|
||||
public function create(array $attrs = []): User
|
||||
{
|
||||
return $this->c->UserModel->setAttrs($attrs);
|
||||
return $this->c->UserModel->setModelAttrs($attrs);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -150,7 +150,7 @@ class Users extends Manager
|
|||
$cache = $this->c->Cache->get(self::CACHE_KEY);
|
||||
|
||||
if (! \is_array($cache)) {
|
||||
$cache = $this->c->groups->get(FORK_GROUP_GUEST)->getAttrs();
|
||||
$cache = $this->c->groups->get(FORK_GROUP_GUEST)->getModelAttrs();
|
||||
|
||||
if (true !== $this->c->Cache->set(self::CACHE_KEY, $cache)) {
|
||||
throw new RuntimeException('Unable to write value to cache - ' . self::CACHE_KEY);
|
||||
|
|
|
@ -149,7 +149,7 @@ class Email extends RulesValidator
|
|||
&& $user instanceof User
|
||||
&& ! $user->isGuest
|
||||
) {
|
||||
$originalUser->setAttrs($user->getAttrs());
|
||||
$originalUser->setModelAttrs($user->getModelAttrs());
|
||||
}
|
||||
|
||||
return $email;
|
||||
|
|
Loading…
Add table
Reference in a new issue