View file forum/topics.php

File size: 5.64Kb
<?php
require_once"../template/start.php";
require_once"../template/regglobals.php";
require_once"../template/config.php";
require_once"setforum.php";
require_once"../template/functions.php";
require_once"../template/antidos.php";
require_once"../template/cookies.php";
require_once"../template/gzip.php";
require_once"../template/header.php";
require_once"../template/referer.php";
include_once"../themes/$config_themes/index.php";
include_once"../template/isset.php";

echo'<img src="../images/img/partners.gif" alt=""> <b>Новые темы на форуме</b><br><br>';

$suf = @file(BASEDIR."local/dataforumset/dataforumuser/$log.dat");
if ($suf!=""){
$lsf = explode(":||:",$suf[0]);}

if($config_forum_off=="1"){

if ($provlog==$_SESSION['log'] && $provpar==md5($_SESSION['par']) && $_SESSION['log']!="" && md5($_SESSION['par'])!=""){

if($config_new_top=="1"){
if(!empty($lsf[1]) || $config_usnastr==0){

if(!isset($action)){
$time=time();
$filtime=filemtime(BASEDIR."local/datatmp/newthmes.dat");
$userfile=file(BASEDIR."local/datatmp/newthmes.dat");
$user_count=count($userfile);

$filtime=$filtime+(60*5); //5-минутное индексирование

if($time>$filtime || $user_count<50){
$dir = opendir (BASEDIR."local/dataforum"); 
while ($file = readdir ($dir))
{if (( $file != ".") && ($file != "..") && ($file != "mainforum.dat") && ($file != "topic1.dat") && ($file != "topic2.dat")  && ($file != "topic3.dat") && ($file != "topic4.dat") && ($file != "topic5.dat") && ($file != "topic6.dat") && ($file != "topic7.dat") && ($file != "topic8.dat") && ($file != "topic9.dat") && ($file != "topic10.dat") && ($file != "topic11.dat") && ($file != "topic12.dat") && !ereg (".sex$", "$file") && !ereg ("topic", "$file") && !ereg ("mainforum", "$file")) // эти файлы игнорируем
{$a[]=$file;}}
closedir ($dir);
$total = count($a); 

for ($i = 0; $i < $total; $i++){
$tex = file(BASEDIR."local/dataforum/$a[$i]");
$data = explode("|",$tex[0]);
if($data[9]!="CLOSED"){
$dat_uz[]=$data[0];
$dat_browz[]=$data[2];
$dat_name[]=$data[3];
$dat_mess[]=$data[4];
$dat_time[]=$data[9];
$dat_id[]=$data[7];
$dat_pod[]=$data[8];}
}
arsort($dat_time);

clear_files(BASEDIR."local/datatmp/newthmes.dat");

foreach($dat_time as $k=>$v){
$fp = fopen(BASEDIR."local/datatmp/newthmes.dat","a+");
$dat_balls = $dat_uz[$k].'|'.$dat_browz[$k].'|'.$dat_name[$k].'|'.$dat_mess[$k].'|'.$dat_time[$k].'|'.$dat_id[$k].'|'.$dat_pod[$k].'|';
flock ($fp,LOCK_EX);
fputs($fp,"$dat_balls\r\n");
fflush ($fp);
flock ($fp,LOCK_UN);
fclose($fp);
chmod ($fp, 0666); 
chmod (BASEDIR."local/datatmp/newthmes.dat", 0666);}
}
//////////////////////////////////////////////////////////
//------------------------------ ВЫВОД ИЗ КЕША ------------------------------//
$file = file(BASEDIR."local/datatmp/newthmes.dat");
$total = count($file);
if ($start=="") {$start = 0;} 
if ($total < $start + $config_userlist){ $end = $total; }
else {$end = $start + $config_userlist; }
for ($i = $start; $i < $end; $i++){
$mainlines=file("../local/dataforum/mainforum.dat");
$ze=count($mainlines);
$data = explode("|",$file[$i]);
do {$ze--; $dt=explode("|", $mainlines[$ze]);
if ($dt[0]==$data[6]) {$frname=$dt[1];}
}while($ze >0);

$data[3] = bb_code_forum($data[3]);

echo '<div class=b><img src="../images/img/forums.gif" alt=""> Тема: <a href="index.php?fid='.$data[6].'&amp;id='.$data[5].'&amp;'.SID.'">'.$data[2].'</a></div>Раздел: <a href="index.php?fid='.$data[6].'&amp;'.SID.'">'.$frname.'</a>';
echo'<br>Создал: <b><a href="../pages/anketa.php?uz='.$data[0].'&amp;'.SID.'">'.nickname($data[0]).'</a></b> '.user_online($data[0]); 
echo'<br>Дата: '.date("d.m.y, в H:i:s", $data[4]).'';
echo'<div>Описание темы:<br>'.bb_code_forum($data[3]).'<br><small><font color="#CC00CC">'.$data[1].' </font></small></div>';}
echo'<hr>'; 
if ($start != 0) {echo '<a href="topics.php?start='.($start - $config_userlist).'&amp;'.SID.'">&lt;-Назад</a> ';}else{echo'&lt;-Назад';}
echo' | '; 
if ($total > $start + $config_userlist) {echo ' <a href="topics.php?start='.($start + $config_userlist).'&amp;'.SID.'">Далее-&gt;</a>';}else{echo'Далее-&gt;';} 

if($total>0){

$ba=ceil($total/$config_userlist);
$ba2=$ba*$config_userlist-$config_userlist;

echo '<br><hr>Страницы:';
$asd=$start-($config_userlist*4);
$asd2=$start+($config_userlist*5);

if($asd<$total && $asd>0){echo ' <a href="topics.php?start=0&amp;'.SID.'">1</a> ... ';}

for($i=$asd; $i<$asd2;)
{
if($i<$total && $i>=0){
$ii=floor(1+$i/$config_userlist);

if ($start==$i) {
echo ' <b>'.$ii.'</b>';
               }
                else {
echo ' <a href="topics.php?start='.$i.'&amp;'.SID.'">'.$ii.'</a>';
                     }}


$i=$i+$config_userlist;}
if($asd2<$total){echo ' ... <a href="topics.php?start='.$ba2.'&amp;'.SID.'">'.$ba.'</a>';}}
}

}else{
echo'<center><font color="red">Показ новых тем на форуме отключен вами в личных настройках!!!</font></center>';}}

if($config_new_top=="0"){
echo'<center><font color="red">Показ новых тем на форуме отключен!!!</font></center>';}

}else{
echo'Вы не авторизованы для просмотра';}
}

if($config_forum_off=="0"){
echo'<center><font color="red">Форум сайта отключен!</font></center>';}

echo'<br><br><img src="../images/img/back.gif" alt=""> <a href="index.php?'.SID.'">Форум</a><br>';
echo '<img src="../images/img/homepage.gif" alt=""> <a href="../index.php?'.SID.'">На главную</a>';

include_once"../themes/$config_themes/foot.php";
?>