View file wwphpmaster2.00_released/www.phpedited.com/fm/show.php

File size: 12.78Kb
<?php
////////////////////////////////////////////////////////////////////////////
//               -_- W|W PHP-master -_-                                   //
//                                                                        //
//                Copyright 2008 MyIE                                     //
//  Create and Design by -_- MyIE                                         //
//  Site (web)           -_- http://www.phpedited.com                     //
//  Site (wap)           -_- http://wap.phpedited.com                     //
//  E-mail (MyIE)        -_- [email protected]                           //
//  ICQ (MyIE)           -_- 952-11-78                                    //
//                                                                        //
//  Вы не имеете право убирать копирайт                                   //
//  оффициального сайта!                                                  //
//This program is free software: you can redistribute it and/or modify    //
//it under the terms of the GNU General Public License as published by    //
//the Free Software Foundation, either version 3 of the License, or       //
//(at your option) any later version.                                     //
//                                                                        //
//This program is distributed in the hope that it will be useful,         //
//but WITHOUT ANY WARRANTY; without even the implied warranty of          //
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the            //
//GNU General Public License for more details.                            //
//                                                                        //
//You should have received a copy of the GNU General Public License       //
//along with this program. If not, see <http://www.gnu.org/licenses/>.    //
////////////////////////////////////////////////////////////////////////////
require_once"../tmpl/cnf.php";
require_once"../tmpl/func.php";
require_once"../tmpl/ses.php";
require_once"../tmpl/hd.php";
require_once"../tmpl/hd_dw.php";

$f=fopen("../wap/lcl/panel3.dt","r");
$ifda=fgets($f);
$ifda=trim($ifda);
if ($ifda==1)
{
echo "<table border=0 cellspacing=5 cellpadding=0 width=100%>";
echo "<tr>";
echo "<td valign=_top width=100%>";
require_once"../panel/panel3q.php";
echo "</td>";
echo "</tr>";
echo "</table>";
}
else
{
echo "</td>";
echo "</tr>";
echo "</table>";
}

$f=fopen("../wap/lcl/panel1.dt","r");
$ifda=fgets($f);
$ifda=trim($ifda);
if ($ifda==1)
{
echo "<table border=0 cellspacing=5 cellpadding=0 width=100%>";
echo "<tr>";
echo "<td valign=_top>";
require_once"../panel/panel1q.php";
echo "</td>";
echo "<td width=100% valign=_top>";
}
else
{
echo "<table border=0 cellspacing=5 cellpadding=0 width=100%>";
echo "<tr>";
echo "<td valign=_top width=100%>";
}
?>

<table border=0 cellspacing=5 cellpadding=0 width=100%>
<tr>
<?php
echo("<td background='../thm-wb/$url_thm/pls.gif' align=center>");
echo("<img src='../thm-wb/$url_thm/plsl.gif' align=left>");
echo("<img src='../thm-wb/$url_thm/plsr.gif' align=right>");
echo("Форум на $title");
?>
</td>
</tr>
<tr>
<td>

<?php
$razdel=$_GET['razdel'];
$podrazdel=$_GET['podrazdel'];
$podrazdel = str_replace("%20"," ",$podrazdel);
$razdel = str_replace("%20"," ",$razdel);
/////// вывод блин
$dir_rec = dir("../wap/lcl/fm/$razdel/$podrazdel/");
$i = 0;
while($entry = $dir_rec->read())
{
if (substr($entry,0,3)=="rec")
{
$names[$i]=substr($entry,4);
$i++;
}
}
$dir_rec->close(); // закрываем директорию
@rsort($names); // сортируем файлы
$total=$i;

echo "<center>";
$podrazdel = str_replace(" ","%20",$podrazdel);
$razdel = str_replace(" ","%20",$razdel);
echo "<a href=$url/fm/index.php?razdel=$razdel class=forum1>";
$podrazdel = str_replace("%20"," ",$podrazdel);
$razdel = str_replace("%20"," ",$razdel);
echo "Форум на $title</a> | ";
echo "$podrazdel";
echo "</center>";

