This commit is contained in:
2023-10-16 16:12:16 +03:00
parent 2abd435798
commit a14232a899
4 changed files with 188 additions and 356 deletions
+81 -233
View File
@@ -4,6 +4,7 @@ if (!defined('GAME_VERSION')) {
require_once '_incl_data/autoload.php';
}
use Clan\ClanInfo;
use Core\Config;
use Core\Database;
use Core\Db;
@@ -146,33 +147,21 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
return $newbuf;
}
$strSearch = [
['\\', '"', "'", '<', '>', ' ', '&gt;', '&lt;', '\r', '\b', ' ', ''],
['::', '[s1;]', '[s2;]', '[s3;]', '[s4;]', ' ',],
];
$strReplace = [
['\\\\', '[s1;]', '[s2;]', '[s3;]', '[s4;]', ' ', '[s4;]', '[s3;]'],
['', '&quot;', '&quot;', '&lt;', '&gt;', ' ',],
];
$_POST['msg'] = $chat->expworld($_POST['msg'], 120);
$_POST['msg'] = str_replace('\\', '\\\\', $_POST['msg']);
$_POST['msg'] = str_replace('"', '[s1;]', $_POST['msg']);
$_POST['msg'] = str_replace("'", '[s2;]', $_POST['msg']);
$_POST['msg'] = str_replace('<', '[s3;]', $_POST['msg']);
$_POST['msg'] = str_replace('>', '[s4;]', $_POST['msg']);
$_POST['msg'] = str_replace(' ', ' ', $_POST['msg']);
$_POST['msg'] = str_replace('&gt;', '[s4;]', $_POST['msg']);
$_POST['msg'] = str_replace('&lt;', '[s3;]', $_POST['msg']);
$_POST['msg'] = str_replace("\r", '[s3;]br[s4;]', $_POST['msg']);
$_POST['msg'] = str_replace("\b", '[s3;]br[s4;]', $_POST['msg']);
$_POST['msg'] = str_replace(" ", '[s3;]TAB[s4;]', $_POST['msg']);
$_POST['msg'] = str_replace("", '[s3;]TAB[s4;]', $_POST['msg']);
$_POST['msg'] = str_replace($strSearch[0], $strReplace[0], $_POST['msg']);
$_POST['msg'] = htmlspecialchars($_POST['msg']);
$_POST['msg'] = str_replace('%usersmile%', '', $_POST['msg']);
$_POST['msg'] = tolink($_POST['msg']);
$_POST['msg'] = str_replace('::', '', $_POST['msg']);
$_POST['msg'] = str_replace('[s1;]', '&quot;', $_POST['msg']);
$_POST['msg'] = str_replace("[s2;]", '&quot;', $_POST['msg']);
$_POST['msg'] = str_replace('[s3;]', '&lt;', $_POST['msg']);
$_POST['msg'] = str_replace('[s4;]', '&gt;', $_POST['msg']);
$_POST['msg'] = str_replace(' ', ' ', $_POST['msg']);
$_POST['msg'] = str_replace($strSearch[1], $strReplace[1], $_POST['msg']);
$smg = Db::getRow('select * from chat where login = ? and time > unix_timestamp() - 20 order by time desc limit 1', [$u->info['login']]);
@@ -208,7 +197,6 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
$cmsg = new ChatMessage();
$cmsg->setInvis($u->info['invis']);
$cmsg->setDa(1);
$cmsg->setCity($u->info['city']);
$cmsg->setType(6);
$cmsg->setColor('#f00');
$cmsg->setText("Я спамер {$u->info['login']} и меня нужно заблокировать " . Config::get('https') . '/info/' . $u->info['id']);
@@ -278,7 +266,8 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
if ($msg['fspam'] != '0') {
$msg['spam'] = 1;
$msg['delete'] = 1;
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>В нашем чате запрещается сообщать ссылки на атльтернативные проекты. Повторные попытки могут привести к блокировке персонажа.</small>","Black","1","1","0"]);';
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>В нашем чате запрещается сообщать ссылки на атльтернативные проекты.
Повторные попытки могут привести к блокировке персонажа.</small>","Black","1","1","0"]);';
}
if ($msg['spam'] == 1 && $u->info['molch1'] < time() && $u->info['admin'] == 0) {
@@ -298,12 +287,13 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
if ($mban['vals'] + 1 < 2) {
$msg['fspam'] = str_replace('%', '</b>,<b>', $msg['fspam']);
$msg['fspam'] = '<b>' . ltrim($msg['fspam'], '0</b>,<b>') . '</b>';
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>В нашем чате запрещается сообщать ссылки на атльтернативные проекты. Запрещенные слова: ' . $msg['fspam'] . '. Предупреждения [' . ($mban['vals'] + 1) . '/1]</small>","Black","1","1","0"]);';
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>В нашем чате запрещается сообщать ссылки на атльтернативные проекты.
Запрещенные слова: ' . $msg['fspam'] . '. Предупреждения [' . ($mban['vals'] + 1) . '/1]</small>","Black","1","1","0"]);';
} else {
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>В нашем чате запрещается сообщать ссылки на атльтернативные проекты. Вы наказаны за нарушение правил общения.</small>","Black","1","1","0"]);';
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>В нашем чате запрещается сообщать ссылки на атльтернативные проекты.
Вы наказаны за нарушение правил общения.</small>","Black","1","1","0"]);';
$cmsg = new ChatMessage();
$cmsg->setCity($u->info['city']);
$cmsg->setLogin('Комментатор');
$cmsg->setText("Персонаж {$u->info['login']}[{$u->info['level']}] был наказан за нарушение правил общения.");
$cmsg->setType(6);
@@ -328,12 +318,14 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
if (is_array($msg['to'])) {// каким хером тут массив?
$msg['to'] = '';
}
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<b>Вас добавили в игнор</b>: Вы не можете отправлять сообщения персонажу &quot;' . htmlspecialchars($msg['to']) . '&quot;.","Black","1","1","0"]);';
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<b>Вас добавили в игнор</b>:
Вы не можете отправлять сообщения персонажу &quot;' . htmlspecialchars($msg['to']) . '&quot;.","Black","1","1","0"]);';
$msg['cancel']++;
}
if ($msg['type'] == 3 && $msg['to'] == 'klan') {
if ($u->info['clan'] == 0) {
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>Вы не являетесь частью одного из <b>Кланов</b> и не можете общаться по этому каналу.</small>","Black","1","1","0"]);';
$r['js'] .= 'chat.sendMsg(["new","' . time() . '","6","","' . $u->info['login'] . '","<small>Вы не являетесь частью одного из <b>Кланов</b>
и не можете общаться по этому каналу.</small>","Black","1","1","0"]);';
$msg['cancel']++;
} else {
$msg['to'] = 'k' . $u->info['clan'];
@@ -415,45 +407,31 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
$cmsg = new ChatMessage();
if (preg_match("/анекдот/i", mb_convert_case($_POST['msg'], MB_CASE_LOWER))) {
$text_com = '';
$sp_all = Db::getValue('select count(*) from a_com_act where act = ? and time > unix_timestamp() limit 5', [$com_act]);
if ($sp_all > 0) {
if (rand(0, 100) < 75) {
$text_com = [
'Отстань попрошайка! ... Ищу анекдоты, интернет не маленький!',
'Подожди... Сейчас что-нибудь найду',
'Почти нашел...',
'Вот один есть, но он не интересный...',
'А свет на центральной площади тьму &quot;пинает&quot;... Эх...',
];
$text_com = $text_com[rand(0, (count($text_com) - 1))];
}
$sp_all = Db::getRow('select * from a_com_anekdot order by rand() limit 1');
if (isset($sp_all['id'])) {
$text_com = $sp_all['text'];
$text_com = str_replace("<br>", "<br>&nbsp; &nbsp; ", $text_com);
$text_com = str_replace("<br />", "<br />&nbsp; &nbsp; ", $text_com);
$text_com = str_ireplace("\r\n", "", $text_com);
$text_com = str_replace("", "", $text_com);
$text_com = '<b style="color: red">Анекдот</b>:<br>&nbsp; &nbsp; ' . $text_com . '<br>';
} else {
$sp_all = Db::getRow('select * from a_com_anekdot order by rand() limit 1');
if (isset($sp_all['id'])) {
$text_com = $sp_all['text'];
$text_com = str_replace("<br>", "<br>&nbsp; &nbsp; ", $text_com);
$text_com = str_replace("<br />", "<br />&nbsp; &nbsp; ", $text_com);
$text_com = str_ireplace("\r\n", "", $text_com);
$text_com = str_replace("", "", $text_com);
$text_com = '<b style="color: red">Анекдот</b>:<br>&nbsp; &nbsp; ' . $text_com . '<br>';
} else {
$text_com = 'Анекдот из головы вылетел...';
}
Db::sql('insert into a_com_act (act, time, uid) values (0, unix_timestamp() + 60, ?)', [$u->info['id']]);
$text_com = 'Анекдот из головы вылетел...';
}
Db::sql('insert into a_com_act (act, time, uid) values (0, unix_timestamp() + 60, ?)', [$u->info['id']]);
if ($text_com != '') {
$cmsg->setText($text_com);
}
} else {
include_once 'commentator.php';
if ($comment != '') {
if (!empty($comment)) {
$cmsg->setText($comment);
}
}
if ($cmsg->getText()) {
$cmsg->setLogin('Комментатор');
$cmsg->setTo($u->info['login']);
$cmsg->setCity($u->info['city']);
$cmsg->setRoom($u->info['room']);
$cmsg->setType(2);
$chat->sendMsg($cmsg);
@@ -461,7 +439,6 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
}
Db::sql('update users set afk = default, dnd = default, timeMain = unix_timestamp() where id = ?', [$u->info['id']]);
}
}
$ar_id = 0;
@@ -554,13 +531,8 @@ where
if ($onlineUser['clan'] > 0) {
if ($u->info['clan'] > 0 && $onlineUser['clan'] != $u->info['clan']) {
if (!isset($cw['war'][$onlineUser['clan']][$u->info['clan']])) {
$onlineUser['cwar'] = mysql_fetch_array(
mysql_query(
'SELECT `id`,`type` FROM `clan_wars` WHERE
((`clan1` = "' . $onlineUser['clan'] . '" AND `clan2` = "' . $u->info['clan'] . '") OR (`clan2` = "' . $onlineUser['clan'] . '" AND `clan1` = "' . $u->info['clan'] . '")) AND
`time_finish` > ' . time() . ' LIMIT 1'
)
);
$onlineUser['cwar'] = Db::getRow('select id, type from clan_wars where clan1 in (?,?) and clan2 in (?,?) and clan1 != clan2 and time_finish > unix_timestamp()',
[$u->info['clan'], $onlineUser['clan'], $u->info['clan'], $onlineUser['clan'],]);
if (isset($onlineUser['cwar']['id'])) {
$cw['war'][$onlineUser['clan']][$u->info['clan']] = $onlineUser['cwar']['type'];
} else {
@@ -572,13 +544,10 @@ where
}
}
if (!isset($cw[$onlineUser['clan']])) {
$onlineUser['clan'] = mysql_fetch_array(
mysql_query('SELECT `name_mini` FROM `clan` WHERE `id` = "' . $onlineUser['clan'] . '" LIMIT 1')
);
$onlineUser['clan'] = ClanInfo::getNameById($onlineUser['clan']);
} else {
$onlineUser['clan'] = $cw[$onlineUser['clan']];
}
$onlineUser['clan'] = $onlineUser['clan']['name_mini'];
}
if ($onlineUser['atack'] > time() || $onlineUser['atack'] == 1 || $onlineUser['atack'] == 2) {
if ($onlineUser['atack'] != 2) {
@@ -607,72 +576,18 @@ where
$r['list'] = '{' . $r['list'] . '}';
}
function json_fix_cyr($json_str)
{
return $json_str;
}
//Получаем сообщения
if (isset($_GET['mid']) && !isset($_POST['mid'])) {
$_POST['mid'] = $_GET['mid'];
}
$i = 0;
$l = 0;
$sp = mysql_query(
'SELECT `nosee`,`frv`,`id`,`dn`,`active`,`invis`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`,`delete`,`molch`,`da` FROM `chat` WHERE
(
(
`delete` > 0 AND
`time` > ' . (time() - 360) . '
) OR
(
`time` > ' . (time() - 120) . ' OR
(
`time` = -1 AND
(
`to` = "' . $u->info['login'] . '" OR
`type` = 8
)
) OR
(
`time` < -1 AND
`time` > -' . time() . ' AND
(
`to` = "' . $u->info['login'] . '" OR
`type` = 8 OR
`to` = ""
)
)
)
)
AND
`new` = "1" AND
(
`id` > ' . ((int)$_POST['mid']) . ' OR
`delete` > 0 OR
`spam` > 0 OR
(
`time` < 0 AND
`time` > -' . time() . ' AND
(
`to` = "' . $u->info['login'] . '" OR
`to` = ""
)
)
)
ORDER BY `id`'
);
while ($pl = mysql_fetch_array($sp)) {
foreach ($chat->getMessages((int)$_POST['mid'], $u->info['login']) as $pl) {
if ($pl['delete'] > 0) {
$r['msg'] .= ',"m' . $i . '":["' . $pl['id'] . '","","delete","","","","","","","0","0","0","1","",""]';
}
if ($pl['type'] == 6 || $pl['type'] == 8) {
$pl['city'] = $u->info['city'];
}
$see = 1;
if ($pl['type'] == 8 && $u->isModerator()) {
@@ -681,52 +596,21 @@ while ($pl = mysql_fetch_array($sp)) {
if (($pl['type'] > 0 && $pl['type'] < 4) || $pl['type'] == -3) {
$pl['room'] = $u->info['room'];
$pl['city'] = $u->info['city'];
}
//fixme $pl['global'] - глобалка по всем городам. Если нет городов, то не нужна и глобалка. Теоретически.
//Проверки на доступ к просмотру
if (
((
(
$pl['type'] == 3 ||
$pl['type'] == 4
) &&
(
$pl['city'] == $u->info['city'] ||
$pl['global'] == 1
)
) ||
(
(
$pl['type'] == 5 ||
$pl['type'] == 6 ||
(
$pl['type'] == 8 && $u->isModerator()
)
) &&
(
$pl['city'] == $u->info['city'] ||
$pl['global'] == 1
)
) ||
(
$pl['type'] == 7 &&
$pl['city'] == $u->info['city'] &&
$pl['room'] == $u->info['room']
) ||
(
$pl['type'] == 6 &&
(
$pl['city'] == $u->info['city'] ||
$pl['global'] == 1
)
) ||
(
(($pl['type'] == 3 || $pl['type'] == 4) && $pl['global'] == 1) ||
(($pl['type'] == 5 || $pl['type'] == 6 || $pl['type'] == 8 && $u->isModerator()) && $pl['global'] == 1) ||
($pl['type'] == 7 && $pl['room'] == $u->info['room']) ||
($pl['type'] == 6 && $pl['global'] == 1) ||
$pl['type'] == 9 ||
$pl['type'] == 10
) &&
$pl['to'] != '' &&
$pl['login'] != $u->info['login'] &&
$pl['to'] != $u->info['login']
$pl['to'] != '' && $pl['login'] != $u->info['login'] && $pl['to'] != $u->info['login']
) {
$n = 0;
$ex = explode(',', $pl['to']);
@@ -743,7 +627,7 @@ while ($pl = mysql_fetch_array($sp)) {
unset($n, $j, $ex);
}
//Клановое сообщение (по всем городам)
if ($pl['type'] == -3 && ($pl['to'] == 'k' . $u->info['clan'] || $u->info['admin'] > 0)) {
if ($pl['type'] == -3 && ($pl['to'] == 'k' . $u->info['clan'] || $u->isAdmin())) {
$pl['type'] = 3;
if ($pl['to'] == 'k' . $u->info['clan']) {
$pl['to'] = 'klan';
@@ -763,11 +647,6 @@ while ($pl = mysql_fetch_array($sp)) {
$see = 0;
}
//Системное сообщение по всему городу
if ($pl['type'] == 8 && $pl['city'] != $u->info['city'] && $pl['global'] == 0) {
$see = 0;
}
//Сообщение с молчанкой
if ($pl['molch'] > 0) {
$see = 0;
@@ -775,29 +654,15 @@ while ($pl = mysql_fetch_array($sp)) {
//Сообщение отправлено в другой комнате
if (
(
$pl['type'] == 1 ||
$pl['type'] == 2
) &&
(
$pl['room'] != $u->info['room'] ||
$pl['city'] != $u->info['city']
) &&
(
$pl['global'] == 0 ||
$_COOKIE['chatCfg11'] == 0
)
($pl['type'] == 1 || $pl['type'] == 2) &&
($pl['room'] != $u->info['room']) &&
($pl['global'] == 0 || $_COOKIE['chatCfg11'] == 0)
) {
$see = 0;
}
//Сообщение прочее, в другом городе
if ($pl['city'] != $u->info['city'] && $pl['global'] == 0) {
$see = 0;
}
//Глобал
if ($pl['global'] == 1 && $pl['city'] == $u->info['city'] && $pl['type'] != -3) {
if ($pl['global'] == 1 && $pl['type'] != -3) {
$see = 1;
}
@@ -806,13 +671,7 @@ while ($pl = mysql_fetch_array($sp)) {
$see = 0;
}
$modr = 0;
if ($u->isModerator()) {
$modr = 1;
}
if ($pl['login'] != $u->info['login'] && $pl['nosee'] != 0 && $u->info['id'] != $pl['nosee'] && $u->info['admin'] == 0 && $modr == 0) {
if ($pl['login'] != $u->info['login'] && $pl['nosee'] != 0 && $u->info['id'] != $pl['nosee'] && !$u->isModerator()) {
$see = 0;
} else {
if ($pl['nosee'] != 0 && $pl['login'] != $u->info['login']) {
@@ -820,14 +679,14 @@ while ($pl = mysql_fetch_array($sp)) {
if ($u->info['id'] == $pl['nosee']) {
$noseein = 'ваш реферал';
}
$pl['text'] = '<span style=\"padding:0 5px 0 5px;background-color:#FFC;\"><font color=red><small>[' . $noseein . ']</small></font> ' . $pl['text'] . '</span>';
if ($u->info['admin'] > 0 || $modr == 1) {
$pl['text'] = '<span style="padding:0 5px 0 5px;background-color:#FFC;"><small style="color: red;">[' . $noseein . ']</small> ' . $pl['text'] . '</span>';
if ($u->isModerator()) {
$see = 1;
}
}
}
if ($see == 1 && $pl['delete'] == 0 && $pl['login'] != '') {
if ($see == 1 && $pl['login'] != '') {
$qix = Db::getValue('select id from friends where ignor > 0 and login_ignor = ? and (user_ignor = ? or user = ?)', [$pl['login'], $u->info['login'], $u->info['id']]);
if (isset($qix)) {
@@ -836,21 +695,19 @@ while ($pl = mysql_fetch_array($sp)) {
unset($qix);
}
if ($see == 1 && $pl['delete'] == 0) {
if ($see == 1) {
if ($pl['time'] < 0) {
if ($pl['to'] == '') {
$lmsch = mysql_fetch_array(mysql_query('SELECT `id` FROM `chat` ORDER BY `id` DESC LIMIT 1'));
if (isset($lmsch['id'])) {
$lmsch['id']++;
mysql_query(
'UPDATE `chat` SET `id` = "' . $lmsch['id'] . '",`time` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1'
);
$pl['id'] = $lmsch['id'];
$lmsch = Chat::getLastMessageId();
if ($lmsch > 0) {
$lmsch++;
Chat::setCurrentTimeAndIdById($pl['id'], $lmsch);
$pl['id'] = $lmsch;
} else {
mysql_query('UPDATE `chat` SET `time` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
Chat::setCurrentTimeById($pl['id']);
}
} else {
mysql_query('UPDATE `chat` SET `time` = "' . time() . '" WHERE `id` = "' . $pl['id'] . '" LIMIT 1');
Chat::setCurrentTimeById($pl['id']);
}
$pl['time'] = time();
}
@@ -860,12 +717,12 @@ while ($pl = mysql_fetch_array($sp)) {
$reimg = [];
if (preg_match_all(
"/\[img\[(.*?)\]\]\[1\]/", $pl['text'], $reimg
) && ($u->info['admin'] > 0 || $pl['type'] == 5 || $pl['type'] == 6 || $pl['type'] == 10 || $pl['type'] == 11)) {
) && ($u->isAdmin() || $pl['type'] == 5 || $pl['type'] == 6 || $pl['type'] == 10 || $pl['type'] == 11)) {
$k = 0;
while ($k <= count($reimg[1])) {
$pl['text'] = str_replace(
'[img[' . $reimg[1][$k] . ']][1]',
'<img src=//img.new-combats.tech/i/' . $reimg[1][$k] . ' height=19>', $pl['text']
'<img src=' . Config::img() . '/i/' . $reimg[1][$k] . ' height=19>', $pl['text']
);
$k++;
}
@@ -876,7 +733,7 @@ while ($pl = mysql_fetch_array($sp)) {
$k = 0;
while ($k <= count($reimg[1])) {
$pl['text'] = str_replace(
'[img[' . $reimg[1][$k] . ']]', '<img src=//img.new-combats.tech/i/' . $reimg[1][$k] . '>',
'[img[' . $reimg[1][$k] . ']]', '<img src=' . Config::img() . '/i/' . $reimg[1][$k] . '>',
$pl['text']
);
$k++;
@@ -919,21 +776,20 @@ while ($pl = mysql_fetch_array($sp)) {
}
if ($pl['type'] != 3 && ($pl['invis'] == 1 || $pl['invis'] > time())) {
if ($u->info['admin'] == 0) {
$pl['login'] = '<b><i>Невидимка</i></b>';
} else {
$pl['login'] = '<b><i>Невидимка</i></b></a> <small>(' . $pl['login'] . ')</small>';
$pl['login'] = '<b><i>Невидимка</i></b>';
if ($u->isAdmin()) {
$pl['login'] .= '</a> <small>(' . $pl['login'] . ')</small>';
}
}
if ($pl['invis'] > 0 && ($pl['type'] == 1 || $pl['type'] == 2)) {
$pl['color'] = 'Black';
}
$r['msg'] .= ',"m' . $i . '":["' . $pl['id'] . '","' . $pl['time'] . '","' . $pl['type'] . '","' . $pl['login'] . '","' . $pl['to'] . '","' . $pl['text'] . '","' . $pl['color'] . '","' . $pl['toChat'] . '","' . $pl['typeTime'] . '","' . $pl['sound'] . '","' . $pl['global'] . '","' . $pl['molch'] . '","' . $pl['active'] . '","' . date(
'H:i', $pl['time']
) . '","' . date('d.m.Y H:i', $pl['time']) . '","' . $pl['frv'] . '","' . $pl['invis'] . '"]';
$r['msg'] .= ',"m' . $i . '":["' . $pl['id'] . '","' . $pl['time'] . '","' . $pl['type'] . '","' . $pl['login'] . '","' .
$pl['to'] . '","' . $pl['text'] . '","' . $pl['color'] . '","' . $pl['toChat'] . '","' . $pl['typeTime'] . '","' . $pl['sound'] .
'","' . $pl['global'] . '","' . $pl['molch'] . '","' . $pl['active'] . '","' . date('H:i', $pl['time']) . '","' .
date('d.m.Y H:i', $pl['time']) . '","' . $pl['frv'] . '","' . $pl['invis'] . '"]';
}
}
if ($l < $pl['id']) {
@@ -957,12 +813,7 @@ if ($r['key'] == $_GET['key']) {
$r['rn'] = $u->room['name'];
}
$posts = mysql_fetch_array(
mysql_query(
'SELECT COUNT(`id`) FROM `items_users` AS `iu` WHERE `iu`.`uid` = "-51' . $u->info['id'] . '" AND `iu`.`delete` = 0 AND `iu`.`inOdet` = 0 AND `iu`.`inShop` = 0 AND `iu`.`lastUPD` < ' . time() . ' LIMIT 1'
)
);
$posts = $posts[0];
$posts = Db::getValue('select count(id) from items_users where uid = ? and inOdet = 0 and inShop = 0 and lastUPD < unix_timestamp()', ['-51' . $u->info['id']]);
if ($posts > 0) {
$r['js'] .= ' $("#postdiv").show();';
@@ -971,17 +822,14 @@ if ($posts > 0) {
}
//Предложение на обмен
$trf = mysql_fetch_array(
mysql_query(
'SELECT * FROM `transfers` WHERE `uid2` = "' . $u->info['id'] . '" AND `start2` = 0 AND `cancel1` = 0 AND `cancel2` = 0 LIMIT 1'
)
);
if (isset($trf['id'])) {
$utf = mysql_fetch_array(mysql_query('SELECT `login` FROM `users` WHERE `id` = "' . $trf['uid1'] . '" LIMIT 1'));
if (isset($utf['login']) && $u->info['battle'] == 0) {
$r['js'] .= 'top.intransferNew(' . $trf['id'] . ',"' . $utf['login'] . '");';
$transfer = Db::getRow('select id, uid1 from transfers where uid2 = ? and start2 = 0 and cancel1 = 0 and cancel2 = 0', [$u->info['id']]);
if (isset($transfer['id'])) {
$utf = User::getLoginById($transfer['uid1']);
if (!empty($utf) && $u->info['battle'] == 0) {
$r['js'] .= 'top.intransferNew(' . $transfer['id'] . ',"' . $utf . '");';
} else {
mysql_query('UPDATE `transfers` SET `cancel2` = "' . time() . '" WHERE `id` = "' . $trf['id'] . '" LIMIT 1');
Db::sql('update transfers set cancel2 = unix_timestamp() where id = ?', [$transfer['id']]);
}
}