Файл: _gladiators2_/gladiators2/gladiators/gladiators/system/modules/mod_viewforum.php
Строк: 77
<?
include($root."/forum/header.php");
$db = new DBconn; // Connect to MySQL base
$db->Conn("greece",$server_conf);
$db->query("select align from users where id=".$_SESSION[id]);
$db->fetch_array();
$forum_id = explode("?",$path[2]);
$access = 0;
$file = file($root."/database/forum/".$forum_id[0]."/settings.set");
$moder = $file[0];
$read = $file[1];
$moder = explode(" ",$moder);
$read = explode(" ",$read);
if(strstr($read[1],"all"))
$access = 1;
elseif(strstr($read[1],"moder"))
{
if(preg_match("/^(uid_".$_SESSION["id"].";)/",$moder[1]) || preg_match("/(;uid_".$_SESSION["id"].";)/",$moder[1]))
$access = 1;
}
elseif(preg_match("/^(uid_".$_SESSION["id"].";)/",$read[1]) || preg_match("/(;uid_".$_SESSION["id"].";)/",$read[1]))
$access = 1;
elseif(preg_match("/^(align_".$db->row["align"].";)/",$read[1]) || preg_match("/(;align_".$db->row["align"].";)/",$read[1]))
$access = 1;
if(!$access)
echo"<span style='color:darkred;font-weight:bold'>У вас нет прав для просмотра данной конференции!</span>";
else
{
$topics = array(array(),array(),array(),array());
$count_topics = 0;
$dir = opendir($root."/database/forum/".$forum_id[0]);
$i = 0;
while ($file=readdir($dir))
{
if (strstr($file,".topic"))
{
$fl = str_replace(".topic","",$file);
$str = file($root."/database/forum/".$forum_id[0]."/".$file);
$topics[0][$i] = $str[0];
$topics[1][$i] = $str[count($str)-1];
$topics[2][$i] = count($str)-1;
$topics[3][$i] = $fl;
$i++;
}
}
closedir($dir);
$count_topics = $i;
$stream_pr = file($root."/database/forum/important.dat");
$i = 0;
$trans = 1;
while($i<=$count_topics-1 && $trans)
{
$trans = 0;
for($j=1;$j<=$count_topics-1;$j++)
{
$row1 = explode("|",$topics[1][$j-1]);
$row2 = explode("|",$topics[1][$j]);
$row1_t = explode("|",$topics[0][$j-1]);
$row2_t = explode("|",$topics[0][$j]);
if(($row2[0] > $row1[0] && check_pr($stream_pr,$row2_t[0]) >= check_pr($stream_pr,$row1_t[0])) || check_pr($stream_pr,$row2_t[0]) > check_pr($stream_pr,$row1_t[0]))
{
$trans = 1;
$t = $topics[0][$j];
$topics[0][$j] = $topics[0][$j-1];
$topics[0][$j-1] = $t;
$t = $topics[1][$j];
$topics[1][$j] = $topics[1][$j-1];
$topics[1][$j-1] = $t;
$t = $topics[2][$j];
$topics[2][$j] = $topics[2][$j-1];
$topics[2][$j-1] = $t;
$t = $topics[3][$j];
$topics[3][$j] = $topics[3][$j-1];
$topics[3][$j-1] = $t;
}
}
$i++;
}
$pages = $count_topics/20;
$pages = explode(".",$pages);
if(!$pages[1] && $pages[0])
$pages[0]--;
echo"<span class=comm><b>Страницы:</b></span> ";
for($i=0;$i<=$pages[0];$i++)
{
if($i==$forum_id[1])
echo"<a href=/forum/".$forum_id[0]."?".$i." style='font-weight:bold;color:darkred'><big>".$i."</big></a> ";
else
echo"<a href=/forum/".$forum_id[0]."?".$i." style='font-weight:bold;'>".$i."</a> ";
}
if(!$forum_id[1])
$forum_id[1] = 0;
$num = $forum_id[1]*20;
$max = $num+20;
if($max > $count_topics-1)
$max = $count_topics;
if($count_topics > 0)
echo"<br><br><table border=0 cellsapcing=0 cellpadding=10 width=100%>
<tr>
<td align=center width=400><b style='color:7c7c5b'><small>Название топика:</small></b></td>
<td align=center width=20><b style='color:7c7c5b'><small>Ответов:</small></b></td>
<td align=center width=200><b style='color:7c7c5b'><small>Тему создал:</small></b></td>
<td align=center width=200><b style='color:7c7c5b'><small>Последнее сообщение:</small></b></td>
</tr>";
for($i=$num;$i<=$max-1;$i++)
{
$row_theme = explode("|",$topics[0][$i]);
echo"<tr><td bgcolor=#cbcbb0>";
if(check_close("",$row_theme[0]))
echo"<span style='font-weight:bold;color:darkred;cursor:hand' title='Тема закрыта'>X</span> ";
$row_theme[1] = StripSlashes($row_theme[1]);
if(check_pr($stream_pr,$row_theme[0]))
{
echo"<span style='color:darkred;font-weight:bold'>Важно:</span><b>
<a href='/forum/".$forum_id[0]."/".$topics[3][$i].".html'><b>".$row_theme[1]."</b></a>";
}
else
echo"<a href='/forum/".$forum_id[0]."/".$topics[3][$i].".html'>".$row_theme[1]."</a>";
echo"</td>
<td bgcolor=#cbcbb0 align=center><small>".$topics[2][$i]."</small></td>
<td bgcolor=#cbcbb0 width=250>";
$row_pl = explode("#",$row_theme[3]);
echo ch_info($row_pl[0],$row_pl[1],$row_pl[3],$row_pl[2],$config["img_server"]);
echo"</td><td bgcolor=#cbcbb0 width=250 height=40>";
$row_last_msg = explode("|",$topics[1][$i]);
if($row_last_msg[0]==$row_theme[0])
echo"<center><small style='color:6f6f6b'>нет ответов</small></center>";
else {
$row_pl = explode("#",$row_last_msg[3]);
echo ch_info($row_pl[0],$row_pl[1],$row_pl[3],$row_pl[2],$config["img_server"]);
echo" <br><small style='color:6f6f6b'>создано: ".$row_last_msg[2]."</small>";
}
echo"</td></tr>n";
}
if($count_topics==0)
echo"<br><br><i>В этой конференции еще нет сообщений</i><br><br>";
if($count_topics > 0)
echo"n</table><br>";
echo"<span class=comm><b>Страницы:</b></span> ";
for($i=0;$i<=$pages[0];$i++)
{
if($i==$forum_id[1])
echo"<a href=/forum/".$forum_id[0]."?".$i." style='font-weight:bold;color:darkred'><big>".$i."</big></a> ";
else
echo"<a href=/forum/".$forum_id[0]."?".$i." style='font-weight:bold;'>".$i."</a> ";
}
}
include($root."/forum/footer.php");
?>