Реализация ChatMessageDTO.
This commit is contained in:
+59
-85
@@ -263,56 +263,21 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
|
||||
'UPDATE `users` SET `molch1` = "' . $u->info['molch1'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
|
||||
);
|
||||
mysql_query("UPDATE `chat` SET `delete` = 1 WHERE `login` = '" . $u->info['login'] . "' LIMIT 1000");
|
||||
$_POST['msg'] = 'Я спамер ' . $u->info['login'] . ' и меня нужно заблокировать https://new-combats.com/info/' . $u->info['id'] . '';
|
||||
|
||||
mysql_query(
|
||||
'INSERT INTO `chat` (`nosee`,`invis`,`da`,`delete`,`molch`,`new`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`) VALUES (
|
||||
"0",
|
||||
"' . $u->info['invis'] . '",
|
||||
"1",
|
||||
"0",
|
||||
"0",
|
||||
"1",
|
||||
"",
|
||||
"",
|
||||
"' . $u->info['city'] . '",
|
||||
"0",
|
||||
"' . time() . '",
|
||||
"6",
|
||||
"0",
|
||||
"' . mysql_real_escape_string($_POST['msg']) . '",
|
||||
"0",
|
||||
"red",
|
||||
"0",
|
||||
"0",
|
||||
"0")'
|
||||
);
|
||||
|
||||
$_POST['msg'] = 'Это супер проект! Всем успехов!';
|
||||
|
||||
mysql_query(
|
||||
'INSERT INTO `chat` (`nosee`,`invis`,`da`,`delete`,`molch`,`new`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`) VALUES (
|
||||
"0",
|
||||
"' . $u->info['invis'] . '",
|
||||
"1",
|
||||
"0",
|
||||
"0",
|
||||
"1",
|
||||
"' . $u->info['login'] . '",
|
||||
"",
|
||||
"' . $u->info['city'] . '",
|
||||
"0",
|
||||
"' . time() . '",
|
||||
"1",
|
||||
"0",
|
||||
"' . mysql_real_escape_string($_POST['msg']) . '",
|
||||
"0",
|
||||
"Black",
|
||||
"0",
|
||||
"0",
|
||||
"0")'
|
||||
);
|
||||
$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']);
|
||||
$chat->sendMsg($cmsg);
|
||||
|
||||
$cmsg->setLogin($u->info['login']);
|
||||
$cmsg->setType(6);
|
||||
$cmsg->setText('Это супер проект! Всем успехов!');
|
||||
$cmsg->setColor('#000');
|
||||
$chat->sendMsg($cmsg);
|
||||
}
|
||||
} elseif ($lmg[0] > 0) {
|
||||
$r['js'] .= 'chat.sendMsg(["new","' . time(
|
||||
@@ -415,14 +380,21 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
|
||||
} else {
|
||||
$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);
|
||||
$chat->sendMsg($cmsg);
|
||||
|
||||
$molchTime = time() + 60 * 60;
|
||||
mysql_query(
|
||||
"INSERT INTO `chat` (`new`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`) VALUES ('1','" . $u->info['city'] . "','0','','','<b>Автоинформатор</b>: Персонаж " . $u->info['login'] . " [" . $u->info['level'] . "] был наказан за нарушение правил общения.','-1','6','0')"
|
||||
);
|
||||
mysql_query(
|
||||
'UPDATE `users` SET `molch1` = "' . (time() + 1 * 60 * 60) . '",`molch2` = "' . (time(
|
||||
) + 1 * 60 * 60) . '",`info_delete` = "' . (time(
|
||||
) + 1 * 60 * 60) . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
|
||||
);
|
||||
'UPDATE `users` SET
|
||||
`molch1` = ' . $molchTime . ',
|
||||
`molch2` = ' . $molchTime . ',
|
||||
`info_delete` = ' . $molchTime . '
|
||||
WHERE `id` = ' . $u->info['id']);
|
||||
$rtxt = $rang . ' "' . $u->info['login'] . '" <small><font color=red>Автоинформатор</font></small>: ' . $msg['text'] . ' [' . $msg['fspam'] . '].';
|
||||
mysql_query(
|
||||
"INSERT INTO `users_delo` (`uid`,`ip`,`city`,`time`,`text`,`login`,`type`) VALUES ('" . $u->info['id'] . "','" . $_SERVER['REMOTE_ADDR'] . "','" . $u->info['city'] . "','" . time(
|
||||
@@ -534,33 +506,33 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
|
||||
) . '","6","","' . $u->info['login'] . '","<small><b>В целях борьбы против рекламы, общение в чате доступно с 8-го уровня.</b> </small>","red","1","1","0"]);';
|
||||
}
|
||||
}
|
||||
//todo: внимательно перебрать логику, возможно есть ненужные\дефолтные поля.
|
||||
$cmsg = new ChatMessage();
|
||||
$cmsg->setNosee($msg['nosee']);
|
||||
$cmsg->setInvis($u->info['invis']);
|
||||
$cmsg->setDa($msg['da']);
|
||||
$cmsg->setDelete($msg['delete']);
|
||||
$cmsg->setMolch($msg['molch']);
|
||||
$cmsg->setLogin($msg['login']);
|
||||
$cmsg->setTo($msg['to']);
|
||||
$cmsg->setCity($u->info['city']);
|
||||
$cmsg->setRoom($u->info['room']);
|
||||
$cmsg->setTime($msg['time']);
|
||||
$cmsg->setType($msg['type']);
|
||||
$cmsg->setSpam($msg['spam']);
|
||||
$cmsg->setText($_POST['msg']);
|
||||
$cmsg->setToChat($msg['toChat']);
|
||||
$cmsg->setColor($msg['color']);
|
||||
$cmsg->setTypeTime($msg['typeTime']);
|
||||
$cmsg->setSound($msg['sound']);
|
||||
$cmsg->setGlobal($msg['global']);
|
||||
$chat->sendMsg($cmsg);
|
||||
|
||||
mysql_query(
|
||||
'INSERT INTO `chat` (`nosee`,`invis`,`da`,`delete`,`molch`,`new`,`login`,`to`,`city`,`room`,`time`,`type`,`spam`,`text`,`toChat`,`color`,`typeTime`,`sound`,`global`) VALUES (
|
||||
"' . $msg['nosee'] . '",
|
||||
"' . $u->info['invis'] . '",
|
||||
"' . $msg['da'] . '",
|
||||
"' . $msg['delete'] . '",
|
||||
"' . $msg['molch'] . '",
|
||||
"1",
|
||||
"' . $msg['login'] . '",
|
||||
"' . mysql_real_escape_string($msg['to']) . '",
|
||||
"' . $u->info['city'] . '",
|
||||
"' . $u->info['room'] . '",
|
||||
"' . $msg['time'] . '",
|
||||
"' . $msg['type'] . '",
|
||||
"' . $msg['spam'] . '",
|
||||
"' . mysql_real_escape_string($_POST['msg']) . '",
|
||||
"' . $msg['toChat'] . '",
|
||||
"' . $msg['color'] . '",
|
||||
"' . $msg['typeTime'] . '",
|
||||
"' . $msg['sound'] . '",
|
||||
"' . $msg['global'] . '")'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if ($msg['type'] == 2 && mb_convert_case($msg['to'], MB_CASE_LOWER) == 'комментатор') {
|
||||
$cmsg = new ChatMessage();
|
||||
if (preg_match("/анекдот/i", mb_convert_case($_POST['msg'], MB_CASE_LOWER))) {
|
||||
$text_com = '';
|
||||
$sp_all = mysql_fetch_array(
|
||||
@@ -602,20 +574,22 @@ if (isset($_POST['msg']) && str_replace(' ', '', $_POST['msg']) != '') {
|
||||
);
|
||||
}
|
||||
if ($text_com != '') {
|
||||
mysql_query(
|
||||
'INSERT INTO `chat` (`text`,`login`,`to`,`city`,`room`,`type`,`time`,`new`) VALUES ("' . $text_com . '","Комментатор","' . $u->info['login'] . '","' . $u->info['city'] . '","' . $u->info['room'] . '","2","' . time(
|
||||
) . '","1")'
|
||||
);
|
||||
$cmsg->setText($text_com);
|
||||
}
|
||||
} else {
|
||||
include('commentator.php');
|
||||
if ($comment != '') {
|
||||
mysql_query(
|
||||
'INSERT INTO `chat` (`text`,`login`,`to`,`city`,`room`,`type`,`time`,`new`) VALUES ("' . $comment . '","Комментатор","' . $u->info['login'] . '","' . $u->info['city'] . '","' . $u->info['room'] . '","2","' . time(
|
||||
) . '","1")'
|
||||
);
|
||||
$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);
|
||||
}
|
||||
}
|
||||
mysql_query(
|
||||
'UPDATE `users` SET `afk` = "",`dnd` = "",`timeMain` = "' . time(
|
||||
|
||||
Reference in New Issue
Block a user