".$subject.""; if($moved>0) echo "(Тема выделена)"; if($moved<0) echo "(Тема перемещена)"; if($row['topic_vote']!=0) { $sql="SELECT * FROM ".PRFX."vote_desc WHERE topic_id=$topic"; $res=mysql_query($sql) OR died ($sql);//died ($sql); $vote=mysql_fetch_array($res); $have_vote=1; if(!isGuest()) { $sql="SELECT vote_user_id FROM ".PRFX."vote_voters WHERE vote_id='".$vote['vote_id']."' AND vote_user_id=".USERID; $res=mysql_query($sql) OR died ($sql); if(mysql_num_rows($res)==0) $have_vote=0; list($posterid)=mysql_fetch_row($res); } else $have_vote=1; echo "
"; echo "
Голосование: ".$vote['vote_text']; if(u_perm("CanModerate","profile",$fuid) OR (USERID==$posterid AND USERID!=GUESTID)) echo " [Редактировать]"; echo "

"; $cnt=0; $sql="SELECT vote_result FROM ".PRFX."vote_results WHERE vote_id=".$vote['vote_id']; $res=mysql_query($sql) OR died ($sql); while ($vote3=mysql_fetch_array($res)) $cnt=$cnt+$vote3['vote_result']; $sql="SELECT * FROM ".PRFX."vote_results WHERE vote_id=".$vote['vote_id']; $res=mysql_query($sql) OR died ($sql); if($have_vote==1) { while ($vote2=mysql_fetch_array($res)){ $prct=(100/$cnt)*$vote2['vote_result']; $prct2=$prct*2; echo ""; } echo "
".$vote2['vote_option_text']."\"\"".round($prct)." %"."[".$vote2['vote_result']." голосов]"; } } else { echo "
"; while ($vote2=mysql_fetch_array($res)){ $prct=(100/$cnt)*$vote2['vote_result']; echo ""; } echo "
".$vote2['vote_option_text']."   [".$vote2['vote_result']." голосов]


"; echo "
Всего голосов: ".$cnt."

"; echo "

"; } $query="SELECT COUNT(*) as nm FROM ".PRFX."posts as p LEFT JOIN ".PRFX."posts_text as t ON (p.post_id=t.post_id) LEFT JOIN ".PRFX."users as u ON (p.poster_id=u.userid) WHERE p.topic_id=$topic"; $result=mysql_query($query) OR died ($query);//die ($query); list($nm)=mysql_fetch_row($result); $query="SELECT t.bbcode_uid, p.post_id, p.topic_id, p.forum_id, p.poster_id, p.post_time, p.poster_ip, p.post_username, post_subject, t.post_text, u.`name`, u.isactive, u.regdate, u.avatar, u.icq, u.website, u.`from`, u.gender, u.sig, p.post_edit_time, p.post_edit_count, p.mov_from, p.mov_by FROM ".PRFX."posts as p LEFT JOIN ".PRFX."posts_text as t ON (p.post_id=t.post_id) LEFT JOIN ".PRFX."users as u ON (p.poster_id=u.userid) WHERE p.topic_id=$topic ORDER BY post_time"; $pagelist=""; $lastpage=ceil($nm/MSGPP); if(($page*MSGPP)>($nm+MSGPP)) $page=$lastpage; if($lastp) $page=$lastpage; if($nm>MSGPP && !$page OR $page<0) $page=1; if ($lastpage>1) { $pagelist="Страницы: "; $pp=$page-1; $np=$page+1; if ($page>1) $pagelist.="<< Пpeдыдущaя  "; for($i=1; $i<=$lastpage; $i++) { if ($page!=$i) $pagelist.=""; $pagelist=$pagelist."$i"; if ($page!=$i) $pagelist.=""; $pagelist.="  "; }; if ($page<$lastpage) $pagelist.=" Cлeдующaя>>"; }; $br_d = ($page-1)*MSGPP; $br_u = MSGPP; if($br_u+$br_d>$nm) $br_u = $nm-$br_d ; if($nm>MSGPP) $query = $query . " LIMIT $br_d,$br_u"; $result=mysql_query($query) OR died ($query);//echo $query; ############## echo "
".$pagelist.""; if($status==1) echo "Тема закрыта."; else echo "Ответить"; ############## echo "

"; if(u_perm("CanModerate","profile",$fuid)) echo "
"; else echo ""; echo ""; $sql="UPDATE ".PRFX."topics SET topic_views = topic_views+1 WHERE topic_id =".$topic; $res=mysql_query($sql) OR died ($sql); while($row=mysql_fetch_array($result)) { $sql="SELECT count(*) FROM ".PRFX."posts WHERE poster_id=".$row['poster_id']; $res=mysql_query($sql) OR died ($sql); list($cmsgs)=mysql_fetch_row($res); if(!isGuest()) { $newms=0; $query4="SELECT msgid FROM `".PRFX."newmsgs` WHERE msgid='".$row['post_id']."' AND userid = ".USERID; $result4=mysql_query($query4) OR died ($query4); if(mysql_num_rows($result4)>0) { $newms=1; $query5="DELETE FROM `".PRFX."newmsgs` WHERE msgid='".$row['post_id']."' AND userid = ".USERID; $result5=mysql_query($query5) OR died ($query5); $old=$row['post_id']-3000; $query5="DELETE FROM `".PRFX."newmsgs` WHERE msgid<'".$old."'"; $result5=mysql_query($query5) OR died ($query5); log_message ("[topic.php] Unset newmsgs for user:".USERID." (postid:".$row['post_id'].") "); } } if($newms!=0) {$newmsgs=" bgcolor='#FCC1BC'";$newms=0;} else $newmsgs = ""; if(abs($row['poster_id'])==GUESTID) $user=$row['post_username']; else $user=$row['name']; if(empty($user))$user=$lang['core']['guest']; $ronly=""; if($row['isactive']>time()) $ronly="style='color: gray'"; //if(abs($row['poster_id'])!=GUESTID) $gst=getrang($row['poster_id'],$cmsgs); else $gst=$lang['core']['guest']; $gst=getrang($row['poster_id'],$cmsgs); if(SHOWAWATAR==1) $gst.="
".getavatar($row['avatar']); $str=""; $str.=""; $str.=""; echo $str; } echo "
АвторСообщение
".$user."
".$gst.""; if(abs($row['poster_id'])!=GUESTID) { $str.="
Зарегистрирован"; if ($row['gender']==0) $str.="о"; if ($row['gender']==2) $str.="а"; $str.=":
".extractdate($row['regdate'])."
"; } if(abs($row['poster_id'])!=GUESTID) $str.="
Сообщений: ".$cmsgs.""; if(!empty($row['from'])) $str.="
Откуда: ".$row['from'].""; if($row['poster_id']==-1) $str.="
Удаленный
пользователь
"; if($row['poster_id']==GUESTID) $str.="
Гость"; if($row['post_edit_count']!=0) { $sql="SELECT `name` FROM ".PRFX."users WHERE userid =".$row['post_edit_count']; $res=mysql_query($sql) OR died ($sql); list($editor) = mysql_fetch_row($res); $tmp=" (Изменено: ".$editor.", ".extractdate($row['post_edit_time'],true).", ".extracttime($row['post_edit_time']).")"; } $str.="
Добавлено: ".extractdate($row['post_time'],true).", ".extracttime($row['post_time'])."".$tmp.""; $tmp=""; if(u_perm("CanPost","profile",$fuid)) $str.="\"Цитировать"; if((u_perm("CanModerate","profile",$fuid) OR (USERID==$row['poster_id']) AND USERID!=GUESTID) AND $status!=1) $str.="\"Изменить"; if(u_perm("CanModerate","profile",$fuid)) $str.="\"Удалить"; if(u_perm("GlobalModer","global")) $str.="\"IP"; $str.="\"Вернуться"; if(u_perm("CanModerate","profile",$fuid)) $str.=""; $str.="
".nl2br(bbencode_second_pass(smilies_pass(bbencode_first_pass($row['post_text'],$row['bbcode_uid'])))); if(!empty($row['sig']) AND AT_SIG==1) $str.="
___________________
".nl2br(bbencode_second_pass(bbencode_first_pass($row['sig'],$row['bbcode_uid']))).""; $str.="
"; if($row['mov_from']>0) { $sql54="SELECT `name` FROM ".PRFX."users WHERE userid =".$row['mov_by']; $res54=mysql_query($sql54) OR died ($sql54); list($modname) = mysql_fetch_row($res54); $str.=""; } $str.="
"; if ($row['poster_id']!=GUESTID){ $str.="профиль"; $str.=" приват "; /*$str.="e-mail";*/ if ($row['website']) { $rest = substr($row['website'], 0, 7); $len = strlen($row['website'])-7; if ($rest=="http://") $row['website']= substr($row['website'], 7, $len);}; if(!empty($row['website'])) $str.=" website "; if(!empty($row['icq'])) $str.=" icq"; } $str.="
\"Перемещено
 
"; ############## echo "
".$pagelist."

"; ############## if(u_perm("CanModerate","profile",$fuid)) { echo " "; if($status!=1) { echo " "; } else { echo " "; } echo "
Тема Сообщения
ЗакрытьОткрытьПереместить\"Удалить\"
"; } echo ""; if($status==1) { echo "
Тема закрыта.
"; } else { if(u_perm("CanPost","profile",$fuid)) { if(!isGuest()) check_watch_topic($topic); } if(u_perm("CanPost","profile",$fuid) AND !READONLY) { $subject = str_replace("Re: ", "", $subject); $subject = str_replace("Re:", "", $subject); $subject = "Re: ".$subject; define("NEWTOPIC",0); include(DOC_ROOT."forum/replyform.php"); } if(READONLY) { echo "
Вам запрещено размещать сообщения на форуме.
"; } } } //EOF if(isset($_GET['topic'])) $topic=abs((int)$_GET['topic']); else $topic=1; if(isset($_GET['page'])) $page=abs((int)$_GET['page']); else $page=0; if(isset($_GET['msg'])) $msg=abs((int)$_GET['msg']); else $msg=0; if($msg!=0) { $topic=gettopicbymsg($msg); $lastpage=true; } $query2="SELECT distinct f.forum_name,f.forum_id, t.topic_title, c.cat_title FROM ".PRFX."forums as f LEFT JOIN ".PRFX."topics as t ON t.forum_id=f.forum_id LEFT JOIN ".PRFX."categories AS c ON f.cat_id = c.cat_id WHERE t.topic_id='".$topic."'"; $result2=mysql_query($query2) OR died ($query2);//died ($query2); $row2=mysql_fetch_array($result2); if(mysql_num_rows($result2)==0) die("Нет ветки с таким номером"); if(!u_perm("CanView","profile",$row2['forum_id'])) verboten(); FormHead(" Форум: ".$row2['cat_title']." -> ".$row2['forum_name']." -> ".$row2['topic_title']); $s_name = "
".SITE." -> "; $s_name.= "".$row2['cat_title']." -> "; $s_name.= "".$row2['forum_name'].""; $s_name.= "
Поиск: \" class=\"button\">
"; FormBetween($s_name); f_index($topic,$page,$lastpage); FormFoot(); ?>