diff --git a/files/lib/data/command/Command.class.php b/files/lib/data/command/Command.class.php index b13dc92..8b54281 100644 --- a/files/lib/data/command/Command.class.php +++ b/files/lib/data/command/Command.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -42,9 +42,9 @@ public function hasTriggers() { } $sql = "SELECT COUNT(*) - FROM chat".WCF_N."_command_trigger + FROM chat1_command_trigger WHERE commandID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $this->commandID ]); return $statement->fetchSingleColumn() > 0; } diff --git a/files/lib/data/command/CommandTrigger.class.php b/files/lib/data/command/CommandTrigger.class.php index c47de22..4c75df2 100644 --- a/files/lib/data/command/CommandTrigger.class.php +++ b/files/lib/data/command/CommandTrigger.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -42,9 +42,9 @@ public function getObjectID() { */ public static function getTriggerByName($name) { $sql = "SELECT * - FROM chat".WCF_N."_command_trigger + FROM chat1_command_trigger WHERE commandTrigger = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $name ]); $row = $statement->fetchArray(); if (!$row) $row = []; diff --git a/files/lib/data/message/MessageAction.class.php b/files/lib/data/message/MessageAction.class.php index 2e25d41..10138c3 100644 --- a/files/lib/data/message/MessageAction.class.php +++ b/files/lib/data/message/MessageAction.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -34,8 +34,8 @@ public function create() { $message = parent::create(); if (isset($this->parameters['updateTimestamp']) && $this->parameters['updateTimestamp']) { - $sql = "UPDATE chat".WCF_N."_room_to_user SET lastPush = ? WHERE roomID = ? AND userID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $sql = "UPDATE chat1_room_to_user SET lastPush = ? WHERE roomID = ? AND userID = ?"; + $statement = WCF::getDB()->prepare($sql); $statement->execute([ TIME_NOW, $message->roomID, $message->userID ]); } if (isset($this->parameters['grantPoints']) && $this->parameters['grantPoints']) { @@ -128,9 +128,9 @@ public function prune() { if (!CHAT_LOG_ARCHIVETIME) return; $sql = "SELECT messageID - FROM chat".WCF_N."_message + FROM chat1_message WHERE time < ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ TIME_NOW - CHAT_LOG_ARCHIVETIME * 86400 ]); $messageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); @@ -179,22 +179,22 @@ public function pull() { WCF::getDB()->beginTransaction(); // update timestamp - $sql = "UPDATE chat".WCF_N."_room_to_user + $sql = "UPDATE chat1_room_to_user SET lastPull = ? WHERE roomID = ? AND userID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ TIME_NOW , $room->roomID , WCF::getUser()->userID ]); - $sql = "UPDATE chat".WCF_N."_session + $sql = "UPDATE chat1_session SET lastRequest = ? WHERE roomID = ? AND userID = ? AND sessionID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ TIME_NOW , $room->roomID , WCF::getUser()->userID @@ -226,10 +226,10 @@ public function pull() { } $sql = "SELECT messageID - FROM chat".WCF_N."_message + FROM chat1_message ".$condition." ORDER BY messageID ".$sortOrder; - $statement = WCF::getDB()->prepareStatement($sql, 20); + $statement = WCF::getDB()->prepare($sql, 20); $statement->execute($condition->getParameters()); $messageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); diff --git a/files/lib/data/room/Room.class.php b/files/lib/data/room/Room.class.php index 1c413e7..34b7a57 100644 --- a/files/lib/data/room/Room.class.php +++ b/files/lib/data/room/Room.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -212,12 +212,12 @@ public function getTopic() { public function getUsers() { if (self::$userToRoom === null) { $sql = "SELECT r2u.userID, r2u.roomID - FROM chat".WCF_N."_room_to_user r2u - INNER JOIN wcf".WCF_N."_user u + FROM chat1_room_to_user r2u + INNER JOIN wcf1_user u ON r2u.userID = u.userID WHERE r2u.active = ? ORDER BY u.username ASC"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ 1 ]); self::$userToRoom = $statement->fetchMap('roomID', 'userID', false); diff --git a/files/lib/data/room/RoomAction.class.php b/files/lib/data/room/RoomAction.class.php index a4c46f8..19f4343 100644 --- a/files/lib/data/room/RoomAction.class.php +++ b/files/lib/data/room/RoomAction.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -73,8 +73,8 @@ public function join() { try { // Create room_to_user mapping. - $sql = "INSERT INTO chat".WCF_N."_room_to_user (active, roomID, userID) VALUES (?, ?, ?)"; - $statement = WCF::getDB()->prepareStatement($sql); + $sql = "INSERT INTO chat1_room_to_user (active, roomID, userID) VALUES (?, ?, ?)"; + $statement = WCF::getDB()->prepare($sql); $statement->execute([ 0, $room->roomID, $user->userID ]); } catch (\wcf\system\database\exception\DatabaseException $e) { @@ -83,8 +83,8 @@ public function join() { } try { - $sql = "INSERT INTO chat".WCF_N."_session (roomID, userID, sessionID, lastRequest) VALUES (?, ?, ?, ?)"; - $statement = WCF::getDB()->prepareStatement($sql); + $sql = "INSERT INTO chat1_session (roomID, userID, sessionID, lastRequest) VALUES (?, ?, ?, ?)"; + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $room->roomID, $user->userID, $sessionID, TIME_NOW ]); } catch (\wcf\system\database\exception\DatabaseException $e) { @@ -106,8 +106,8 @@ public function join() { } // Attempt to mark the user as active in the room. - $sql = "UPDATE chat".WCF_N."_room_to_user SET active = ? WHERE roomID = ? AND userID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $sql = "UPDATE chat1_room_to_user SET active = ? WHERE roomID = ? AND userID = ?"; + $statement = WCF::getDB()->prepare($sql); $statement->execute([ 1, $room->roomID, $user->userID ]); if ($statement->getAffectedRows() === 0) { // The User already is inside the room: Nothing to do here. @@ -115,8 +115,8 @@ public function join() { } // Update lastPull. This must not be merged into the above query, because of the 'getAffectedRows' check. - $sql = "UPDATE chat".WCF_N."_room_to_user SET lastPull = ? WHERE roomID = ? AND userID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $sql = "UPDATE chat1_room_to_user SET lastPull = ? WHERE roomID = ? AND userID = ?"; + $statement = WCF::getDB()->prepare($sql); $statement->execute([ TIME_NOW, $room->roomID, $user->userID ]); (new MessageAction([ ], 'create', [ 'data' => [ 'roomID' => $room->roomID @@ -179,9 +179,9 @@ public function leave() { if ($sessionID !== null) { $condition->add('sessionID = ?', [ $sessionID ]); } - $sql = "DELETE FROM chat".WCF_N."_session + $sql = "DELETE FROM chat1_session ".$condition; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute($condition->getParameters()); if ($statement->getAffectedRows() === 0) { throw new UserInputException('sessionID'); @@ -193,18 +193,18 @@ public function leave() { // Check whether we deleted the last session. $sql = "SELECT COUNT(*) - FROM chat".WCF_N."_session + FROM chat1_session WHERE roomID = ? AND userID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $room->roomID, $user->userID ]); // We did not: Nothing to do here. if ($statement->fetchColumn()) return; // Mark the user as inactive. - $sql = "UPDATE chat".WCF_N."_room_to_user SET active = ? WHERE roomID = ? AND userID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $sql = "UPDATE chat1_room_to_user SET active = ? WHERE roomID = ? AND userID = ?"; + $statement = WCF::getDB()->prepare($sql); $statement->execute([ 0, $room->roomID, $user->userID ]); if ($statement->getAffectedRows() === 0) throw new \LogicException('Unreachable'); diff --git a/files/lib/data/user/User.class.php b/files/lib/data/user/User.class.php index a695a42..303974d 100644 --- a/files/lib/data/user/User.class.php +++ b/files/lib/data/user/User.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -40,9 +40,9 @@ class User extends \wcf\data\DatabaseObjectDecorator implements \JsonSerializabl public function getRoomAssociations($skipCache = false) { if ($this->roomToUser === null || $skipCache) { $sql = "SELECT * - FROM chat".WCF_N."_room_to_user + FROM chat1_room_to_user WHERE userID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $this->userID ]); $this->roomToUser = [ ]; while (($row = $statement->fetchArray())) { @@ -86,9 +86,9 @@ public function isInRoom(\chat\data\room\Room $room, $skipCache = false) { */ public static function getDeadSessions() { $sql = "SELECT userID, roomID, sessionID - FROM chat".WCF_N."_session + FROM chat1_session WHERE lastRequest < ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ TIME_NOW - 60 * 3 ]); return $statement->fetchAll(\PDO::FETCH_ASSOC); diff --git a/files/lib/page/LogPage.class.php b/files/lib/page/LogPage.class.php index c51b4f0..7e2db67 100644 --- a/files/lib/page/LogPage.class.php +++ b/files/lib/page/LogPage.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -113,10 +113,10 @@ public function readData() { } $sql = "SELECT messageID - FROM chat".WCF_N."_message + FROM chat1_message ".$condition." ORDER BY messageID ASC"; - $statement = WCF::getDB()->prepareStatement($sql, 20); + $statement = WCF::getDB()->prepare($sql, 20); $statement->execute($condition->getParameters()); $messageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN); diff --git a/files/lib/page/RoomPage.class.php b/files/lib/page/RoomPage.class.php index ec65ef0..efc3828 100644 --- a/files/lib/page/RoomPage.class.php +++ b/files/lib/page/RoomPage.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -75,8 +75,8 @@ public function checkPermissions() { $package = \wcf\data\package\PackageCache::getInstance()->getPackageByIdentifier('be.bastelstu.chat'); if (stripos($package->packageVersion, 'Alpha') !== false) { - $sql = "SELECT COUNT(*) FROM wcf".WCF_N."_user"; - $statement = WCF::getDB()->prepareStatement($sql); + $sql = "SELECT COUNT(*) FROM wcf1_user"; + $statement = WCF::getDB()->prepare($sql); $statement->execute(); $userCount = $statement->fetchSingleColumn(); if ((($userCount > 5 && !OFFLINE) || ($userCount > 30 && OFFLINE)) && sha1(WCF_UUID) !== '643a6b3af2a6ea3d393c4d8371e75d7d1b66e0d0') { @@ -90,7 +90,7 @@ public function checkPermissions() { */ public function readData() { $sql = "SELECT 1"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute(); if ($statement->fetchSingleColumn() !== 1) { throw new NamedUserException('PHP must be configured to use the MySQLnd driver, instead of libmysqlclient.'); diff --git a/files/lib/system/cache/builder/CommandCacheBuilder.class.php b/files/lib/system/cache/builder/CommandCacheBuilder.class.php index 9a2e5af..eb07a26 100644 --- a/files/lib/system/cache/builder/CommandCacheBuilder.class.php +++ b/files/lib/system/cache/builder/CommandCacheBuilder.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -41,8 +41,8 @@ public function rebuild(array $parameters) { } $sql = "SELECT * - FROM chat".WCF_N."_command_trigger"; - $statement = WCF::getDB()->prepareStatement($sql); + FROM chat1_command_trigger"; + $statement = WCF::getDB()->prepare($sql); $statement->execute(); $data['triggers'] = $statement->fetchMap('commandTrigger', 'commandID'); diff --git a/files/lib/system/cache/builder/PermissionCacheBuilder.class.php b/files/lib/system/cache/builder/PermissionCacheBuilder.class.php index 43eaa84..5866328 100644 --- a/files/lib/system/cache/builder/PermissionCacheBuilder.class.php +++ b/files/lib/system/cache/builder/PermissionCacheBuilder.class.php @@ -40,11 +40,11 @@ public function rebuild(array $parameters) { $sql = "SELECT option_to_group.objectID AS roomID, option_to_group.optionValue, acl_option.optionName AS permission - FROM wcf".WCF_N."_acl_option acl_option - INNER JOIN wcf".WCF_N."_acl_option_to_group option_to_group + FROM wcf1_acl_option acl_option + INNER JOIN wcf1_acl_option_to_group option_to_group ON option_to_group.optionID = acl_option.optionID ".$conditionBuilder; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute($conditionBuilder->getParameters()); while (($row = $statement->fetchArray())) { if (!isset($data[$row['roomID']][$row['permission']])) { diff --git a/files/lib/system/command/TemproomCommand.class.php b/files/lib/system/command/TemproomCommand.class.php index 02e539b..e20f5b4 100644 --- a/files/lib/system/command/TemproomCommand.class.php +++ b/files/lib/system/command/TemproomCommand.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -96,10 +96,10 @@ public function execute($parameters, Room $room, UserProfile $user = null) { $recipient = $this->getUser($this->assertParameter($parameters, 'username')); WCF::getDB()->beginTransaction(); try { - $sql = "INSERT INTO chat".WCF_N."_room_temporary_invite + $sql = "INSERT INTO chat1_room_temporary_invite (userID, roomID) VALUES (?, ?)"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $recipient->userID, $room->roomID ]); } catch (\wcf\system\database\DatabaseException $e) { diff --git a/files/lib/system/event/listener/HourlyCleanUpCronjobExecuteChatCleanUpListener.class.php b/files/lib/system/event/listener/HourlyCleanUpCronjobExecuteChatCleanUpListener.class.php index 3c6ef83..3fc240f 100644 --- a/files/lib/system/event/listener/HourlyCleanUpCronjobExecuteChatCleanUpListener.class.php +++ b/files/lib/system/event/listener/HourlyCleanUpCronjobExecuteChatCleanUpListener.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -27,11 +27,11 @@ public function execute($eventObj, $className, $eventName, array &$parameters) { (new \chat\data\message\MessageAction([ ], 'prune'))->executeAction(); (new \chat\data\user\UserAction([], 'clearDeadSessions'))->executeAction(); - $sql = "UPDATE chat".WCF_N."_room_to_user + $sql = "UPDATE chat1_room_to_user SET active = ? - WHERE (roomID, userID) NOT IN (SELECT roomID, userID FROM chat".WCF_N."_session) + WHERE (roomID, userID) NOT IN (SELECT roomID, userID FROM chat1_session) AND active = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ 0, 1 ]); if ($statement->getAffectedRows()) { \wcf\functions\exception\logThrowable(new \Exception('Unreachable')); diff --git a/files/lib/system/event/listener/RoomCanSeeTemproomListener.class.php b/files/lib/system/event/listener/RoomCanSeeTemproomListener.class.php index 1704645..cedfd65 100644 --- a/files/lib/system/event/listener/RoomCanSeeTemproomListener.class.php +++ b/files/lib/system/event/listener/RoomCanSeeTemproomListener.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 3 @@ -32,10 +32,10 @@ public function execute($eventObj, $className, $eventName, array &$parameters) { if ($eventObj->ownerID === $user->userID) return; $sql = "SELECT COUNT(*) - FROM chat".WCF_N."_room_temporary_invite + FROM chat1_room_temporary_invite WHERE userID = ? AND roomID = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ $user->userID, $eventObj->roomID ]); if ($statement->fetchSingleColumn() > 0) return; diff --git a/files/lib/system/page/handler/TRoomPageHandler.class.php b/files/lib/system/page/handler/TRoomPageHandler.class.php index ba69430..e1bac8c 100644 --- a/files/lib/system/page/handler/TRoomPageHandler.class.php +++ b/files/lib/system/page/handler/TRoomPageHandler.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -37,17 +37,17 @@ public function isValid($objectID) { */ public function lookup($searchString) { $sql = "(SELECT ('chat.room.room' || roomID || '.title') AS languageItem - FROM chat".WCF_N."_room + FROM chat1_room WHERE title LIKE ? ) UNION (SELECT languageItem - FROM wcf".WCF_N."_language_item + FROM wcf1_language_item WHERE languageItemValue LIKE ? AND languageItem LIKE ? AND languageID = ? )"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute([ '%'.$searchString.'%' , '%'.$searchString.'%' , 'chat.room.room%.title' diff --git a/files/lib/system/permission/PermissionHandler.class.php b/files/lib/system/permission/PermissionHandler.class.php index f1d5d4b..6529fa2 100644 --- a/files/lib/system/permission/PermissionHandler.class.php +++ b/files/lib/system/permission/PermissionHandler.class.php @@ -69,11 +69,11 @@ public function __construct(\wcf\data\user\UserProfile $user = null) { $sql = "SELECT option_to_user.objectID AS roomID, option_to_user.optionValue, acl_option.optionName AS permission - FROM wcf".WCF_N."_acl_option acl_option - INNER JOIN wcf".WCF_N."_acl_option_to_user option_to_user + FROM wcf1_acl_option acl_option + INNER JOIN wcf1_acl_option_to_user option_to_user ON option_to_user.optionID = acl_option.optionID ".$conditionBuilder; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); $statement->execute($conditionBuilder->getParameters()); while (($row = $statement->fetchArray())) { $userPermissions[$row['roomID']][$row['permission']] = $row['optionValue']; diff --git a/files_wcf/lib/system/package/plugin/ChatCommandPackageInstallationPlugin.class.php b/files_wcf/lib/system/package/plugin/ChatCommandPackageInstallationPlugin.class.php index e5cfd69..d1b235f 100644 --- a/files_wcf/lib/system/package/plugin/ChatCommandPackageInstallationPlugin.class.php +++ b/files_wcf/lib/system/package/plugin/ChatCommandPackageInstallationPlugin.class.php @@ -5,7 +5,7 @@ * Use of this software is governed by the Business Source License * included in the LICENSE file. * - * Change Date: 2025-03-05 + * Change Date: 2026-03-04 * * On the date above, in accordance with the Business Source * License, use of this software will be governed by version 2 @@ -46,7 +46,7 @@ protected function handleDelete(array $items) { $sql = "DELETE FROM ".$this->application.WCF_N."_".$this->tableName." WHERE packageID = ? AND identifier = ?"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); WCF::getDB()->beginTransaction(); foreach ($items as $item) { @@ -134,7 +134,7 @@ protected function import(array $row, array $data) { // import initial triggers $sql = "INSERT INTO ".$this->application.WCF_N."_command_trigger (commandTrigger, commandID) VALUES (?, ?)"; - $statement = WCF::getDB()->prepareStatement($sql); + $statement = WCF::getDB()->prepare($sql); try { WCF::getDB()->beginTransaction();