<?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/err.php";
?>
<table border=0 cellspacing=5 cellpadding=0 width=100%>
<tr>
<td><div class=a>
<?php
echo "Форум на $title";
?>
</div></td>
</tr>
<tr>
<td>
<?php
$razdel=$_GET['razdel'];
$podrazdel=$_GET['podrazdel'];
$entry=$_GET['entry'];
$theme=$_GET['theme'];
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> | ";
$podrazdel = str_replace(" ","%20",$podrazdel);
$razdel = str_replace(" ","%20",$razdel);
echo "<a href=$url/fm/show.php?razdel=$razdel&podrazdel=$podrazdel class=forum1>";
$podrazdel = str_replace("%20"," ",$podrazdel);
$razdel = str_replace("%20"," ",$razdel);
echo "$podrazdel</a>";
echo " | $theme";
echo "</center>";
echo "<table border=0 cellspacing=5 cellpadding=0 width=100%>";
// определяем очередность сообщений и выводим их
$file_array=file("../lcl/fm/$razdel/$podrazdel/rec.$entry");
$i=count($file_array);
$count = $i;
$count1 = $count;
if (empty($start))
{
$start = 0;
}
$start = intval($start);
if ($start < 0)
{
$start = 0;
}
$file=fopen("../lcl/msg_fm.dt","r");
$mgs_fm=fgets($file);
if ($count > $start + $mgs_fm) $count = $start + $mgs_fm;
fclose($file);
echo "<table border=0 cellspacing=5 cellpadding=0 width=100%>";
// выводим все сообщения в цикле
for ($i = $start; $i < $count; $i++)
{
if ($i!=0)
{
list ($from, $msg, $time) = explode("|", $file_array[$i]);
// делаем bb-code
$msg = str_replace("[color=red]","<font color=red>",$msg);
$msg = str_replace("[color=blue]","<font color=blue>",$msg);
$msg = str_replace("[color=green]","<font color=green>",$msg);
$msg = str_replace("[color=yellow]","<font color=yellow>",$msg);
$msg = str_replace("[/color]","</font>",$msg);
$msg = str_replace("[u]","<u>",$msg);
$msg = str_replace("[U]","<u>",$msg);
$msg = str_replace("[i]","<i>",$msg);
$msg = str_replace("[I]","<i>",$msg);
$msg = str_replace("[b]","<B>",$msg);
$msg = str_replace("[B]","<B>",$msg);
$msg = str_replace("[sub]","<SUB>",$msg);
$msg = str_replace("[SUB]","<SUB>",$msg);
$msg = str_replace("[sup]","<SUP>",$msg);
$msg = str_replace("[SUP]","<SUP>",$msg);
$msg = str_replace("[/u]","</u>",$msg);
$msg = str_replace("[/U]","</u>",$msg);
$msg = str_replace("[/i]","</i>",$msg);
$msg = str_replace("[/I]","</i>",$msg);
$msg = str_replace("[/b]","</B>",$msg);
$msg = str_replace("[/B]","</B>",$msg);
$msg = str_replace("[/SUB]","</SUB>",$msg);
$msg = str_replace("[/sub]","</SUB>",$msg);
$msg = str_replace("[/SUP]","</SUP>",$msg);
$msg = str_replace("[/sup]","</SUP>",$msg);
$msg = eregi_replace("(.*)\\[url\\](.*)\\[/url\\](.*)","\\1<ahref=\\2>\\2</a>\\3",$msg);
$msg = str_replace("[br]","<br>",$msg);
$msg = str_replace(";)","<img src='../wap/img/bb_icons/smile.gif'>",$msg);
$msg = str_replace(":dance:","<img src='../wap/img/bb_icons/4.gif'>",$msg);
$msg = str_replace(";(","<img src='../wap/img/bb_icons/2.gif'>",$msg);
$msg = str_replace(":lol:","<img src='../wap/img/bb_icons/8.gif'>",$msg);
$msg = str_replace(":ok:","<img src='../wap/img/bb_icons/9.gif'>",$msg);
$msg = str_replace(":shit:","<img src='../wap/img/bb_icons/13.gif'>",$msg);
$msg = str_replace(":star:","<img src='../wap/img/bb_icons/star.gif'>",$msg);
// непосредственный вывод
$from=trim($from);
echo "<tr><td class=frm3><div class=ab>$from</div></td><td align=right><div class=ab> $time";
////////// проверка на админа ////////
if ($_SESSION)
{
$files_array = file("../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);
echo ("<a href='fm_msg_del.php?del=$i&razdel=$razdel&podrazdel=$podrazdel&entry=$entry&theme=$theme' class=cool>[del]</a>");
echo ("<a href='msg_edit.php?del=$i&razdel=$razdel&podrazdel=$podrazdel&entry=$entry&theme=$theme&i=$i' class=cool>[edit]</a></div>");
}
}
////////// проверка на админа ////////
echo "</td></tr><tr><td valign=_top>";
echo "$msg<br></td>";
echo "</td></tr>";
$theme = $file_array[0];
}
}
echo "</td>";
echo "</tr>";
print "</table>";
$file=fopen("../lcl/perm_fm.dt","r");
$guest=fgets($file);
if ($_SESSION)
{
$log=$_SESSION['username'];
?>
<table width=1 border=0>
<?php
$podrazdel = str_replace(" ","%20",$podrazdel);
$razdel = str_replace(" ","%20",$razdel);
$theme = str_replace(" ","%20",$theme);
if ($start != 0)
{
echo '<form action=fm_add.php?log='.$log.'&entry='.$entry.'&start='.($start - $mgs_fm).'&razdel='.$razdel.'&podrazdel='.$podrazdel.'&theme='.$theme.' method=post name="formular">';
}
if ($count1 > $start + $mgs_fm)
{
echo '<form action=fm_add.php?log='.$log.'&entry='.$entry.'&start='.($start + $mgs_fm).'&razdel='.$razdel.'&podrazdel='.$podrazdel.'&theme='.$theme.' method=post name="formular">';
}
else
{
echo '<form action=fm_add.php?log='.$log.'&entry='.$entry.'&razdel='.$razdel.'&podrazdel='.$podrazdel.'&theme='.$theme.' method=post name="formular">';
}
?>
<tr>
<td colspan=2>Сообщение | post:<br>
<textarea cols=18 rows=5 name=msg class=input>
</textarea>
</td>
</tr>
<tr>
<td colspan=2><center><input type=submit value='Добавить' class=submit></center></td>
</tr>
</form>
</table>
<?php
}
if ((!$_SESSION) && ($guest==1))
{
?>
<table width=1 border=0>
<?php
$podrazdel = str_replace(" ","%20",$podrazdel);
$razdel = str_replace(" ","%20",$razdel);
$theme = str_replace(" ","%20",$theme);
if ($start != 0)
{
echo '<form action=fm_add.php?log=guest&entry='.$entry.'&razdel='.$razdel.'&podrazdel='.$podrazdel.'&theme='.$theme.'&start='.($start - $mgs_fm).' method=post name="formular">';
}
if ($count1 > $start + $mgs_fm)
{
echo '<form action=fm_add.php?log=guest&entry='.$entry.'&razdel='.$razdel.'&podrazdel='.$podrazdel.'&theme='.$theme.'&start='.($start + $mgs_fm).' method=post name="formular">';
}
?>
<tr>
<td colspan=2>Сообщение: <font color=red></font><br>
<textarea cols=100% rows=7 name='msg' class=input>
</textarea>
</td>
</tr>
<tr>
<td colspan=2><center><input type=submit value='Добавить' class=submit></center></td>
</tr>
</form>
</table>
<?php
}
if ((!$_SESSION) && ($guest==0))
{
?>
<center>
<table border=0 width=100%>
<tr>
<td align=center><font color=00FF00>Для добавления сообщения необходимо авторизоваться</font></td>
</tr>
</table>
</center>
<?php
}
/////////////////////////
print "<right>";
if ($start != 0)
{
$theme = str_replace(" ","%20",$theme);
$podrazdel = str_replace(" ","%20",$podrazdel);
$razdel = str_replace(" ","%20",$razdel);
print "<A href=showpst.php?razdel=$razdel&podrazdel=$podrazdel&entry=$entry&start=".($start - $mgs_fm)."&theme=$theme class=forum2> Предыдущие </A>";
$theme = str_replace("%20"," ",$theme);
$podrazdel = str_replace("%20"," ",$podrazdel);
$razdel = str_replace("%20"," ",$razdel);
}
if ($count1 > $start + $mgs_fm)
{
$theme = str_replace(" ","%20",$theme);
$podrazdel = str_replace(" ","%20",$podrazdel);
$razdel = str_replace(" ","%20",$razdel);
print "<A href=showpst.php?razdel=$razdel&podrazdel=$podrazdel&entry=$entry&start=".($start + $mgs_fm)."&theme=$theme class=forum2> Следующие </A> \n";
$theme = str_replace("%20"," ",$theme);
$podrazdel = str_replace("%20"," ",$podrazdel);
$razdel = str_replace("%20"," ",$razdel);
}
print "</right>";
////////////////////////////////////////////////////////////////////////////////////
?>
</td>
</tr>
</table>
<?php
require_once"../tmpl/dw.php";
?>