Вход Регистрация
Файл: _gladiators2_/gladiators2/gladiators/gladiators/system/modules/mod_viewtopic.php
Строк: 107
<?

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]);
$topic_id explode(".",$path[3]);
$topic_p explode("?",$topic_id[1]);

if(!
$topic_p[1])
 
$topic_p[1] = 0;

$access 0;

$file file($root."/database/forum/".$forum_id[0]."/settings.set");
$moder $file[0];
$read $file[1];
$edit $file[3];
$del $file[4];

$moder explode(" ",$moder);
$read explode(" ",$read);
$edit explode(" ",$edit);
$del explode(" ",$del);

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;

$moder_on 0;

if(
preg_match("/^(uid_".$_SESSION["id"].";)/",$moder[1]) || preg_match("/(;uid_".$_SESSION["id"].";)/",$moder[1]))
 
$moder_on 1;
elseif(
preg_match("/(^|;)(align_".$db->row["align"].";)/",$moder[1]))
 
$moder_on 1;


if(!
$access)
 echo
"<span style='color:darkred;font-weight:bold'>У вас нет прав для просмотра данной конференции!</span>";
else
{
 if(
file_exists($root."/database/forum/".$forum_id[0]."/".$topic_id[0].".topic"))
 {
  
$file file($root."/database/forum/".$forum_id[0]."/".$topic_id[0].".topic");
  
$count count($file);
 }
 else
  
$count 0;

$kol 0;

$list_array = array();

for(
$i=0;$i<=$count-1;$i++)
{
 
$row explode("|",$file[$i]);

 if(
$row[0]==$topic_id[0])
  
$list_array[] = $file[$i];
}

$pages $count/20;
$pages explode(".",$pages);

if(!
$pages[1])
 
$pages[0]--;

echo
"<span class=comm><b>Страницы:</b></span> ";

for(
$i=0;$i<=$pages[0];$i++)
{
 if(
$i==$topic_p[1])
  echo
"<a href=/forum/".$forum_id[0]."/".$topic_id[0].".html?".$i." style='font-weight:bold;color:darkred'><big>".$i."</big></a> ";
 else
  echo
"<a href=/forum/".$forum_id[0]."/".$topic_id[0].".html?".$i." style='font-weight:bold;'>".$i."</a> ";
}

if(!
$topic_p[1])
 
$topic_p[1] = 0;


$num $topic_p[1]*20;
$max $num+20;

if(
$max $count-1)
 
$max $count;

echo
"<br><br><table border=0 cellsapcing=0 cellpadding=5 width=100%>";

for(
$i=$num;$i<=$max-1;$i++)
{
 
$row explode("|",$file[$i]);

 if(
$kol==0)
 {
  
$row_title explode("|",$file[0]);

  echo
"<big><b><i>".StripSlashes($row_title[1])."</i></b></big>";

  if(
check_close("",$row_title[0]))
   echo
"<br><span style='color:darkred;font-weight:bold'>Тема закрыта</span>";

  echo
"<br><br>";
 }
 echo
"<tr><td>";

 
$row_pl explode("#",$row[3]);

 echo 
ch_info($row_pl[0],$row_pl[1],$row_pl[3],$row_pl[2],$config["img_server"]);

 echo
" <small>дата: ".$row[2]." | тема: ".StripSlashes($row[1])."</small>";

 
$row[4] = preg_replace("/(?<!")(http|ftp):\/\/(\S+)/si",'<a href="\1://\2" target=_blank>\1://\2</a>',$row[4]);
 
$row[4] = str_replace("&lt;B&gt;","<b>",$row[4]);
 
$row[4] = str_replace("&lt;/B&gt;","</b>",$row[4]);
 
$row[4] = str_replace("&lt;I&gt;","<i>",$row[4]);
 
$row[4] = str_replace("&lt;/I&gt;","</i>",$row[4]);
 
$row[4] = str_replace("&lt;U&gt;","<u>",$row[4]);
 
$row[4] = str_replace("&lt;/U&gt;","</u>",$row[4]);
 
$row[4] = str_replace("&lt;CODE&gt;","<CODE>",$row[4]);
 
$row[4] = str_replace("&lt;/CODE&gt;","</CODE>",$row[4]);

 
preg_match_all("/[:]{1}[a-zA-Z0-9_-]+[:]{1}/",$row[4],$ch_smiles);

 
$j 0;

 while(
$j<=count($ch_smiles[0]) && $j<=4)
 {
  
$sm str_replace(":","",$ch_smiles[0][$j]);
  if(
file_exists($root."/img/smiles/forum/main/".$sm.".gif"))
   
$row[4] = str_replace(":".$sm.":","<img src=".$config["img_server"]."/smiles/forum/main/".$sm.".gif>",$row[4]);
  if(
file_exists($root."/img/smiles/forum/extended/".$sm.".gif"))
   
$row[4] = str_replace(":".$sm.":","<img src=".$config["img_server"]."/smiles/forum/extended/".$sm.".gif>",$row[4]);

  
$j++;
 }
 
$row[4] = StripSlashes($row[4]);
 echo
"</td></tr><td bgcolor=#cbcbb0 colspan=2>".$row[4]."</td></tr><tr><td valign=top align=right>

<table border=0 cellspacing=0 cellpadding=0>
<tr>"
;

 
$editable 0;


 if(
$moder_on)
 {
  echo
"<td width=10></td><td><a href='/forum/".$forum_id[0]."/".$topic_id[0].".html?".$topic_p[1]."/hidden_".$row[0]."' onclick="return confirm('В дальнейшем содержание нельзя будет восстановить. Вы точно хотите скрыть содержание сообщения?');"><b><small>Скрыть содержание</small></b></a></td>";
  echo
"<td width=10></td><td><a style='cursor:pointer;cursor:hand' onclick="add_mess('".$forum_id[0]."','".$topic_id[0]."','".$topic_p[1]."','".$row[0]."');"><b><small>Добавить текст</small></b></a></td>";

 }
 
 if(
strstr($edit[1],"all") && $row_pl[0]==$_SESSION["login"])
  
$editable 1;
 elseif(
strstr($edit[1],"moder") && $moder_on)
  
$editable 1;
 elseif(
preg_match("/^(uid_".$_SESSION["id"].";)/",$edit[1]) || preg_match("/(;uid_".$_SESSION["id"].";)/",$edit[1]))
  
$editable 1;
 elseif(
preg_match("/^(align_".$db->row["align"].";)/",$edit[1]) || preg_match("/(;align_".$db->row["align"].";)/",$edit[1]))
  
$editable 1;

 if(
$editable==1)
  echo
"<td width=10></td><td><a href='/forum/".$forum_id[0]."/".$topic_id[0].".html?".$topic_p[1]."/edit_".$row[0]."'><b><small>Редактировать</small></b></a></td>";

 
$delitable 0;

 if(
strstr($del[1],"all") && $row_pl[0]==$_SESSION["login"])
  
$delitable 1;
 elseif(
strstr($del[1],"moder") && $moder_on)
  
$delitable 1;
 elseif(
preg_match("/^(uid_".$_SESSION["id"].";)/",$del[1]) || preg_match("/(;uid_".$_SESSION["id"].";)/",$del[1]))
  
$delitable 1;
 elseif(
preg_match("/^(align_".$db->row["align"].";)/",$del[1]) || preg_match("/(;align_".$db->row["align"].";)/",$del[1]))
  
$delitable 1;

 if(
$delitable==1)
  echo
"<td width=10></td><td><a href='/forum/".$forum_id[0]."/".$topic_id[0].".html?".$topic_p[1]."/delete_".$row[0]."' onclick='return confirm("Вы действительно хотите удалить это сообщение?");'><b><small>Удалить(x)</small></b></a></td>";


 echo
"</tr></table></td></tr>n";

 
$kol++;

}

echo
"</table>";
echo
"<span class=comm><b>Страницы:</b></span> ";

for(
$i=0;$i<=$pages[0];$i++)
{
 if(
$i==$topic_p[1])
  echo
"<a href=/forum/".$forum_id[0]."/".$topic_id[0].".html?".$i." style='font-weight:bold;color:darkred'><big>".$i."</big></a> ";
 else
  echo
"<a href=/forum/".$forum_id[0]."/".$topic_id[0].".html?".$i." style='font-weight:bold;'>".$i."</a> ";
}

if(
$moder_on)
{
 echo
"<br><br><input type=submit value='Удалить топик' class=button onclick='javascript: if(confirm("Вы действительно хотите удалить эту тему?")==true)window.location="/forum/".$forum_id[0]."/".$topic_id[0].".html?".$topic_p[1]."/deltopic_".$topic_id[0].""'>";

 if(
check_close("",$topic_id[0]))
  echo
" <input type=submit value='Открыть топик' class=button onclick='javascript: if(confirm("Вы действительно хотите открыть этот топик?")==true)window.location="/forum/".$forum_id[0]."/".$topic_id[0].".html?".$topic_p[1]."/opentopic_".$topic_id[0].""'>";
 else
  echo
" <input type=submit value='Закрыть топик' class=button onclick='javascript: if(confirm("Вы действительно хотите закрыть этот топик?")==true)window.location="/forum/".$forum_id[0]."/".$topic_id[0].".html?".$topic_p[1]."/closetopic_".$topic_id[0].""'>";
}


// END OF CHECK ALIGN

include($root."/forum/footer.php");
?>
Онлайн: 1
Реклама