<?php
require'f_forumm.php';
$pe_pagina=$_COOKIE['pe_pagina']??10;
$rpls=$conn->query('SELECT COUNT(*)FROM`forum_postari`WHERE`tid`="'.$tid.'"')->fetch_row()[0];
$num_pages=ceil(($rpls+1)/$pe_pagina);
if($page=='')
{
if($go=='last')
$page=$num_pages;
elseif($go!='last'&&$go>0)
{
if($conn->query('SELECT COUNT(*)FROM`forum_postari`WHERE`id`="'.$go.'"&&`tid`="'.$tid.'"')->fetch_row()[0]==0)
{
http_response_code(301);
header('Location: '.$adresasite[0].'/forum/topic/'.$tid.'-'.seo($tinfo[3]));
header('Cache-Control: no-store,no-cache,must-revalidate,max-age=0,post-check=0,pre-check=0');
header('Expires: -1');
require'f_fun.php';
}
$page=ceil(($conn->query('SELECT COUNT(*)FROM`forum_postari`WHERE`id`<"'.$go.'"&&`tid`="'.$tid.'"ORDER BY`data`')->fetch_row()[0]+2)/$pe_pagina);
}
else
$page=1;
}
if($page>$num_pages)
$page=$num_pages;
$limit_start=$pe_pagina*($page-1);
require'f_conectare.php';
conectare('topic '.$tnume,'forum/topic/'.$tid.'-'.seo($tinfo[3]));
$titlu='Topic '.$tnume;
require'f_tabelare.php';
if($is_pc>1)
$head[0].='.o{color:#000000}';
if($de==0)
$head[3]='<link rel="canonical" href="'.$adresasite[0].'/forum/topic/'.$tid.'-'.seo($tinfo[3]).($page>1?'/pagina/'.$page:'').'" />';
if($finfo[1]>0)
$back[2]='<a href="/forum/categorie/'.$finfo[1].'-'.seo($cinfo[1]).'">'.img('categorie.gif',1).$cnume.'</a>';
else
$back[2]='<a href="/grup/id/'.$finfo[3].'-'.seo($cinfo[1]).'">'.img('grupuri.png',2).'Grup '.$cnume.'</a>';
require'f_sus.php';
echo$div[4].'Topic '.$tnume.$div[5].$div[10].'<a href="/posteaza-in-topic/topic/'.$tid.'-'.seo($tinfo[3]).'"><img src="'.$domenii_statice[1].'adauga.gif" alt="" />Postează răspuns</a><br />'.($page>1?'<a href="/forum/topic/'.$tid.'-'.seo($tinfo[3]).'">Prima pagina</a>':'').($page<$num_pages?'<a href="/forum/topic/'.$tid.'-'.seo($tinfo[3]).'/tip/last">Ultima pagina</a>':'').'Raspunsuri: <strong>'.$rpls.'</strong><br />Vizualizări: <strong>'.($tinfo[6]+1).'</strong><br />';
if($finfo[3]==0)
{
if($de>0)
echo($conn->query('SELECT COUNT(*)FROM`forum_abonati_topicuri`WHERE`de`="'.$de.'"&&`tid`="'.$tid.'"')->fetch_row()[0]==0?'Nu ești abonat la acest topic<br /><a href="/abonare-topic/topic/'.$tid.'-'.seo($tinfo[3]).'/tip/abonare">Abonează-te</a>':'Esti abonat la acest topic<br /><a href="/abonare-topic/topic/'.$tid.'-'.seo($tinfo[3]).'/tip/dezabonare">Dezabonează-te</a>').'<br />';
echo'<a href="/abonati-topic/topic/'.$tid.'-'.seo($tinfo[3]).'">Membrii abonați</a> <strong>'.number_format($conn->query('SELECT COUNT(*)FROM`forum_abonati_topicuri`WHERE`tid`="'.$tid.'"')->fetch_row()[0]).'</strong><br />';
if($conn->query('SELECT`citit`FROM`forum_abonati_topicuri`WHERE`de`="'.$de.'"&&`tid`="'.$tid.'"')->fetch_row()[0]==0)
$conn->query('UPDATE`forum_abonati_topicuri`SET`citit`="1"WHERE`de`="'.$de.'"&&`tid`="'.$tid.'"');
}
$respondenti=$conn->query('SELECT COUNT(DISTINCT`de`)FROM`forum_postari`WHERE`tid`="'.$tid.'"')->fetch_row()[0];
$raspunsuri_membru=$conn->query('SELECT COUNT(*)FROM`forum_postari`WHERE`tid`="'.$tid.'"&&`de`="'.$de.'"')->fetch_row()[0];
echo'Membrii respondenti: '.($respondenti>0?'<a href="/respondenti-topic/topic/'.$tid.'-'.seo($tinfo[3]).'"><strong>'.$respondenti.'</strong></a>':'<strong>0</strong>').'<br />'.($raspunsuri_membru>0?'<a href="/postari-membru-in/topic/'.$tid.'-'.seo($tinfo[3]).'/la/'.$de.'-'.seo(nume($de,1)).'">Ai <strong>'.$raspunsuri_membru.'</strong> postări în acest topic</a>':'Nu ai postări în acest topic!').'<br /><small>BBCode: <strong>[url=/forum/topic/'.$tid.'-'.seo($tinfo[3]).']'.$tnume.'[/url]</strong></small>'.$div[0];
require'f_data.php';
require'f_profil.php';
require'f_filtru.php';
if($page==1)
{
$conn->query('UPDATE`forum_topicuri`SET`vizualizari`=vizualizari+1 WHERE`id`="'.$tid.'"');
$pe_pagina=$pe_pagina-1;
echo'<table'.$clasa_tabel.'><tr><td'.$clasa_kk.'><a href="/profil-membru/la/'.$tinfo[1].'-'.seo(nume($tinfo[1],1)).'">'.avatar($tinfo[1]).'</a></td><td'.$clasa_k.'>'.$clasa_n.profil($tinfo[1]).'<small> - '.data($tinfo[5]).'</small>'.$div[0].$clasa_normal.filtru($tinfo[4]).'<br /><a href="/optiuni-topic/topic/'.$tid.'-'.seo($tinfo[3]).'">Optiuni topic</a>';
if($tinfo[7]>0)
echo'<br />Acest topic are și un <a href="/chestionar/id/'.$tinfo[7].'-'.seo(mb_substr($conn->query('SELECT`intrebare`FROM`chestionar_intrebari`WHERE`id`="'.$tinfo[7].'"')->fetch_row()[0],0,15)).'">'.img('vot.gif',2).'chestionar</a>';
echo$div[0].'</td></tr></table>';
}
if($page>1)
$limit_start--;
$elemente=$conn->query('SELECT COUNT(*)FROM`forum_postari`WHERE`tid`="'.$tid.'"')->fetch_row()[0];
if($elemente>0)
{
echo'<table'.$clasa_tabel.'>';
$items=$conn->query('SELECT`id`,`text`,`de`,`data`,`citat`FROM`forum_postari`WHERE`tid`="'.$tid.'"ORDER BY`data`LIMIT '.$limit_start.','.$pe_pagina);
while($item=$items->fetch_row())
{
echo'<tr><td'.$clasa_kk.'><a href="/profil-membru/la/'.$item[2].'-'.seo(nume($item[2],1)).'">'.avatar($item[2]).'</a></td><td'.$clasa_k.'>'.$clasa_n.profil($item[2]).'<small> - '.data($item[3]).'</small>'.$div[0].$clasa_normal;
if($item[4]>0)
{
$nfox=$conn->query('SELECT`text`,`de`FROM`forum_postari`WHERE`id`="'.$item[4].'"')->fetch_row();
echo'<small>Replica la: <q>'.filtru($nfox[0]).'</q> de '.nume($nfox[1]).'</small><br />';
}
if($go==$item[0])
echo'<img src="'.$domenii_statice[2].'flag.gif" alt="steag" width="16" height="16" />';
echo filtru($item[1]).' <a href="/optiuni-postare/id/'.$item[0].'">Optiuni postare</a> <a href="/posteaza-in-topic/topic/'.$tid.'-'.seo($tinfo[3]).'/id/'.$item[0].'">&#174;</a>';
echo$div[0].'</td></tr>';
}
$x2='/topic/'.$tid.'-'.seo($tinfo[3]);
echo'</table>';
require'f_paginare2.php';
unset($x2);
}
else
echo$div[7].'Acest topic nu are postări!'.$div[0];
if($tinfo[8]!=1||$perm>0)
{
echo'<table'.$clasa_tabel.'><tr><td'.$clasa_k.'>'.$clasa_o.'Răspunsul tău:'.$div[0].$clasa_normal;
$form[0]='/posteaza-raspuns/topic/'.$tid.'-'.seo($tinfo[3]).'" method="post';
$form[1]=0;
require'f_textarea.php';
$form[2]=textarea('pmtext','',1).'<br />';
$form[3]='pmtext';
$form[4]='Scrie';
$form[5]=1;
require'f_form.php';
echo$div[0].'</td></tr></table>';
}
else
echo$div[4].'<img src="'.$domenii_statice[2].'actiune_delete.png" alt="" width="16" height="16" />Eroare!'.$div[5].$div[7].'Topicul este inchis, deci nu se poate posta!'.$div[0];
if($finfo[1]>0&&$elemente>0)
{
require'f_like.php';
echo$div[1].distribuie('forum/topic/'.$tid.'-'.seo($tinfo[3]),$titlu).$div[0];
}
require'f_jos.php';