<?php
require'f_chat.php';
require'f_conectare.php';
conectare('camera chat '.$cnume,'camera-chat/camera/'.$cid.'-'.seo($cinfo[1]).'/v/0/p/0');
if($de>0)
{
require'f_refresh.php';
$head[4]=refresh('/camera-chat'.$x2);
}
$titlu=nume($de,1).'@'.$cnume;
require'f_tabelare.php';
if($pmtext!='')
$back[2]='<a href="/camera-chat'.$x2.'">'.img('arrow_next.png',2).$cnume.'</a>';
require'f_sus.php';
$conectati=$conn->query('SELECT COUNT(*)FROM`chat_conectati`WHERE`cid`="'.$cid.'"')->fetch_row()[0];
if(isset($_POST['pmtext']))
{
$tip='scrie mesaje pe chat';
require'f_vechime.php';
require'f_scris2.php';
}
if($pmtext!='')
{
require'f_mut.php';
if($conn->query('SELECT COUNT(*)FROM`chat_mesaje`WHERE`text`="'.$pmtext.'"&&`de`="'.$de.'"')->fetch_row()[0]==0)
{
require'f_blocat.php';
if(blocat($pmtext))
{
$tip='mesaj în camera de chat '.$cinfo[1].($la>0?', către membrul '.nume($la,1):'');
$text=$pmtext;
require'f_ban.php';
}
if(mb_substr_count($pmtext,$cod_robot)>0)
{
if($perm<2)
$conn->query('INSERT INTO`chat_mesaje`SET`de`="'.$de.'",`la`="'.$la.'",`data`="'.$_SERVER['REQUEST_TIME'].'",`text`="Ma cred hacker, dar sunt doar un idiot! '.$adresasite[1].' e cel mai tare chat! Rog un administrator sa ma baneze!",`cid`="'.$cid.'";');
else
$conn->query('INSERT INTO`chat_mesaje`SET`de`="'.$id_robot.'",`la`="0",`data`="'.$_SERVER['REQUEST_TIME'].'",`text`="'.$pmtext.'",`cid`="'.$cid.'";');
}
else
$conn->query('INSERT INTO`chat_mesaje`SET`de`="'.$de.'",`la`="'.$la.'",`data`="'.$_SERVER['REQUEST_TIME'].'",`text`="'.$pmtext.'",`cid`="'.$cid.'";');
$conn->query('INSERT INTO`chat_arhiva`SET`de`="'.$de.'",`la`="'.$la.'",`data`="'.$_SERVER['REQUEST_TIME'].'",`text`="'.$pmtext.'",`cid`="'.$cid.'";');
$conn->query('INSERT INTO`evenimente`SET`text`="a scris un mesaj pe chat, în camera '.$cinfo[1].'",`de`="'.$de.'",`la`="'.$la.'",`data`="'.$_SERVER['REQUEST_TIME'].'"');
$lei_chat=$lei['chat'];
if($conectati>2&&$_SERVER['REQUEST_TIME']>($cinfo[3]+180))
{
$conn->query('INSERT INTO`chat_mesaje`SET`de`="'.$id_robot.'",`la`="0",`data`="'.$_SERVER['REQUEST_TIME'].'",`text`="'.nume($de,1).', ti-am dat [b]'.$lei['chat_activitate'].'[/b] lei, pentru activitatea de pe chat!",`cid`="'.$cid.'";');
$conn->query('UPDATE`chat_camere`SET`activitate`="'.$_SERVER['REQUEST_TIME'].'"WHERE`id`="'.$cid.'"');
$lei_chat=$lei['chat']+$lei['chat_activitate'];
}
$conn->query('UPDATE`chat_camere`SET`data`="'.$_SERVER['REQUEST_TIME'].'"WHERE`id`="'.$cid.'"');
$conn->query('UPDATE`membrii`SET`mesaje_chat`=mesaje_chat+1,`lei`=lei+'.$lei_chat.' WHERE`id`="'.$de.'"');
}
}
if($de>0)
require'f_nou.php';
echo$div[4].img('arrow_next.png',2).$cnume.$div[5].$div[1].'[<a href="/scrie-mesaj-chat'.$x2.'"><img src="'.$domenii_statice[1].'adauga.gif" alt="" />Scrie</a>] [<a href="/camera-chat'.$x2.'">reîncarcă</a>] [<a href="/conectati-chat'.$x2.'">'.img('group.gif',1).'conectati '.$cnume.'</a> <strong>'.number_format($conectati).'</strong>]'.$div[0];
$chats=$conn->query('SELECT`de`,`la`,`data`,`text`,`raportat`,`id`FROM`chat_mesaje`WHERE`cid`="'.$cid.'"ORDER BY`data`DESC');
$elemente=$chats->num_rows;
if($elemente>0)
echo'<table'.$clasa_tabel.'>';
$counter=0;
require'f_filtru.php';
require'f_simbol.php';
$pe_pagina=$_COOKIE['pe_pagina']??10;
while($chat=$chats->fetch_row())
{
$canc=true;
if($counter<$pe_pagina)
{
if($conn->query('SELECT COUNT(*)FROM`membrii_pedepsiti`WHERE`de`="'.$chat[0].'"&&`penalty`="0"')->fetch_row()[0]>0&&$de!=$chat[0]||$conn->query('SELECT COUNT(*)FROM`ignorati`WHERE`la`="'.$chat[0].'"&&`de`="'.$de.'"')->fetch_row()[0]>0||$chat[0]!=$de&&$chat[1]!=0&&$chat[1]!=$de)
$canc=false;
if($chat[4]==1&&$perm>0)
$canc=true;
if($canc)
{
$tosay=filtru($chat[3]);
$bott=$chat[0];
if(mb_substr_count($tosay,'<img src=')>3)
{
$tosay='<i>'.nume($chat[0]).', incearca sa te rezumi doar la 3 zambareti pe mesaj!</i>';
$bott=$id_robot;
}
$iml='';
$cmid=$conn->query('SELECT`chmood`FROM`membrii`WHERE`id`="'.$bott.'"')->fetch_row()[0];
if($cmid!=0)
{
$mlnk=$conn->query('SELECT`img`,`text`FROM`chat_moduri`WHERE`id`="'.$cmid.'"')->fetch_row();
$iml='<img src="'.$domenii_statice[2].'moduri/'.$mlnk[0].'" alt="'.$mlnk[1].'" />';
}
$optlink=$iml.simbol($bott).nume($bott);
if($chat[1]!=0&&$chat[0]==$de)
$optlink='<img src="'.$domenii_statice[1].'moduri/out.gif" alt="!" />Privat la '.simbol($chat[1]).nume($chat[1]);
if($chat[1]==$de&&$de!=0)
$optlink='<img src="'.$domenii_statice[2].'moduri/in.gif" alt="" />Privat de la '.simbol($bott).nume($bott);
if($chat[4]==1)
$optlink='<img src="'.$domenii_statice[2].'moduri/point.gif" alt="!" />de la '.simbol($chat[0]).nume($chat[0]).', la '.simbol($chat[1]).nume($chat[1]);
echo'<tr><td'.$clasa_kk.'><a href="/scrie-mesaj-privat-chat'.$x2.'/la/'.$bott.'-'.seo(nume($bott,1)).'">'.avatar($bott).'</a></td><td'.$clasa_k.'>'.$clasa_n.'<a href="/scrie-mesaj-privat-chat'.$x2.'/la/'.$bott.'-'.seo(nume($bott,1)).'">'.$optlink.'</a>'.($perm>0?' <sterge><a href="/admin-sterge-mesaj-chat'.$x2.'/id/'.$chat[5].'"><img src="'.$domenii_statice[2].'sterge.png" alt="" width="16" height="16" /></a></sterge>':'').$div[0].($is_pc=='1'?'':'<div class="'.($chat[5]%2?'verde':'orange').'">').$tosay.$div[0].'</td></tr>';
}
}
$counter++;
}
if($elemente>0)
echo'</table>';
echo$div[1].'<a href="/arhiva-camera-chat'.$x2.'">Arhiva</a>'.$div[0];
if($cinfo[5]==0)
echo$div[1].'<a href="/raporteaza-camera-chat'.$x2.'"><img src="'.$domenii_statice[1].'point.gif" alt="!" />Raporteaza camera</a>'.$div[0];
if($perm>0)
{
if($cinfo[5]>0)
{
require'f_profil.php';
echo$div[1].'Camera raportata de: '.profil($cinfo[5]).'<strong> - </strong><a href="/admin-rezolva-camera-chat'.$x2.'">'.img('administrare.png',1).'Ridica nivelul de alerta</a>'.$div[0];
}
echo$div[1].'<a href="/admin-sterge-mesaje-chat'.$x2.'"><img src="'.$domenii_statice[2].'sterge.png" alt="" width="16" height="16" />Șterge toate mesajele din camera '.$cnume.'</a>'.$div[0];
}
require'f_jos.php';