Skip to content
Commits on Source (2)
...@@ -65,7 +65,7 @@ class ilForumPageGUI extends ilPageObjectGUI implements ilForumObjectConstants ...@@ -65,7 +65,7 @@ class ilForumPageGUI extends ilPageObjectGUI implements ilForumObjectConstants
if ($links->length > 0) { if ($links->length > 0) {
foreach ($links as $link) { foreach ($links as $link) {
/** @var $link DOMNode */ /** @var DOMNode $link */
$link->attributes->getNamedItem('LinkTarget')->nodeValue = '_blank'; $link->attributes->getNamedItem('LinkTarget')->nodeValue = '_blank';
} }
} }
......
...@@ -222,14 +222,14 @@ class ilFileDataForum extends ilFileData ...@@ -222,14 +222,14 @@ class ilFileDataForum extends ilFileData
} }
/** /**
* @param string md5 encrypted filename * @param string $hashedFilename
* @return array{path: string, filename: string, clean_filename: string}|null * @return array{path: string, filename: string, clean_filename: string}|null
*/ */
public function getFileDataByMD5Filename(string $a_md5_filename) : ?array public function getFileDataByMD5Filename(string $hashedFilename) : ?array
{ {
$files = ilFileUtils::getDir($this->forum_path); $files = ilFileUtils::getDir($this->forum_path);
foreach ($files as $file) { foreach ($files as $file) {
if ($file['type'] === 'file' && md5($file['entry']) === $a_md5_filename) { if ($file['type'] === 'file' && md5($file['entry']) === $hashedFilename) {
return [ return [
'path' => $this->forum_path . '/' . $file['entry'], 'path' => $this->forum_path . '/' . $file['entry'],
'filename' => $file['entry'], 'filename' => $file['entry'],
...@@ -242,15 +242,15 @@ class ilFileDataForum extends ilFileData ...@@ -242,15 +242,15 @@ class ilFileDataForum extends ilFileData
} }
/** /**
* @param string|string[] md5 encrypted filename or array of multiple md5 encrypted files * @param string|string[] $hashedFilenameOrFilenames
* @return bool * @return bool
*/ */
public function unlinkFilesByMD5Filenames($a_md5_filename) : bool public function unlinkFilesByMD5Filenames($hashedFilenameOrFilenames) : bool
{ {
$files = ilFileUtils::getDir($this->forum_path); $files = ilFileUtils::getDir($this->forum_path);
if (is_array($a_md5_filename)) { if (is_array($hashedFilenameOrFilenames)) {
foreach ($files as $file) { foreach ($files as $file) {
if ($file['type'] === 'file' && in_array(md5($file['entry']), $a_md5_filename, true)) { if ($file['type'] === 'file' && in_array(md5($file['entry']), $hashedFilenameOrFilenames, true)) {
unlink($this->forum_path . '/' . $file['entry']); unlink($this->forum_path . '/' . $file['entry']);
} }
} }
...@@ -259,7 +259,7 @@ class ilFileDataForum extends ilFileData ...@@ -259,7 +259,7 @@ class ilFileDataForum extends ilFileData
} }
foreach ($files as $file) { foreach ($files as $file) {
if ($file['type'] === 'file' && md5($file['entry']) === $a_md5_filename) { if ($file['type'] === 'file' && md5($file['entry']) === $hashedFilenameOrFilenames) {
return unlink($this->forum_path . '/' . $file['entry']); return unlink($this->forum_path . '/' . $file['entry']);
} }
} }
......
...@@ -191,14 +191,14 @@ class ilFileDataForumDrafts extends ilFileData ...@@ -191,14 +191,14 @@ class ilFileDataForumDrafts extends ilFileData
} }
/** /**
* @param string md5 encrypted filename * @param string $hashedFilename
* @return array{path: string, filename: string, clean_filename: string}|null * @return array{path: string, filename: string, clean_filename: string}|null
*/ */
public function getFileDataByMD5Filename(string $a_md5_filename) : ?array public function getFileDataByMD5Filename(string $hashedFilename) : ?array
{ {
$files = ilFileUtils::getDir($this->getDraftsPath() . '/' . $this->getDraftId()); $files = ilFileUtils::getDir($this->getDraftsPath() . '/' . $this->getDraftId());
foreach ($files as $file) { foreach ($files as $file) {
if ($file['type'] === 'file' && md5($file['entry']) === $a_md5_filename) { if ($file['type'] === 'file' && md5($file['entry']) === $hashedFilename) {
return [ return [
'path' => $this->getDraftsPath() . '/' . $this->getDraftId() . '/' . $file['entry'], 'path' => $this->getDraftsPath() . '/' . $this->getDraftId() . '/' . $file['entry'],
'filename' => $file['entry'], 'filename' => $file['entry'],
...@@ -211,15 +211,15 @@ class ilFileDataForumDrafts extends ilFileData ...@@ -211,15 +211,15 @@ class ilFileDataForumDrafts extends ilFileData
} }
/** /**
* @param string|string[] $a_md5_filename * @param string|string[] $hashedFilenameOrFilenames
* @return bool * @return bool
*/ */
public function unlinkFilesByMD5Filenames($a_md5_filename) : bool public function unlinkFilesByMD5Filenames($hashedFilenameOrFilenames) : bool
{ {
$files = ilFileUtils::getDir($this->getDraftsPath() . '/' . $this->getDraftId()); $files = ilFileUtils::getDir($this->getDraftsPath() . '/' . $this->getDraftId());
if (is_array($a_md5_filename)) { if (is_array($hashedFilenameOrFilenames)) {
foreach ($files as $file) { foreach ($files as $file) {
if ($file['type'] === 'file' && in_array(md5($file['entry']), $a_md5_filename, true)) { if ($file['type'] === 'file' && in_array(md5($file['entry']), $hashedFilenameOrFilenames, true)) {
unlink($this->getDraftsPath() . '/' . $this->getDraftId() . '/' . $file['entry']); unlink($this->getDraftsPath() . '/' . $this->getDraftId() . '/' . $file['entry']);
} }
} }
...@@ -228,7 +228,7 @@ class ilFileDataForumDrafts extends ilFileData ...@@ -228,7 +228,7 @@ class ilFileDataForumDrafts extends ilFileData
} }
foreach ($files as $file) { foreach ($files as $file) {
if ($file['type'] === 'file' && md5($file['entry']) === $a_md5_filename) { if ($file['type'] === 'file' && md5($file['entry']) === $hashedFilenameOrFilenames) {
return unlink($this->getDraftsPath() . '/' . $this->getDraftId() . '/' . $file['entry']); return unlink($this->getDraftsPath() . '/' . $this->getDraftId() . '/' . $file['entry']);
} }
} }
......
...@@ -256,6 +256,7 @@ class ilForum ...@@ -256,6 +256,7 @@ class ilForum
[$lastPost, $objNewPost->getForumId()] [$lastPost, $objNewPost->getForumId()]
); );
/** @var ilObjForum $forum_obj */
$forum_obj = ilObjectFactory::getInstanceByRefId($this->getForumRefId()); $forum_obj = ilObjectFactory::getInstanceByRefId($this->getForumRefId());
$forum_obj->markPostRead($objNewPost->getPosAuthorId(), $objNewPost->getThreadId(), $objNewPost->getId()); $forum_obj->markPostRead($objNewPost->getPosAuthorId(), $objNewPost->getThreadId(), $objNewPost->getId());
......
...@@ -170,7 +170,7 @@ class ilForumAuthorInformation ...@@ -170,7 +170,7 @@ class ilForumAuthorInformation
$this->getAuthor()->getId() $this->getAuthor()->getId()
); );
} }
} elseif ($this->display_id > 0 && $this->alias !== '' && !$this->doesAuthorAccountExists()) { } elseif ($this->display_id > 0 && $this->alias !== '' && $this->doesAuthorAccountExists() === false) {
// The author did use a pseudonym and the account does not exist anymore (deleted, lost on import etc.) // The author did use a pseudonym and the account does not exist anymore (deleted, lost on import etc.)
$this->author_short_name = $this->author_name = $translationLanguage->txt('deleted'); $this->author_short_name = $this->author_name = $translationLanguage->txt('deleted');
$this->is_deleted = true; $this->is_deleted = true;
......
<?php declare(strict_types=1); <?php declare(strict_types=1);
/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
/** /**
* This file is part of ILIAS, a powerful learning management system * This file is part of ILIAS, a powerful learning management system
...@@ -44,6 +43,7 @@ class ilForumImporter extends ilXmlImporter implements ilForumObjectConstants ...@@ -44,6 +43,7 @@ class ilForumImporter extends ilXmlImporter implements ilForumObjectConstants
$newObj->create(); $newObj->create();
} }
/** @var ilObjForum $newObj */
$parser = new ilForumXMLParser($newObj, $a_xml, $a_mapping); $parser = new ilForumXMLParser($newObj, $a_xml, $a_mapping);
$parser->setImportDirectory($this->getImportDirectory()); $parser->setImportDirectory($this->getImportDirectory());
$parser->setImportInstallId($this->getInstallId()); $parser->setImportInstallId($this->getInstallId());
...@@ -53,7 +53,7 @@ class ilForumImporter extends ilXmlImporter implements ilForumObjectConstants ...@@ -53,7 +53,7 @@ class ilForumImporter extends ilXmlImporter implements ilForumObjectConstants
$a_mapping->addMapping('Modules/Forum', 'frm', $a_id, (string) $newObj->getId()); $a_mapping->addMapping('Modules/Forum', 'frm', $a_id, (string) $newObj->getId());
} }
public function finalProcessing($a_mapping) : void public function finalProcessing(ilImportMapping $a_mapping) : void
{ {
parent::finalProcessing($a_mapping); parent::finalProcessing($a_mapping);
...@@ -68,8 +68,8 @@ class ilForumImporter extends ilXmlImporter implements ilForumObjectConstants ...@@ -68,8 +68,8 @@ class ilForumImporter extends ilXmlImporter implements ilForumObjectConstants
foreach ($styleMapping as $newForumId => $oldStyleId) { foreach ($styleMapping as $newForumId => $oldStyleId) {
$newStyleId = (int) $a_mapping->getMapping('Services/Style', 'sty', $oldStyleId); $newStyleId = (int) $a_mapping->getMapping('Services/Style', 'sty', $oldStyleId);
if ($newForumId > 0 && $newStyleId > 0) { if ($newForumId > 0 && $newStyleId > 0) {
$frm = ilObjectFactory::getInstanceByObjId($newForumId, false); $frm = ilObjectFactory::getInstanceByObjId((int) $newForumId, false);
if (!$frm || !($frm instanceof ilObjForum)) { if (!($frm instanceof ilObjForum)) {
continue; continue;
} }
$this->content_style_domain $this->content_style_domain
......
...@@ -37,7 +37,8 @@ class ilForumLP extends ilObjectLP ...@@ -37,7 +37,8 @@ class ilForumLP extends ilObjectLP
$num_postings->setSize(4); $num_postings->setSize(4);
$num_postings->setRequired(true); $num_postings->setRequired(true);
if (is_int(ilForumProperties::getInstance($this->obj_id)->getLpReqNumPostings())) { if (is_int(ilForumProperties::getInstance($this->obj_id)->getLpReqNumPostings())) {
$num_postings->setValue(ilForumProperties::getInstance($this->obj_id)->getLpReqNumPostings()); $requiredNumberOfPostings = ilForumProperties::getInstance($this->obj_id)->getLpReqNumPostings();
$num_postings->setValue((string) $requiredNumberOfPostings);
} }
$modeElement->addSubItem($num_postings); $modeElement->addSubItem($num_postings);
} }
......
...@@ -91,7 +91,7 @@ class ilForumModerators ...@@ -91,7 +91,7 @@ class ilForumModerators
$roles = $this->rbac->review()->getRoleListByObject($this->getRefId()); $roles = $this->rbac->review()->getRoleListByObject($this->getRefId());
foreach ($roles as $role) { foreach ($roles as $role) {
if (strpos($role['title'], 'il_frm_moderator') !== false) { if (strpos($role['title'], 'il_frm_moderator') !== false) {
$assigned_users = array_map('intval', $this->rbac->review()->assignedUsers((int) $role['rol_id'])); $assigned_users = $this->rbac->review()->assignedUsers((int) $role['rol_id']);
break; break;
} }
} }
......
...@@ -187,10 +187,9 @@ class ilForumModeratorsGUI ...@@ -187,10 +187,9 @@ class ilForumModeratorsGUI
$result = []; $result = [];
$i = 0; $i = 0;
foreach ($entries as $usr_id) { foreach ($entries as $usr_id) {
/** @var $user ilObjUser */ /** @var ilObjUser $user */
$user = ilObjectFactory::getInstanceByObjId($usr_id, false); $user = ilObjectFactory::getInstanceByObjId($usr_id, false);
// Bugfix/Fallback for #25640 if (!($user instanceof ilObjUser)) {
if (!$user) {
$this->oForumModerators->detachModeratorRole($usr_id); $this->oForumModerators->detachModeratorRole($usr_id);
continue; continue;
} }
......
...@@ -25,6 +25,10 @@ class ilForumNotificationCache ...@@ -25,6 +25,10 @@ class ilForumNotificationCache
/** @var array<string, mixed> */ /** @var array<string, mixed> */
private array $storage = []; private array $storage = [];
/**
* @param string $id
* @return mixed
*/
public function fetch(string $id) public function fetch(string $id)
{ {
if (false === $this->exists($id)) { if (false === $this->exists($id)) {
...@@ -34,6 +38,11 @@ class ilForumNotificationCache ...@@ -34,6 +38,11 @@ class ilForumNotificationCache
return $this->storage[$id]; return $this->storage[$id];
} }
/**
* @param string $key
* @param mixed $data
* @return void
*/
public function store(string $key, $data) : void public function store(string $key, $data) : void
{ {
$this->storage[$key] = $data; $this->storage[$key] = $data;
......
...@@ -602,7 +602,7 @@ class ilForumPost ...@@ -602,7 +602,7 @@ class ilForumPost
$this->setLft((int) $row['lft']); $this->setLft((int) $row['lft']);
$this->setRgt((int) $row['rgt']); $this->setRgt((int) $row['rgt']);
$this->setDepth((int) $row['depth']); $this->setDepth((int) $row['depth']);
$this->setIsRead((bool) (isset($row['post_read']) && (int) $row['post_read'] ?? 1)); $this->setIsRead(isset($row['post_read']) && (int) $row['post_read']);
$this->setDisplayUserId((int) $row['pos_display_user_id']); $this->setDisplayUserId((int) $row['pos_display_user_id']);
$this->setPosAuthorId((int) $row['pos_author_id']); $this->setPosAuthorId((int) $row['pos_author_id']);
$this->setIsAuthorModerator((bool) $row['is_author_moderator']); $this->setIsAuthorModerator((bool) $row['is_author_moderator']);
......
...@@ -24,7 +24,7 @@ class ilForumPostDraft ...@@ -24,7 +24,7 @@ class ilForumPostDraft
{ {
public const MEDIAOBJECT_TYPE = 'frm~d:html'; public const MEDIAOBJECT_TYPE = 'frm~d:html';
/** @var self[] */ /** @var array<int, array{draft_ids: array<int, self>}|array<int, array<int, self>>> */
private static array $instances = []; private static array $instances = [];
private static array $forum_statistics_cache = []; private static array $forum_statistics_cache = [];
private static array $drafts_settings_cache = []; private static array $drafts_settings_cache = [];
......
...@@ -34,7 +34,6 @@ class ilForumSettingsGUI implements ilForumObjectConstants ...@@ -34,7 +34,6 @@ class ilForumSettingsGUI implements ilForumObjectConstants
private \ILIAS\HTTP\Wrapper\WrapperFactory $http_wrapper; private \ILIAS\HTTP\Wrapper\WrapperFactory $http_wrapper;
private \ILIAS\Refinery\Factory $refinery; private \ILIAS\Refinery\Factory $refinery;
private ilForumNotification $forumNotificationObj; private ilForumNotification $forumNotificationObj;
private ilPropertyFormGUI $form;
private ?ilPropertyFormGUI $notificationSettingsForm = null; private ?ilPropertyFormGUI $notificationSettingsForm = null;
public int $ref_id; public int $ref_id;
private ilObjectService $obj_service; private ilObjectService $obj_service;
...@@ -86,7 +85,6 @@ class ilForumSettingsGUI implements ilForumObjectConstants ...@@ -86,7 +85,6 @@ class ilForumSettingsGUI implements ilForumObjectConstants
default: default:
$this->ctrl->redirect($this->parent_obj); $this->ctrl->redirect($this->parent_obj);
break;
} }
} }
} }
...@@ -283,7 +281,7 @@ class ilForumSettingsGUI implements ilForumObjectConstants ...@@ -283,7 +281,7 @@ class ilForumSettingsGUI implements ilForumObjectConstants
$a_values['file_upload_allowed'] = $this->parent_obj->objProperties->getFileUploadAllowed(); $a_values['file_upload_allowed'] = $this->parent_obj->objProperties->getFileUploadAllowed();
$object = $this->parent_obj->getObject(); $object = $this->parent_obj->getObject();
$a_values['activation_online'] = !($object->getOfflineStatus() === null) && !$object->getOfflineStatus(); $a_values['activation_online'] = $object->getOfflineStatus() === false;
} }
public function updateCustomValues(ilPropertyFormGUI $a_form) : void public function updateCustomValues(ilPropertyFormGUI $a_form) : void
...@@ -490,7 +488,7 @@ class ilForumSettingsGUI implements ilForumObjectConstants ...@@ -490,7 +488,7 @@ class ilForumSettingsGUI implements ilForumObjectConstants
); );
} }
$hidden_value = json_decode($hidden_value, null, 512, JSON_THROW_ON_ERROR); $hidden_value = json_decode($hidden_value, false, 512, JSON_THROW_ON_ERROR);
$interested_events = 0; $interested_events = 0;
$interested_events += (int) $notify_modified; $interested_events += (int) $notify_modified;
...@@ -674,9 +672,6 @@ class ilForumSettingsGUI implements ilForumObjectConstants ...@@ -674,9 +672,6 @@ class ilForumSettingsGUI implements ilForumObjectConstants
); );
} }
/** @var $oParticipants ilParticipants */
$oParticipants = null;
$grp_ref_id = $this->tree->checkForParentType($this->parent_obj->getObject()->getRefId(), 'grp'); $grp_ref_id = $this->tree->checkForParentType($this->parent_obj->getObject()->getRefId(), 'grp');
if ($grp_ref_id > 0) { if ($grp_ref_id > 0) {
$parent_obj = ilObjectFactory::getInstanceByRefId($grp_ref_id); $parent_obj = ilObjectFactory::getInstanceByRefId($grp_ref_id);
...@@ -689,7 +684,7 @@ class ilForumSettingsGUI implements ilForumObjectConstants ...@@ -689,7 +684,7 @@ class ilForumSettingsGUI implements ilForumObjectConstants
return ilCourseParticipants::_getInstanceByObjId($parent_obj->getId()); return ilCourseParticipants::_getInstanceByObjId($parent_obj->getId());
} }
private function updateUserNotifications($update_all_users = false) : void private function updateUserNotifications(bool $update_all_users = false) : void
{ {
$oParticipants = $this->getParticipants(); $oParticipants = $this->getParticipants();
......
...@@ -66,7 +66,7 @@ class ilForumStatisticsTableGUI extends ilTable2GUI ...@@ -66,7 +66,7 @@ class ilForumStatisticsTableGUI extends ilTable2GUI
} }
/** /**
* @return array<int, array{field: string, txt: string, sortable: bool}> * @return array<int, array{field: string, txt: string, sortable?: bool}>
*/ */
protected function getColumnDefinition() : array protected function getColumnDefinition() : array
{ {
......
...@@ -356,7 +356,7 @@ class ilForumTopicTableGUI extends ilTable2GUI ...@@ -356,7 +356,7 @@ class ilForumTopicTableGUI extends ilTable2GUI
$thread_ids = []; $thread_ids = [];
$user_ids = []; $user_ids = [];
foreach ($data['items'] as $thread) { foreach ($data['items'] as $thread) {
/** @var $thread ilForumTopic */ /** @var ilForumTopic $thread */
$thread_ids[] = $thread->getId(); $thread_ids[] = $thread->getId();
if ($thread->getDisplayUserId() > 0) { if ($thread->getDisplayUserId() > 0) {
$user_ids[$thread->getDisplayUserId()] = $thread->getDisplayUserId(); $user_ids[$thread->getDisplayUserId()] = $thread->getDisplayUserId();
......
...@@ -88,10 +88,16 @@ class ilForumXMLParser extends ilSaxParser ...@@ -88,10 +88,16 @@ class ilForumXMLParser extends ilSaxParser
public function setHandlers($a_xml_parser) : void public function setHandlers($a_xml_parser) : void
{ {
xml_set_object($a_xml_parser, $this); xml_set_object($a_xml_parser, $this);
xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag'); xml_set_element_handler($a_xml_parser, [$this, 'handlerBeginTag'], [$this, 'handlerEndTag']);
xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData'); xml_set_character_data_handler($a_xml_parser, [$this, 'handlerCharacterData']);
} }
/**
* @param XMLParser|resource $a_xml_parser
* @param string $a_name
* @param array $a_attribs
* @return void
*/
public function handlerBeginTag($a_xml_parser, string $a_name, array $a_attribs) : void public function handlerBeginTag($a_xml_parser, string $a_name, array $a_attribs) : void
{ {
switch ($a_name) { switch ($a_name) {
...@@ -124,6 +130,11 @@ class ilForumXMLParser extends ilSaxParser ...@@ -124,6 +130,11 @@ class ilForumXMLParser extends ilSaxParser
} }
} }
/**
* @param XMLParser|resource $a_xml_parser
* @param string $a_name
* @return void
*/
public function handlerEndTag($a_xml_parser, string $a_name) : void public function handlerEndTag($a_xml_parser, string $a_name) : void
{ {
$this->cdata = trim($this->cdata); $this->cdata = trim($this->cdata);
...@@ -743,8 +754,8 @@ class ilForumXMLParser extends ilSaxParser ...@@ -743,8 +754,8 @@ class ilForumXMLParser extends ilSaxParser
/** /**
* handler for character data * handler for character data
* @param resource $a_xml_parser xml parser * @param XMLParser|resource $a_xml_parser xml parser
* @param string $a_data character data * @param string $a_data character data
*/ */
public function handlerCharacterData($a_xml_parser, string $a_data) : void public function handlerCharacterData($a_xml_parser, string $a_data) : void
{ {
......
...@@ -367,7 +367,7 @@ class ilObjForum extends ilObject ...@@ -367,7 +367,7 @@ class ilObjForum extends ilObject
public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree = false) : ?ilObject public function cloneObject(int $target_id, int $copy_id = 0, bool $omit_tree = false) : ?ilObject
{ {
/** @var $new_obj ilObjForum */ /** @var ilObjForum $new_obj */
$new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree); $new_obj = parent::cloneObject($target_id, $copy_id, $omit_tree);
$this->cloneAutoGeneratedRoles($new_obj); $this->cloneAutoGeneratedRoles($new_obj);
...@@ -1004,7 +1004,7 @@ class ilObjForum extends ilObject ...@@ -1004,7 +1004,7 @@ class ilObjForum extends ilObject
$casted_data['pos_cens_date'] = (string) $data['pos_cens_date']; $casted_data['pos_cens_date'] = (string) $data['pos_cens_date'];
$casted_data['pos_activation_date'] = (string) $data['pos_activation_date']; $casted_data['pos_activation_date'] = (string) $data['pos_activation_date'];
self::$forum_last_post_cache[$ref_id] = is_array($casted_data) ? $casted_data : []; self::$forum_last_post_cache[$ref_id] = $casted_data;
return self::$forum_last_post_cache[$ref_id]; return self::$forum_last_post_cache[$ref_id];
} }
......
...@@ -117,7 +117,10 @@ class ilObjForumAccess extends ilObjectAccess ...@@ -117,7 +117,10 @@ class ilObjForumAccess extends ilObjectAccess
public static function getCachedUserInstance(int $usr_id) : ilObjUser public static function getCachedUserInstance(int $usr_id) : ilObjUser
{ {
if (!isset(self::$userInstanceCache[$usr_id]) && ilObjUser::userExists([$usr_id])) { if (!isset(self::$userInstanceCache[$usr_id]) && ilObjUser::userExists([$usr_id])) {
self::$userInstanceCache[$usr_id] = ilObjectFactory::getInstanceByObjId($usr_id, false); $user = ilObjectFactory::getInstanceByObjId($usr_id, false);
if ($user instanceof ilObjUser) {
self::$userInstanceCache[$usr_id] = $user;
}
} }
return self::$userInstanceCache[$usr_id]; return self::$userInstanceCache[$usr_id];
......
...@@ -521,8 +521,8 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu ...@@ -521,8 +521,8 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu
$this->objCurrentTopic->update(); $this->objCurrentTopic->update();
$this->ctrl->redirect($this, "showThreads"); $this->ctrl->redirect($this, "showThreads");
break;
// no break
case strtolower(ilCommonActionDispatcherGUI::class): case strtolower(ilCommonActionDispatcherGUI::class):
$gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall(); $gui = ilCommonActionDispatcherGUI::getInstanceFromAjaxCall();
$this->ctrl->forwardCommand($gui); $this->ctrl->forwardCommand($gui);
...@@ -1713,7 +1713,7 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu ...@@ -1713,7 +1713,7 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu
'ilias.php?baseClass=ilRepositoryGUI&amp;ref_id=' . $ref_id 'ilias.php?baseClass=ilRepositoryGUI&amp;ref_id=' . $ref_id
); );
/** @var $frm ilForum */ /** @var ilForum $frm */
$frm = $a_forum_obj->Forum; $frm = $a_forum_obj->Forum;
$frm->setForumId($a_forum_obj->getId()); $frm->setForumId($a_forum_obj->getId());
} }
...@@ -3305,9 +3305,6 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu ...@@ -3305,9 +3305,6 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu
} }
$bottom_toolbar->addStickyItem($bottom_split_button); $bottom_toolbar->addStickyItem($bottom_split_button);
$this->toolbar->addStickyItem($bottom_split_button); $this->toolbar->addStickyItem($bottom_split_button);
}
if ($bottom_toolbar_split_button_items) {
$bottom_toolbar->addSeparator(); $bottom_toolbar->addSeparator();
} }
...@@ -3478,7 +3475,7 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu ...@@ -3478,7 +3475,7 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu
$this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE); $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
} }
/** @var $ref_obj ilObjForum */ /** @var ilObjForum $ref_obj */
$ref_obj = ilObjectFactory::getInstanceByRefId($a_forum_ref_id); $ref_obj = ilObjectFactory::getInstanceByRefId($a_forum_ref_id);
if ($ref_obj->getType() === 'frm') { if ($ref_obj->getType() === 'frm') {
$forumObj = new ilObjForum($a_forum_ref_id); $forumObj = new ilObjForum($a_forum_ref_id);
...@@ -3665,7 +3662,6 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu ...@@ -3665,7 +3662,6 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu
if ([] !== $errorMessages) { if ([] !== $errorMessages) {
$this->tpl->setOnScreenMessage('failure', implode("<br><br>", $errorMessages), true); $this->tpl->setOnScreenMessage('failure', implode("<br><br>", $errorMessages), true);
$this->ctrl->redirect($this, 'showThreads'); $this->ctrl->redirect($this, 'showThreads');
return;
} }
ilSession::set('threads2move', []); ilSession::set('threads2move', []);
...@@ -4475,10 +4471,7 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu ...@@ -4475,10 +4471,7 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu
$frm_noti = new ilForumNotification($ref_id); $frm_noti = new ilForumNotification($ref_id);
$frm_noti->setUserId($this->user->getId()); $frm_noti->setUserId($this->user->getId());
$user_toggle = (int) $frm_noti->isUserToggleNotification(); return $frm_noti->isUserToggleNotification() === false;
if ($user_toggle === 0 && $this->objProperties->isUserToggleNoti() === false) {
return true;
}
} }
return false; return false;
...@@ -4510,8 +4503,8 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu ...@@ -4510,8 +4503,8 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu
foreach ($threadIdToSortValueMap as $threadId => $sortValue) { foreach ($threadIdToSortValueMap as $threadId => $sortValue) {
$sortValue = str_replace(',', '.', $sortValue); $sortValue = str_replace(',', '.', $sortValue);
$sortValue = (float) $sortValue * 100; $sortValue = ((float) $sortValue) * 100;
$this->object->setThreadSorting((int) $threadId, $sortValue); $this->object->setThreadSorting((int) $threadId, (int) $sortValue);
} }
$this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true); $this->tpl->setOnScreenMessage('success', $this->lng->txt('saved_successfully'), true);
...@@ -5568,7 +5561,7 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu ...@@ -5568,7 +5561,7 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu
$actions['delete'] = $this->ctrl->getFormAction($this, 'deletePostingDraft'); $actions['delete'] = $this->ctrl->getFormAction($this, 'deletePostingDraft');
$this->ctrl->clearParameters($this); $this->ctrl->clearParameters($this);
if (isset($draft_id) && $action === 'editdraft') { if ($draft_id !== 0 && $action === 'editdraft') {
$actions = []; $actions = [];
} }
} }
...@@ -5736,9 +5729,9 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu ...@@ -5736,9 +5729,9 @@ class ilObjForumGUI extends ilObjectGUI implements ilDesktopItemHandling, ilForu
$node->isCensored() $node->isCensored()
) )
) { ) {
$this->error->raiseError($this->lng->txt('permission_denied'), $this->error->getMessage()); $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
} elseif ($action === 'showreply' && !$this->access->checkAccess('add_reply', '', $ref_id)) { } elseif ($action === 'showreply' && !$this->access->checkAccess('add_reply', '', $ref_id)) {
$this->error->raiseError($this->lng->txt('permission_denied'), $this->error->getMessage()); $this->error->raiseError($this->lng->txt('permission_denied'), $this->error->MESSAGE);
} }
$tpl->setVariable('REPLY_ANKER', 'reply_' . $this->objCurrentPost->getId()); $tpl->setVariable('REPLY_ANKER', 'reply_' . $this->objCurrentPost->getId());
......
...@@ -421,7 +421,7 @@ class ilObjForumNotificationDataProvider implements ilForumNotificationMailData ...@@ -421,7 +421,7 @@ class ilObjForumNotificationDataProvider implements ilForumNotificationMailData
return $this->notificationCache->fetch($cacheKey); return $this->notificationCache->fetch($cacheKey);
} }
private function createRecipientArray(ilPDOStatement $statement) : array private function createRecipientArray(ilDBStatement $statement) : array
{ {
$refIds = $this->getRefIdsByObjId($this->getObjId()); $refIds = $this->getRefIdsByObjId($this->getObjId());
......