uawdijnntqw1x1x1
IP : 216.73.216.163
Hostname : yjpwxulqtt
Kernel : Linux yjpwxulqtt 5.15.0-126-generic #136-Ubuntu SMP Wed Nov 6 10:38:22 UTC 2024 x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec,proc_open,popen
OS : Linux
PATH:
/
home
/
user
/
web
/
pansionat-v-yaroslavle.ru
/
public_html
/
bitrix
/
modules
/
forum
/
lib
/
.
/
comments
/
feed.php
/
/
<?php namespace Bitrix\Forum\Comments; use \Bitrix\Main\Localization\Loc; use \Bitrix\Forum\Internals\Error\Error; Loc::loadMessages(__FILE__); class Feed extends BaseObject { const ERROR_PARAMS_MESSAGE = 'params0004'; const ERROR_PERMISSION = 'params0005'; private function checkTopic() { if (empty($this->topic)) { $this->topic = $this->createTopic(); } return ($this->topic !== null); } /** * Returns true if entity allows adding * @return bool */ public function canAdd() { return $this->getEntity()->canAdd($this->getUser()->getId()); } /** * Returns true if entity allows reading * @return bool */ public function canRead() { return $this->getEntity()->canRead($this->getUser()->getId()); } /** * Returns true if entity allows editing * @return bool */ public function canEdit() { return $this->getEntity()->canEdit($this->getUser()->getId()); } /** * @param integer $commentId Message ID in b_forum_message to edit. * @return bool */ public function canEditComment($commentId) { return Comment::createFromId($this, $commentId)->canEdit(); } /** * Returns true if entity allows deleting. * @return bool */ public function canDelete() { return $this->getEntity()->canEdit($this->getUser()->getId()); } /** * @param integer $commentId Message ID in b_forum_message to delete. * @return bool */ public function canDeleteComment($commentId) { return Comment::createFromId($this, $commentId)->canEdit(); } /** * @return bool */ public function canModerate() { return $this->getEntity()->canModerate($this->getUser()->getId()); } /** * @return bool */ public function canEditOwn() { return $this->getEntity()->canEditOwn($this->getUser()->getId()); } /** * Add a comment * @param array $params Fields for new message to add in table b_forum_message. * @return array|bool */ public function add(array $params) { if (!$this->canAdd()) $this->errorCollection->addOne(new Error(Loc::getMessage("FORUM_CM_RIGHTS1"), self::ERROR_PERMISSION)); else if ($this->checkTopic()) { $comment = Comment::create($this); $comment->add($params); if ($comment->hasErrors()) $this->errorCollection->add($comment->getErrors()); else return $comment->getComment(); } return false; } /** * Edit a comment * @param integer $id Message id. * @param array $params Fields to edit message. * @return array|bool */ public function edit($id, array $params) { $comment = Comment::createFromId($this, $id); if (!$this->canEdit() && !$comment->canEdit()) $this->errorCollection->addOne(new Error(Loc::getMessage("FORUM_CM_RIGHTS2"), self::ERROR_PERMISSION)); else { $comment->edit($params); if ($comment->hasErrors()) $this->errorCollection->add($comment->getErrors()); else return $comment->getComment(); } return false; } /** * Delete a comment * @param integer $id Message id. * @return array|bool */ public function delete($id) { $comment = Comment::createFromId($this, $id); if (!$this->canDelete() && !$comment->canDelete()) $this->errorCollection->addOne(new Error(Loc::getMessage("FORUM_CM_RIGHTS3"), self::ERROR_PERMISSION)); else { $comment->delete(); if ($comment->hasErrors()) $this->errorCollection->add($comment->getErrors()); else return $comment->getComment(); } return false; } /** * Moderate comment with id * @param integer $id Message id. * @param boolean $show State for moderating: true - show, false - hide. * @return array|bool */ public function moderate($id, $show) { $comment = Comment::createFromId($this, $id); if (!$this->canModerate()) $this->errorCollection->addOne(new Error(Loc::getMessage("FORUM_CM_RIGHTS4"), self::ERROR_PERMISSION)); else { $comment->moderate($show); if ($comment->hasErrors()) $this->errorCollection->add($comment->getErrors()); else return $comment->getComment(); } return false; } /** * Mainly this function for forum entity. In this case params have to from the list: A < E < I < M < Q < U < Y * A - NO ACCESS E - READ I - ANSWER * M - NEW TOPIC Q - MODERATE U - EDIT Y - FULL_ACCESS * @param string $permission A,E,I,M,Q,U,Y. * @return $this */ public function setPermission($permission) { $this->getEntity()->setPermission($this->getUser()->getId(), $permission); return $this; } /** * @param boolean $allow True or false. * @return $this */ public function setEditOwn($allow) { $this->getEntity()->setEditOwn($allow); return $this; } /** * Returns permission From list: A < E < I < M < Q < U < Y. * @return string */ public function getPermission() { return $this->getEntity()->getPermission($this->getUser()->getId()); } }
/home/user/web/pansionat-v-yaroslavle.ru/public_html/bitrix/modules/forum/lib/./comments/feed.php