/***************************************************************************
* ExBB v.1.1 *
* Copyright (c) 2002-20õõ by Alexander Subhankulov aka Warlock *
* *
* http://www.exbb.net *
* email: admin@exbb.net *
* *
***************************************************************************/
/***************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
include('common.php');
$vars = parsed_vars();
$intopic = $vars['topic'];
$inforum = $vars['forum'];
$instart = isset($vars['start']) ? $vars['start'] : 1;
$jumpto = $vars['jumpto'];
if ( !isset($vars['topic']) || $vars['topic'] == 0 ) die('Hack attempt!');
$forum = get_file($exbb['home_path'].'data/allforums.php');
forumjump($forum);
if ($jumpto != '') { Header("Location: $jumpto"); exit; }
$exbb['delim_r'] = $exbb['text_menu'] ? ' : ' : '';
$exbb['icon_eml'] = $exbb['text_menu'] ? 'E-mail' : '';
$exbb['icon_www'] = $exbb['text_menu'] ? 'WWW' : '';
$exbb['icon_aol'] = $exbb['text_menu'] ? 'AOL' : '';
$exbb['icon_pm'] = $exbb['text_menu'] ? $lang['Message'] : '';
$exbb['icon_prf'] = $exbb['text_menu'] ? $lang['Profile'] : '';
$exbb['icon_edit'] = $exbb['text_menu'] ? $lang['Editing'] : '';
$exbb['icon_del'] = $exbb['text_menu'] ? $lang['Delete'] : '';
$replygraphic = ($exbb['text_menu']) ? ''.$lang['Paste_qte'].'' : '';
$category = $forum[$inforum]['catname'];
$forumname = stripslashes($forum[$inforum]['name']);
$catid = $forum[$inforum]['catid'];
$upload = ( isset($forum[$inforum]['upload']) && !empty($forum[$inforum]['upload']) && $exbb['file_upload'] ) ? $forum[$inforum]['upload'] : 0;
if ((!$inuser['private'][$inforum]) && ($forum[$inforum]['private'])) { error($lang['Privat_topic'],$lang['Privat_denied']);}
if ($exbb['reged']) {
$top_id = $inforum.$intopic;
$t_visits = (isset($_COOKIE['t_visits'])) ? unserialize($_COOKIE['t_visits']) : array();
$t_visits[$top_id] = time();
my_setcookie('t_visits',serialize($t_visits),86400);
}
$allof = false;
switch ($forum[$inforum]['status']) {
case 'reged': if (!$exbb['reged']) {$allof = true;} break;
default: $allof = false;
}
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-thd.php';
if ( !file_exists($filetoopen) ) error($lang['Topic_open'],$lang['Topic_miss']);
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/list.php';
$list = get_file($filetoopen);
#$list[$intopic]['views']++;
#save_file($filetoopen,$list);
$cur_topic = array();
$cur_topic[$intopic] = $list[$intopic];
unset($list);
$topictitle = wordwrap($cur_topic[$intopic]['name'], 32, ' ', 1);
$topicdescr = $cur_topic[$intopic]['desc'];
$threadstate = ( isset($cur_topic[$intopic]['state']) ) ? $cur_topic[$intopic]['state'] : 'closed';
$threadposts = $cur_topic[$intopic]['posts'];
$is_poll = isset($cur_topic[$intopic]['poll']) ? true : false;
#������ ������ �����������
if ($allof || $threadstate == 'closed') {
$replygraphic = null;
$lang['MS_paste'] = '';
}
$movedto = null;
if (isset($cur_topic[$intopic]['movedid'])) {
list($in_f,$in_t) = explode(':',$cur_topic[$intopic]['movedid']);
$movedto = '
'.$lang['Moved_to'].'';
}
$inmembmod = moderator($inforum,$forum);
$newthreadbutton = '';
if ($forum[$inforum]['polls'] && $exbb['reged']) $newthreadbutton .= ' ';
if (!$forum[$inforum]['private']) whosonline($lang['Topic_see'].' '.$topictitle.' - '.$forumname.'');
if ($threadstate == 'open') {
$replybutton = '';
}
else { $replybutton = ''; }
if ( isset($cur_topic[$intopic]['fls']) ) {
$extmode = unserialize($cur_topic[$intopic]['ext']);
$in_first = $extmode[0];
$in_end = $cur_topic[$intopic]['fls'];
} else {
$in_first = $cur_topic[$intopic]['posts'] + 1;
$in_end = 0;
}
unset($extmode);
$in_first_page = ceil($in_first/intval($exbb['posts_per_page']));
$numberofpages = $in_first_page + $in_end;
$pagestart = (isset($vars['v'])) ? $numberofpages : intval($instart);
if ($pagestart < 1 or $pagestart > $numberofpages) $pagestart = 1;
$in_file = ($pagestart <= $in_first_page) ? '' : $pagestart - $in_first_page;
if ($numberofpages > 1) {
$showmore = true;
$startarray = ($pagestart - 1) * $exbb['posts_per_page'];
$endarray = intval($exbb['posts_per_page']);
} else {
$showmore = false;
$startarray = 0;
$pages = $lang['Pages'].' ('.$numberofpages.')'.$movedto;
$endarray = $in_first;
}
unset($in_first,$in_end,$in_first_page);
if ($showmore) {
$pageshow = 4;
if ($pagestart > 1) $prevpage = $pagestart - 1;
if ($pagestart < $numberofpages) $nextpage = $pagestart + 1;
$limitlower = $pagestart - $pageshow + 1;
$limitupper = $pagestart + $pageshow - 1;
if ($limitupper > $numberofpages) {
$limitupper = $numberofpages;
if ($limitlower > $numberofpages) $limitlower = $numberofpages - $pageshow;
}
if ($limitlower <= 0) $limitlower = 1;
for($i=$limitlower;$i<=$limitupper;$i++){
if ($pagestart != $i) {$pages .= ''.$i.' ';}
else {$pages .= '['.$i.'] ';}
}
$prevpage = ($prevpage) ? '« ' : '';
$nextpage = ($pagestart < $numberofpages) ? '» ' : '';
$lastpage = ($limitupper < $numberofpages) ? ''.$lang['page_last'].' ' : '';
$firspage = ($limitlower > 1) ? ''.$lang['page_first'].' ' : '';
$pages = ''.$lang['Pages'].' ('.$numberofpages.'): '.$firspage.' '.$prevpage.' '.$pages.' '.$nextpage.' '.$lastpage.$movedto;
}
unset($numberofpages,$limitlower,$limitupper,$prevpage,$nextpage,$lastpage,$firspage);
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-thd'.$in_file.'.php';
if (file_exists($filetoopen)) {
$threads = get_file($filetoopen);
if (!is_array($threads)) error($lang['Topic_open'],$lang['Topic_miss']);
} else { error($lang['Topic_open'],$lang['Topic_miss']); }
$keys = array_keys($threads);
sort($keys,SORT_NUMERIC);
if ( empty($in_file) ) $keys = array_slice($keys,$startarray,$endarray);
elseif ( isset($vars['v']) ) { $keys = array_slice($keys,-$exbb['posts_per_page']); }
$firstkey = reset($keys);
$style = './templates/'.$exbb['default_style'].'topic_data.tpl';
$bot = is_search_bot() ? true : false;
$names = array();
if ($exbb['ratings'] && !$bot) $ranks = get_file($exbb['home_path'].'data/membertitles.php');
$filetoopen = $exbb['home_path'].'forum'.$vars['forum'].'/attaches-'.$vars['topic'].'.php';
$t_attaches = ( file_exists($filetoopen) ) ? get_file($filetoopen) : array();
foreach ($keys as $id=>$key) {
$member_id = isset($threads[$key]['p_id']) ? $threads[$key]['p_id'] : 0;
$postipaddress = $threads[$key]['ip'];
$showemoticons = $threads[$key]['smiles'];
$post = $threads[$key]['post'];
#Attach
if ( isset($threads[$key]['attach_id']) ) {
if ( isset($t_attaches[$threads[$key]['attach_id']]['size']) && $exbb['show_img']) {
$post .= $lang['img_attach'].'
[s]('.$lang['Edited_by_own'].longDate($threads[$key]['edited']+$exbb['usertime']*3600).')[/s]'; if (isset($threads[$key]['mo_edited'])) { $post .= '
";print_r($names[$member_id]);echo""; $eml = $names[$member_id]['eml']; $www = $names[$member_id]['www']; $pm = $names[$member_id]['pm']; $prf = $names[$member_id]['prf']; $aim = $names[$named]['aim']; $edit = sprintf($names[$member_id]['edit'],$inforum,$intopic,$key,$in_file,$pagestart); $del = sprintf($names[$member_id]['del'],$inforum,$intopic,$key,$in_file,$pagestart); $posts = $names[$member_id]['posts']; $joined = $names[$member_id]['jnd']; $info = ''.$lang['Post_date'].' '.longDate($key+$exbb['usertime']*3600).''; $icq = $names[$member_id]['icq']; $uin = $names[$member_id]['uin']; if ($forum[$inforum]['codes']) $post = ikoncode($post); if (!empty($signature)) $post .= '
";print_r($user);echo""; if ( ($exbb['mem_id'] == $named && $threadstate != 'closed') || $inmembmod) { $names[$named]['edit'] = ''.$exbb['icon_edit'].''.$exbb['delim_r']; } if ($inmembmod) { $names[$named]['del'] = ''.$exbb['icon_del'].''; } $names[$named]['user'] = $user['name']; $names[$named]['id'] = $user['id']; $names[$named]['interests'] = $user['interests']; $names[$named]['membertitle'] = $user['title']; $user['posts'] = (empty($user['posts'])) ? 0 : $user['posts']; $names[$named]['posts'] = $lang['User_total_posts'].' '.$user['posts'].' :'; if ($exbb['location']) { if ($user['location'] != '') { $names[$named]['location'] = (strlen($user['location']) > 20) ? '