C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\webboard\showtopic.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
<?php
/* $Id: showtopic.php,v 1.3 2002/12/28 15:19:53 thetinysteini Exp $ */
/*
          ThWboard - PHP/MySQL Bulletin Board System
        ==============================================
            (c) 2000, 2001 by
               Paul Baecher         <paul@thewall.de>
               Felix Gonschorek   <funner@thewall.de>

          download the latest version:
            http://www.thwboard.de

          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 "./inc/header.inc.php";

if ( ( !
$thread['threadid'] ) OR ( $board['boarddisabled'] == ) )
{
    
message('Error''Thread existiert nicht');
}

$postings $thread['threadmessages'] = ++$thread['threadreplies'];
$post_pages ceil($postings $config['vars_m_amount']);

if( !isset(
$pagenum) )
{
    
$pagenum 1;
}
else if( 
$pagenum == 'lastpage' )
{
    
$pagenum $post_pages;
}

if( 
$config['enable_ranks'] )
{
    
$a_rank = array();
    
$r_rank thwb_query("SELECT ranktitle, rankimage, rankposts FROM ".$pref."rank ORDER BY rankposts DESC");
    while( 
$rank mysql_fetch_array($r_rank) )
    {
        
$a_rank[$rank['rankposts']] = $rank['ranktitle'] . ( $rank['rankimage'] ? '<br><img src="' $rank['rankimage'] . '" border="0">' '');
    }
}

$a_group = array();
$r_group thwb_query("SELECT groupid, title FROM $pref"."group ORDER BY titlepriority DESC");
while( 
$group mysql_fetch_array($r_group) )
{
    
$a_group[] = $group;
}

$Tframe = new Template("templates/" $style['styletemplate'] . "/frame.html");
$Tpostings = new Template("templates/" $style['styletemplate'] . "/postings.html");
$Tpostingrow =new Template("templates/" $style['styletemplate'] . "/postingrow.html");
$Tpostingoptions = new Template('templates/'.$style['styletemplate'].'/postingoptions.html');

$i = ($pagenum 1) * $config['vars_m_amount'];

$r_post thwb_query("SELECT
        post.posttime,
        post.posttext,
        post.userid,
        post.postid,
        post.postlasteditby,
        post.postlastedittime,
        post.postsmilies,
        post.postcode,
        post.postguestname,
        post.postip,
        user.username,
        user.usersignature,
        user.usertitle,
        user.userposts,
        user.userrating,
        user.useravatar,
        user.groupids,
        user.userhomepage,
        user.userisadmin
    FROM
        "
.$pref."post as post
    LEFT JOIN
        "
.$pref."user as user ON (post.userid=user.userid)
    WHERE
        post.threadid=
$thread[threadid]
    ORDER BY
        post.posttime ASC
    LIMIT
        "
.(intval($pagenum) - 1) * $config['vars_m_amount'].", $config[vars_m_amount]");

if( !
$r_post )
{
    
message('Sorry''Thread existiert nicht!');
}

if( isset(
$highlight) )
{
    
$a_highword explode(' '$highlight);
    if( 
count($a_highword) > 20 )
        
$a_highword = array();
}

while( 
$post mysql_fetch_array($r_post) )
{
    
$post['username'] = parse_code($post['username']);
    
$post['posttext'] = parse_code($post['posttext'], 1, ($post['postcode'] ? 0), ($post['postcode'] ? 0), ($post['postsmilies'] ? 0));
    
$post['useravatar'] = parse_code$post['useravatar'] );
    
$post['posttime'] = form_date($post['posttime']);
    
$post['postnumber'] = sprintf("%03d"$i);
    if( 
$post['userid'] == )
    {
        
$post['groupids'] = ','.$config['guest_groupid'].',';
    }

    if( !
$post['usertitle'] )
    {
        
reset($a_group);
        while( list(, 
$group) = each($a_group) )
        {
            if( 
strstr($post['groupids'], ','.$group['groupid'].',' ) )
            {
                
$post['usertitle'] = $group['title'].'<br>';
                break;
            }
        }
    }
    else
    {
        
$post['usertitle'] .= '<br>';
    }

    if( 
$config['enable_ranks'] )
    {
        
reset($a_rank);
            
        while( list(
$posts$rank) = each($a_rank) )
        {
            if( 
$post['userposts'] >= $posts )
            {
                
$post['userrank'] = $rank.'<br>';
                break;
            }
        }
    }
    else
    {
        
$user['userrank'] = '';
    }


    if( 
$post['userid'] == )
    {
        
$post['username'] = $post['postguestname'];
        
$postingoptions '(Gast)';
    }
    else
    {
        
$postingoptions '';
        eval(
$Tpostingoptions->GetTemplate('postingoptions'));
    }
    

    
$post['avatar'] = "";

    if ( ( 
$config['useravatar'] >= ) && ( $post['useravatar'] != "" ) && ( $post['useravatar'] != "notallowed" ) )
    {
        if ( 
$post['userhomepage'] ) 
        {
            
$post['avatar'] .= "<a href=\"$post[userhomepage]\" target=\"_blank\">";
        }
        
        
$post['avatar'] .= "<img src=\"$post[useravatar]\" alt=\"Avatar von $post[username]\" title=\"Avatar von $post[username]\" border=\"0\">";
        
        if ( 
$post['userhomepage'] ) 
        {
            
$post['avatar'] .= "</a>";
        }
         
         
$post['avatar'] .="\n";
    }
    
    if( 
$post['username'] == '' )
    {
        
$post['username'] == '(N/A)';
    }
    
    if( 
defined('ENABLE_VOTING') )
    {
        if( 
$post['userrating'] != )
        {
            
$post['userrating'] = sprintf("%.1f", ($post['userrating'] / 10));
        }
        else
        {
            
$post['userrating'] = "-";
        }
    }
    else
    {
        
$post['userrating'] = "";
    }

    
// show a signature?
    
if( $post['usersignature'] )
    {
        if( 
$g_user['userhidesig'] != )
        {
            
$post['posttext'] .= "<br>--<br>" parse_code($post['usersignature'], 1, ($config['imageslevel'] ? 1), 1$config['smilies']);
        }
    }
    
    if( 
$post['postlastedittime'] )
    {
        
$post['posteditnotes'] = "<hr size=\"1\">$style[smallfont]Dieser Post wurde am " date("d.m.Y"$post['postlastedittime'] + $config['timeoffset'] * 3600) . " um " date("H:i"$post['postlastedittime'] + $config['timeoffset'] * 3600) . " Uhr von $post[postlasteditby] editiert.$style[smallfontend]";
    }
    else
    {
        
$post['posteditnotes'] = "";
    }

    if( isset(
$highlight) )
    {
        
$post['posttext'] = highlight_words($post['posttext'], $a_highword);
    }
    
    eval(
$Tpostingrow->GetTemplate("POSTINGROWS"));
    
$i++;
}

// max. number of pages visible at a time / 2 ([1] [2] ...
define('PADDING'3);
$pages_nav '';

$linkappend '';
if( 
$time )
    
$linkappend '&time='.$time;
if( 
$highlight )
    
$linkappend .= '&highlight='.urlencode($highlight);

// << <
if( $pagenum PADDING )
{
    
$pages_nav '[ <a class="hefo" href="showtopic.php?threadid='.$thread['threadid'].'&pagenum=1'.$linkappend.'">Erste Seite</a> ] ... ';
}
// pages ..
$i $pagenum PADDING;
if( 
$i )
    
$i 1;
$imax $pagenum PADDING;
if( 
$imax $post_pages )
    
$imax $post_pages;

for( 
$i$i <= $imax$i++ )
{
    if( 
$i == $pagenum )
        
$pages_nav .= '-'.$i.'- ';
    else
        
$pages_nav .= '[ <a class="hefo" href="showtopic.php?threadid='.$thread['threadid'].'&pagenum='.$i.$linkappend.'">'.$i.'</a> ] ';
}
// > >>
if( $pagenum PADDING $post_pages )
{
    
$pages_nav .= '... [ <a class="hefo" href="showtopic.php?threadid='.$thread['threadid'].'&pagenum=lastpage'.$linkappend.'">Letzte Seite</a> ]';
}



// replyform nur auf der letzten seite..
if ( $pagenum == $post_pages && $P->has_permissionP_REPLY ) && !$thread['threadclosed'] )
{
    if( isset(
$replyto) )
    {
        
$r_post thwb_query("SELECT post.posttext, post.threadid, post.postguestname, user.username FROM ".$pref."post AS post
            LEFT JOIN "
.$pref."user AS user ON post.userid=user.userid WHERE postid='".intval($replyto)."'");
        
$post mysql_fetch_array($r_post);
        
        
// verify postid to prevent quotes from restricted forums
        
if( $post['threadid'] != $thread['threadid'] )
        {
            
message("Error""Invalid postid!");
        }
        
        
$post['posttext'] = htmlspecialchars($post['posttext']);

        if( !
$post['username'] )
        {
            
$replytext '[quote][b]' $post['postguestname'] . ' postete[/b]'."\n".$post['posttext'].'[/quote]'."\n";
        }
        else
        {
            
$replytext '[quote][b]' $post['username'] . ' postete[/b]'."\n".$post['posttext'].'[/quote]'."\n";
        }
    }

    if( 
$config['smilies'] )
    {
        
$smilies_on_off "AN";
    }
    else
    {
        
$smilies_on_off "AUS";
    }

    if( 
$config['use_email'] )
    {
        
$notifyavailable '';
    }
    else
    {
        
$notifyavailable ' (Derzeit nicht verfügbar)';
    }
    
    if( 
$g_user['userid'] )
    {
        
$replyusername "$style[stdfont]$g_user[userhtmlname]$style[stdfontend]$style[smallfont] [ <a href=\"logout.php\">Logout</a> ]$style[smallfontend]";
    }
    else
    {
        if( 
$g_user['userid'] == && $P->has_permissionP_REPLY ) )
        {
            
$replyusername '<input class="tbinput" name="post[postguestname]" type="text">' $style['smallfont'] .
            
' (Minimal ' $config['min_usernamelength'] . ', maximal ' $config['max_usernamelength'] .
            
' Zeichen, keine Sonderzeichen)' $style['smallfontend'];
        }
        else
        {
            
$replyusername '';
        }
    }

    
$Treply = new Template("./templates/".$style['styletemplate']."/replyform.html");
    eval(
$Treply->GetTemplate("REPLYFORM"));
}

thwb_query("UPDATE ".$pref."thread SET threadviews=threadviews+1 WHERE threadid='$thread[threadid]'");

$JUMP_MENU jumpmenu($board['boardid']);

$navpath .= 'Threadansicht';
$titleprepend htmlspecialchars($thread['threadtopic']) . ' - ';


eval(
$Tpostings->GetTemplate("CONTENT"));
eval(
$Tframe->GetTemplate());
?>