Реализация ChatMessageDTO.
This commit is contained in:
+52
-17
@@ -85,29 +85,64 @@ class Chat
|
||||
]);
|
||||
}
|
||||
|
||||
public function debug($text)
|
||||
public function debug($text, $isLegacyErrorMessage = false)
|
||||
{
|
||||
if ($isLegacyErrorMessage) {
|
||||
$text = 'core' . date('#d.m.Y %H:i:s:') . "<b>$text</b>";
|
||||
}
|
||||
Db::sql('insert into chat (new, text, time, type, color, `to`, login) values (1,?,unix_timestamp(),3,?,?,?)', [
|
||||
trim($text), 'crimson', 'Merlin', 'debugger'
|
||||
]);
|
||||
}
|
||||
|
||||
public function send($color, $room, $city, $from, $to, $text, $time, $type, $toChat, $spam, $sound, $new = 0)
|
||||
public function sendMsg(ChatMessage $chatMessage): void
|
||||
{
|
||||
mysql_query("INSERT INTO `chat` (`new`,`sound`,`color`,`city`,`room`,`login`,`to`,`text`,`time`,`type`,`toChat`,`spam`) VALUES ('" . $new . "','" . $sound . "','" . $color . "','" . $city . "','" . $room . "','" . $from . "','" . $to . "','" . $text . "','" . $time . "','" . $type . "','" . $toChat . "','" . $spam . "')");
|
||||
return mysql_insert_id();
|
||||
}
|
||||
|
||||
public function jsmsg($id, $time, $to, $from, $type, $ch, $e, $see, $js = 0, $cl = '#000000', $typeTime = NULL)
|
||||
{
|
||||
$tm = date('H:i', $time);
|
||||
if ($typeTime == 1) {
|
||||
$tm = date('d.m.Y H:i', $time);
|
||||
}
|
||||
$rt = 'top.addMessage(\'' . $id . '\',\'' . $tm . '\',\'' . $to . ' \',\'' . $from . '\',\'' . $type . '\',\'' . $ch . '\'," ' . $e . ' ",\'' . $see . '\',\'' . $cl . '\');';
|
||||
if ($js == 1) {
|
||||
$rt = '<script>' . $rt . '</script>';
|
||||
}
|
||||
return $rt;
|
||||
$q = 'insert into chat(
|
||||
new,
|
||||
sound,
|
||||
color,
|
||||
city,
|
||||
room,
|
||||
login,
|
||||
`to`,
|
||||
text,
|
||||
time,
|
||||
type,
|
||||
toChat,
|
||||
spam,
|
||||
invis,
|
||||
da,
|
||||
`delete`,
|
||||
global,
|
||||
molch,
|
||||
nosee,
|
||||
typeTime,
|
||||
dn,
|
||||
frv
|
||||
) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)';
|
||||
$args = [
|
||||
$chatMessage->getNew(),
|
||||
$chatMessage->getSound(),
|
||||
$chatMessage->getColor(),
|
||||
$chatMessage->getCity(),
|
||||
$chatMessage->getRoom(),
|
||||
$chatMessage->getLogin(),
|
||||
$chatMessage->getTo(),
|
||||
$chatMessage->getText(),
|
||||
$chatMessage->getTime(),
|
||||
$chatMessage->getType(),
|
||||
$chatMessage->getToChat(),
|
||||
$chatMessage->getSpam(),
|
||||
$chatMessage->getInvis(),
|
||||
$chatMessage->getDa(),
|
||||
$chatMessage->getDelete(),
|
||||
$chatMessage->getGlobal(),
|
||||
$chatMessage->getMolch(),
|
||||
$chatMessage->getNosee(),
|
||||
$chatMessage->getTypeTime(),
|
||||
$chatMessage->getDn(),
|
||||
$chatMessage->getFireworks(),
|
||||
];
|
||||
Db::sql($q, $args);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user