parent::__construct();
$this->conversationID = $conversationID;
- $this->getConditionBuilder()->add('conversation_to_user.conversationID = ?', array($conversationID));
+ $this->getConditionBuilder()->add('conversation_to_user.conversationID = ?', [$conversationID]);
if (!$isAuthor) {
if ($userID) {
- $this->getConditionBuilder()->add('conversation_to_user.isInvisible = 0 OR conversation_to_user.participantID = ?', array($userID));
+ $this->getConditionBuilder()->add('conversation_to_user.isInvisible = 0 OR conversation_to_user.participantID = ?', [$userID]);
}
else {
$this->getConditionBuilder()->add('conversation_to_user.isInvisible = 0');
* @see \wcf\data\DatabaseObjectList::readObjectIDs()
*/
public function readObjectIDs() {
- $this->objectIDs = array();
+ $this->objectIDs = [];
$sql = "SELECT conversation_to_user.participantID AS objectID
FROM wcf".WCF_N."_conversation_to_user conversation_to_user
".$this->sqlConditionJoins."
WHERE conversationID = ?
AND participantID IS NULL";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($this->conversationID));
+ $statement->execute([$this->conversationID]);
$i = 0;
while ($row = $statement->fetchArray()) {
// create fake user profiles
* @see \wcf\data\ILinkableObject::getLink()
*/
public function getLink() {
- return LinkHandler::getInstance()->getLink('Conversation', array(
+ return LinkHandler::getInstance()->getLink('Conversation', [
'object' => $this->getDecoratedObject(),
'appendSession' => false,
'encodeTitle' => true
- ));
+ ]);
}
/**
* @see \wcf\data\IFeedEntry::getCategories()
*/
public function getCategories() {
- return array();
+ return [];
}
/**
/**
* @see \wcf\data\AbstractDatabaseObjectAction::$permissionsDelete
*/
- protected $permissionsDelete = array('user.conversation.canUseConversation');
+ protected $permissionsDelete = ['user.conversation.canUseConversation'];
/**
* @see \wcf\data\AbstractDatabaseObjectAction::$permissionsUpdate
*/
- protected $permissionsUpdate = array('user.conversation.canUseConversation');
+ protected $permissionsUpdate = ['user.conversation.canUseConversation'];
/**
* conversation object
* @return array
*/
public function add() {
- $label = ConversationLabelEditor::create(array(
+ $label = ConversationLabelEditor::create([
'userID' => WCF::getUser()->userID,
'label' => $this->parameters['data']['labelName'],
'cssClassName' => $this->parameters['data']['cssClassName']
- ));
+ ]);
- return array(
+ return [
'actionName' => 'add',
'cssClassName' => $label->cssClassName,
'label' => StringUtil::encodeHTML($label->label),
'labelID' => $label->labelID
- );
+ ];
}
/**
}
// validate conversation id
- $this->parameters['conversationIDs'] = (isset($this->parameters['conversationIDs'])) ? ArrayUtil::toIntegerArray($this->parameters['conversationIDs']) : array();
+ $this->parameters['conversationIDs'] = (isset($this->parameters['conversationIDs'])) ? ArrayUtil::toIntegerArray($this->parameters['conversationIDs']) : [];
if (empty($this->parameters['conversationIDs'])) {
throw new UserInputException('conversationID');
}
*/
public function getLabelForm() {
// read assigned labels
- $labelIDs = array();
+ $labelIDs = [];
foreach ($this->labelList as $label) {
$labelIDs[] = $label->labelID;
}
- $assignedLabels = array();
+ $assignedLabels = [];
// read assigned labels if editing single conversation
if (count($this->parameters['conversationIDs']) == 1) {
$conversationID = current($this->parameters['conversationIDs']);
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("conversationID = ?", array($conversationID));
- $conditions->add("labelID IN (?)", array($labelIDs));
+ $conditions->add("conversationID = ?", [$conversationID]);
+ $conditions->add("labelID IN (?)", [$labelIDs]);
$sql = "SELECT labelID
FROM wcf".WCF_N."_conversation_label_to_object
$assignedLabels = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'assignedLabels' => $assignedLabels,
'conversation' => $this->conversation,
'labelList' => $this->labelList
- ));
+ ]);
- return array(
+ return [
'actionName' => 'getLabelForm',
'template' => WCF::getTPL()->fetch('conversationLabelAssignment')
- );
+ ];
}
/**
$this->validateGetLabelForm();
// validate given labels
- $this->parameters['labelIDs'] = (isset($this->parameters['labelIDs']) && is_array($this->parameters['labelIDs'])) ? ArrayUtil::toIntegerArray($this->parameters['labelIDs']) : array();
+ $this->parameters['labelIDs'] = (isset($this->parameters['labelIDs']) && is_array($this->parameters['labelIDs'])) ? ArrayUtil::toIntegerArray($this->parameters['labelIDs']) : [];
if (!empty($this->parameters['labelIDs'])) {
foreach ($this->parameters['labelIDs'] as $labelID) {
$isValid = false;
*/
public function assignLabel() {
// remove previous labels (if any)
- $labelIDs = array();
+ $labelIDs = [];
foreach ($this->labelList as $label) {
$labelIDs[] = $label->labelID;
}
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("conversationID IN (?)", array($this->parameters['conversationIDs']));
- $conditions->add("labelID IN (?)", array($labelIDs));
+ $conditions->add("conversationID IN (?)", [$this->parameters['conversationIDs']]);
+ $conditions->add("labelID IN (?)", [$labelIDs]);
$sql = "DELETE FROM wcf".WCF_N."_conversation_label_to_object
".$conditions;
WCF::getDB()->beginTransaction();
foreach ($this->parameters['labelIDs'] as $labelID) {
foreach ($this->parameters['conversationIDs'] as $conversationID) {
- $statement->execute(array(
+ $statement->execute([
$labelID,
$conversationID
- ));
+ ]);
}
}
WCF::getDB()->commitTransaction();
}
}
- return array(
+ return [
'actionName' => 'assignLabel',
'labelIDs' => $this->parameters['labelIDs']
- );
+ ];
}
}
// fire notification event
if (!$conversation->isDraft) {
- $notificationRecipients = array_diff($conversation->getParticipantIDs(true), array($message->userID)); // don't notify message author
+ $notificationRecipients = array_diff($conversation->getParticipantIDs(true), [$message->userID]); // don't notify message author
if (!empty($notificationRecipients)) {
UserNotificationHandler::getInstance()->fireEvent('conversationMessage', 'com.woltlab.wcf.conversation.message.notification', new ConversationMessageUserNotificationObject($message), $notificationRecipients);
}
WHERE participantID = ?
AND conversationID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($message->userID, $conversation->conversationID));
+ $statement->execute([$message->userID, $conversation->conversationID]);
$conversationEditor->updateParticipantSummary();
$conversationEditor->updateParticipantCount();
WHERE conversationID = ?
AND hideConversation = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
+ $statement->execute([
Conversation::STATE_DEFAULT,
$conversation->conversationID,
Conversation::STATE_HIDDEN
- ));
+ ]);
}
// reset storage
// save embedded objects
if (MessageEmbeddedObjectManager::getInstance()->registerObjects('com.woltlab.wcf.conversation.message', $message->messageID, $message->message)) {
- $messageEditor->update(array(
+ $messageEditor->update([
'hasEmbeddedObjects' => 1
- ));
+ ]);
}
// clear quotes
SearchIndexManager::getInstance()->update('com.woltlab.wcf.conversation.message', $message->messageID, $this->parameters['data']['message'], ($conversation->firstMessageID == $message->messageID ? $conversation->subject : ''), $message->time, $message->userID, $message->username);
if ($message->hasEmbeddedObjects != MessageEmbeddedObjectManager::getInstance()->registerObjects('com.woltlab.wcf.conversation.message', $message->messageID, $this->parameters['data']['message'])) {
- $message->update(array(
+ $message->update([
'hasEmbeddedObjects' => ($message->hasEmbeddedObjects ? 0 : 1)
- ));
+ ]);
}
}
}
public function delete() {
$count = parent::delete();
- $attachmentMessageIDs = $conversationIDs = array();
+ $attachmentMessageIDs = $conversationIDs = [];
foreach ($this->objects as $message) {
if (!in_array($message->conversationID, $conversationIDs)) {
$conversationIDs[] = $message->conversationID;
if (!empty($this->objectIDs)) {
// delete notifications
- UserNotificationHandler::getInstance()->deleteNotifications('conversationMessage', 'com.woltlab.wcf.conversation.message.notification', array(), $this->objectIDs);
+ UserNotificationHandler::getInstance()->deleteNotifications('conversationMessage', 'com.woltlab.wcf.conversation.message.notification', [], $this->objectIDs);
// update search index
SearchIndexManager::getInstance()->delete('com.woltlab.wcf.conversation.message', $this->objectIDs);
if (!$this->conversation->conversationID) {
throw new UserInputException('containerID');
}
- else if ($this->conversation->isClosed || !Conversation::isParticipant(array($this->conversation->conversationID))) {
+ else if ($this->conversation->isClosed || !Conversation::isParticipant([$this->conversation->conversationID])) {
throw new PermissionDeniedException();
}
// quick reply
if ($this->message === null) {
QuickReplyManager::getInstance()->setMessage('conversation', $this->conversation->conversationID, $this->parameters['message']);
- $url = LinkHandler::getInstance()->getLink('ConversationMessageAdd', array('id' => $this->conversation->conversationID));
+ $url = LinkHandler::getInstance()->getLink('ConversationMessageAdd', ['id' => $this->conversation->conversationID]);
}
else {
// editing message
QuickReplyManager::getInstance()->setMessage('conversationMessage', $this->message->messageID, $this->parameters['message']);
- $url = LinkHandler::getInstance()->getLink('ConversationMessageEdit', array('id' => $this->message->messageID));
+ $url = LinkHandler::getInstance()->getLink('ConversationMessageEdit', ['id' => $this->message->messageID]);
}
if (!empty($this->parameters['tmpHash'])) {
}
// redirect
- return array(
+ return [
'url' => $url
- );
+ ];
}
/**
throw new UserInputException('containerID');
}
- if ($this->conversation->isClosed || !Conversation::isParticipant(array($this->conversation->conversationID))) {
+ if ($this->conversation->isClosed || !Conversation::isParticipant([$this->conversation->conversationID])) {
throw new PermissionDeniedException();
}
public function beginEdit() {
BBCodeHandler::getInstance()->setAllowedBBCodes(explode(',', WCF::getSession()->getPermission('user.message.allowedBBCodes')));
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'defaultSmilies' => SmileyCache::getInstance()->getCategorySmilies(),
'message' => $this->message,
'permissionCanUseSmilies' => 'user.message.canUseSmilies',
'wysiwygSelector' => 'messageEditor'.$this->message->messageID
- ));
+ ]);
if (MODULE_ATTACHMENT) {
$tmpHash = StringUtil::getRandomID();
$attachmentHandler = new AttachmentHandler('com.woltlab.wcf.conversation.message', $this->message->messageID, $tmpHash);
$attachmentList = $attachmentHandler->getAttachmentList();
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'attachmentHandler' => $attachmentHandler,
'attachmentList' => $attachmentList->getObjects(),
'attachmentObjectID' => $this->message->messageID,
'attachmentObjectType' => 'com.woltlab.wcf.conversation.message',
'attachmentParentObjectID' => 0,
'tmpHash' => $tmpHash
- ));
+ ]);
}
- return array(
+ return [
'actionName' => 'beginEdit',
'template' => WCF::getTPL()->fetch('conversationMessageInlineEditor')
- );
+ ];
}
/**
* @see \wcf\data\IMessageInlineEditorAction::save()
*/
public function save() {
- $data = array(
+ $data = [
'message' => PreParser::getInstance()->parse(MessageUtil::stripCrap($this->parameters['data']['message']), explode(',', WCF::getSession()->getPermission('user.message.allowedBBCodes')))
- );
+ ];
if (!$this->message->getConversation()->isDraft) {
$data['lastEditTime'] = TIME_NOW;
$data['editCount'] = $this->message->editCount + 1;
}
// execute update action
- $action = new ConversationMessageAction(array($this->message), 'update', array('data' => $data));
+ $action = new ConversationMessageAction([$this->message], 'update', ['data' => $data]);
$action->executeAction();
// load new message
$count = 0;
if ($attachmentList !== null) {
// set permissions
- $attachmentList->setPermissions(array(
+ $attachmentList->setPermissions([
'canDownload' => true,
'canViewPreview' => true
- ));
+ ]);
$count = count($attachmentList);
}
// update count to reflect number of attachments after edit
if ($count != $this->message->attachments) {
$messageEditor = new ConversationMessageEditor($this->message);
- $messageEditor->update(array('attachments' => $count));
+ $messageEditor->update(['attachments' => $count]);
}
}
// load embedded objects
- MessageEmbeddedObjectManager::getInstance()->loadObjects('com.woltlab.wcf.conversation.message', array($this->message->messageID));
+ MessageEmbeddedObjectManager::getInstance()->loadObjects('com.woltlab.wcf.conversation.message', [$this->message->messageID]);
- $data = array(
+ $data = [
'actionName' => 'save',
'message' => $this->message->getFormattedMessage()
- );
+ ];
if (MODULE_ATTACHMENT) {
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'attachmentList' => $attachmentList,
'objectID' => $this->message->messageID
- ));
+ ]);
$data['attachmentList'] = WCF::getTPL()->fetch('attachments');
}
*/
public function validateMessage(DatabaseObject $container, $message) {
if (mb_strlen($message) > WCF::getSession()->getPermission('user.conversation.maxLength')) {
- throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.tooLong', array('maxTextLength' => WCF::getSession()->getPermission('user.conversation.maxLength'))));
+ throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.tooLong', ['maxTextLength' => WCF::getSession()->getPermission('user.conversation.maxLength')]));
}
// search for disallowed bbcodes
$disallowedBBCodes = BBCodeParser::getInstance()->validateBBCodes($message, explode(',', WCF::getSession()->getPermission('user.message.allowedBBCodes')));
if (!empty($disallowedBBCodes)) {
- throw new UserInputException('text', WCF::getLanguage()->getDynamicVariable('wcf.message.error.disallowedBBCodes', array('disallowedBBCodes' => $disallowedBBCodes)));
+ throw new UserInputException('text', WCF::getLanguage()->getDynamicVariable('wcf.message.error.disallowedBBCodes', ['disallowedBBCodes' => $disallowedBBCodes]));
}
// search for censored words
if (ENABLE_CENSORSHIP) {
$result = Censorship::getInstance()->test($message);
if ($result) {
- throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.censoredWordsFound', array('censoredWords' => $result)));
+ throw new UserInputException('message', WCF::getLanguage()->getDynamicVariable('wcf.message.error.censoredWordsFound', ['censoredWords' => $result]));
}
}
}
public function getMessageList(DatabaseObject $conversation, $lastMessageTime) {
$messageList = new ViewableConversationMessageList();
$messageList->setConversation($conversation);
- $messageList->getConditionBuilder()->add("conversation_message.conversationID = ?", array($conversation->conversationID));
- $messageList->getConditionBuilder()->add("conversation_message.time > ?", array($lastMessageTime));
+ $messageList->getConditionBuilder()->add("conversation_message.conversationID = ?", [$conversation->conversationID]);
+ $messageList->getConditionBuilder()->add("conversation_message.time > ?", [$lastMessageTime]);
$messageList->sqlOrderBy = "conversation_message.time ".CONVERSATION_LIST_DEFAULT_SORT_ORDER;
$messageList->readObjects();
FROM wcf".WCF_N."_conversation_message
WHERE conversationID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($conversation->conversationID));
+ $statement->execute([$conversation->conversationID]);
$count = $statement->fetchArray();
- return array(intval(ceil($count['count'] / CONVERSATION_MESSAGES_PER_PAGE)), $count['count']);
+ return [intval(ceil($count['count'] / CONVERSATION_MESSAGES_PER_PAGE)), $count['count']];
}
/**
* @see \wcf\data\IMessageQuickReply::getRedirectUrl()
*/
public function getRedirectUrl(DatabaseObject $conversation, DatabaseObject $message) {
- return LinkHandler::getInstance()->getLink('Conversation', array(
+ return LinkHandler::getInstance()->getLink('Conversation', [
'object' => $conversation,
'messageID' => $message->messageID
- )).'#message'.$message->messageID;
+ ]).'#message'.$message->messageID;
}
/**
public function validateSaveFullQuote() {
$this->message = $this->getSingleObject();
- if (!Conversation::isParticipant(array($this->message->conversationID))) {
+ if (!Conversation::isParticipant([$this->message->conversationID])) {
throw new PermissionDeniedException();
}
}
MessageQuoteManager::getInstance()->removeQuote($removeQuoteID);
}
- $returnValues = array(
+ $returnValues = [
'count' => MessageQuoteManager::getInstance()->countQuotes(),
- 'fullQuoteMessageIDs' => MessageQuoteManager::getInstance()->getFullQuoteObjectIDs(array('com.woltlab.wcf.conversation.message'))
- );
+ 'fullQuoteMessageIDs' => MessageQuoteManager::getInstance()->getFullQuoteObjectIDs(['com.woltlab.wcf.conversation.message'])
+ ];
if ($quoteID) {
$returnValues['renderedQuote'] = MessageQuoteManager::getInstance()->getQuoteComponents($quoteID);
$this->readBoolean('renderQuote', true);
$this->message = $this->getSingleObject();
- if (!Conversation::isParticipant(array($this->message->conversationID))) {
+ if (!Conversation::isParticipant([$this->message->conversationID])) {
throw new PermissionDeniedException();
}
}
public function saveQuote() {
$quoteID = MessageQuoteManager::getInstance()->addQuote('com.woltlab.wcf.conversation.message', $this->message->conversationID, $this->message->messageID, $this->parameters['message'], false);
- $returnValues = array(
+ $returnValues = [
'count' => MessageQuoteManager::getInstance()->countQuotes(),
- 'fullQuoteMessageIDs' => MessageQuoteManager::getInstance()->getFullQuoteObjectIDs(array('com.woltlab.wcf.conversation.message'))
- );
+ 'fullQuoteMessageIDs' => MessageQuoteManager::getInstance()->getFullQuoteObjectIDs(['com.woltlab.wcf.conversation.message'])
+ ];
if ($this->parameters['renderQuote']) {
$returnValues['renderedQuote'] = MessageQuoteManager::getInstance()->getQuoteComponents($quoteID);
public function getRenderedQuotes() {
$quotes = MessageQuoteManager::getInstance()->getQuotesByParentObjectID('com.woltlab.wcf.conversation.message', $this->conversation->conversationID);
- return array(
+ return [
'template' => implode("\n\n", $quotes)
- );
+ ];
}
/**
*/
public function getConversation() {
if ($this->conversation === null) {
- $this->conversation = new Conversation(null, array(
+ $this->conversation = new Conversation(null, [
'conversationID' => $this->conversationID,
'subject' => $this->subject
- ));
+ ]);
}
return $this->conversation;
*/
public function getLink($query = '') {
if ($query) {
- return LinkHandler::getInstance()->getLink('Conversation', array(
+ return LinkHandler::getInstance()->getLink('Conversation', [
'object' => $this->getConversation(),
'messageID' => $this->messageID,
'highlight' => urlencode($query)
- ), '#message'.$this->messageID);
+ ], '#message'.$this->messageID);
}
return $this->getDecoratedObject()->getLink();
parent::__construct();
// set conditions
- $this->getConditionBuilder()->add('modification_log.objectTypeID = ?', array(ConversationModificationLogHandler::getInstance()->getObjectType('com.woltlab.wcf.conversation.conversation')->objectTypeID));
- $this->getConditionBuilder()->add('modification_log.objectID = ?', array($conversationID));
+ $this->getConditionBuilder()->add('modification_log.objectTypeID = ?', [ConversationModificationLogHandler::getInstance()->getObjectType('com.woltlab.wcf.conversation.conversation')->objectTypeID]);
+ $this->getConditionBuilder()->add('modification_log.objectID = ?', [$conversationID]);
}
/**
/**
* @see \wcf\page\AbstractPage::$neededModules
*/
- public $neededModules = array('MODULE_CONVERSATION');
+ public $neededModules = ['MODULE_CONVERSATION'];
/**
* @see \wcf\page\AbstractPage::$neededPermissions
*/
- public $neededPermissions = array('user.conversation.canUseConversation');
+ public $neededPermissions = ['user.conversation.canUseConversation'];
/**
* participants (comma separated user names)
* participants (user ids)
* @var integer[]
*/
- public $participantIDs = array();
+ public $participantIDs = [];
/**
* invisible participants (user ids)
* @var integer[]
*/
- public $invisibleParticipantIDs = array();
+ public $invisibleParticipantIDs = [];
/**
* @see \wcf\page\IPage::readParameters()
Conversation::validateParticipant($user);
}
catch (UserInputException $e) {
- throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.conversation.participants.error.'.$e->getType(), array('errorData' => array('username' => $user->username))));
+ throw new NamedUserException(WCF::getLanguage()->getDynamicVariable('wcf.conversation.participants.error.'.$e->getType(), ['errorData' => ['username' => $user->username]]));
}
$this->participants = $user->username;
parent::save();
// save conversation
- $data = array_merge($this->additionalFields, array(
+ $data = array_merge($this->additionalFields, [
'subject' => $this->subject,
'time' => TIME_NOW,
'userID' => WCF::getUser()->userID,
'username' => WCF::getUser()->username,
'isDraft' => ($this->draft ? 1 : 0),
'participantCanInvite' => $this->participantCanInvite
- ));
+ ]);
if ($this->draft) {
- $data['draftData'] = serialize(array(
+ $data['draftData'] = serialize([
'participants' => $this->participantIDs,
'invisibleParticipants' => $this->invisibleParticipantIDs
- ));
+ ]);
}
- $conversationData = array(
+ $conversationData = [
'data' => $data,
'attachmentHandler' => $this->attachmentHandler,
- 'messageData' => array(
+ 'messageData' => [
'message' => $this->text,
'enableBBCodes' => $this->enableBBCodes,
'enableHtml' => $this->enableHtml,
'enableSmilies' => $this->enableSmilies,
'showSignature' => $this->showSignature
- )
- );
+ ]
+ ];
if (!$this->draft) {
$conversationData['participants'] = $this->participantIDs;
$conversationData['invisibleParticipants'] = $this->invisibleParticipantIDs;
}
- $this->objectAction = new ConversationAction(array(), 'create', $conversationData);
+ $this->objectAction = new ConversationAction([], 'create', $conversationData);
$resultValues = $this->objectAction->executeAction();
MessageQuoteManager::getInstance()->saved();
$this->saved();
// forward
- HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Conversation', array(
+ HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Conversation', [
'object' => $resultValues['returnValues']
- )));
+ ]));
exit;
}
MessageQuoteManager::getInstance()->assignVariables();
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'participantCanInvite' => $this->participantCanInvite,
'participants' => $this->participants,
'invisibleParticipants' => $this->invisibleParticipants
- ));
+ ]);
}
}
/**
* @see \wcf\page\AbstractPage::$neededModules
*/
- public $neededModules = array('MODULE_CONVERSATION');
+ public $neededModules = ['MODULE_CONVERSATION'];
/**
* @see \wcf\page\AbstractPage::$neededPermissions
*/
- public $neededPermissions = array('user.conversation.canUseConversation');
+ public $neededPermissions = ['user.conversation.canUseConversation'];
/**
* conversation id
FROM wcf".WCF_N."_conversation_message
WHERE conversationID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array($this->conversation->conversationID));
+ $statement->execute([$this->conversation->conversationID]);
$messageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
$renderedQuotes = MessageQuoteManager::getInstance()->getQuotesByObjectIDs('com.woltlab.wcf.conversation.message', $messageIDs);
$this->messageList->setConversation($this->conversation);
$this->messageList->sqlLimit = CONVERSATION_REPLY_SHOW_MESSAGES_MAX;
$this->messageList->sqlOrderBy = 'conversation_message.time DESC';
- $this->messageList->getConditionBuilder()->add('conversation_message.conversationID = ?', array($this->conversation->conversationID));
+ $this->messageList->getConditionBuilder()->add('conversation_message.conversationID = ?', [$this->conversation->conversationID]);
$this->messageList->readObjects();
}
parent::save();
// save message
- $data = array_merge($this->additionalFields, array(
+ $data = array_merge($this->additionalFields, [
'conversationID' => $this->conversationID,
'message' => $this->text,
'time' => TIME_NOW,
'enableHtml' => $this->enableHtml,
'enableSmilies' => $this->enableSmilies,
'showSignature' => $this->showSignature
- ));
+ ]);
- $messageData = array(
+ $messageData = [
'data' => $data,
'attachmentHandler' => $this->attachmentHandler
- );
+ ];
- $this->objectAction = new ConversationMessageAction(array(), 'create', $messageData);
+ $this->objectAction = new ConversationMessageAction([], 'create', $messageData);
$resultValues = $this->objectAction->executeAction();
MessageQuoteManager::getInstance()->saved();
$this->saved();
// forward
- HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Conversation', array(
+ HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Conversation', [
'object' => $this->conversation,
'messageID' => $resultValues['returnValues']->messageID
- )).'#message'.$resultValues['returnValues']->messageID);
+ ]).'#message'.$resultValues['returnValues']->messageID);
exit;
}
MessageQuoteManager::getInstance()->assignVariables();
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'conversation' => $this->conversation,
'conversationID' => $this->conversationID,
'items' => $this->messageList->countObjects(),
'messages' => $this->messageList->getObjects(),
'attachmentList' => $this->messageList->getAttachmentList()
- ));
+ ]);
}
/**
MessageForm::save();
// save message
- $data = array_merge($this->additionalFields, array(
+ $data = array_merge($this->additionalFields, [
'message' => $this->text,
'enableBBCodes' => $this->enableBBCodes,
'enableHtml' => $this->enableHtml,
'enableSmilies' => $this->enableSmilies,
'showSignature' => $this->showSignature
- ));
+ ]);
if ($this->conversation->isDraft && !$this->draft) {
$data['time'] = TIME_NOW;
}
$data['lastEditTime'] = TIME_NOW;
$data['editCount'] = $this->message->editCount + 1;
}
- $messageData = array(
+ $messageData = [
'data' => $data,
'attachmentHandler' => $this->attachmentHandler
- );
- $this->objectAction = new ConversationMessageAction(array($this->message), 'update', $messageData);
+ ];
+ $this->objectAction = new ConversationMessageAction([$this->message], 'update', $messageData);
$this->objectAction->executeAction();
// update conversation
if ($this->isFirstMessage) {
- $data = array(
+ $data = [
'subject' => $this->subject,
'isDraft' => ($this->draft ? 1 : 0),
'participantCanInvite' => $this->participantCanInvite
- );
+ ];
if ($this->draft) {
- $data['draftData'] = serialize(array(
+ $data['draftData'] = serialize([
'participants' => $this->participantIDs,
'invisibleParticipants' => $this->invisibleParticipantIDs
- ));
+ ]);
}
- $conversationData = array(
+ $conversationData = [
'data' => $data
- );
+ ];
if ($this->conversation->isDraft && !$this->draft) {
$conversationData['participants'] = $this->participantIDs;
$conversationData['invisibleParticipants'] = $this->invisibleParticipantIDs;
$conversationData['data']['time'] = $conversationData['data']['lastPostTime'] = TIME_NOW;
}
- $conversationAction = new ConversationAction(array($this->conversation), 'update', $conversationData);
+ $conversationAction = new ConversationAction([$this->conversation], 'update', $conversationData);
$conversationAction->executeAction();
}
$this->saved();
// forward
- HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Conversation', array(
+ HeaderUtil::redirect(LinkHandler::getInstance()->getLink('Conversation', [
'object' => $this->conversation,
'messageID' => $this->messageID
- )).'#message'.$this->messageID);
+ ]).'#message'.$this->messageID);
exit;
}
$this->messageList->setConversation($this->conversation);
$this->messageList->sqlLimit = CONVERSATION_REPLY_SHOW_MESSAGES_MAX;
$this->messageList->sqlOrderBy = 'conversation_message.time DESC';
- $this->messageList->getConditionBuilder()->add('conversation_message.conversationID = ?', array($this->message->conversationID));
- $this->messageList->getConditionBuilder()->add("conversation_message.messageID <> ?", array($this->message->messageID));
+ $this->messageList->getConditionBuilder()->add('conversation_message.conversationID = ?', [$this->message->conversationID]);
+ $this->messageList->getConditionBuilder()->add("conversation_message.messageID <> ?", [$this->message->messageID]);
$this->messageList->readObjects();
}
public function assignVariables() {
parent::assignVariables();
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'messageID' => $this->messageID,
'message' => $this->message,
'conversationID' => $this->conversationID,
'items' => $this->messageList->countObjects(),
'messages' => $this->messageList->getObjects(),
'attachmentList' => $this->messageList->getAttachmentList()
- ));
+ ]);
}
/**
parent::readData();
$this->items = new FeedConversationList();
- $this->items->getConditionBuilder()->add('conversation_to_user.participantID = ?', array(WCF::getUser()->userID));
- $this->items->getConditionBuilder()->add('conversation_to_user.hideConversation = ?', array(0));
+ $this->items->getConditionBuilder()->add('conversation_to_user.participantID = ?', [WCF::getUser()->userID]);
+ $this->items->getConditionBuilder()->add('conversation_to_user.hideConversation = ?', [0]);
$this->items->sqlConditionJoins = "LEFT JOIN wcf".WCF_N."_conversation conversation ON (conversation.conversationID = conversation_to_user.conversationID)";
$this->items->sqlLimit = 20;
$this->items->readObjects();
AND time > ?
ORDER BY time";
$statement = WCF::getDB()->prepareStatement($sql, 1);
- $statement->execute(array($this->conversationID, $this->objectList->current()->time));
+ $statement->execute([$this->conversationID, $this->objectList->current()->time]);
$endTime = $statement->fetchSingleColumn() - 1;
}
}
$messageList = new ConversationMessageList();
$messageList->setObjectIDs($objectIDs);
$messageList->readObjects();
- $conversationIDs = array();
+ $conversationIDs = [];
foreach ($messageList as $message) {
$conversationIDs[] = $message->conversationID;
}
* @see \wcf\system\attachment\IAttachmentObjectType::setPermissions()
*/
public function setPermissions(array $attachments) {
- $messageIDs = array();
+ $messageIDs = [];
foreach ($attachments as $attachment) {
// set default permissions
- $attachment->setPermissions(array(
+ $attachment->setPermissions([
'canDownload' => false,
'canViewPreview' => false
- ));
+ ]);
if ($this->getObject($attachment->objectID) === null) {
$messageIDs[] = $attachment->objectID;
if (($message = $this->getObject($attachment->objectID)) !== null) {
if (!$message->getConversation()->canRead()) continue;
- $attachment->setPermissions(array(
+ $attachment->setPermissions([
'canDownload' => true,
'canViewPreview' => true
- ));
+ ]);
}
else if ($attachment->tmpHash != '' && $attachment->userID == WCF::getUser()->userID) {
- $attachment->setPermissions(array(
+ $attachment->setPermissions([
'canDownload' => true,
'canViewPreview' => true
- ));
+ ]);
}
}
}
/**
* @see \wcf\system\clipboard\action\AbstractClipboardAction::$actionClassActions
*/
- protected $actionClassActions = array('close', 'markAsRead', 'open');
+ protected $actionClassActions = ['close', 'markAsRead', 'open'];
/**
* list of conversations
/**
* @see \wcf\system\clipboard\action\AbstractClipboardAction::$supportedActions
*/
- protected $supportedActions = array('assignLabel', 'close', 'leave', 'leavePermanently', 'markAsRead', 'open', 'restore');
+ protected $supportedActions = ['assignLabel', 'close', 'leave', 'leavePermanently', 'markAsRead', 'open', 'restore'];
/**
* @see \wcf\system\clipboard\action\IClipboardAction::execute()
FROM wcf".WCF_N."_conversation_label
WHERE userID = ?";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(WCF::getUser()->userID));
+ $statement->execute([WCF::getUser()->userID]);
$row = $statement->fetchArray();
if ($row['count'] == 0) {
return null;
break;
case 'leave':
- $item->addInternalData('parameters', array('hideConversation' => 1));
+ $item->addInternalData('parameters', ['hideConversation' => 1]);
$item->addParameter('actionName', 'hideConversation');
$item->addParameter('className', $this->getClassName());
break;
case 'leavePermanently':
$item->addParameter('objectIDs', array_keys($this->conversations));
- $item->addInternalData('parameters', array('hideConversation' => 2));
+ $item->addInternalData('parameters', ['hideConversation' => 2]);
$item->addParameter('actionName', 'hideConversation');
$item->addParameter('className', $this->getClassName());
break;
$item->addParameter('objectIDs', array_keys($this->conversations));
$item->addParameter('actionName', 'markAsRead');
$item->addParameter('className', $this->getClassName());
- $item->addInternalData('confirmMessage', WCF::getLanguage()->getDynamicVariable('wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.markAsRead.confirmMessage', array(
+ $item->addInternalData('confirmMessage', WCF::getLanguage()->getDynamicVariable('wcf.clipboard.item.com.woltlab.wcf.conversation.conversation.markAsRead.confirmMessage', [
'count' => $item->getCount()
- )));
+ ]));
break;
case 'restore':
- $item->addInternalData('parameters', array('hideConversation' => 0));
+ $item->addInternalData('parameters', ['hideConversation' => 0]);
$item->addParameter('actionName', 'hideConversation');
$item->addParameter('className', $this->getClassName());
break;
* @return Conversation[]
*/
protected function validateParticipation(array $conversations) {
- $conversationIDs = array();
+ $conversationIDs = [];
// validate ownership
foreach ($conversations as $conversation) {
// validate participation as non-owner
if (!empty($conversationIDs)) {
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("conversationID IN (?)", array($conversationIDs));
- $conditions->add("participantID = ?", array(WCF::getUser()->userID));
+ $conditions->add("conversationID IN (?)", [$conversationIDs]);
+ $conditions->add("participantID = ?", [WCF::getUser()->userID]);
$sql = "SELECT conversationID
FROM wcf".WCF_N."_conversation_to_user
* @return integer[]
*/
protected function validateClose() {
- $conversationIDs = array();
+ $conversationIDs = [];
foreach ($this->conversations as $conversation) {
if (!$conversation->isClosed && $conversation->userID == WCF::getUser()->userID) {
* @return integer[]
*/
public function validateLeave() {
- $tmpIDs = array();
+ $tmpIDs = [];
foreach ($this->conversations as $conversation) {
$tmpIDs[] = $conversation->conversationID;
}
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("conversationID IN (?)", array($tmpIDs));
- $conditions->add("participantID = ?", array(WCF::getUser()->userID));
- $conditions->add("hideConversation <> ?", array(1));
+ $conditions->add("conversationID IN (?)", [$tmpIDs]);
+ $conditions->add("participantID = ?", [WCF::getUser()->userID]);
+ $conditions->add("hideConversation <> ?", [1]);
$sql = "SELECT conversationID
FROM wcf".WCF_N."_conversation_to_user
* @return integer[]
*/
public function validateMarkAsRead() {
- $conversationIDs = array();
+ $conversationIDs = [];
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("conversationID IN (?)", array(array_keys($this->conversations)));
- $conditions->add("participantID = ?", array(WCF::getUser()->userID));
+ $conditions->add("conversationID IN (?)", [array_keys($this->conversations)]);
+ $conditions->add("participantID = ?", [WCF::getUser()->userID]);
$sql = "SELECT conversationID, lastVisitTime
FROM wcf".WCF_N."_conversation_to_user
".$conditions;
$statement = WCF::getDB()->prepareStatement($sql);
$statement->execute($conditions->getParameters());
- $lastVisitTime = array();
+ $lastVisitTime = [];
while ($row = $statement->fetchArray()) {
$lastVisitTime[$row['conversationID']] = $row['lastVisitTime'];
}
* @return integer[]
*/
protected function validateOpen() {
- $conversationIDs = array();
+ $conversationIDs = [];
foreach ($this->conversations as $conversation) {
if ($conversation->isClosed && $conversation->userID == WCF::getUser()->userID) {
* @return integer[]
*/
public function validateRestore() {
- $tmpIDs = array();
+ $tmpIDs = [];
foreach ($this->conversations as $conversation) {
$tmpIDs[] = $conversation->conversationID;
}
$conditions = new PreparedStatementConditionBuilder();
- $conditions->add("conversationID IN (?)", array($tmpIDs));
- $conditions->add("participantID = ?", array(WCF::getUser()->userID));
- $conditions->add("hideConversation <> ?", array(0));
+ $conditions->add("conversationID IN (?)", [$tmpIDs]);
+ $conditions->add("participantID = ?", [WCF::getUser()->userID]);
+ $conditions->add("hideConversation <> ?", [0]);
$sql = "SELECT conversationID
FROM wcf".WCF_N."_conversation_to_user
* number of unread conversations
* @var integer[]
*/
- protected $unreadConversationCount = array();
+ protected $unreadConversationCount = [];
/**
* number of conversations
* @var integer[]
*/
- protected $conversationCount = array();
+ protected $conversationCount = [];
/**
* Returns the number of unread conversations for given user.
$this->unreadConversationCount[$userID] = 0;
// load storage data
- UserStorageHandler::getInstance()->loadStorage(array($userID));
+ UserStorageHandler::getInstance()->loadStorage([$userID]);
// get ids
- $data = UserStorageHandler::getInstance()->getStorage(array($userID), 'unreadConversationCount');
+ $data = UserStorageHandler::getInstance()->getStorage([$userID], 'unreadConversationCount');
// cache does not exist or is outdated
if ($data[$userID] === null || $skipCache) {
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('conversation.conversationID = conversation_to_user.conversationID');
- $conditionBuilder->add('conversation_to_user.participantID = ?', array($userID));
+ $conditionBuilder->add('conversation_to_user.participantID = ?', [$userID]);
$conditionBuilder->add('conversation_to_user.hideConversation = 0');
$conditionBuilder->add('conversation_to_user.lastVisitTime < conversation.lastPostTime');
$this->conversationCount[$userID] = 0;
// load storage data
- UserStorageHandler::getInstance()->loadStorage(array($userID));
+ UserStorageHandler::getInstance()->loadStorage([$userID]);
// get ids
- $data = UserStorageHandler::getInstance()->getStorage(array($userID), 'conversationCount');
+ $data = UserStorageHandler::getInstance()->getStorage([$userID], 'conversationCount');
// cache does not exist or is outdated
if ($data[$userID] === null) {
$conditionBuilder1 = new PreparedStatementConditionBuilder();
- $conditionBuilder1->add('conversation_to_user.participantID = ?', array($userID));
+ $conditionBuilder1->add('conversation_to_user.participantID = ?', [$userID]);
$conditionBuilder1->add('conversation_to_user.hideConversation IN (0,1)');
$conditionBuilder2 = new PreparedStatementConditionBuilder();
- $conditionBuilder2->add('conversation.userID = ?', array($userID));
+ $conditionBuilder2->add('conversation.userID = ?', [$userID]);
$conditionBuilder2->add('conversation.isDraft = 1');
$sql = "SELECT (SELECT COUNT(*)
/**
* @see \wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data, array $additionalData = array()) {
+ public function import($oldID, array $data, array $additionalData = []) {
$data['objectID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation.message', $data['objectID']);
if (!$data['objectID']) return 0;
if (($newMessage = $this->fixEmbeddedAttachments($messageObj->message, $oldID, $attachmentID)) !== false) {
$editor = new ConversationMessageEditor($messageObj);
- $editor->update(array(
+ $editor->update([
'message' => $newMessage
- ));
+ ]);
}
}
/**
* @see \wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data, array $additionalData = array()) {
+ public function import($oldID, array $data, array $additionalData = []) {
$oldUserID = $data['userID'];
$data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
// add author
if (empty($data['isDraft'])) {
- ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, array(
+ ImportHandler::getInstance()->getImporter('com.woltlab.wcf.conversation.user')->import(0, [
'conversationID' => $oldID,
'participantID' => $oldUserID,
'username' => $data['username'],
'hideConversation' => 0,
'isInvisible' => 0,
'lastVisitTime' => $data['time']
- ), array('labelIDs' => array()));
+ ], ['labelIDs' => []]);
}
return $conversation->conversationID;
/**
* @see \wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data, array $additionalData = array()) {
+ public function import($oldID, array $data, array $additionalData = []) {
$data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
if (!$data['userID']) return 0;
- $action = new ConversationLabelAction(array(), 'create', array(
+ $action = new ConversationLabelAction([], 'create', [
'data' => $data
- ));
+ ]);
$returnValues = $action->executeAction();
$newID = $returnValues['returnValues']->labelID;
/**
* @see \wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data, array $additionalData = array()) {
+ public function import($oldID, array $data, array $additionalData = []) {
$data['conversationID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation', $data['conversationID']);
if (!$data['conversationID']) return 0;
$data['userID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['userID']);
/**
* @see \wcf\system\importer\IImporter::import()
*/
- public function import($oldID, array $data, array $additionalData = array()) {
+ public function import($oldID, array $data, array $additionalData = []) {
$data['conversationID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation', $data['conversationID']);
if (!$data['conversationID']) return 0;
$data['participantID'] = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.user', $data['participantID']);
isInvisible = IF(isInvisible AND VALUES(isInvisible),1,0),
lastVisitTime = GREATEST(lastVisitTime,VALUES(lastVisitTime))";
$statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(array(
+ $statement->execute([
$data['conversationID'],
$data['participantID'],
$data['username'],
$data['hideConversation'],
$data['isInvisible'],
$data['lastVisitTime']
- ));
+ ]);
// save labels
if ($data['participantID'] && !empty($additionalData['labelIDs'])) {
$statement = WCF::getDB()->prepareStatement($sql);
foreach ($additionalData['labelIDs'] as $labelID) {
$labelID = ImportHandler::getInstance()->getNewID('com.woltlab.wcf.conversation.label', $labelID);
- if ($labelID) $statement->execute(array($labelID, $data['conversationID']));
+ if ($labelID) $statement->execute([$labelID, $data['conversationID']]);
}
}
$messages = $messageList->getObjects();
// read conversations
- $conversationIDs = $validMessageIDs = array();
+ $conversationIDs = $validMessageIDs = [];
foreach ($messages as $message) {
$conversationIDs[] = $message->conversationID;
$validMessageIDs[] = $message->messageID;
}
- $quotedMessages = array();
+ $quotedMessages = [];
if (!empty($conversationIDs)) {
$conversationList = new ConversationList();
$conversationList->setObjectIDs($conversationIDs);
// check for orphaned quotes
if (count($validMessageIDs) != count($data)) {
- $orphanedQuoteIDs = array();
+ $orphanedQuoteIDs = [];
foreach ($data as $messageID => $quoteIDs) {
if (!in_array($messageID, $validMessageIDs)) {
foreach (array_keys($quoteIDs) as $quoteID) {
* list of conversation message
* @var ConversationMessage[]
*/
- protected static $messages = array();
+ protected static $messages = [];
/**
* @see \wcf\system\moderation\queue\AbstractModerationQueueHandler::$requiredPermission
* @see \wcf\system\moderation\queue\IModerationQueueHandler::assignQueues()
*/
public function assignQueues(array $queues) {
- $assignments = array();
+ $assignments = [];
foreach ($queues as $queue) {
$assignUser = false;
if (WCF::getSession()->getPermission('mod.conversation.canModerateConversation')) {
return false;
}
- if (!Conversation::isParticipant(array($this->getMessage($objectID)->conversationID))) {
+ if (!Conversation::isParticipant([$this->getMessage($objectID)->conversationID])) {
return false;
}
* @see \wcf\system\moderation\queue\report\IModerationQueueReportHandler::getReportedContent()
*/
public function getReportedContent(ViewableModerationQueue $queue) {
- WCF::getTPL()->assign(array(
+ WCF::getTPL()->assign([
'message' => new ViewableConversationMessage($queue->getAffectedObject())
- ));
+ ]);
return WCF::getTPL()->fetch('moderationConversationMessage');
}
* @see \wcf\system\moderation\queue\IModerationQueueHandler::populate()
*/
public function populate(array $queues) {
- $objectIDs = array();
+ $objectIDs = [];
foreach ($queues as $object) {
$objectIDs[] = $object->objectID;
}
}
// fetch conversations
- $conversationIDs = array();
+ $conversationIDs = [];
foreach ($messages as $message) {
$conversationIDs[] = $message->conversationID;
}
*/
public function removeContent(ModerationQueue $queue, $message) {
if ($this->isValid($queue->objectID)) {
- $messageAction = new ConversationMessageAction(array($this->getMessage($queue->objectID)), 'delete');
+ $messageAction = new ConversationMessageAction([$this->getMessage($queue->objectID)], 'delete');
$messageAction->executeAction();
}
}
* @see \wcf\system\stat\IStatDailyHandler::getData()
*/
public function getData($date) {
- return array(
+ return [
'counter' => $this->getCounter($date, 'wcf'.WCF_N.'_conversation_message', 'time'),
'total' => $this->getTotal($date, 'wcf'.WCF_N.'_conversation_message', 'time')
- );
+ ];
}
}
* @see \wcf\system\stat\IStatDailyHandler::getData()
*/
public function getData($date) {
- return array(
+ return [
'counter' => $this->getCounter($date, 'wcf'.WCF_N.'_conversation', 'time'),
'total' => $this->getTotal($date, 'wcf'.WCF_N.'_conversation', 'time')
- );
+ ];
}
}
public function getTitle() {
$count = count($this->getAuthors());
if ($count > 1) {
- return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.title.stacked', array('count' => $count));
+ return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.title.stacked', ['count' => $count]);
}
return $this->getLanguage()->get('wcf.user.notification.conversation.message.title');
$count = count($authors);
if ($count > 1) {
- return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.message.stacked', array(
+ return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.message.stacked', [
'author' => $this->author,
'authors' => $authors,
'count' => $count,
'message' => $this->userNotificationObject,
'others' => $count - 1
- ));
+ ]);
}
- return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.message', array(
+ return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.message', [
'author' => $this->author,
'message' => $this->userNotificationObject
- ));
+ ]);
}
/**
* @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
*/
public function getEmailMessage($notificationType = 'instant') {
- return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.mail', array(
+ return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message.mail', [
'message' => $this->userNotificationObject,
'author' => $this->author,
'notificationType' => $notificationType
- ));
+ ]);
}
/**
* @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
*/
public function getLink() {
- return LinkHandler::getInstance()->getLink('Conversation', array(
+ return LinkHandler::getInstance()->getLink('Conversation', [
'object' => $this->userNotificationObject->getConversation(),
'messageID' => $this->userNotificationObject->messageID
- ), '#message'.$this->userNotificationObject->messageID);
+ ], '#message'.$this->userNotificationObject->messageID);
}
/**
* @see \wcf\system\user\notification\event\IUserNotificationEvent::getMessage()
*/
public function getMessage() {
- return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message', array(
+ return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.message', [
'author' => $this->author,
'conversation' => $this->userNotificationObject
- ));
+ ]);
}
/**
* @see \wcf\system\user\notification\event\IUserNotificationEvent::getEmailMessage()
*/
public function getEmailMessage($notificationType = 'instant') {
- return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.mail', array(
+ return $this->getLanguage()->getDynamicVariable('wcf.user.notification.conversation.mail', [
'conversation' => $this->userNotificationObject,
'author' => $this->author,
'notificationType' => $notificationType
- ));
+ ]);
}
/**
* @see \wcf\system\user\notification\event\IUserNotificationEvent::getLink()
*/
public function getLink() {
- return LinkHandler::getInstance()->getLink('Conversation', array('object' => $this->userNotificationObject));
+ return LinkHandler::getInstance()->getLink('Conversation', ['object' => $this->userNotificationObject]);
}
/**
// '__unknownNotificationObject' tells the notification API
// that the object does not exist anymore so that the related
// notification can be deleted automatically
- $objects[$objectID] = new static::$decoratorClassName(new static::$objectClassName(null, array(
+ $objects[$objectID] = new static::$decoratorClassName(new static::$objectClassName(null, [
'__unknownNotificationObject' => true,
'conversationID' => $objectID
- )));
+ ]));
}
}
* @see \wcf\system\worker\IWorker::execute()
*/
public function execute() {
- $this->objectList->getConditionBuilder()->add('conversation_message.messageID BETWEEN ? AND ?', array($this->limit * $this->loopCount + 1, $this->limit * $this->loopCount + $this->limit));
+ $this->objectList->getConditionBuilder()->add('conversation_message.messageID BETWEEN ? AND ?', [$this->limit * $this->loopCount + 1, $this->limit * $this->loopCount + $this->limit]);
parent::execute();
SearchIndexManager::getInstance()->add('com.woltlab.wcf.conversation.message', $message->messageID, $message->message, ($message->subject ?: ''), $message->time, $message->userID, $message->username);
$editor = new ConversationMessageEditor($message);
- $data = array();
+ $data = [];
// count attachments
- $attachmentStatement->execute(array($attachmentObjectType->objectTypeID, $message->messageID));
+ $attachmentStatement->execute([$attachmentObjectType->objectTypeID, $message->messageID]);
$row = $attachmentStatement->fetchSingleRow();
$data['attachments'] = $row['attachments'];
* @see \wcf\system\worker\IWorker::execute()
*/
public function execute() {
- $this->objectList->getConditionBuilder()->add('conversation.conversationID BETWEEN ? AND ?', array($this->limit * $this->loopCount + 1, $this->limit * $this->loopCount + $this->limit));
+ $this->objectList->getConditionBuilder()->add('conversation.conversationID BETWEEN ? AND ?', [$this->limit * $this->loopCount + 1, $this->limit * $this->loopCount + $this->limit]);
parent::execute();
AND participantID IS NOT NULL";
$existingParticipantStatement = WCF::getDB()->prepareStatement($sql, 5);
- $obsoleteConversations = array();
+ $obsoleteConversations = [];
foreach ($this->objectList as $conversation) {
$editor = new ConversationEditor($conversation);
if (!$conversation->userID) $obsolete = true;
}
else {
- $existingParticipantStatement->execute(array($conversation->conversationID));
+ $existingParticipantStatement->execute([$conversation->conversationID]);
$row = $existingParticipantStatement->fetchSingleRow();
if (!$row['participants']) $obsolete = true;
}
}
// update data
- $data = array();
+ $data = [];
// get first post
- $firstMessageStatement->execute(array($conversation->conversationID));
+ $firstMessageStatement->execute([$conversation->conversationID]);
if (($row = $firstMessageStatement->fetchSingleRow()) !== false) {
$data['firstMessageID'] = $row['messageID'];
$data['lastPostTime'] = $data['time'] = $row['time'];
}
// get last post
- $lastMessageStatement->execute(array($conversation->conversationID));
+ $lastMessageStatement->execute([$conversation->conversationID]);
if (($row = $lastMessageStatement->fetchSingleRow()) !== false) {
$data['lastPostTime'] = $row['time'];
$data['lastPosterID'] = $row['userID'];
}
// get stats
- $statsStatement->execute(array($conversation->conversationID));
+ $statsStatement->execute([$conversation->conversationID]);
$row = $statsStatement->fetchSingleRow();
$data['replies'] = ($row['messages'] ? $row['messages'] - 1 : 0);
$data['attachments'] = ($row['attachments'] ?: 0);
// get number of participants
- $participantCounterStatement->execute(array($conversation->conversationID, Conversation::STATE_LEFT, $conversation->userID, 0));
+ $participantCounterStatement->execute([$conversation->conversationID, Conversation::STATE_LEFT, $conversation->userID, 0]);
$row = $participantCounterStatement->fetchSingleRow();
$data['participants'] = $row['participants'];
// get participant summary
- $participantStatement->execute(array($conversation->conversationID, $conversation->userID, 0));
- $users = array();
+ $participantStatement->execute([$conversation->conversationID, $conversation->userID, 0]);
+ $users = [];
while ($row = $participantStatement->fetchArray()) {
$users[] = $row;
}