$file=fopen("../wap/lcl/msg_fm_theme.dt","r");
$msg_fm_theme=fgets($file);
fclose($file);
$file=fopen("../wap/lcl/msg_fm.dt","r");
$msg_fm=fgets($file);
fclose($file);

echo "<table border=0 cellspacing=5 cellpadding=0 width=100%>";
echo "<tr><td class=frm2>Название тем</td><td width=15% align=center class=frm2>Дабавил</td><td width=15% align=center class=frm2>Ответов</td><td width=15% align=center class=frm2>Последний</td></tr>";

// определяем очередность сообщений и выводим их
if (empty($_GET['start'])) $start = 0;
else $start = $_GET['start'];
if ($total < $start + $msg_fm_theme) { $end = $total; }
else {$end = $start + $msg_fm_theme; }
for ($i = $start; $i < $end; $i++)
{
$entry = $names[$i];
$file=fopen("../wap/lcl/fm/$razdel/$podrazdel/rec.".$entry,"r");
$buff=fgets($file);
fclose($file);
$file_array=file("../wap/lcl/fm/$razdel/$podrazdel/rec.".$entry);
$strok=count($file_array);
$strok=$strok-1;
echo "<tr><td class=frm2>";
echo "<table border=0 cellspacing=2 cellpadding=0 width=100%>";
echo "<tr>";
echo "<td>";
$podrazdel = str_replace(" ","%20",$podrazdel);
$razdel = str_replace(" ","%20",$razdel);
$file_array[0] = str_replace(" ","%20",$file_array[0]);
echo "<a href=showpst.php?entry=$entry&razdel=$razdel&podrazdel=$podrazdel&theme=$file_array[0] class=forum2>";
$podrazdel = str_replace("%20"," ",$podrazdel);
$razdel = str_replace("%20"," ",$razdel);
$file_array[0] = str_replace("%20"," ",$file_array[0]);
echo "$file_array[0]</a> ";
////////// проверка на админа ////////
if ($_SESSION)
{
$files_array = file("../wap/lcl/prof/$log");
if(!$files_array)
	{
echo("Ошибка открытия файла wap/lcl/prof/log$log");
	}
if (($files_array[2]==101) || ($files_array[2]==102) || ($files_array[2]==103))
	{
$podrazdel = str_replace(" ","%20",$podrazdel);
$razdel = str_replace(" ","%20",$razdel);
$file_array[0] = str_replace(" ","%20",$file_array[0]);
echo (" <a href='fm_theme_del.php?razdel=$razdel&podrazdel=$podrazdel&entry=$entry' class=cool title='Удалить'>[del]</a> ");
echo (" <a href='theme_edit.php?razdel=$razdel&theme=$file_array[0]&podrazdel=$podrazdel&entry=$entry' class=cool title='Редактировать'>[rename]</a> ");
$podrazdel = str_replace("%20"," ",$podrazdel);
$razdel = str_replace("%20"," ",$razdel);
$file_array[0] = str_replace("%20"," ",$file_array[0]);
	}
}
////////// проверка на админа end ////////
//////////////////////////////////  Постраничная навигация в темк //////////////////////////////////////////////////
echo "</td>";
echo "<td width=25%><br>";
/////// вывод блин
$file_array_ass=file("../wap/lcl/fm/$razdel/$podrazdel/rec.$entry");
$total_ass=count($file_array_ass)-1;
// определяем очередность сообщений и выводим их
$file_array_ass=file("../wap/lcl/fm/$razdel/$podrazdel/rec.$entry");
$i_ass=count($file_array_ass);
$count_ass= $i_ass;
$count_ass1 = $count_ass;
if (empty($start_ass))
{
$start_ass = 0;
}
$starts_ass = intval($start_ass);
if ($start_ass < 0)
{
$start_ass = 0;
}
$file_ass=fopen("../wap/lcl/msg_fm.dt","r");
$msg_fm=fgets($file_ass);
fclose($file_ass);
if ($count_ass > $start_ass + $msg_fm) $counts = $start + $msg_fm;
////////////////////////////////////////////////////////////////////////////////////
$file_array_ass = file("../wap/lcl/fm/$razdel/$podrazdel/rec.$entry");
$total_ass=count($file_array_ass);
// Вывод выбора страницы
if($total_ass>0)
{
$ba_ass=ceil($total_ass/$msg_fm);
$ba_ass2=$ba_ass*$msg_fm-$msg_fm;

$asd_ass=$start_ass-($msg_fm*4);
$asd_ass2=$start_ass+($msg_fm*5);

if (($asd_ass<$total_ass) && ($asd_ass>0)) { echo " <a href='showpst.php?start=0&razdel=$razdel&podrazdel=$podrazdel&entry=$entry&theme=$file_array[0]' class=forum2 title='Перейти на страницу 1'> 1 </a> ... "; }

if ($strok>$msg_fm)
	{
for ($i_ass=$asd_ass; $i_ass<$asd_ass2;)
{
if (($i_ass<$total_ass) && ($i_ass>=0))
{
$ii_ass=floor(1+$i_ass/$msg_fm);

if ($start_ass==$i_ass) {
echo"[ ";
echo " <a href='showpst.php?entry=$entry&razdel=$razdel&podrazdel=$podrazdel&entry=$entry&theme=$file_array[0]' class=forum2 title='Перейти на страницу $ii_ass'> $ii_ass </a>";
               }
                else {
echo " <a href='showpst.php?start=$i_ass&razdel=$razdel&podrazdel=$podrazdel&entry=$entry&theme=$file_array[0]' class=forum2 title='Перейти на страницу $ii_ass'> $ii_ass </a>";
                     }
}
$i_ass=$i_ass+$msg_fm;
}
if($asd_ass2<$total_ass) { echo " ... <a href='showpst.php?start=$ba_ass2&razdel=$razdel&podrazdel=$podrazdel&entry=$entry&theme=$file_array[0]' class=forum2 title='Перейти на страницу $ba_ass'> $ba_ass </a>"; }
echo " ]"; }
}
echo "</td>";
echo "</tr>";
echo "</table>";
////////////////////////////////////////////////////////////////////////////////////
$fil_arra=file("../wap/lcl/fm/$razdel/$podrazdel/rec.$entry");
$last=count($fil_arra);
$last=$last-1;
list ($from_r, $msg_r, $time_r) = explode("|", $fil_arra[$last]);
////////////////////////
$file=fopen("../wap/lcl/msg_fm.dt","r");
$mgs_fm=fgets($file);
$total_down=count($fil_arra);
$ba=ceil($total_down/$mgs_fm);
$ba2=$ba*$mgs_fm-$mgs_fm;
//////////////// вывод КтоСоздалТему, КоличестваОтветов, ПоследнийОтветивший ////////////////
list ($from_, $msg_, $time_) = explode("|", $fil_arra[1]);
$from_=trim($from_);
echo "</td><td align=center class=frm2><a href='../usr/prosmotr.php?log_pr=$from_' title='Просмотр профиля $from_'>$from_</a>";
echo "</td><td align=center class=frm2>$strok</td><td align=center class=frm2>";
if ($from_r!="guest") { echo "<a href='../usr/prosmotr.php?log_pr=$from_r' title='Просмотр профиля $from_r'>$from_r</a>"; }
else { echo "$from_r"; }
echo "<a href='showpst.php?entry=$entry&razdel=$razdel&podrazdel=$podrazdel&theme=$file_array[0]&start=$ba2' title='Последнее сообщение'><img src='../thm-wb/$url_thm/lastpost.gif' border=0></a>";
echo "<br>$time_r</td></tr>";
}
?>
</center>
</table>
<?php
if ($_SESSION)
{
$podrazdel = str_replace(" ","%20",$podrazdel);
$razdel = str_replace(" ","%20",$razdel);
echo "<div align=right><a href='newtopic.php?razdel=$razdel&podrazdel=$podrazdel' class=forum1 title='Создать тему'>[new topic]</a></div>";
}
////////////////////////////////////////////////////////////////////////////////////
// Вывод выбора далее\назад
if ($start != 0) {echo '<a href="show.php?start='.($start - $msg_fm_theme).'&razdel='.$razdel.'&podrazdel='.$podrazdel.'" class=forum2>&lt;-Назад</a> ';}else{echo'&lt;-Назад ';}
echo'|'; 
// Вывод выбора страницы
if($total>0)
{
$ba=ceil($total/$msg_fm_theme);
$ba2=$ba*$msg_fm_theme-$msg_fm_theme;

$asd=$start-($msg_fm_theme*4);
$asd2=$start+($msg_fm_theme*5);

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

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

if ($start==$i) {
echo ' <b>'.$ii.'</b>';
               }
                else {
echo ' <a href="show.php?start='.$i.'&razdel='.$razdel.'&podrazdel='.$podrazdel.'" class=forum2>'.$ii.'</a>';
                     }
}
$i=$i+$msg_fm_theme;
}
if($asd2<$total) { echo ' ... <a href="show.php?start='.$ba2.'&razdel='.$razdel.'&podrazdel='.$podrazdel.'" class=forum2>'.$ba.'</a>'; }
}
echo' |'; 
if ($total > $start + $msg_fm_theme) {echo ' <a href="show.php?start='.($start + $msg_fm_theme).'&razdel='.$razdel.'&podrazdel='.$podrazdel.'" class=forum2>Далее -&gt;</a>';}else{echo' Далее-&gt;';}

