safe_mode = true;
$_TIME = time()+($config['date_adjust']*60);
if ($is_logged) {$name = $db->safesql($member_id['name']);} else {$CN_HALT = TRUE;}
$_IP = $db->safesql($_SERVER['REMOTE_ADDR']);
$time = date ("Y-m-d H:i:s", $_TIME);
$message = $db->safesql($parse->BB_Parse($parse->process($mcadd['message'])), false);
if( strlen($message) > 3000) $CN_HALT = TRUE;
if ($message =='' OR $member_id['banned'] == "yes") $CN_HALT = TRUE;
$message = preg_replace("#(^|\s|>)((http|https|ftp)://\w+[^\s\[\]\<]+)#i", '\\1URL', $message);
//* Автоперенос длинных слов
if(intval($chatconfig['auto_wrap'])){
$message = preg_split('((>)|(<))', $message, -1, PREG_SPLIT_DELIM_CAPTURE);
$n = count($message);
for ($i = 0; $i < $n; $i++) {
if ($message[$i] == "<") {
$i++; continue;
}
$message[$i] = preg_replace("#([^\s<>'\"/\.\\-\?&\n\r\%]{".intval($chatconfig['auto_wrap'])."})#i", "\\1
", $message[$i]);
}
$message = join("", $message);
}
$data['skin'] = strtolower($_REQUEST['skin']);
// Добавление
if ($CN_HALT) {
} else {
$db->query("INSERT INTO ".PREFIX."_chat (name, message, date, ip, `mgroup`, user_id) VALUES ('$name', '$message', '$time', '$_IP', '$member_id[user_group]', '$member_id[user_id]')");
$cache->del('minichat');
}
?>