mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-12-21 21:30:08 +00:00
Use ->prepare()
in favor of ->prepareStatement()
This commit is contained in:
parent
f1fdf31ccd
commit
27213e507f
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* License, use of this software will be governed by version 2
|
||||||
@ -42,9 +42,9 @@ public function hasTriggers() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT COUNT(*)
|
$sql = "SELECT COUNT(*)
|
||||||
FROM chat".WCF_N."_command_trigger
|
FROM chat1_command_trigger
|
||||||
WHERE commandID = ?";
|
WHERE commandID = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ $this->commandID ]);
|
$statement->execute([ $this->commandID ]);
|
||||||
return $statement->fetchSingleColumn() > 0;
|
return $statement->fetchSingleColumn() > 0;
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* License, use of this software will be governed by version 2
|
||||||
@ -42,9 +42,9 @@ public function getObjectID() {
|
|||||||
*/
|
*/
|
||||||
public static function getTriggerByName($name) {
|
public static function getTriggerByName($name) {
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM chat".WCF_N."_command_trigger
|
FROM chat1_command_trigger
|
||||||
WHERE commandTrigger = ?";
|
WHERE commandTrigger = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ $name ]);
|
$statement->execute([ $name ]);
|
||||||
$row = $statement->fetchArray();
|
$row = $statement->fetchArray();
|
||||||
if (!$row) $row = [];
|
if (!$row) $row = [];
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* License, use of this software will be governed by version 2
|
||||||
@ -34,8 +34,8 @@ public function create() {
|
|||||||
$message = parent::create();
|
$message = parent::create();
|
||||||
|
|
||||||
if (isset($this->parameters['updateTimestamp']) && $this->parameters['updateTimestamp']) {
|
if (isset($this->parameters['updateTimestamp']) && $this->parameters['updateTimestamp']) {
|
||||||
$sql = "UPDATE chat".WCF_N."_room_to_user SET lastPush = ? WHERE roomID = ? AND userID = ?";
|
$sql = "UPDATE chat1_room_to_user SET lastPush = ? WHERE roomID = ? AND userID = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ TIME_NOW, $message->roomID, $message->userID ]);
|
$statement->execute([ TIME_NOW, $message->roomID, $message->userID ]);
|
||||||
}
|
}
|
||||||
if (isset($this->parameters['grantPoints']) && $this->parameters['grantPoints']) {
|
if (isset($this->parameters['grantPoints']) && $this->parameters['grantPoints']) {
|
||||||
@ -128,9 +128,9 @@ public function prune() {
|
|||||||
if (!CHAT_LOG_ARCHIVETIME) return;
|
if (!CHAT_LOG_ARCHIVETIME) return;
|
||||||
|
|
||||||
$sql = "SELECT messageID
|
$sql = "SELECT messageID
|
||||||
FROM chat".WCF_N."_message
|
FROM chat1_message
|
||||||
WHERE time < ?";
|
WHERE time < ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ TIME_NOW - CHAT_LOG_ARCHIVETIME * 86400 ]);
|
$statement->execute([ TIME_NOW - CHAT_LOG_ARCHIVETIME * 86400 ]);
|
||||||
$messageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
|
$messageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
|
||||||
|
|
||||||
@ -179,22 +179,22 @@ public function pull() {
|
|||||||
|
|
||||||
WCF::getDB()->beginTransaction();
|
WCF::getDB()->beginTransaction();
|
||||||
// update timestamp
|
// update timestamp
|
||||||
$sql = "UPDATE chat".WCF_N."_room_to_user
|
$sql = "UPDATE chat1_room_to_user
|
||||||
SET lastPull = ?
|
SET lastPull = ?
|
||||||
WHERE roomID = ?
|
WHERE roomID = ?
|
||||||
AND userID = ?";
|
AND userID = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ TIME_NOW
|
$statement->execute([ TIME_NOW
|
||||||
, $room->roomID
|
, $room->roomID
|
||||||
, WCF::getUser()->userID
|
, WCF::getUser()->userID
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$sql = "UPDATE chat".WCF_N."_session
|
$sql = "UPDATE chat1_session
|
||||||
SET lastRequest = ?
|
SET lastRequest = ?
|
||||||
WHERE roomID = ?
|
WHERE roomID = ?
|
||||||
AND userID = ?
|
AND userID = ?
|
||||||
AND sessionID = ?";
|
AND sessionID = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ TIME_NOW
|
$statement->execute([ TIME_NOW
|
||||||
, $room->roomID
|
, $room->roomID
|
||||||
, WCF::getUser()->userID
|
, WCF::getUser()->userID
|
||||||
@ -226,10 +226,10 @@ public function pull() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT messageID
|
$sql = "SELECT messageID
|
||||||
FROM chat".WCF_N."_message
|
FROM chat1_message
|
||||||
".$condition."
|
".$condition."
|
||||||
ORDER BY messageID ".$sortOrder;
|
ORDER BY messageID ".$sortOrder;
|
||||||
$statement = WCF::getDB()->prepareStatement($sql, 20);
|
$statement = WCF::getDB()->prepare($sql, 20);
|
||||||
$statement->execute($condition->getParameters());
|
$statement->execute($condition->getParameters());
|
||||||
$messageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
|
$messageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* License, use of this software will be governed by version 2
|
||||||
@ -212,12 +212,12 @@ public function getTopic() {
|
|||||||
public function getUsers() {
|
public function getUsers() {
|
||||||
if (self::$userToRoom === null) {
|
if (self::$userToRoom === null) {
|
||||||
$sql = "SELECT r2u.userID, r2u.roomID
|
$sql = "SELECT r2u.userID, r2u.roomID
|
||||||
FROM chat".WCF_N."_room_to_user r2u
|
FROM chat1_room_to_user r2u
|
||||||
INNER JOIN wcf".WCF_N."_user u
|
INNER JOIN wcf1_user u
|
||||||
ON r2u.userID = u.userID
|
ON r2u.userID = u.userID
|
||||||
WHERE r2u.active = ?
|
WHERE r2u.active = ?
|
||||||
ORDER BY u.username ASC";
|
ORDER BY u.username ASC";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ 1 ]);
|
$statement->execute([ 1 ]);
|
||||||
self::$userToRoom = $statement->fetchMap('roomID', 'userID', false);
|
self::$userToRoom = $statement->fetchMap('roomID', 'userID', false);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* License, use of this software will be governed by version 2
|
||||||
@ -73,8 +73,8 @@ public function join() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
// Create room_to_user mapping.
|
// Create room_to_user mapping.
|
||||||
$sql = "INSERT INTO chat".WCF_N."_room_to_user (active, roomID, userID) VALUES (?, ?, ?)";
|
$sql = "INSERT INTO chat1_room_to_user (active, roomID, userID) VALUES (?, ?, ?)";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ 0, $room->roomID, $user->userID ]);
|
$statement->execute([ 0, $room->roomID, $user->userID ]);
|
||||||
}
|
}
|
||||||
catch (\wcf\system\database\exception\DatabaseException $e) {
|
catch (\wcf\system\database\exception\DatabaseException $e) {
|
||||||
@ -83,8 +83,8 @@ public function join() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$sql = "INSERT INTO chat".WCF_N."_session (roomID, userID, sessionID, lastRequest) VALUES (?, ?, ?, ?)";
|
$sql = "INSERT INTO chat1_session (roomID, userID, sessionID, lastRequest) VALUES (?, ?, ?, ?)";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ $room->roomID, $user->userID, $sessionID, TIME_NOW ]);
|
$statement->execute([ $room->roomID, $user->userID, $sessionID, TIME_NOW ]);
|
||||||
}
|
}
|
||||||
catch (\wcf\system\database\exception\DatabaseException $e) {
|
catch (\wcf\system\database\exception\DatabaseException $e) {
|
||||||
@ -106,8 +106,8 @@ public function join() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Attempt to mark the user as active in the room.
|
// Attempt to mark the user as active in the room.
|
||||||
$sql = "UPDATE chat".WCF_N."_room_to_user SET active = ? WHERE roomID = ? AND userID = ?";
|
$sql = "UPDATE chat1_room_to_user SET active = ? WHERE roomID = ? AND userID = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ 1, $room->roomID, $user->userID ]);
|
$statement->execute([ 1, $room->roomID, $user->userID ]);
|
||||||
if ($statement->getAffectedRows() === 0) {
|
if ($statement->getAffectedRows() === 0) {
|
||||||
// The User already is inside the room: Nothing to do here.
|
// 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.
|
// 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 = ?";
|
$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, $user->userID ]);
|
$statement->execute([ TIME_NOW, $room->roomID, $user->userID ]);
|
||||||
|
|
||||||
(new MessageAction([ ], 'create', [ 'data' => [ 'roomID' => $room->roomID
|
(new MessageAction([ ], 'create', [ 'data' => [ 'roomID' => $room->roomID
|
||||||
@ -179,9 +179,9 @@ public function leave() {
|
|||||||
if ($sessionID !== null) {
|
if ($sessionID !== null) {
|
||||||
$condition->add('sessionID = ?', [ $sessionID ]);
|
$condition->add('sessionID = ?', [ $sessionID ]);
|
||||||
}
|
}
|
||||||
$sql = "DELETE FROM chat".WCF_N."_session
|
$sql = "DELETE FROM chat1_session
|
||||||
".$condition;
|
".$condition;
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute($condition->getParameters());
|
$statement->execute($condition->getParameters());
|
||||||
if ($statement->getAffectedRows() === 0) {
|
if ($statement->getAffectedRows() === 0) {
|
||||||
throw new UserInputException('sessionID');
|
throw new UserInputException('sessionID');
|
||||||
@ -193,18 +193,18 @@ public function leave() {
|
|||||||
|
|
||||||
// Check whether we deleted the last session.
|
// Check whether we deleted the last session.
|
||||||
$sql = "SELECT COUNT(*)
|
$sql = "SELECT COUNT(*)
|
||||||
FROM chat".WCF_N."_session
|
FROM chat1_session
|
||||||
WHERE roomID = ?
|
WHERE roomID = ?
|
||||||
AND userID = ?";
|
AND userID = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ $room->roomID, $user->userID ]);
|
$statement->execute([ $room->roomID, $user->userID ]);
|
||||||
|
|
||||||
// We did not: Nothing to do here.
|
// We did not: Nothing to do here.
|
||||||
if ($statement->fetchColumn()) return;
|
if ($statement->fetchColumn()) return;
|
||||||
|
|
||||||
// Mark the user as inactive.
|
// Mark the user as inactive.
|
||||||
$sql = "UPDATE chat".WCF_N."_room_to_user SET active = ? WHERE roomID = ? AND userID = ?";
|
$sql = "UPDATE chat1_room_to_user SET active = ? WHERE roomID = ? AND userID = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ 0, $room->roomID, $user->userID ]);
|
$statement->execute([ 0, $room->roomID, $user->userID ]);
|
||||||
if ($statement->getAffectedRows() === 0) throw new \LogicException('Unreachable');
|
if ($statement->getAffectedRows() === 0) throw new \LogicException('Unreachable');
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* 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) {
|
public function getRoomAssociations($skipCache = false) {
|
||||||
if ($this->roomToUser === null || $skipCache) {
|
if ($this->roomToUser === null || $skipCache) {
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM chat".WCF_N."_room_to_user
|
FROM chat1_room_to_user
|
||||||
WHERE userID = ?";
|
WHERE userID = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ $this->userID ]);
|
$statement->execute([ $this->userID ]);
|
||||||
$this->roomToUser = [ ];
|
$this->roomToUser = [ ];
|
||||||
while (($row = $statement->fetchArray())) {
|
while (($row = $statement->fetchArray())) {
|
||||||
@ -86,9 +86,9 @@ public function isInRoom(\chat\data\room\Room $room, $skipCache = false) {
|
|||||||
*/
|
*/
|
||||||
public static function getDeadSessions() {
|
public static function getDeadSessions() {
|
||||||
$sql = "SELECT userID, roomID, sessionID
|
$sql = "SELECT userID, roomID, sessionID
|
||||||
FROM chat".WCF_N."_session
|
FROM chat1_session
|
||||||
WHERE lastRequest < ?";
|
WHERE lastRequest < ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ TIME_NOW - 60 * 3 ]);
|
$statement->execute([ TIME_NOW - 60 * 3 ]);
|
||||||
|
|
||||||
return $statement->fetchAll(\PDO::FETCH_ASSOC);
|
return $statement->fetchAll(\PDO::FETCH_ASSOC);
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* License, use of this software will be governed by version 2
|
||||||
@ -113,10 +113,10 @@ public function readData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT messageID
|
$sql = "SELECT messageID
|
||||||
FROM chat".WCF_N."_message
|
FROM chat1_message
|
||||||
".$condition."
|
".$condition."
|
||||||
ORDER BY messageID ASC";
|
ORDER BY messageID ASC";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql, 20);
|
$statement = WCF::getDB()->prepare($sql, 20);
|
||||||
$statement->execute($condition->getParameters());
|
$statement->execute($condition->getParameters());
|
||||||
$messageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
|
$messageIDs = $statement->fetchAll(\PDO::FETCH_COLUMN);
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* 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');
|
$package = \wcf\data\package\PackageCache::getInstance()->getPackageByIdentifier('be.bastelstu.chat');
|
||||||
if (stripos($package->packageVersion, 'Alpha') !== false) {
|
if (stripos($package->packageVersion, 'Alpha') !== false) {
|
||||||
$sql = "SELECT COUNT(*) FROM wcf".WCF_N."_user";
|
$sql = "SELECT COUNT(*) FROM wcf1_user";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
$userCount = $statement->fetchSingleColumn();
|
$userCount = $statement->fetchSingleColumn();
|
||||||
if ((($userCount > 5 && !OFFLINE) || ($userCount > 30 && OFFLINE)) && sha1(WCF_UUID) !== '643a6b3af2a6ea3d393c4d8371e75d7d1b66e0d0') {
|
if ((($userCount > 5 && !OFFLINE) || ($userCount > 30 && OFFLINE)) && sha1(WCF_UUID) !== '643a6b3af2a6ea3d393c4d8371e75d7d1b66e0d0') {
|
||||||
@ -90,7 +90,7 @@ public function checkPermissions() {
|
|||||||
*/
|
*/
|
||||||
public function readData() {
|
public function readData() {
|
||||||
$sql = "SELECT 1";
|
$sql = "SELECT 1";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
if ($statement->fetchSingleColumn() !== 1) {
|
if ($statement->fetchSingleColumn() !== 1) {
|
||||||
throw new NamedUserException('PHP must be configured to use the MySQLnd driver, instead of libmysqlclient.');
|
throw new NamedUserException('PHP must be configured to use the MySQLnd driver, instead of libmysqlclient.');
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* License, use of this software will be governed by version 2
|
||||||
@ -41,8 +41,8 @@ public function rebuild(array $parameters) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT *
|
$sql = "SELECT *
|
||||||
FROM chat".WCF_N."_command_trigger";
|
FROM chat1_command_trigger";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute();
|
$statement->execute();
|
||||||
|
|
||||||
$data['triggers'] = $statement->fetchMap('commandTrigger', 'commandID');
|
$data['triggers'] = $statement->fetchMap('commandTrigger', 'commandID');
|
||||||
|
@ -40,11 +40,11 @@ public function rebuild(array $parameters) {
|
|||||||
$sql = "SELECT option_to_group.objectID AS roomID,
|
$sql = "SELECT option_to_group.objectID AS roomID,
|
||||||
option_to_group.optionValue,
|
option_to_group.optionValue,
|
||||||
acl_option.optionName AS permission
|
acl_option.optionName AS permission
|
||||||
FROM wcf".WCF_N."_acl_option acl_option
|
FROM wcf1_acl_option acl_option
|
||||||
INNER JOIN wcf".WCF_N."_acl_option_to_group option_to_group
|
INNER JOIN wcf1_acl_option_to_group option_to_group
|
||||||
ON option_to_group.optionID = acl_option.optionID
|
ON option_to_group.optionID = acl_option.optionID
|
||||||
".$conditionBuilder;
|
".$conditionBuilder;
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute($conditionBuilder->getParameters());
|
$statement->execute($conditionBuilder->getParameters());
|
||||||
while (($row = $statement->fetchArray())) {
|
while (($row = $statement->fetchArray())) {
|
||||||
if (!isset($data[$row['roomID']][$row['permission']])) {
|
if (!isset($data[$row['roomID']][$row['permission']])) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* 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'));
|
$recipient = $this->getUser($this->assertParameter($parameters, 'username'));
|
||||||
WCF::getDB()->beginTransaction();
|
WCF::getDB()->beginTransaction();
|
||||||
try {
|
try {
|
||||||
$sql = "INSERT INTO chat".WCF_N."_room_temporary_invite
|
$sql = "INSERT INTO chat1_room_temporary_invite
|
||||||
(userID, roomID)
|
(userID, roomID)
|
||||||
VALUES (?, ?)";
|
VALUES (?, ?)";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ $recipient->userID, $room->roomID ]);
|
$statement->execute([ $recipient->userID, $room->roomID ]);
|
||||||
}
|
}
|
||||||
catch (\wcf\system\database\DatabaseException $e) {
|
catch (\wcf\system\database\DatabaseException $e) {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* 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\message\MessageAction([ ], 'prune'))->executeAction();
|
||||||
(new \chat\data\user\UserAction([], 'clearDeadSessions'))->executeAction();
|
(new \chat\data\user\UserAction([], 'clearDeadSessions'))->executeAction();
|
||||||
|
|
||||||
$sql = "UPDATE chat".WCF_N."_room_to_user
|
$sql = "UPDATE chat1_room_to_user
|
||||||
SET active = ?
|
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 = ?";
|
AND active = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ 0, 1 ]);
|
$statement->execute([ 0, 1 ]);
|
||||||
if ($statement->getAffectedRows()) {
|
if ($statement->getAffectedRows()) {
|
||||||
\wcf\functions\exception\logThrowable(new \Exception('Unreachable'));
|
\wcf\functions\exception\logThrowable(new \Exception('Unreachable'));
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 3
|
* 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;
|
if ($eventObj->ownerID === $user->userID) return;
|
||||||
|
|
||||||
$sql = "SELECT COUNT(*)
|
$sql = "SELECT COUNT(*)
|
||||||
FROM chat".WCF_N."_room_temporary_invite
|
FROM chat1_room_temporary_invite
|
||||||
WHERE userID = ?
|
WHERE userID = ?
|
||||||
AND roomID = ?";
|
AND roomID = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ $user->userID, $eventObj->roomID ]);
|
$statement->execute([ $user->userID, $eventObj->roomID ]);
|
||||||
if ($statement->fetchSingleColumn() > 0) return;
|
if ($statement->fetchSingleColumn() > 0) return;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* License, use of this software will be governed by version 2
|
||||||
@ -37,17 +37,17 @@ public function isValid($objectID) {
|
|||||||
*/
|
*/
|
||||||
public function lookup($searchString) {
|
public function lookup($searchString) {
|
||||||
$sql = "(SELECT ('chat.room.room' || roomID || '.title') AS languageItem
|
$sql = "(SELECT ('chat.room.room' || roomID || '.title') AS languageItem
|
||||||
FROM chat".WCF_N."_room
|
FROM chat1_room
|
||||||
WHERE title LIKE ?
|
WHERE title LIKE ?
|
||||||
)
|
)
|
||||||
UNION
|
UNION
|
||||||
(SELECT languageItem
|
(SELECT languageItem
|
||||||
FROM wcf".WCF_N."_language_item
|
FROM wcf1_language_item
|
||||||
WHERE languageItemValue LIKE ?
|
WHERE languageItemValue LIKE ?
|
||||||
AND languageItem LIKE ?
|
AND languageItem LIKE ?
|
||||||
AND languageID = ?
|
AND languageID = ?
|
||||||
)";
|
)";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute([ '%'.$searchString.'%'
|
$statement->execute([ '%'.$searchString.'%'
|
||||||
, '%'.$searchString.'%'
|
, '%'.$searchString.'%'
|
||||||
, 'chat.room.room%.title'
|
, 'chat.room.room%.title'
|
||||||
|
@ -69,11 +69,11 @@ public function __construct(\wcf\data\user\UserProfile $user = null) {
|
|||||||
$sql = "SELECT option_to_user.objectID AS roomID,
|
$sql = "SELECT option_to_user.objectID AS roomID,
|
||||||
option_to_user.optionValue,
|
option_to_user.optionValue,
|
||||||
acl_option.optionName AS permission
|
acl_option.optionName AS permission
|
||||||
FROM wcf".WCF_N."_acl_option acl_option
|
FROM wcf1_acl_option acl_option
|
||||||
INNER JOIN wcf".WCF_N."_acl_option_to_user option_to_user
|
INNER JOIN wcf1_acl_option_to_user option_to_user
|
||||||
ON option_to_user.optionID = acl_option.optionID
|
ON option_to_user.optionID = acl_option.optionID
|
||||||
".$conditionBuilder;
|
".$conditionBuilder;
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
$statement->execute($conditionBuilder->getParameters());
|
$statement->execute($conditionBuilder->getParameters());
|
||||||
while (($row = $statement->fetchArray())) {
|
while (($row = $statement->fetchArray())) {
|
||||||
$userPermissions[$row['roomID']][$row['permission']] = $row['optionValue'];
|
$userPermissions[$row['roomID']][$row['permission']] = $row['optionValue'];
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* Use of this software is governed by the Business Source License
|
* Use of this software is governed by the Business Source License
|
||||||
* included in the LICENSE file.
|
* 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
|
* On the date above, in accordance with the Business Source
|
||||||
* License, use of this software will be governed by version 2
|
* 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."
|
$sql = "DELETE FROM ".$this->application.WCF_N."_".$this->tableName."
|
||||||
WHERE packageID = ?
|
WHERE packageID = ?
|
||||||
AND identifier = ?";
|
AND identifier = ?";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
|
|
||||||
WCF::getDB()->beginTransaction();
|
WCF::getDB()->beginTransaction();
|
||||||
foreach ($items as $item) {
|
foreach ($items as $item) {
|
||||||
@ -134,7 +134,7 @@ protected function import(array $row, array $data) {
|
|||||||
// import initial triggers
|
// import initial triggers
|
||||||
$sql = "INSERT INTO ".$this->application.WCF_N."_command_trigger (commandTrigger, commandID)
|
$sql = "INSERT INTO ".$this->application.WCF_N."_command_trigger (commandTrigger, commandID)
|
||||||
VALUES (?, ?)";
|
VALUES (?, ?)";
|
||||||
$statement = WCF::getDB()->prepareStatement($sql);
|
$statement = WCF::getDB()->prepare($sql);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
WCF::getDB()->beginTransaction();
|
WCF::getDB()->beginTransaction();
|
||||||
|
Loading…
Reference in New Issue
Block a user