?>

<h5 align=right>
<input type="hidden" name="Choose site" class=select>
<SELECT onchange="top.location.href = this.options[this.selectedIndex].value;" class=select>
<option value="#" style="BACKGROUND: #663333; COLOR: #ffffff;">Выбор раздела</option>
<?php
// первый уровень начался
$dir_one = opendir ("../wap/lcl/fm/");
while ( $one_razdel = readdir ($dir_one))
{
if (( $one_razdel != ".") && ($one_razdel != ".."))
{
$one_razdel = str_replace(" ","%20",$one_razdel);
echo '<option VALUE='.$url.'/fm/index.php?razdel='.$one_razdel.' class=select>';
$one_razdel = str_replace("%20"," ",$one_razdel);
echo ' &nbsp; '.$one_razdel.'</a>';
// второй уровень начался
$dir_two = opendir ("../wap/lcl/fm/$one_razdel/");
while ( $one_podrazdel = readdir ($dir_two))
	{
if (( $one_podrazdel != ".") && ($one_podrazdel != ".."))
	{
$one_podrazdel = str_replace(" ","%20",$one_podrazdel);
$one_razdel = str_replace(" ","%20",$one_razdel);
echo '<option VALUE="'.$url.'/fm/show.php?podrazdel='.$one_podrazdel.'&razdel='.$one_razdel.'" class=select>';
$one_podrazdel = str_replace("%20"," ",$one_podrazdel);
$one_razdel = str_replace("%20"," ",$one_razdel);
echo ' &nbsp; &nbsp; '.$one_podrazdel.'</option>';
	}
	}
closedir ($dir_two);
// второй уровень кончился
}
}
?>
</h5>

</td>
</tr>
</table>

<?php
$f=fopen("../wap/lcl/panel2.dt","r");
$ifda=fgets($f);
$ifda=trim($ifda);
if ($ifda==1)
{
echo "</td>";
echo "<td width=100% valign=_top>";
require_once"../panel/panel2q.php";
}

require_once"../tmpl/dw.php";
decoder();
echo "</BODY>";
echo "</HTML>";
?>