mirror of
https://github.com/wbbaddons/Tims-Chat.git
synced 2024-10-31 14:10:08 +00:00
Fixed errors originating from WoltLab/WCF@92b007d51d
This commit is contained in:
parent
335fa0ea7a
commit
2ad6fb2dc9
@ -63,7 +63,7 @@ public function save() {
|
|||||||
|
|
||||||
$this->title = 'wcf.chat.room.title'.$this->roomObj->roomID;
|
$this->title = 'wcf.chat.room.title'.$this->roomObj->roomID;
|
||||||
if (I18nHandler::getInstance()->isPlainValue('title')) {
|
if (I18nHandler::getInstance()->isPlainValue('title')) {
|
||||||
I18nHandler::getInstance()->remove($this->title, \wcf\util\ChatUtil::getPackageID());
|
I18nHandler::getInstance()->remove($this->title);
|
||||||
$this->title = I18nHandler::getInstance()->getValue('title');
|
$this->title = I18nHandler::getInstance()->getValue('title');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -72,7 +72,7 @@ public function save() {
|
|||||||
|
|
||||||
$this->topic = 'wcf.chat.room.topic'.$this->roomObj->roomID;
|
$this->topic = 'wcf.chat.room.topic'.$this->roomObj->roomID;
|
||||||
if (I18nHandler::getInstance()->isPlainValue('topic')) {
|
if (I18nHandler::getInstance()->isPlainValue('topic')) {
|
||||||
I18nHandler::getInstance()->remove($this->topic, \wcf\util\ChatUtil::getPackageID());
|
I18nHandler::getInstance()->remove($this->topic);
|
||||||
$this->topic = I18nHandler::getInstance()->getValue('topic');
|
$this->topic = I18nHandler::getInstance()->getValue('topic');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -110,10 +110,9 @@ public function countUsers() {
|
|||||||
wcf".WCF_N."_user_storage
|
wcf".WCF_N."_user_storage
|
||||||
WHERE
|
WHERE
|
||||||
field = ?
|
field = ?
|
||||||
AND packageID = ?
|
|
||||||
AND fieldValue = ?";
|
AND fieldValue = ?";
|
||||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||||
$stmt->execute(array('roomID', \wcf\util\ChatUtil::getPackageID(), $this->roomID));
|
$stmt->execute(array('roomID', $this->roomID));
|
||||||
|
|
||||||
return $stmt->fetchColumn();
|
return $stmt->fetchColumn();
|
||||||
}
|
}
|
||||||
@ -158,18 +157,15 @@ public function getTitle() {
|
|||||||
* @return array<\wcf\data\user\User>
|
* @return array<\wcf\data\user\User>
|
||||||
*/
|
*/
|
||||||
public function getUsers() {
|
public function getUsers() {
|
||||||
$packageID = \wcf\util\ChatUtil::getPackageID();
|
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
userID
|
userID
|
||||||
FROM
|
FROM
|
||||||
wcf".WCF_N."_user_storage
|
wcf".WCF_N."_user_storage
|
||||||
WHERE
|
WHERE
|
||||||
field = ?
|
field = ?
|
||||||
AND packageID = ?
|
|
||||||
AND fieldValue = ?";
|
AND fieldValue = ?";
|
||||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||||
$stmt->execute(array('roomID', $packageID, $this->roomID));
|
$stmt->execute(array('roomID', $this->roomID));
|
||||||
$userIDs = array();
|
$userIDs = array();
|
||||||
while ($userIDs[] = $stmt->fetchColumn());
|
while ($userIDs[] = $stmt->fetchColumn());
|
||||||
|
|
||||||
@ -184,15 +180,14 @@ public function getUsers() {
|
|||||||
wcf".WCF_N."_user_storage st
|
wcf".WCF_N."_user_storage st
|
||||||
ON (
|
ON (
|
||||||
u.userID = st.userID
|
u.userID = st.userID
|
||||||
AND st.field = ?
|
AND st.field = ?
|
||||||
AND st.packageID = ?
|
|
||||||
)
|
)
|
||||||
WHERE
|
WHERE
|
||||||
u.userID IN (".rtrim(str_repeat('?,', count($userIDs)), ',').")
|
u.userID IN (".rtrim(str_repeat('?,', count($userIDs)), ',').")
|
||||||
ORDER BY
|
ORDER BY
|
||||||
u.username ASC";
|
u.username ASC";
|
||||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||||
array_unshift($userIDs, 'away', $packageID);
|
array_unshift($userIDs, 'away');
|
||||||
$stmt->execute($userIDs);
|
$stmt->execute($userIDs);
|
||||||
|
|
||||||
return $stmt->fetchObjects('\wcf\data\user\User');
|
return $stmt->fetchObjects('\wcf\data\user\User');
|
||||||
|
@ -65,12 +65,11 @@ public function prune() {
|
|||||||
FROM
|
FROM
|
||||||
wcf".WCF_N."_user_storage
|
wcf".WCF_N."_user_storage
|
||||||
WHERE
|
WHERE
|
||||||
packageID = ?
|
|
||||||
AND field = ?
|
AND field = ?
|
||||||
AND fieldValue IS NOT NULL
|
AND fieldValue IS NOT NULL
|
||||||
)";
|
)";
|
||||||
$stmt = \wcf\system\WCF::getDB()->prepareStatement($sql);
|
$stmt = \wcf\system\WCF::getDB()->prepareStatement($sql);
|
||||||
$stmt->execute(array(0, \wcf\util\ChatUtil::getPackageID(), 'roomID'));
|
$stmt->execute(array(0, 'roomID'));
|
||||||
$objectIDs = array();
|
$objectIDs = array();
|
||||||
|
|
||||||
while ($objectIDs[] = $stmt->fetchColumn());
|
while ($objectIDs[] = $stmt->fetchColumn());
|
||||||
|
@ -22,12 +22,10 @@ class ChatRoomEditor extends \wcf\data\DatabaseObjectEditor implements \wcf\data
|
|||||||
* @see \wcf\data\DatabaseObjectEditor::deleteAll()
|
* @see \wcf\data\DatabaseObjectEditor::deleteAll()
|
||||||
*/
|
*/
|
||||||
public static function deleteAll(array $objectIDs = array()) {
|
public static function deleteAll(array $objectIDs = array()) {
|
||||||
$packageID = \wcf\util\ChatUtil::getPackageID();
|
|
||||||
|
|
||||||
WCF::getDB()->beginTransaction();
|
WCF::getDB()->beginTransaction();
|
||||||
foreach ($objectIDs as $objectID) {
|
foreach ($objectIDs as $objectID) {
|
||||||
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.title'.$objectID, $packageID);
|
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.title'.$objectID);
|
||||||
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.topic'.$objectID, $packageID);
|
\wcf\system\language\I18nHandler::getInstance()->remove('wcf.chat.room.topic'.$objectID);
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT
|
$sql = "SELECT
|
||||||
|
@ -21,9 +21,8 @@ class ChatSuspensionEditor extends \wcf\data\DatabaseObjectEditor implements \wc
|
|||||||
* Clears the suspension cache.
|
* Clears the suspension cache.
|
||||||
*/
|
*/
|
||||||
public static function resetCache() {
|
public static function resetCache() {
|
||||||
$packageID = \wcf\util\ChatUtil::getPackageID();
|
|
||||||
$ush = \wcf\system\user\storage\UserStorageHandler::getInstance();
|
$ush = \wcf\system\user\storage\UserStorageHandler::getInstance();
|
||||||
|
|
||||||
$ush->resetAll('suspensions', $packageID);
|
$ush->resetAll('suspensions');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,6 @@ final class ChatUtil {
|
|||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public static function getDiedUsers() {
|
public static function getDiedUsers() {
|
||||||
$packageID = self::getPackageID();
|
|
||||||
if (self::nodePushRunning()) {
|
if (self::nodePushRunning()) {
|
||||||
$time = TIME_NOW - 120;
|
$time = TIME_NOW - 120;
|
||||||
}
|
}
|
||||||
@ -66,17 +65,15 @@ public static function getDiedUsers() {
|
|||||||
wcf".WCF_N."_user_storage a
|
wcf".WCF_N."_user_storage a
|
||||||
ON a.userID = r.userID
|
ON a.userID = r.userID
|
||||||
AND a.field = ?
|
AND a.field = ?
|
||||||
AND a.packageID = ?
|
|
||||||
WHERE
|
WHERE
|
||||||
r.field = ?
|
r.field = ?
|
||||||
AND r.packageID = ?
|
|
||||||
AND r.fieldValue IS NOT NULL
|
AND r.fieldValue IS NOT NULL
|
||||||
AND (
|
AND (
|
||||||
a.fieldValue < ?
|
a.fieldValue < ?
|
||||||
OR a.fieldValue IS NULL
|
OR a.fieldValue IS NULL
|
||||||
)";
|
)";
|
||||||
$stmt = WCF::getDB()->prepareStatement($sql);
|
$stmt = WCF::getDB()->prepareStatement($sql);
|
||||||
$stmt->execute(array('lastActivity', $packageID, 'roomID', $packageID, $time - 30));
|
$stmt->execute(array('lastActivity', 'roomID', $time - 30));
|
||||||
$users = array();
|
$users = array();
|
||||||
while ($users[] = $stmt->fetchArray());
|
while ($users[] = $stmt->fetchArray());
|
||||||
|
|
||||||
@ -152,11 +149,10 @@ public static function nodePushRunning() {
|
|||||||
public static function readUserData($field, \wcf\data\user\User $user = null) {
|
public static function readUserData($field, \wcf\data\user\User $user = null) {
|
||||||
if ($user === null) $user = WCF::getUser();
|
if ($user === null) $user = WCF::getUser();
|
||||||
$ush = UserStorageHandler::getInstance();
|
$ush = UserStorageHandler::getInstance();
|
||||||
$packageID = self::getPackageID();
|
|
||||||
|
|
||||||
// load storage
|
// load storage
|
||||||
$ush->loadStorage(array($user->userID), $packageID);
|
$ush->loadStorage(array($user->userID));
|
||||||
$data = $ush->getStorage(array($user->userID), $field, $packageID);
|
$data = $ush->getStorage(array($user->userID), $field);
|
||||||
|
|
||||||
if ($data[$user->userID] === null) {
|
if ($data[$user->userID] === null) {
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
@ -254,10 +250,9 @@ public static function timeModifier($time) {
|
|||||||
public static function writeUserData(array $data, \wcf\data\user\User $user = null) {
|
public static function writeUserData(array $data, \wcf\data\user\User $user = null) {
|
||||||
if ($user === null) $user = WCF::getUser();
|
if ($user === null) $user = WCF::getUser();
|
||||||
$ush = UserStorageHandler::getInstance();
|
$ush = UserStorageHandler::getInstance();
|
||||||
$packageID = self::getPackageID();
|
|
||||||
|
|
||||||
foreach ($data as $key => $value) {
|
foreach ($data as $key => $value) {
|
||||||
$ush->update($user->userID, $key, (isset(static::$serialize[$key])) ? serialize($value) : $value, $packageID);
|
$ush->update($user->userID, $key, (isset(static::$serialize[$key])) ? serialize($value) : $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user