View file forum/inc/theme.php

File size: 6.65Kb
<?


$k_page=1;


$id_forum=intval($_GET['id_forum']);

$q = mysql_query("SELECT * FROM `$mysql[pref]forum_f` WHERE `id` = '$id_forum';");

if(mysql_num_rows($q) != 0)

{

$forum = mysql_fetch_array($q);

}

else

{

header ("Location: index.php?".SID."&");


exit;

}



$id_razd=intval($_GET['id_razd']);

$q = mysql_query("SELECT * FROM `$mysql[pref]forum_r` WHERE `id_f` = '$id_forum' AND `id` = '$id_razd';");

if(mysql_num_rows($q) != 0)

{

$razd = mysql_fetch_array($q);

}

else

{

header ("Location: index.php?".SID."&id_forum=$id_forum");


exit;

}




$id_them=intval($_GET['id_them']);

$q = mysql_query("SELECT * FROM `$mysql[pref]forum_t` WHERE `id_f` = '$id_forum' AND `id_r` = '$id_razd' AND `id` = '$id_them';");

mysql_query("UPDATE `$mysql[pref]forum_t` SET `time_read` = '$time' WHERE `id` = '$id_them';");


if(mysql_num_rows($q) != 0)

{

$thema = mysql_fetch_array($q);

}

else

{

header ("Location: index.php?".SID."&id_forum=$id_forum&id_razd=$id_razd");




exit;

}


if ($mail_in_new>0)echo "<div class=\"privat\"><img src=\"../SYSTEM/themes/$them/img/mail0.gif\" alt=\"\" /> <a href=\"../mail.php?act=in\">Приват</a> [$mail_in_new]</div><hr />\n";

echo "<div class=\"menu\">*<a href=\"new.php\">Новые сообщения</a><br />";

echo "##<a href=\"reload.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;page=end\">Обновить</a><br />";

echo "##<a href=\"../PAGES/smiles.php\">Смайлы</a><br />";

/*echo "<div class=\"str\"><a href=\"index.php?id_forum=$id_forum\">".$forum['name']."</a>";

echo " Ξ <a href=\"index.php?id_forum=$id_forum&amp;id_razd=$id_razd\">".$razd['name']."</a>\n";

echo " Ξ <a href=\"reload.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;page=end\">Обновить</a>";

if (!isset($_SESSION['order'])){

echo " | <a href=\"order.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;order=asc\">обратное отображение</a>!!!";

echo $_SESSION['order'];}

else

{

//echo " | <a href=\"order.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;order=desc\">обратное отображение</a>";

echo $_SESSION['order'];}

*/

echo "</div><hr />";

echo "<div class=\"h\">$thema[name]</div><hr />\n";

if ($thema['close']==1)

{

echo "<span style=\"color:$color[msg]\"><b>";

echo "Тема закрыта<br />\n";

echo "</b></span>";

}

echo "<br />\n";


$q = mysql_query("SELECT COUNT(*) FROM `$mysql[pref]forum_p` WHERE `id_f` = '$id_forum' AND `id_r` = '$id_razd' AND `id_t` = '$id_them';");


$k_post=mysql_result($q, 0);



if ($k_post>0)

{




//// кол-во пунктов на страницу ////

if (isset($user))               ////

$k_p_str=$user['forum_k_p_s'];  ////

else $k_p_str=$set['k_p_s'];    ////

////////////////////////////////////

$k_page=k_page($k_post,$k_p_str);

$page=page();





if ($k_page<$page){$page=$k_page;}

if (0>$page){$page=1;}

$i=$k_p_str*$page-$k_p_str;

$post_t=$i;

$q4 = mysql_query("SELECT * FROM `$mysql[pref]forum_p` WHERE `id_f` = '$id_forum' AND `id_r` = '$id_razd' AND `id_t` = '$id_them' ORDER BY id DESC LIMIT $i, $k_p_str;");

while ($post = mysql_fetch_array($q4))

{

$post_t++;

$timep=vremja($post['time']+$timesdvig);



echo "<div class=\"mess\">\n";

echo "<div class=\"menu\">\n";

if (isset($user) && $user['level']>0 && $user['slinks']==0)

echo "<a href=\"set_p.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;id_post=$post[id]&amp;page=$page\">\n";

user_pic($post['id_us']);

if (isset($user) && $user['level']>0 && $user['slinks']==0)echo "</a>\n";




if ($thema['id_us']==$post['id_us'])$autor=" <span style=\"color:$color[autor]\">(авт)</span>.";

else $autor='';


if ($set['forum_show_num_post']==1) echo "$post_t ";


if (isset($user))

echo " ".user_nick($post['id_us'], "user.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;page=$page&amp;id_user=$post[id_us]")."$autor";

else

echo " ".user_nick($post['id_us'], "../info.php?id=$post[id_us]")."$autor";

echo "<a href=\"../info.php?id=$post[id_us]\">[i]</a><br />\n";



echo "<br />\n";

echo "<small><span style=\"color:$color[post_time]\">[$timep]</span></small>";

echo "<br />\n";

echo "</div>\n";

$post_user_id=$post[$i]['id_user'];

$q = mysql_query("SELECT * FROM `$mysql[pref]users` WHERE `id` = 

'$post_user_id';");

$post_user = mysql_fetch_array($q);
if ($post_user['level']>0)

echo "<span style=\"color:$color[post]\">".bbcode (admin_smiles(smiles(links($post['msg']))))."</span>";

else


echo "<span style=\"color:$color[post]\">".bbcode (smiles(links($post['msg'])))."</span>";












echo "";

echo "";



if ( $post['time_mod']!=0)

{

echo "<br /><small><span style=\"color:$color[edit]\">Изменено: ".$post['nick_mod']."<br />";

$timed=vremja($post['time_mod']+$timesdvig);

echo "[$timed]</span></small>";

}

elseif(isset($user) && $user['id']==$post['id_us'] && $post_t==$k_post && $thema['close']!=1)

{

echo "<br /><a href=\"set_p.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;id_post=$post[id]&amp;page=$page\">Изменить</a>\n";

}



echo "</div>\n";

echo "<br />\n";

}

}

else

{

echo "Нет постов<br />\n";

}



echo "<hr />\n<div class=\"str\">";

str("index.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;",$k_page,$page);

echo "</div>\n";


echo "<hr />\n";

if (isset($user) && $thema['close']==0)

{

if ($user['p_vvoda']==1)

{


echo "<form method=\"post\" action=\"add_p.php?act=add&amp;id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;page=$page\">\n";


echo "Сообщение:<br />\n<textarea name=\"msg\" class=\"form\" rows=\"3\"></textarea><br />\n";

//echo "<input type=\"checkbox\" name=\"tr\" value=\"1\" /> Транслит<br />\n";

echo "<input value=\"Добавить\" class=\"form\" type=\"submit\" />\n";



echo "</form>\n";

echo "<hr />\n";

}

else

{

echo "<a href=\"add_p.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;page=$page\">Ответить</a><br />\n";

}

if ($user['id']==$thema['id_us'])

{

echo "<a href=\"close.php?id_forum=$id_forum&amp;id_razd=$id_razd&amp;id_them=$id_them&amp;page=$page\">Закрыть тему</a><br />\n";

}

}




echo "<a href=\"index.php?id_forum=$id_forum&amp;id_razd=$id_razd\">&lt;&lt; $razd[name]</a>\n";

echo "<br /><a href=\"index.php?id_forum=$id_forum\">&lt;&lt; $forum[name]</a><hr />\n";

//echo "<br /><a href=\"index.php\">&lt;&lt; К форумам</a><br />\n";

?>