}
$sql = "SELECT *
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
WHERE participantID = ?
AND conversationID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$userID, $this->conversationID]);
$row = $statement->fetchArray();
if ($row !== false) {
public static function getUserConversation($conversationID, $userID)
{
$sql = "SELECT conversation_to_user.*, conversation.*
- FROM wcf" . WCF_N . "_conversation conversation
- LEFT JOIN wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ FROM wcf1_conversation conversation
+ LEFT JOIN wcf1_conversation_to_user conversation_to_user
ON conversation_to_user.participantID = ?
AND conversation_to_user.conversationID = conversation.conversationID
WHERE conversation.conversationID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$userID, $conversationID]);
$row = $statement->fetchArray();
if ($row !== false) {
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('conversation.conversationID IN (?)', [$conversationIDs]);
$sql = "SELECT conversation_to_user.*, conversation.*
- FROM wcf" . WCF_N . "_conversation conversation
- LEFT JOIN wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ FROM wcf1_conversation conversation
+ LEFT JOIN wcf1_conversation_to_user conversation_to_user
ON conversation_to_user.participantID = " . $userID . "
AND conversation_to_user.conversationID = conversation.conversationID
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$conversations = [];
while ($row = $statement->fetchArray()) {
$this->canAddUnrestricted = false;
if ($this->isActiveParticipant()) {
$sql = "SELECT joinedAt
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
WHERE conversationID = ?
AND participantID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->conversationID,
WCF::getUser()->userID,
}
$sql = "SELECT participantID
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
return $statement->fetchAll(\PDO::FETCH_COLUMN);
}
$sql = "SELECT user_table.username
- FROM wcf" . WCF_N . "_conversation_to_user conversation_to_user
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ FROM wcf1_conversation_to_user conversation_to_user
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = conversation_to_user.participantID
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
return $statement->fetchAll(\PDO::FETCH_COLUMN);
{
if ($this->isActiveParticipant === null) {
$sql = "SELECT leftAt
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
WHERE conversationID = ?
AND participantID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
$this->conversationID,
WCF::getUser()->userID,
$conditions->add("userID = ?", [$userID]);
$sql = "SELECT conversationID
- FROM wcf" . WCF_N . "_conversation
+ FROM wcf1_conversation
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$index = \array_search($row['conversationID'], $conversationIDs);
$conditions->add("hideConversation <> ?", [self::STATE_LEFT]);
$sql = "SELECT conversationID
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$index = \array_search($row['conversationID'], $conversationIDs);
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('groupID IN (?)', [$validGroupIDs]);
$sql = "SELECT DISTINCT userID
- FROM wcf" . WCF_N . "_user_to_group
+ FROM wcf1_user_to_group
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
while ($userID = $statement->fetchColumn()) {
$userIDs[] = $userID;
UserStorageHandler::getInstance()->reset($conversation->getParticipantIDs(), 'conversationCount');
// mark conversation as read for the author
- $sql = "UPDATE wcf" . WCF_N . "_conversation_to_user
+ $sql = "UPDATE wcf1_conversation_to_user
SET lastVisitTime = ?
WHERE participantID = ?
AND conversationID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$data['time'], $data['userID'], $conversation->conversationID]);
} else {
// update conversation count
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("conversationID IN (?)", [$this->objectIDs]);
$sql = "SELECT DISTINCT participantID
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($participantID = $statement->fetchColumn()) {
}
$conversationIDs = [];
- $sql = "UPDATE wcf" . WCF_N . "_conversation_to_user
+ $sql = "UPDATE wcf1_conversation_to_user
SET lastVisitTime = ?
WHERE participantID = ?
AND conversationID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($this->getObjects() as $conversation) {
$statement->execute([
$condition->add('notification.eventID = ?', [$eventID]);
$condition->add("notification.objectID IN (
SELECT messageID
- FROM wcf" . WCF_N . "_conversation_message
+ FROM wcf1_conversation_message
WHERE conversationID IN (?)
AND time <= ?
)", [
]);
$sql = "SELECT notificationID
- FROM wcf" . WCF_N . "_user_notification notification
+ FROM wcf1_user_notification notification
{$condition}";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($condition->getParameters());
UserNotificationHandler::getInstance()->markAsConfirmedByIDs(
*/
public function markAllAsRead()
{
- $sql = "UPDATE wcf" . WCF_N . "_conversation_to_user
+ $sql = "UPDATE wcf1_conversation_to_user
SET lastVisitTime = ?
WHERE participantID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
TIME_NOW,
WCF::getUser()->userID,
{
// get hidden state from first conversation (all others have the same state)
$sql = "SELECT hideConversation
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
WHERE conversationID = ?
AND participantID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
\current($this->objectIDs),
WCF::getUser()->userID,
*/
public function hideConversation()
{
- $sql = "UPDATE wcf" . WCF_N . "_conversation_to_user
+ $sql = "UPDATE wcf1_conversation_to_user
SET hideConversation = ?
WHERE conversationID = ?
AND participantID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($this->objectIDs as $conversationID) {
$conditionBuilder->add('conversation.conversationID IN (?)', [$this->objectIDs]);
$conditionBuilder->add('conversation_to_user.conversationID IS NULL');
$sql = "SELECT DISTINCT conversation.conversationID
- FROM wcf" . WCF_N . "_conversation conversation
- LEFT JOIN wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ FROM wcf1_conversation conversation
+ LEFT JOIN wcf1_conversation_to_user conversation_to_user
ON conversation_to_user.conversationID = conversation.conversationID
AND conversation_to_user.hideConversation <> " . Conversation::STATE_LEFT . "
AND conversation_to_user.participantID IS NOT NULL
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$conversationIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
{
$sqlSelect = ' , (
SELECT participantID
- FROM wcf' . WCF_N . '_conversation_to_user
+ FROM wcf1_conversation_to_user
WHERE conversationID = conversation.conversationID
AND participantID <> conversation.userID
AND isInvisible = 0
) AS otherParticipantID
, (
SELECT username
- FROM wcf' . WCF_N . '_conversation_to_user
+ FROM wcf1_conversation_to_user
WHERE conversationID = conversation.conversationID
AND participantID <> conversation.userID
AND isInvisible = 0
$conditionBuilder = new PreparedStatementConditionBuilder();
$conditionBuilder->add('conversation_message.conversationID IN (?)', [$this->objectIDs]);
$sql = "SELECT conversationID, COUNT(messageID) AS messages, SUM(attachments) AS attachments
- FROM wcf" . WCF_N . "_conversation_message conversation_message
+ FROM wcf1_conversation_message conversation_message
" . $conditionBuilder . "
GROUP BY conversationID";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$objectIDs = [];
*/
public function resetParticipants()
{
- $sql = "DELETE FROM wcf" . WCF_N . "_conversation_to_user
+ $sql = "DELETE FROM wcf1_conversation_to_user
WHERE conversationID = ?
AND participantID <> ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->conversationID, $this->userID]);
}
$conditions->add("userID IN (?)", [\array_merge($participantIDs, $invisibleParticipantIDs)]);
$sql = "SELECT userID, username
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$usernames[$row['userID']] = $row['username'];
if (!empty($participantIDs)) {
WCF::getDB()->beginTransaction();
- $sql = "INSERT INTO wcf" . WCF_N . "_conversation_to_user
+ $sql = "INSERT INTO wcf1_conversation_to_user
(conversationID, participantID, username, isInvisible, joinedAt)
VALUES (?, ?, ?, ?, ?)
ON DUPLICATE KEY
isInvisible = 0,
leftAt = 0,
leftByOwnChoice = 1";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($participantIDs as $userID) {
$statement->execute([
if (!empty($invisibleParticipantIDs)) {
WCF::getDB()->beginTransaction();
- $sql = "INSERT INTO wcf" . WCF_N . "_conversation_to_user
+ $sql = "INSERT INTO wcf1_conversation_to_user
(conversationID, participantID, username, isInvisible)
VALUES (?, ?, ?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
foreach ($invisibleParticipantIDs as $userID) {
$statement->execute([
*/
public function updateParticipantCount()
{
- $sql = "UPDATE wcf" . WCF_N . "_conversation conversation
+ $sql = "UPDATE wcf1_conversation conversation
SET participants = (
SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ FROM wcf1_conversation_to_user conversation_to_user
WHERE conversation_to_user.conversationID = conversation.conversationID
AND conversation_to_user.hideConversation <> ?
AND conversation_to_user.participantID <> ?
AND conversation_to_user.isInvisible = ?
)
WHERE conversation.conversationID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
Conversation::STATE_LEFT,
$this->userID,
public function updateParticipantSummary()
{
$sql = "SELECT participantID AS userID, hideConversation, username
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
WHERE conversationID = ?
AND participantID <> ?
AND isInvisible = 0
ORDER BY username";
- $statement = WCF::getDB()->prepareStatement($sql, 5);
+ $statement = WCF::getDB()->prepare($sql, 5);
$statement->execute([$this->conversationID, $this->userID]);
$this->update(['participantSummary' => \serialize($statement->fetchAll(\PDO::FETCH_ASSOC))]);
public function updateFirstMessage()
{
$sql = "SELECT messageID
- FROM wcf" . WCF_N . "_conversation_message
+ FROM wcf1_conversation_message
WHERE conversationID = ?
ORDER BY time ASC";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([
$this->conversationID,
]);
public function updateLastMessage()
{
$sql = "SELECT time, userID, username
- FROM wcf" . WCF_N . "_conversation_message
+ FROM wcf1_conversation_message
WHERE conversationID = ?
ORDER BY time DESC";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([
$this->conversationID,
]);
}
}
$this->sqlConditionJoins .= "
- LEFT JOIN wcf" . WCF_N . "_user user_table
+ LEFT JOIN wcf1_user user_table
ON user_table.userID = conversation_to_user.participantID";
if (!empty($this->sqlSelects)) {
}
$this->sqlSelects .= 'conversation_to_user.*';
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ LEFT JOIN wcf1_conversation_to_user conversation_to_user
ON conversation_to_user.participantID = user_table.userID
AND conversation_to_user.conversationID = " . $conversationID;
}
public function countObjects()
{
$sql = "SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ FROM wcf1_conversation_to_user conversation_to_user
" . $this->sqlConditionJoins . "
" . $this->getConditionBuilder();
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($this->getConditionBuilder()->getParameters());
$row = $statement->fetchArray();
{
$this->objectIDs = [];
$sql = "SELECT conversation_to_user.participantID AS objectID
- FROM wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ FROM wcf1_conversation_to_user conversation_to_user
" . $this->sqlConditionJoins . "
" . $this->getConditionBuilder() . "
" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : '');
- $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
+ $statement = WCF::getDB()->prepare($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute($this->getConditionBuilder()->getParameters());
$this->objectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
// check for deleted users
$sql = "SELECT username
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
WHERE conversationID = ?
AND participantID IS NULL";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$this->conversationID]);
$i = 0;
while ($row = $statement->fetchArray()) {
public function readObjectIDs()
{
$sql = "SELECT conversation_to_user.conversationID AS objectID
- FROM wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ FROM wcf1_conversation_to_user conversation_to_user
" . $this->sqlConditionJoins . "
" . $this->getConditionBuilder() . "
" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : '');
- $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
+ $statement = WCF::getDB()->prepare($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute($this->getConditionBuilder()->getParameters());
$this->objectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
$this->getConditionBuilder()
->add('conversation_to_user.hideConversation = ?', [$this->filter == 'hidden' ? 1 : 0]);
$this->sqlConditionJoins = "
- LEFT JOIN wcf" . WCF_N . "_conversation conversation
+ LEFT JOIN wcf1_conversation conversation
ON conversation.conversationID = conversation_to_user.conversationID";
if ($this->filter == 'outbox') {
$this->getConditionBuilder()->add('conversation.userID = ?', [$userID]);
if ($labelID) {
$this->getConditionBuilder()->add("conversation.conversationID IN (
SELECT conversationID
- FROM wcf" . WCF_N . "_conversation_label_to_object
+ FROM wcf1_conversation_label_to_object
WHERE labelID = ?
)", [$labelID]);
}
// own posts
$this->sqlSelects = "DISTINCT conversation_message.userID AS ownPosts";
$this->sqlJoins = "
- LEFT JOIN wcf" . WCF_N . "_conversation_message conversation_message
+ LEFT JOIN wcf1_conversation_message conversation_message
ON conversation_message.conversationID = conversation.conversationID
AND conversation_message.userID = " . $userID;
}
$this->sqlSelects .= "conversation_to_user.*";
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ LEFT JOIN wcf1_conversation_to_user conversation_to_user
ON conversation_to_user.participantID = " . $userID . "
AND conversation_to_user.conversationID = conversation.conversationID";
}
$sql = "SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ FROM wcf1_conversation_to_user conversation_to_user
" . $this->sqlConditionJoins . "
" . $this->getConditionBuilder();
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($this->getConditionBuilder()->getParameters());
$row = $statement->fetchArray();
THEN conversation_to_user.leftAt
ELSE conversation.lastPostTime
END) AS lastPostTime
- FROM wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ FROM wcf1_conversation_to_user conversation_to_user
" . $this->sqlConditionJoins . "
" . $this->getConditionBuilder() . "
" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : '');
- $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
+ $statement = WCF::getDB()->prepare($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute($this->getConditionBuilder()->getParameters());
$this->objectIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
$conditions = new PreparedStatementConditionBuilder();
$conditions->add("messageID IN (?)", [$messageIDs]);
$sql = "SELECT messageID, userID, username, time
- FROM wcf" . WCF_N . "_conversation_message
+ FROM wcf1_conversation_message
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$messageData = [];
while ($row = $statement->fetchArray()) {
$conditions->add("labelID IN (?)", [\array_keys($labels)]);
$sql = "SELECT labelID, conversationID
- FROM wcf" . WCF_N . "_conversation_label_to_object
+ FROM wcf1_conversation_label_to_object
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$data = [];
while ($row = $statement->fetchArray()) {
$conditions->add("labelID IN (?)", [\array_keys($labels)]);
$sql = "SELECT labelID
- FROM wcf" . WCF_N . "_conversation_label_to_object
+ FROM wcf1_conversation_label_to_object
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$conversation->assignLabel($labels[$row['labelID']]);
$conditions->add("labelID IN (?)", [$labelIDs]);
$sql = "SELECT labelID
- FROM wcf" . WCF_N . "_conversation_label_to_object
+ FROM wcf1_conversation_label_to_object
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$assignedLabels = $statement->fetchAll(\PDO::FETCH_COLUMN);
}
$conditions->add("conversationID IN (?)", [$this->parameters['conversationIDs']]);
$conditions->add("labelID IN (?)", [$labelIDs]);
- $sql = "DELETE FROM wcf" . WCF_N . "_conversation_label_to_object
+ $sql = "DELETE FROM wcf1_conversation_label_to_object
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
// assign label ids
if (!empty($this->parameters['labelIDs'])) {
- $sql = "INSERT INTO wcf" . WCF_N . "_conversation_label_to_object
+ $sql = "INSERT INTO wcf1_conversation_label_to_object
(labelID, conversationID)
VALUES (?, ?)";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
WCF::getDB()->beginTransaction();
foreach ($this->parameters['labelIDs'] as $labelID) {
$userConversation = Conversation::getUserConversation($conversation->conversationID, $message->userID);
if ($userConversation !== null && $userConversation->isInvisible) {
// make invisible participant visible
- $sql = "UPDATE wcf" . WCF_N . "_conversation_to_user
+ $sql = "UPDATE wcf1_conversation_to_user
SET isInvisible = 0
WHERE participantID = ?
AND conversationID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$message->userID, $conversation->conversationID]);
$conversationEditor->updateParticipantSummary();
}
// reset visibility if it was hidden but not left
- $sql = "UPDATE wcf" . WCF_N . "_conversation_to_user
+ $sql = "UPDATE wcf1_conversation_to_user
SET hideConversation = ?
WHERE conversationID = ?
AND hideConversation = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([
Conversation::STATE_DEFAULT,
$conversation->conversationID,
/** @var Conversation $container */
$sql = "SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_conversation_message
+ FROM wcf1_conversation_message
WHERE conversationID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([$container->conversationID]);
$count = $statement->fetchArray();
}
$this->sqlSelects .= 'conversation.subject';
$this->sqlJoins .= "
- LEFT JOIN wcf" . WCF_N . "_conversation conversation
+ LEFT JOIN wcf1_conversation conversation
ON conversation.conversationID = conversation_message.conversationID";
}
}
public function readObjects()
{
$sql = "SELECT modification_log.*
- FROM wcf" . WCF_N . "_modification_log modification_log
+ FROM wcf1_modification_log modification_log
" . $this->getConditionBuilder() . "
" . (!empty($this->sqlOrderBy) ? "ORDER BY " . $this->sqlOrderBy : '');
- $statement = WCF::getDB()->prepareStatement($sql, $this->sqlLimit, $this->sqlOffset);
+ $statement = WCF::getDB()->prepare($sql, $this->sqlLimit, $this->sqlOffset);
$statement->execute($this->getConditionBuilder()->getParameters());
$this->objects = $statement->fetchObjects(($this->objectClassName ?: $this->className));
$condition->add('userID IN (?)', [$draftData[$participantType]]);
$sql = "SELECT username
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
" . $condition;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($condition->getParameters());
if (!empty($this->{$participantType})) {
$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
+ LEFT JOIN wcf1_conversation conversation
ON conversation.conversationID = conversation_to_user.conversationID";
$this->items->sqlLimit = 20;
$this->items->readObjects();
$conditions = new PreparedStatementConditionBuilder();
$conditions->add('username IN (?)', [$this->participants]);
$sql = "SELECT userID
- FROM wcf" . WCF_N . "_user
+ FROM wcf1_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$userIDs = [];
while ($userID = $statement->fetchColumn()) {
conversation.userID = ?
AND conversation.conversationID IN (
SELECT conversationID
- FROM wcf' . WCF_N . '_conversation_to_user
+ FROM wcf1_conversation_to_user
WHERE participantID IN (?)
GROUP BY conversationID
HAVING COUNT(conversationID) = ?
conversation.userID <> ?
AND conversation.conversationID IN (
SELECT conversationID
- FROM wcf' . WCF_N . '_conversation_to_user
+ FROM wcf1_conversation_to_user
WHERE participantID IN (?)
AND isInvisible = ?
GROUP BY conversationID
$this->objectList->seek($count - 1);
if ($this->objectList->current()->time < $this->conversation->lastPostTime) {
$sql = "SELECT time
- FROM wcf" . WCF_N . "_conversation_message
+ FROM wcf1_conversation_message
WHERE conversationID = ?
AND time > ?
ORDER BY time";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute([$this->conversationID, $this->objectList->current()->time]);
$endTime = $statement->fetchSingleColumn() - 1;
}
$conditionBuilder->add('time ' . ($this->sortOrder == 'ASC' ? '<=' : '>=') . ' ?', [$this->message->time]);
$sql = "SELECT COUNT(*) AS messages
- FROM wcf" . WCF_N . "_conversation_message conversation_message
+ FROM wcf1_conversation_message conversation_message
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$row = $statement->fetchArray();
$this->pageNo = \intval(\ceil($row['messages'] / $this->itemsPerPage));
protected function goToLastPost()
{
$sql = "SELECT conversation_message.messageID
- FROM wcf" . WCF_N . "_conversation_message conversation_message
+ FROM wcf1_conversation_message conversation_message
" . $this->objectList->getConditionBuilder() . "
ORDER BY time " . ($this->sortOrder == 'ASC' ? 'DESC' : 'ASC');
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute($this->objectList->getConditionBuilder()->getParameters());
$row = $statement->fetchArray();
if ($row === false) {
$conditionBuilder->add('time > ?', [$this->conversation->lastVisitTime]);
$sql = "SELECT conversation_message.messageID
- FROM wcf" . WCF_N . "_conversation_message conversation_message
+ FROM wcf1_conversation_message conversation_message
" . $conditionBuilder . "
ORDER BY time ASC";
- $statement = WCF::getDB()->prepareStatement($sql, 1);
+ $statement = WCF::getDB()->prepare($sql, 1);
$statement->execute($conditionBuilder->getParameters());
$row = $statement->fetchArray();
if ($row !== false) {
case 'assignLabel':
// check if user has labels
$sql = "SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_conversation_label
+ FROM wcf1_conversation_label
WHERE userID = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute([WCF::getUser()->userID]);
$row = $statement->fetchArray();
if ($row['count'] == 0) {
$conditions->add("participantID = ?", [WCF::getUser()->userID]);
$sql = "SELECT conversationID
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
while ($row = $statement->fetchArray()) {
$index = \array_search($row['conversationID'], $conversationIDs);
$conditions->add("hideConversation <> ?", [1]);
$sql = "SELECT conversationID
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
return $statement->fetchAll(\PDO::FETCH_COLUMN);
$conditions->add("participantID = ?", [WCF::getUser()->userID]);
$sql = "SELECT conversationID, lastVisitTime
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
$lastVisitTime = [];
while ($row = $statement->fetchArray()) {
$conditions->add("hideConversation <> ?", [0]);
$sql = "SELECT conversationID
- FROM wcf" . WCF_N . "_conversation_to_user
+ FROM wcf1_conversation_to_user
" . $conditions;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditions->getParameters());
return $statement->fetchAll(\PDO::FETCH_COLUMN);
$conditionBuilder->add('conversation_to_user.leftAt = 0');
$sql = "SELECT COUNT(*) AS count
- FROM wcf" . WCF_N . "_conversation_to_user conversation_to_user,
- wcf" . WCF_N . "_conversation conversation
+ FROM wcf1_conversation_to_user conversation_to_user,
+ wcf1_conversation conversation
" . $conditionBuilder;
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute($conditionBuilder->getParameters());
$row = $statement->fetchArray();
$this->unreadConversationCount[$userID] = $row['count'];
$sql = "SELECT (
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ FROM wcf1_conversation_to_user conversation_to_user
" . $conditionBuilder1 . "
) + (
SELECT COUNT(*)
- FROM wcf" . WCF_N . "_conversation conversation
+ FROM wcf1_conversation conversation
" . $conditionBuilder2 . "
) AS count";
- $statement = WCF::getDB()->prepareStatement($sql);
+ $statement = WCF::getDB()->prepare($sql);
$statement->execute(\array_merge(
$conditionBuilder1->getParameters(),
$conditionBuilder2->getParameters()
public function execute($eventObj, $className, $eventName, array &$parameters)
{
/** @var PruneIpAddressesCronjob $eventObj */
- $eventObj->columns['wcf' . WCF_N . '_conversation_message']['ipAddress'] = 'time';
+ $eventObj->columns['wcf1_conversation_message']['ipAddress'] = 'time';
}
}
* @inheritDoc
*/
protected $databaseTables = [
- 'wcf{WCF_N}_conversation',
- 'wcf{WCF_N}_conversation_message',
+ 'wcf1_conversation',
+ 'wcf1_conversation_message',
[
- 'name' => 'wcf{WCF_N}_conversation',
+ 'name' => 'wcf1_conversation',
'userID' => 'lastPosterID',
'username' => 'lastPoster',
],
[
- 'name' => 'wcf{WCF_N}_conversation_to_user',
+ 'name' => 'wcf1_conversation_to_user',
'userID' => 'participantID',
],
];
* @inheritDoc
*/
protected $databaseTables = [
- 'wcf{WCF_N}_conversation',
- 'wcf{WCF_N}_conversation_message',
+ 'wcf1_conversation',
+ 'wcf1_conversation_message',
[
- 'name' => 'wcf{WCF_N}_conversation_label',
+ 'name' => 'wcf1_conversation_label',
'username' => null,
],
[
- 'name' => 'wcf{WCF_N}_conversation_to_user',
+ 'name' => 'wcf1_conversation_to_user',
'userID' => 'participantID',
'ignore' => true,
],
*/
public function getJoins(): string
{
- return " JOIN wcf" . WCF_N . "_conversation_to_user conversation_to_user
+ return " JOIN wcf1_conversation_to_user conversation_to_user
ON conversation_to_user.participantID = " . WCF::getUser()->userID . "
AND conversation_to_user.conversationID = " . $this->getTableName() . ".conversationID
- LEFT JOIN wcf" . WCF_N . "_conversation conversation
+ LEFT JOIN wcf1_conversation conversation
ON conversation.conversationID = " . $this->getTableName() . ".conversationID";
}
*/
public function getTableName(): string
{
- return 'wcf' . WCF_N . '_conversation_message';
+ return 'wcf1_conversation_message';
}
/**
public function getData($date)
{
return [
- 'counter' => $this->getCounter($date, 'wcf' . WCF_N . '_conversation_message', 'time'),
- 'total' => $this->getTotal($date, 'wcf' . WCF_N . '_conversation_message', 'time'),
+ 'counter' => $this->getCounter($date, 'wcf1_conversation_message', 'time'),
+ 'total' => $this->getTotal($date, 'wcf1_conversation_message', 'time'),
];
}
}
public function getData($date)
{
return [
- 'counter' => $this->getCounter($date, 'wcf' . WCF_N . '_conversation', 'time'),
- 'total' => $this->getTotal($date, 'wcf' . WCF_N . '_conversation', 'time'),
+ 'counter' => $this->getCounter($date, 'wcf1_conversation', 'time'),
+ 'total' => $this->getTotal($date, 'wcf1_conversation', 'time'),
];
}
}
$this->objectList->sqlOrderBy = 'conversation_message.messageID';
$this->objectList->sqlSelects = '(
SELECT subject
- FROM wcf' . WCF_N . '_conversation
+ FROM wcf1_conversation
WHERE conversationID = conversation_message.conversationID
) AS subject';
}