~cruzjbishop/anelectron/trunk

« back to all changes in this revision

Viewing changes to main/posts_theme.php

  • Committer: Cruz Julian Bishop
  • Date: 2012-03-18 22:16:46 UTC
  • Revision ID: cruzjbishop@gmail.com-20120318221646-se8p54bd2g7i936n
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
function posts_theme() {
 
4
 
 
5
    global $user, $logged_in, $globals, $AEF_SESS, $theme, $l;
 
6
    global $categories, $forums, $active, $activebots, $anonymous, $guests, $board, $poll, $user_group, $post_group, $tid, $tpg, $fid, $title, $topic, $post, $topicpages, $attachments, $page, $pg, $dmenus, $postcodefield, $users_who_read, $feeds;
 
7
 
 
8
    if (!empty($board['rss'])) {
 
9
 
 
10
        $feeds[] = '<link rel="alternate" type="application/rss+xml" title="' . $board['fname'] . ' - ' . $l['rss'] . '" href="' . $globals['ind'] . 'act=feeds&amp;forum=' . $board['fid'] . '" />';
 
11
    }
 
12
 
 
13
    if (!empty($board['rss_topic'])) {
 
14
 
 
15
        $feeds[] = '<link rel="alternate" type="application/rss+xml" title="' . $topic['topic'] . ' - ' . $l['rss'] . '" href="' . $globals['ind'] . 'act=feeds&amp;topic=' . $topic['tid'] . '" />';
 
16
    }
 
17
 
 
18
    //////////////////////////
 
19
    // Count the topic pages
 
20
    //////////////////////////
 
21
 
 
22
    $tpages = ceil(($topic['n_posts'] + 1) / $globals['maxpostsintopics']);
 
23
 
 
24
    $pg = ($page / $globals['maxpostsintopics']) + 1; //Current Page
 
25
 
 
26
    $topicpages = array();
 
27
 
 
28
    if ($tpages > 1) {
 
29
 
 
30
        if ($pg != 1) {
 
31
 
 
32
            $topicpages['&lt;&lt;'] = 1;
 
33
 
 
34
            $topicpages['&lt;'] = ($pg - 1);
 
35
        }
 
36
 
 
37
        for ($i = ($pg - 4); $i < $pg; $i++) {
 
38
 
 
39
            if ($i >= 1) {
 
40
 
 
41
                $topicpages[$i] = $i;
 
42
            }
 
43
        }
 
44
 
 
45
        $topicpages[$pg] = $pg;
 
46
 
 
47
 
 
48
        for ($i = ($pg + 1); $i <= ($pg + 4); $i++) {
 
49
 
 
50
            if ($i <= $tpages) {
 
51
 
 
52
                $topicpages[$i] = $i;
 
53
            }
 
54
        }
 
55
 
 
56
 
 
57
        if ($pg != $tpages) {
 
58
 
 
59
            $topicpages['&gt;'] = ($pg + 1);
 
60
 
 
61
            $topicpages['&gt;&gt;'] = $tpages;
 
62
        }
 
63
 
 
64
 
 
65
        if ($tpages > 1) {
 
66
 
 
67
            $topicpages[$l['all']] = 'all';
 
68
        }
 
69
    }
 
70
 
 
71
    //Link array of active users
 
72
    $activeusers = array();
 
73
 
 
74
    //Build the active users array
 
75
    foreach ($active as $i => $v) {
 
76
 
 
77
        $activeusers[] = '<a href="' . userlink($v['id'], $v['username']) . '" style="color: ' . $active[$i]['mem_gr_colour'] . ';" >' . $active[$i]['username'] . '</a>';
 
78
    }
 
79
 
 
80
    //Are there any Bots
 
81
    foreach ($activebots as $k => $v) {
 
82
 
 
83
        $activeusers[] = $v;
 
84
    }
 
85
 
 
86
    //The header
 
87
    aefheader($title);
 
88
 
 
89
    /////////////////////////////
 
90
    //The Poll if any
 
91
    /////////////////////////////
 
92
 
 
93
    if (!empty($poll)) {
 
94
 
 
95
        //Show the Voting Form
 
96
        if ($poll['what_to_show'] == 1) {
 
97
 
 
98
            //Can he see the results without voting
 
99
            if ($poll['show_when'] == 0) {
 
100
 
 
101
                $polloptions[] = '<a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;tpg=' . $pg . '&amp;spollres" >' . $l['show_results'] . '</a>';
 
102
            }
 
103
 
 
104
            //Show the results
 
105
        } elseif ($poll['what_to_show'] == 2) {
 
106
 
 
107
 
 
108
            foreach ($poll['options'] as $opk => $opt) {
 
109
 
 
110
                //If the total Votes are zero
 
111
                if ($poll['votes'] != 0) {
 
112
 
 
113
                    $percentage = ($opt['poo_votes'] / $poll['votes']) * 100;
 
114
 
 
115
                    $img_width = (400 * $percentage) / 100;
 
116
 
 
117
                    $img_width = (($img_width > 0) ? $img_width : 11);
 
118
                } else {
 
119
 
 
120
                    $img_width = 11;
 
121
                    $percentage = 0;
 
122
                }
 
123
 
 
124
                $poll['options'][$opk]['width'] = $img_width;
 
125
                $poll['options'][$opk]['percentage'] = substr($percentage, 0, 5);
 
126
            }
 
127
 
 
128
 
 
129
            //Has he voted yet
 
130
            if ((!$poll['user_voted']) &&
 
131
                    ($user['can_vote_polls'] || $board['can_vote_polls']) &&
 
132
                    !$poll['expired'] && !$poll['locked']) {
 
133
 
 
134
                $polloptions[] = '<a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;tpg=' . $pg . '" >' . $l['vote'] . '</a>';
 
135
            }
 
136
 
 
137
 
 
138
            //Can he delete his vote
 
139
            if ($poll['user_voted'] && $logged_in && $poll['change_vote']) {
 
140
 
 
141
                $polloptions[] = '<a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;tpg=' . $pg . '&amp;deletevote" >' . $l['delete_vote'] . '</a>';
 
142
            }
 
143
 
 
144
 
 
145
            //Show a message
 
146
        } elseif ($poll['what_to_show'] == 3) {
 
147
 
 
148
            //Left empty for future compatibility
 
149
        }
 
150
 
 
151
 
 
152
        ///////////////////////////////
 
153
        // Some Administrative Options
 
154
        ///////////////////////////////
 
155
        //Can he EDIT the results
 
156
        if (($poll['i_started'] && $user['can_edit_own_poll']) ||
 
157
                (!$poll['i_started'] && $user['can_edit_other_poll'])) {
 
158
 
 
159
            $adpolloptions[] = '<a href="' . $globals['ind'] . 'act=editpoll&amp;poid=' . $poll['poid'] . '">' . $l['edit_poll'] . '</a>';
 
160
        }
 
161
 
 
162
        //Can he Remove the poll
 
163
        if (($poll['i_started'] && $user['can_rem_own_poll']) ||
 
164
                (!$poll['i_started'] && $user['can_rem_other_poll'])) {
 
165
 
 
166
            $adpolloptions[] = '<a href="' . $globals['ind'] . 'act=removepoll&amp;poid=' . $poll['poid'] . '">' . $l['reomve_poll'] . '</a>';
 
167
        }
 
168
    }//End of empty($poll)
 
169
    //Show the results
 
170
    if (!empty($poll['what_to_show']) && ($poll['what_to_show'] == 2)) {
 
171
 
 
172
        $showthis = '<table cellpadding="3" cellspacing="3">';
 
173
 
 
174
        foreach ($poll['options'] as $opk => $opt) {
 
175
 
 
176
            $showthis .= '<tr><td align="right">
 
177
                        <b>' . $opt['poo_option'] . '</b>
 
178
                        (' . $opt['poo_votes'] . ')
 
179
                        </td>
 
180
                        <td align="left">
 
181
            <img src="' . $theme['images'] . 'poll.gif" width="' . $poll['options'][$opk]['width'] . '" height="10" alt="" /> (' . $opt['percentage'] . '%)
 
182
                        </td></tr>';
 
183
        }
 
184
 
 
185
        $showthis .= '<tr><td colspan="2"><br /><b>' . $l['total_votes'] . '</b> : ' . $poll['votes'] . '</td></tr></table>';
 
186
 
 
187
        //Show the form for Voting
 
188
    } elseif (!empty($poll['what_to_show']) && ($poll['what_to_show'] == 1)) {
 
189
 
 
190
        $showthis = '<form accept-charset="' . $globals['charset'] . '" method="post" action="" name="poll_vote">
 
191
                    <table cellpadding="3" cellspacing="3">';
 
192
 
 
193
        foreach ($poll['options'] as $opk => $opt) {
 
194
 
 
195
            $showthis .= '<tr><td align="right">
 
196
                        ' . $opt['poo_option'] . '
 
197
                        <input type="radio" name="uservote" value="' . $opt['pooid'] . '" />
 
198
                        </td>
 
199
                        </tr>';
 
200
        }
 
201
 
 
202
        $showthis .= '<tr>
 
203
                    <td>
 
204
                    <input type="submit" name="vote_poll" value="' . $l['submit_vote'] . '" /><br />
 
205
                    </td>
 
206
                    </tr>
 
207
                    </table>
 
208
                    </form>';
 
209
    } elseif (!empty($poll['what_to_show']) && ($poll['what_to_show'] == 3)) {
 
210
 
 
211
        $showthis = '<table cellpadding="3" cellspacing="3">';
 
212
 
 
213
        $showthis .= '<tr><td><br />' . $l['will_be_shown_at'] . ' <b>' . datify($poll['expires_on']) . '</b><br /><br />' . $l['total_votes'] . ' : <b>' . $poll['votes'] . '</b></td></tr></table>';
 
214
    }
 
215
 
 
216
 
 
217
    if (!empty($poll['what_to_show'])) {
 
218
 
 
219
        echo'<br /><table width="100%" class="cbor" cellpadding="1" cellspacing="1">
 
220
            <tr>
 
221
            <td class="ptcbg" colspan="2">' . $l['poll'] . '</td>
 
222
            </tr>
 
223
 
 
224
            ' . (!empty($adpolloptions) ? '<tr>
 
225
            <td class="ptcbg1" colspan="2" align="right" style="padding:4px;">' . implode('&nbsp;|&nbsp;', $adpolloptions) . '
 
226
            </td></tr>' : '') . '
 
227
 
 
228
            <tr>
 
229
            <td class="ptwbg" colspan="2"><b>' . $l['the_poll_question'] . ' : </b>' . $poll['qt'] . '</td>
 
230
            </tr>
 
231
 
 
232
            <tr>
 
233
            <td class="ptwbg" align="center">' . $showthis . '</td>
 
234
            ' . (!empty($polloptions) ? '<td class="ptwbg" align="center" width="25%" valign="top">' . implode('<br />', $polloptions) . '</td>' : '') . '
 
235
            </tr>
 
236
 
 
237
            </table>
 
238
            <br /><br />';
 
239
    }
 
240
 
 
241
 
 
242
    if (!empty($topicpages)) {
 
243
 
 
244
        $links = '<table align="right" class="cbgbor" cellspacing="1">
 
245
<tr>';
 
246
        $links .= '<td class="pagelinks"><a href="#" onmouseover="dropmenu(this, \'pagejump\')" onmouseout="pullmenu(\'pagejump\')" title="' . $l['jump_to_txt'] . '" >' . $l['page'] . ' ' . $pg . ' ' . $l['of'] . ' ' . $tpages . '</a></td>';
 
247
 
 
248
        echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
 
249
createmenu("pagejump", [
 
250
[\'<form accept-charset="' . $globals['charset'] . '" name="pagejump" method="get" action="' . $globals['ind'] . '"><input type="hidden" name="tid" value="' . $tid . '" /><input type="text" name="tpg" size="10" /><input type="submit" value="' . $l['submit_go'] . '" /><\/form>\']
 
251
]);
 
252
// ]]></script>';
 
253
 
 
254
        foreach ($topicpages as $k => $lv) {
 
255
 
 
256
            $links .= '<td class="' . ($k == $pg ? 'activepage' : 'pagelinks' ) . '"><a href="' . topiclink($tid, $topic['topic'], $lv) . '" >' . $k . '</a></td>';
 
257
        }
 
258
        $links .= '</tr>
 
259
</table>';
 
260
 
 
261
        echo $links;
 
262
    }
 
263
 
 
264
    //Can he post reply
 
265
    if (!empty($user['can_reply_to_this_topic'])) {
 
266
 
 
267
        echo '<br /><a href="' . $globals['ind'] . 'act=post&amp;topid=' . $topic['tid'] . '"><img src="' . $theme['images'] . 'buttons/reply.png" alt="" /></a>';
 
268
    }
 
269
 
 
270
    if (!empty($user['can_poll_this_topic'])) {
 
271
 
 
272
        echo '&nbsp;&nbsp;<a href="' . $globals['ind'] . 'act=postpoll"><img src="' . $theme['images'] . 'buttons/addpoll.png" alt="" /></a>';
 
273
    }
 
274
 
 
275
    if (!(empty($user['can_lock_this_topic']) && !$user['can_make_sticky']
 
276
            && empty($user['can_edit_this_topic']) && empty($user['can_del_this_topic'])
 
277
            && empty($user['can_move_this_topic']))) {
 
278
 
 
279
        //Moderation option
 
280
        $top_opt[] = '<a href="#" onmouseover="dropmenu(this, \'modopt\')" onmouseout="pullmenu(\'modopt\')">' . $l['options'] . '</a>';
 
281
 
 
282
        echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[';
 
283
 
 
284
        if ($user['can_edit_this_topic']) {
 
285
 
 
286
            echo '
 
287
function qet(){
 
288
    var qet = \'<form accept-charset="' . $globals['charset'] . '" action="' . $globals['ind'] . 'act=edittopic&amp;topid=' . $topic['tid'] . '"  method="post" name="edittopicform"><table width="100%" cellpadding="2" cellspacing="1" align="center"><tr><td width="25%" class="etlc">' . $l['edit_title'] . '<\/td><td class="etrc"><input type="text" size="30" name="toptitle" value="' . $topic['topic'] . '" \/><\/td><\/tr><tr><td class="etlc">' . $l['edit_description'] . '<\/td><td class="etrc"><input type="text" size="30" name="topdesc" value="' . $topic['description'] . '" \/><\/td><\/tr><tr><td colspan="2" class="etrc" style="text-align:center"><input type="hidden" name="topic_icon" value="' . $topic['type_image'] . '" \/><input type="submit" name="edittopic" value="' . $l['edit_submit_button'] . '" \/><\/td><\/tr><\/table><\/form>\';
 
289
    domwindow("qet", qet, "", "' . $l['quick_edit_topic'] . '");
 
290
};
 
291
';
 
292
        }
 
293
 
 
294
        echo 'createmenu("modopt", [
 
295
' . (empty($user['can_lock_this_topic']) ? '' : '[\'' . ($topic['t_status'] == 1 ? '<a href="' . $globals['ind'] . 'act=locktopic&amp;do=0&amp;topid=' . $topic['tid'] . '">' . $l['lock_topic'] . '<\/a>' : '<a href="' . $globals['ind'] . 'act=locktopic&amp;do=1&amp;topid=' . $topic['tid'] . '">' . $l['unlock_topic'] . '<\/a>') . '\'],') . '
 
296
' . ($user['can_make_sticky'] ? '[\'' . ($topic['t_sticky'] == 1 ? '<a href="' . $globals['ind'] . 'act=pintopic&amp;do=0&amp;topid=' . $topic['tid'] . '">' . $l['unpin_topic'] . '<\/a>' : '<a href="' . $globals['ind'] . 'act=pintopic&amp;do=1&amp;topid=' . $topic['tid'] . '">' . $l['pin_topic'] . '<\/a>') . '\'],' : '') . '
 
297
' . (empty($user['can_edit_this_topic']) ? '' : '[\'<a href="' . $globals['ind'] . 'act=edittopic&amp;topid=' . $topic['tid'] . '">' . $l['edit_topic'] . '<\/a>\'],
 
298
[\'<a href="javascript:void(0);" onclick="qet();">' . $l['quick_edit_topic'] . '<\/a>\'],' ) . '
 
299
' . (empty($user['can_del_this_topic']) ? '' : '[\'<a href="' . $globals['ind'] . 'act=deletetopic&amp;topid=' . $topic['tid'] . '">' . $l['delete_topic'] . '<\/a>\'],' ) . '
 
300
' . (empty($user['can_move_this_topic']) ? '' : '[\'<a href="' . $globals['ind'] . 'act=movetopic&amp;topid=' . $topic['tid'] . '">' . $l['move_topic'] . '<\/a>\'],' ) . '
 
301
]);
 
302
// ]]></script>';
 
303
    }
 
304
 
 
305
    echo '<br /><br /><table width="100%" cellpadding="4" cellspacing="0" class="cbgbor">
 
306
    <tr>' . (empty($board['rss_topic']) ? '' : '<td class="ptcbgrss"><a href="' . $globals['ind'] . 'act=feeds&amp;topic=' . $topic['tid'] . '"><img src="' . $theme['images'] . 'feeds.gif" alt="" /></a></td>') . '<td class="ptcbg1" align="right">';
 
307
 
 
308
    //Mark as unread
 
309
    if ($logged_in) {
 
310
 
 
311
        $top_opt[] = '<a href="' . $globals['ind'] . 'act=markread&amp;mark=unreadtopic&amp;utid=' . $topic['tid'] . '">' . $l['mark_as_unread'] . '</a>';
 
312
    }
 
313
 
 
314
    //Can he post reply - quick
 
315
    if (!empty($user['can_reply_to_this_topic']) && !empty($board['quick_reply'])) {
 
316
 
 
317
        $top_opt[] = '<a href="javascript:showquickreply(\'quickreply\')">' . $l['quick_reply'] . '</a>';
 
318
 
 
319
        $usesmileys = ($logged_in ? ( $user['showsmileys'] == 1 ? true : ($user['showsmileys'] == 2 ? false : $globals['usesmileys']) ) : $globals['usesmileys']);
 
320
 
 
321
        $dmenus[] = '<div id="quickreply" class="pqr">
 
322
<form accept-charset="' . $globals['charset'] . '" method="post" action="' . $globals['ind'] . 'act=post&amp;topid=' . $topic['tid'] . '">
 
323
<table width="100%" cellspacing="0" cellpadding="0" id="qrhandle">
 
324
<tr>
 
325
<td class="dwhl"></td>
 
326
<td align="left" class="dwhc"><b>' . $l['quick_reply'] . '</b></td>
 
327
<td align="right" class="dwhc"><a href="javascript:hideel(\'quickreply\')"><img src="' . $theme['images'] . 'close.gif" alt="" /></a></td>
 
328
<td class="dwhr"></td>
 
329
</tr>
 
330
</table>
 
331
 
 
332
<table width="100%" cellspacing="1" cellpadding="2" class="dwbody">
 
333
<tr>
 
334
<td class="rlc" width="15%"><b>' . $l['qr_post'] . '</b></td>
 
335
<td align="left" class="rrc">
 
336
<textarea name="post" rows="6" cols="55" id="topicpost"></textarea>
 
337
' . $postcodefield . '
 
338
</td>
 
339
</tr>
 
340
 
 
341
<tr>
 
342
<td class="rlc"><b>' . $l['qr_options'] . '</b></td>
 
343
<td align="left" class="rrc"><input type="checkbox" name="usesmileys" ' . (empty($usesmileys) ? '' : 'checked="checked"') . ' />&nbsp;' . $l['qr_enable_smileys'] . '
 
344
</td>
 
345
</tr>
 
346
 
 
347
<tr>
 
348
<td class="rlc" colspan="2" style="text-align:center">
 
349
<input type="submit" name="submitpost" value="' . $l['qr_submit'] . '" />
 
350
</td>
 
351
</tr>
 
352
 
 
353
<tr>
 
354
<td align="left" class="dwb" colspan="2"></td>
 
355
</tr>
 
356
 
 
357
</table>
 
358
</form>
 
359
</div>
 
360
 
 
361
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
 
362
Drag.init($("qrhandle"), $("quickreply"));
 
363
function showquickreply(){
 
364
    qrid = \'quickreply\';
 
365
    $(qrid).style.left=((getwidth()/2)-($(qrid).offsetWidth/2))+"px";
 
366
    $(qrid).style.top=(scrolledy()+110)+"px";
 
367
    showel(qrid);
 
368
    smoothopaque(qrid, 0, 100, 10);
 
369
}
 
370
// ]]></script>';
 
371
    }
 
372
 
 
373
    if ($user['notify_new_posts'] && empty($user['is_topic_subscribed'])) {
 
374
 
 
375
        $top_opt[] = '<a href="' . $globals['ind'] . 'act=notify&amp;nact=topic&amp;ntid=' . $topic['tid'] . '">' . $l['subscribe_topic'] . '</a>';
 
376
    } elseif ($user['notify_new_posts'] && !empty($user['is_topic_subscribed'])) {
 
377
 
 
378
        $top_opt[] = '<a href="' . $globals['ind'] . 'act=notify&amp;nact=unsubtopic&amp;ntid=' . $topic['tid'] . '">' . $l['unsubscribe_topic'] . '</a>';
 
379
    }
 
380
 
 
381
    $top_opt[] = '<a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;threaded=true">' . $l['threaded_mode'] . '</a>';
 
382
 
 
383
    if ($globals['allow_taf'] && $user['can_email_topic']) {
 
384
 
 
385
        $top_opt[] = '<a href="' . $globals['ind'] . 'act=tellafriend&amp;topid=' . $topic['tid'] . '">' . $l['tell_a_friend'] . '</a>';
 
386
    }
 
387
 
 
388
    $top_opt[] = '<a href="' . $globals['ind'] . 'tid=' . $topic['tid'] . '&amp;tpg=' . (!is_numeric($page) ? 'all' : $pg) . '&amp;printtopic" target="_blank" title="' . $l['print_title'] . '">' . $l['print'] . '</a>&nbsp;&nbsp;';
 
389
 
 
390
 
 
391
 
 
392
    echo implode(' | ', $top_opt);
 
393
 
 
394
    echo '</td></tr>
 
395
    </table>';
 
396
 
 
397
    $show_mod = (($user['can_del_own_post'] && $user['can_del_own_post']) || $user['can_merge_posts'] ? 1 : 0);
 
398
 
 
399
    if ($show_mod) {
 
400
 
 
401
        echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
 
402
    function deleteconfirm(){
 
403
        if($("selectedposts").value == "delete"){
 
404
            var conf = confirm("' . $l['del_sel_conf'] . '");
 
405
            if(conf == true){
 
406
                return true;
 
407
            }else{
 
408
                return false;
 
409
            }
 
410
        }else{
 
411
            return true;
 
412
        }
 
413
    }
 
414
    // ]]></script>
 
415
    <form accept-charset="' . $globals['charset'] . '" method="post" action="" name="postmod" onsubmit="return deleteconfirm();">';
 
416
    }
 
417
 
 
418
    foreach ($post as $p => $pv) {
 
419
 
 
420
        //The first row that is Headers
 
421
        echo '<br /><table width="100%" cellpadding="0" cellspacing="0">
 
422
    <tr>
 
423
    <td>
 
424
    <table width="100%" cellpadding="0" cellspacing="0"><tr>
 
425
    <td class="pcbgl"></td>
 
426
    <td class="pcbg"><b>' . ($post[$p]['post_count'] == 0 ? '&nbsp;' . $title . (empty($topic['description']) ? '' : ',&nbsp;' . $topic['description']) . '&nbsp;(' . $topic['n_posts'] . ' ' . $l['replies'] . ', ' . $l['read'] . ' ' . $topic['n_views'] . ' ' . $l['times'] . ')' : $post[$p]['post_title']) . '</b></td>
 
427
    <td class="pcbgr"></td>
 
428
    </tr>
 
429
    </table>
 
430
    </td>
 
431
    </tr>
 
432
 
 
433
    <tr>
 
434
    <td class="cbgbor">
 
435
    <table width="100%" cellpadding="1" cellspacing="0">
 
436
    <tr>
 
437
    <td class="posterbg" width="22%">
 
438
 
 
439
    <a href="' . (isset($post[$p]['is_guest']) ? 'mailto:' . $post[$p]['email'] : userlink($pv['id'], $pv['username'])) . '">
 
440
    ' . $post[$p]['username'] . '
 
441
    </a>
 
442
    </td>
 
443
 
 
444
    <td class="postdate" align="right">
 
445
    <div style="float:left">
 
446
    <a name="p' . $post[$p]['pid'] . '"></a>
 
447
    <img src="' . $theme['images'] . 'postedon.png" title="' . $l['posted_on'] . '" alt="' . $l['posted_on'] . '" /> <a href="' . topiclink($tid, $topic['topic'], $pg) . '#p' . $p . '">#</a>
 
448
    ' . $post[$p]['pdate'];
 
449
 
 
450
        echo (($post[$p]['post_count']) ? ' | ' . $l['post_num_prefix'] . ': ' . $post[$p]['post_count'] : '');
 
451
 
 
452
        echo '</div>';
 
453
 
 
454
        $post_opt = array();
 
455
 
 
456
        //Can he post reply
 
457
        if (isset($post[$p]['can_reply'])) {
 
458
 
 
459
            $post_opt[] = '<a href="' . $globals['ind'] . 'act=post&amp;topid=' . $topic['tid'] . '&amp;pid=' . $post[$p]['pid'] . '">' . $l['quote'] . '</a>';
 
460
        }
 
461
 
 
462
        //Can he edit the post
 
463
        if (isset($post[$p]['can_edit'])) {
 
464
 
 
465
            $post_opt[] = '<a href="' . $globals['ind'] . 'act=edit&amp;pid=' . $post[$p]['pid'] . '">' . $l['edit'] . '</a>';
 
466
        }
 
467
 
 
468
        //Can he delete the post
 
469
        if (isset($post[$p]['can_del']) && $post[$p]['post_count'] != 0) {
 
470
 
 
471
            $post_opt[] = '<a href="' . $globals['ind'] . 'act=delete&amp;pid=' . $post[$p]['pid'] . '" onclick="return confirm(\'' . $l['del_this_conf'] . '\');">' . $l['delete'] . '</a>';
 
472
        }
 
473
 
 
474
        //Can he report this post
 
475
        if (!empty($globals['report_posts']) && !empty($user['can_report_post'])) {
 
476
 
 
477
            $post_opt[] = '<a href="' . $globals['ind'] . 'act=report&amp;pid=' . $post[$p]['pid'] . '">' . $l['report'] . '</a>';
 
478
        }
 
479
 
 
480
        //Does he have an admin
 
481
        if ($show_mod) {
 
482
 
 
483
            $post_opt[] = '<input type="checkbox" name="pids[]" value="' . $post[$p]['pid'] . '" />';
 
484
        }
 
485
 
 
486
        echo implode(' | ', $post_opt) . '</td>
 
487
    </tr>';
 
488
 
 
489
        echo '<tr>
 
490
    <td class="posterinfo" valign="top">';
 
491
 
 
492
        if (!empty($post[$p]['avatarurl'])) {
 
493
 
 
494
            echo '<div style="text-align:center;"><a href="' . userlink($pv['id'], $pv['username']) . '"><img src="' . $post[$p]['avatarurl'][0] . '" width="' . $post[$p]['avatarurl'][1] . '" height="' . $post[$p]['avatarurl'][2] . '" alt="" /></a></div>';
 
495
        }
 
496
 
 
497
        echo '<div class="pisub">' . $l['prefix_group'] . ' <span ' . (empty($post[$p]['mem_gr_colour']) ? '' : 'style="color:' . $post[$p]['mem_gr_colour'] . ';"') . '>' . $post[$p]['mem_gr_name'] . '</span><br />';
 
498
 
 
499
        //If the user group has some images as per Group
 
500
        if ($post[$p]['image_count']) {
 
501
 
 
502
            for ($i = 0; $i < $post[$p]['image_count']; $i++) {
 
503
                echo '<img src="' . $theme['images'] . $post[$p]['image_name'] . '" alt="" />';
 
504
            }
 
505
 
 
506
            echo '</div>';
 
507
        }
 
508
 
 
509
        echo '
 
510
    ' . (!empty($post[$p]['post_gr_name']) ? '<div class="pisub">' . $l['prefix_post_group'] . ' ' . $post[$p]['post_gr_name'] . '</div>' : '') . '
 
511
    ' . (!empty($post[$p]['posts']) ? '<div class="pisub">' . $l['prefix_posts'] . ' ' . $post[$p]['posts'] . '</div>' : '') . '
 
512
    <div class="pisub">' . $l['prefix_status'] . ' ' . ($post[$p]['status'] ? '<img src="' . $theme['images'] . 'online.png" title="' . $l['online'] . '" alt="" />' : '<img src="' . $theme['images'] . 'offline.png" title="' . $l['offline'] . '" alt="" />') . '</div>
 
513
    ' . ( (empty($post[$p]['users_text'])) ? '' : '<br />' . $post[$p]['users_text'] ) . '
 
514
    </td>
 
515
    <td class="post" align="left" valign="top">
 
516
    ' . wordwrap($post[$p]['post'], 80, " ", 1) . '
 
517
    ' . (!empty($attachments[$post[$p]['pid']]) ? '<br /><br />-----------------------<br />' . implode('<br />', $attachments[$post[$p]['pid']]) : '') . '
 
518
    ' . (!empty($post[$p]['modifier']) ? '<br /><br />' . $l['edited_by'] . ' <b>' . $post[$p]['modifier'] . '</b> : ' . $post[$p]['modtime'] : '');
 
519
 
 
520
        if (!empty($post[$p]['sig'])) {
 
521
 
 
522
            echo '<br /><br />-----------------------<br />' . $post[$p]['sig'];
 
523
        }
 
524
 
 
525
        echo '</td>
 
526
    </tr>';
 
527
 
 
528
        echo '<tr>
 
529
    <td class="ptip">
 
530
    <b>' . $l['ip'] . ':</b> ' . ((isset($post[$p]['poster_ip'])) ? $post[$p]['poster_ip'] : '--' ) . '
 
531
    </td>
 
532
    <td class="specialrow">
 
533
    &nbsp;<a href="' . (isset($post[$p]['is_guest']) ? 'mailto:' . $post[$p]['email'] : userlink($pv['id'], $pv['username'])) . '"><img src="' . $theme['images'] . 'profile.gif" title="' . $l['view_profile_of'] . ' ' . $post[$p]['username'] . '" alt="" /></a>&nbsp;
 
534
 
 
535
    ' . (!empty($post[$p]['email']) ? '<a href="mailto:' . $post[$p]['email'] . '"><img src="' . $theme['images'] . 'email.gif" title="' . $l['send_email_to'] . ' ' . $post[$p]['username'] . '" alt="" /></a>&nbsp;' : '') . '
 
536
 
 
537
    ' . ($logged_in ? '<a href="' . $globals['ind'] . 'act=usercp&amp;ucpact=writepm&amp;to=' . $post[$p]['id'] . '"><img src="' . $theme['images'] . 'pmuser.gif" title="' . $l['send_pm_to'] . ' ' . $post[$p]['username'] . '" alt="" /></a>&nbsp;' : '') . '
 
538
 
 
539
    ' . (!empty($post[$p]['www']) ? '<a href="' . $post[$p]['www'] . '" target="_blank"><img src="' . $theme['images'] . 'www.gif" title="' . $l['visit_website_of'] . ' ' . $post[$p]['username'] . '" alt="" /></a>&nbsp;' : '') . '
 
540
 
 
541
    ' . (!empty($post[$p]['msn']) ? '<a href="http://members.msn.com/' . $post[$p]['msn'] . '" target="_blank"><img src="' . $theme['images'] . 'msn.gif" title="' . $l['view_msn_profile'] . ' ' . $post[$p]['username'] . '" alt="" /></a>&nbsp;' : '') . '
 
542
 
 
543
    ' . (!empty($post[$p]['aim']) ? '<a href="aim:goim?screenname=' . $post[$p]['aim'] . '&amp;message=' . $l['aim_hello'] . '" target="_blank"><img src="' . $theme['images'] . 'aim.gif" title="' . $l['aim_username_is'] . ' ' . $post[$p]['username'] . ' ' . $l['is'] . ' ' . $post[$p]['aim'] . '" alt="" /></a>&nbsp;' : '') . '
 
544
 
 
545
    ' . (!empty($post[$p]['yim']) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $post[$p]['yim'] . '&amp;.src=pg" target="_blank"><img src="' . $theme['images'] . 'yim.gif" title="' . $l['yim_identity_is'] . ' ' . $post[$p]['username'] . ' ' . $l['is'] . ' ' . $post[$p]['yim'] . '" alt="" /></a>&nbsp;' : '') . '
 
546
 
 
547
    </td>
 
548
    </tr>
 
549
 
 
550
    </table>
 
551
 
 
552
    </td>
 
553
    </tr>
 
554
 
 
555
    <tr>
 
556
    <td><img src="' . $theme['images'] . 'cbot.png" width="100%" height="10" alt="" /></td>
 
557
    </tr>
 
558
    </table>';
 
559
    }
 
560
 
 
561
    if (!empty($globals['prenextopic'])) {
 
562
 
 
563
        echo '<br /><a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;tpg=' . $pg . '&amp;previous" >&laquo;&nbsp;' . $l['previous'] . '</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;tpg=' . $pg . '&amp;next" >' . $l['next'] . '&nbsp;&raquo;</a>';
 
564
    }
 
565
 
 
566
    if ($show_mod) {
 
567
 
 
568
        echo '<br /><div style="text-align:right;">' . $l['with_selected'] . ' : <select name="withselected" id="selectedposts">
 
569
    ' . (($user['can_del_own_post'] && $user['can_del_own_post']) ? '<option value="delete">' . $l['delete_posts'] . '</option>' : '') . '
 
570
    ' . ($user['can_merge_posts'] ? '<option value="merge">' . $l['merge_posts'] . '</option>' : '') . '
 
571
    </select>&nbsp;&nbsp;&nbsp;&nbsp;
 
572
    <input type="submit" name="withselsubmit" value="' . $l['submit_go'] . '" />&nbsp;&nbsp;&nbsp;&nbsp;
 
573
    </div>
 
574
    </form>';
 
575
    }
 
576
 
 
577
    echo '<br /><br /><table width="100%" cellpadding="4" cellspacing="0" class="cbgbor">
 
578
    <tr><td class="ptcbg1" align="right">';
 
579
    echo implode(' | ', $top_opt);
 
580
 
 
581
    echo '</td></tr>
 
582
    </table><br />';
 
583
 
 
584
    if (!empty($topicpages)) {
 
585
 
 
586
        echo $links;
 
587
    }
 
588
 
 
589
    //Can he post reply
 
590
    if (!empty($user['can_reply_to_this_topic'])) {
 
591
 
 
592
        echo '<br /><a href="' . $globals['ind'] . 'act=post&amp;topid=' . $topic['tid'] . '"><img src="' . $theme['images'] . 'buttons/reply.png" alt="" /></a>';
 
593
    }
 
594
 
 
595
    if (!empty($user['can_poll_this_topic'])) {
 
596
 
 
597
        echo '&nbsp;&nbsp;<a href="' . $globals['ind'] . 'act=postpoll"><img src="' . $theme['images'] . 'buttons/addpoll.png" alt="" /></a>';
 
598
    }
 
599
 
 
600
    echo '<div align="right">' . navigator() . '</div>';
 
601
 
 
602
    if (!empty($users_who_read)) {
 
603
 
 
604
        echo '<br /><br />
 
605
        <table border="0" width="100%" cellspacing="1" cellpadding="4" class="cbor">
 
606
 
 
607
            <tr>
 
608
            <td colspan="2" class="cbg1" align="left">' . $l['users_who_read'] . '</td>
 
609
            </tr>
 
610
 
 
611
            <tr>
 
612
            <td align="center" class="miposts" width="5%">
 
613
            <img src="' . $theme['images'] . 'online.gif" alt="" />
 
614
            </td>
 
615
            <td class="mifor">';
 
616
 
 
617
        foreach ($users_who_read as $u => $uv) {
 
618
 
 
619
            $users_who_read[$u] = '<a href="' . userlink($uv['id'], $uv['username']) . '" style="color: ' . $uv['mem_gr_colour'] . ';" >' . $uv['username'] . '</a>';
 
620
        }
 
621
 
 
622
        echo implode(', ', $users_who_read) . '</td>
 
623
            </tr>
 
624
 
 
625
        </table>';
 
626
    }
 
627
 
 
628
    echo '<br /><br />
 
629
    <table border="0" width="100%" cellspacing="1" cellpadding="4" class="cbor">
 
630
 
 
631
        <tr>
 
632
        <td colspan="2" class="cbg1" align="left">' . $l['users_viewing'] . '</td>
 
633
        </tr>
 
634
 
 
635
        <tr>
 
636
        <td align="center" class="miposts" width="5%">
 
637
        <img src="' . $theme['images'] . 'online.gif" alt="" />
 
638
        </td>
 
639
        <td class="mifor">
 
640
        ' . $guests . ' ' . $l['guests'] . ', ' . count($active) . ' ' . $l['users'] . '' . (($anonymous) ? ', ' . $anonymous . ' ' . $l['viewing_anonymous'] : '.' ) . '
 
641
        ' . (!empty($activeusers) ? '<hr />' . implode(', ', $activeusers) : '') . '
 
642
        </td>
 
643
        </tr>
 
644
 
 
645
    </table>';
 
646
 
 
647
    //The defualt footers
 
648
    aeffooter();
 
649
}
 
650
 
 
651
function thread_theme() {
 
652
 
 
653
    global $user, $logged_in, $globals, $AEF_SESS, $theme, $l;
 
654
    global $categories, $forums, $active, $activebots, $anonymous, $guests, $board, $poll, $user_group, $post_group, $tid, $tpg, $fid, $title, $topic, $post, $topicpages, $attachments, $page, $dmenus, $postcodefield, $pid, $fpid, $users_who_read, $feeds;
 
655
 
 
656
    if (!empty($board['rss'])) {
 
657
 
 
658
        $feeds[] = '<link rel="alternate" type="application/rss+xml" title="' . $board['fname'] . ' - ' . $l['rss'] . '" href="' . $globals['ind'] . 'act=feeds&amp;forum=' . $board['fid'] . '" />';
 
659
    }
 
660
 
 
661
    if (!empty($board['rss_topic'])) {
 
662
 
 
663
        $feeds[] = '<link rel="alternate" type="application/rss+xml" title="' . $topic['topic'] . ' - ' . $l['rss'] . '" href="' . $globals['ind'] . 'act=feeds&amp;topic=' . $topic['tid'] . '" />';
 
664
    }
 
665
 
 
666
    //Link array of active users
 
667
    $activeusers = array();
 
668
 
 
669
    //Build the active users array
 
670
    foreach ($active as $i => $v) {
 
671
 
 
672
        $activeusers[] = '<a href="' . userlink($v['id'], $v['username']) . '" style="color: ' . $active[$i]['mem_gr_colour'] . ';" >' . $active[$i]['username'] . '</a>';
 
673
    }
 
674
 
 
675
    //Are there any Bots
 
676
    foreach ($activebots as $k => $v) {
 
677
 
 
678
        $activeusers[] = $v;
 
679
    }
 
680
 
 
681
    //The header
 
682
    aefheader($title);
 
683
 
 
684
    /////////////////////////////
 
685
    //The Poll if any
 
686
    /////////////////////////////
 
687
 
 
688
    if (!empty($poll)) {
 
689
 
 
690
        //Show the Voting Form
 
691
        if ($poll['what_to_show'] == 1) {
 
692
 
 
693
            //Can he see the results without voting
 
694
            if ($poll['show_when'] == 0) {
 
695
 
 
696
                $polloptions[] = '<a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;spollres" >' . $l['show_results'] . '</a>';
 
697
            }
 
698
 
 
699
            //Show the results
 
700
        } elseif ($poll['what_to_show'] == 2) {
 
701
 
 
702
 
 
703
            foreach ($poll['options'] as $opk => $opt) {
 
704
 
 
705
                //If the total Votes are zero
 
706
                if ($poll['votes'] != 0) {
 
707
 
 
708
                    $percentage = ($opt['poo_votes'] / $poll['votes']) * 100;
 
709
 
 
710
                    $img_width = (400 * $percentage) / 100;
 
711
 
 
712
                    $img_width = (($img_width > 0) ? $img_width : 11);
 
713
                } else {
 
714
 
 
715
                    $img_width = 11;
 
716
                    $percentage = 0;
 
717
                }
 
718
 
 
719
                $poll['options'][$opk]['width'] = $img_width;
 
720
                $poll['options'][$opk]['percentage'] = substr($percentage, 0, 5);
 
721
            }
 
722
 
 
723
 
 
724
            //Has he voted yet
 
725
            if ((!$poll['user_voted']) &&
 
726
                    ($user['can_vote_polls'] || $board['can_vote_polls']) &&
 
727
                    !$poll['expired'] && !$poll['locked']) {
 
728
 
 
729
                $polloptions[] = '<a href="' . $globals['ind'] . 'tid=' . $tid . '" >' . $l['vote'] . '</a>';
 
730
            }
 
731
 
 
732
 
 
733
            //Can he delete his vote
 
734
            if ($poll['user_voted'] && $logged_in && $poll['change_vote']) {
 
735
 
 
736
                $polloptions[] = '<a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;deletevote" >' . $l['delete_vote'] . '</a>';
 
737
            }
 
738
 
 
739
 
 
740
            //Show a message
 
741
        } elseif ($poll['what_to_show'] == 3) {
 
742
 
 
743
            //Left empty for future compatibility
 
744
        }
 
745
 
 
746
 
 
747
        ///////////////////////////////
 
748
        // Some Administrative Options
 
749
        ///////////////////////////////
 
750
        //Can he EDIT the results
 
751
        if (($poll['i_started'] && $user['can_edit_own_poll']) ||
 
752
                (!$poll['i_started'] && $user['can_edit_other_poll'])) {
 
753
 
 
754
            $adpolloptions[] = '<a href="' . $globals['ind'] . 'act=editpoll&amp;poid=' . $poll['poid'] . '">' . $l['edit_poll'] . '</a>';
 
755
        }
 
756
 
 
757
        //Can he Remove the poll
 
758
        if (($poll['i_started'] && $user['can_rem_own_poll']) ||
 
759
                (!$poll['i_started'] && $user['can_rem_other_poll'])) {
 
760
 
 
761
            $adpolloptions[] = '<a href="' . $globals['ind'] . 'act=removepoll&amp;poid=' . $poll['poid'] . '">' . $l['reomve_poll'] . '</a>';
 
762
        }
 
763
    }//End of empty($poll)
 
764
    //Show the results
 
765
    if (!empty($poll['what_to_show']) && ($poll['what_to_show'] == 2)) {
 
766
 
 
767
        $showthis = '<table cellpadding="3" cellspacing="3">';
 
768
 
 
769
        foreach ($poll['options'] as $opk => $opt) {
 
770
 
 
771
            $showthis .= '<tr><td align="right">
 
772
                        <b>' . $opt['poo_option'] . '</b>
 
773
                        (' . $opt['poo_votes'] . ')
 
774
                        </td>
 
775
                        <td align="left">
 
776
            <img src="' . $theme['images'] . 'poll.gif" width="' . $poll['options'][$opk]['width'] . '" height="10" alt="" /> (' . $opt['percentage'] . '%)
 
777
                        </td></tr>';
 
778
        }
 
779
 
 
780
        $showthis .= '<tr><td colspan="2"><br /><b>' . $l['total_votes'] . '</b> : ' . $poll['votes'] . '</td></tr></table>';
 
781
 
 
782
        //Show the form for Voting
 
783
    } elseif (!empty($poll['what_to_show']) && ($poll['what_to_show'] == 1)) {
 
784
 
 
785
        $showthis = '<form accept-charset="' . $globals['charset'] . '" method="post" action="" name="poll_vote">
 
786
                    <table cellpadding="3" cellspacing="3">';
 
787
 
 
788
        foreach ($poll['options'] as $opk => $opt) {
 
789
 
 
790
            $showthis .= '<tr><td align="right">
 
791
                        ' . $opt['poo_option'] . '
 
792
                        <input type="radio" name="uservote" value="' . $opt['pooid'] . '" />
 
793
                        </td>
 
794
                        </tr>';
 
795
        }
 
796
 
 
797
        $showthis .= '<tr>
 
798
                    <td>
 
799
                    <input type="submit" name="vote_poll" value="' . $l['submit_vote'] . '" /><br />
 
800
                    </td>
 
801
                    </tr>
 
802
                    </table>
 
803
                    </form>';
 
804
    } elseif (!empty($poll['what_to_show']) && ($poll['what_to_show'] == 3)) {
 
805
 
 
806
        $showthis = '<table cellpadding="3" cellspacing="3">';
 
807
 
 
808
        $showthis .= '<tr><td><br />' . $l['will_be_shown_at'] . ' <b>' . datify($poll['expires_on']) . '</b><br /><br />' . $l['total_votes'] . ' : <b>' . $poll['votes'] . '</b></td></tr></table>';
 
809
    }
 
810
 
 
811
 
 
812
    if (!empty($poll['what_to_show'])) {
 
813
 
 
814
        echo'<br /><table width="100%" class="cbor" cellpadding="1" cellspacing="1">
 
815
            <tr>
 
816
            <td class="ptcbg" colspan="2">' . $l['poll'] . '</td>
 
817
            </tr>
 
818
 
 
819
            ' . (!empty($adpolloptions) ? '<tr>
 
820
            <td class="ptcbg1" colspan="2" align="right" style="padding:4px;">' . implode('&nbsp;|&nbsp;', $adpolloptions) . '
 
821
            </td></tr>' : '') . '
 
822
 
 
823
            <tr>
 
824
            <td class="ptwbg" colspan="2"><b>' . $l['the_poll_question'] . ' : </b>' . $poll['qt'] . '</td>
 
825
            </tr>
 
826
 
 
827
            <tr>
 
828
            <td class="ptwbg" align="center">' . $showthis . '</td>
 
829
            ' . (!empty($polloptions) ? '<td class="ptwbg" align="center" width="25%" valign="top">' . implode('<br />', $polloptions) . '</td>' : '') . '
 
830
            </tr>
 
831
 
 
832
            </table>
 
833
            <br /><br />';
 
834
    }
 
835
 
 
836
 
 
837
    //Can he post reply
 
838
    if (!empty($user['can_reply_to_this_topic'])) {
 
839
 
 
840
        echo '<br /><a href="' . $globals['ind'] . 'act=post&amp;topid=' . $topic['tid'] . '&amp;par_id=' . $pid . '"><img src="' . $theme['images'] . 'buttons/reply.png" alt="" /></a>';
 
841
    }
 
842
 
 
843
    if (!empty($user['can_poll_this_topic'])) {
 
844
 
 
845
        echo '&nbsp;&nbsp;<a href="' . $globals['ind'] . 'act=postpoll"><img src="' . $theme['images'] . 'buttons/addpoll.png" alt="" /></a>';
 
846
    }
 
847
 
 
848
    if (!(empty($user['can_lock_this_topic']) && !$user['can_make_sticky']
 
849
            && empty($user['can_edit_this_topic']) && empty($user['can_del_this_topic'])
 
850
            && empty($user['can_move_this_topic']))) {
 
851
 
 
852
        //Moderation option
 
853
        $top_opt[] = '<a href="#" onmouseover="dropmenu(this, \'modopt\')" onmouseout="pullmenu(\'modopt\')">' . $l['options'] . '</a>';
 
854
 
 
855
        echo '<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
 
856
createmenu("modopt", [
 
857
' . (empty($user['can_lock_this_topic']) ? '' : '[\'' . ($topic['t_status'] == 1 ? '<a href="' . $globals['ind'] . 'act=locktopic&amp;do=0&amp;topid=' . $topic['tid'] . '">' . $l['lock_topic'] . '</a>' : '<a href="' . $globals['ind'] . 'act=locktopic&amp;do=1&amp;topid=' . $topic['tid'] . '">' . $l['unlock_topic'] . '</a>') . '\'],') . '
 
858
' . ($user['can_make_sticky'] ? '[\'' . ($topic['t_sticky'] == 1 ? '<a href="' . $globals['ind'] . 'act=pintopic&amp;do=0&amp;topid=' . $topic['tid'] . '">' . $l['unpin_topic'] . '</a>' : '<a href="' . $globals['ind'] . 'act=pintopic&amp;do=1&amp;topid=' . $topic['tid'] . '">' . $l['pin_topic'] . '</a>') . '\'],' : '') . '
 
859
' . (empty($user['can_edit_this_topic']) ? '' : '[\'<a href="' . $globals['ind'] . 'act=edittopic&amp;topid=' . $topic['tid'] . '">' . $l['edit_topic'] . '<\/a>\'],' ) . '
 
860
' . (empty($user['can_del_this_topic']) ? '' : '[\'<a href="' . $globals['ind'] . 'act=deletetopic&amp;topid=' . $topic['tid'] . '">' . $l['delete_topic'] . '<\/a>\'],' ) . '
 
861
' . (empty($user['can_move_this_topic']) ? '' : '[\'<a href="' . $globals['ind'] . 'act=movetopic&amp;topid=' . $topic['tid'] . '">' . $l['move_topic'] . '<\/a>\'],' ) . '
 
862
]);
 
863
// ]]></script>';
 
864
    }
 
865
 
 
866
    echo '<br /><br /><table width="100%" cellpadding="4" cellspacing="0" class="cbgbor">
 
867
    <tr>' . (empty($board['rss_topic']) ? '' : '<td class="ptcbgrss"><a href="' . $globals['ind'] . 'act=feeds&amp;topic=' . $topic['tid'] . '"><img src="' . $theme['images'] . 'feeds.gif" alt="" /></a></td>') . '<td class="ptcbg1" align="right">';
 
868
 
 
869
    //Mark as unread
 
870
    if ($logged_in) {
 
871
 
 
872
        $top_opt[] = '<a href="' . $globals['ind'] . 'act=markread&amp;mark=unreadtopic&amp;utid=' . $topic['tid'] . '">' . $l['mark_as_unread'] . '</a>';
 
873
    }
 
874
 
 
875
    //Can he post reply - quick
 
876
    if (!empty($user['can_reply_to_this_topic']) && !empty($board['quick_reply'])) {
 
877
 
 
878
        $top_opt[] = '<a href="javascript:showquickreply(\'quickreply\')">' . $l['quick_reply'] . '</a>';
 
879
 
 
880
        $usesmileys = ($logged_in ? ( $user['showsmileys'] == 1 ? true : ($user['showsmileys'] == 2 ? false : $globals['usesmileys']) ) : $globals['usesmileys']);
 
881
 
 
882
        $dmenus[] = '<div id="quickreply" class="pqr">
 
883
<form accept-charset="' . $globals['charset'] . '" method="post" action="' . $globals['ind'] . 'act=post&amp;topid=' . $topic['tid'] . '&amp;par_id=' . $pid . '">
 
884
<table width="100%" cellspacing="0" cellpadding="0" id="qrhandle">
 
885
<tr>
 
886
<td class="dwhl"></td>
 
887
<td align="left" class="dwhc"><b>' . $l['quick_reply'] . '</b></td>
 
888
<td align="right" class="dwhc"><a href="javascript:hideel(\'quickreply\')"><img src="' . $theme['images'] . 'close.gif" alt="" /></a></td>
 
889
<td class="dwhr"></td>
 
890
</tr>
 
891
</table>
 
892
 
 
893
<table width="100%" cellspacing="1" cellpadding="2" class="dwbody">
 
894
<tr>
 
895
<td class="rlc" width="15%"><b>' . $l['qr_post'] . '</b></td>
 
896
<td align="left" class="rrc">
 
897
<textarea name="post" rows="6" cols="55" id="topicpost"></textarea>
 
898
' . $postcodefield . '
 
899
</td>
 
900
</tr>
 
901
 
 
902
<tr>
 
903
<td class="rlc"><b>' . $l['qr_options'] . '</b></td>
 
904
<td align="left" class="rrc"><input type="checkbox" name="usesmileys" ' . (empty($usesmileys) ? '' : 'checked="checked"') . ' />&nbsp;' . $l['qr_enable_smileys'] . '
 
905
</td>
 
906
</tr>
 
907
 
 
908
<tr>
 
909
<td class="rlc" colspan="2" style="text-align:center">
 
910
<input type="submit" name="submitpost" value="' . $l['qr_submit'] . '" />
 
911
</td>
 
912
</tr>
 
913
 
 
914
<tr>
 
915
<td align="left" class="dwb" colspan="2"></td>
 
916
</tr>
 
917
 
 
918
</table>
 
919
</form>
 
920
</div>
 
921
 
 
922
<script language="javascript" type="text/javascript"><!-- // --><![CDATA[
 
923
Drag.init($("qrhandle"), $("quickreply"));
 
924
function showquickreply(){
 
925
    qrid = \'quickreply\';
 
926
    $(qrid).style.left=((getwidth()/2)-($(qrid).offsetWidth/2))+"px";
 
927
    $(qrid).style.top=(scrolledy()+110)+"px";
 
928
    showel(qrid);
 
929
    smoothopaque(qrid, 0, 100, 10);
 
930
}
 
931
// ]]></script>';
 
932
    }
 
933
 
 
934
    if ($user['notify_new_posts'] && empty($user['is_topic_subscribed'])) {
 
935
 
 
936
        $top_opt[] = '<a href="' . $globals['ind'] . 'act=notify&amp;nact=topic&amp;ntid=' . $topic['tid'] . '">' . $l['subscribe_topic'] . '</a>';
 
937
    } elseif ($user['notify_new_posts'] && !empty($user['is_topic_subscribed'])) {
 
938
 
 
939
        $top_opt[] = '<a href="' . $globals['ind'] . 'act=notify&amp;nact=unsubtopic&amp;ntid=' . $topic['tid'] . '">' . $l['unsubscribe_topic'] . '</a>';
 
940
    }
 
941
 
 
942
    $top_opt[] = '<a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;nor=true">' . $l['normal_mode'] . '</a>';
 
943
 
 
944
    if ($globals['allow_taf'] && $user['can_email_topic']) {
 
945
 
 
946
        $top_opt[] = '<a href="' . $globals['ind'] . 'act=tellafriend&amp;topid=' . $topic['tid'] . '">' . $l['tell_a_friend'] . '</a>';
 
947
    }
 
948
 
 
949
    $top_opt[] = '<a href="' . $globals['ind'] . 'tid=' . $topic['tid'] . '&amp;printtopic" target="_blank" title="' . $l['print_title'] . '">' . $l['print'] . '</a>&nbsp;&nbsp;';
 
950
 
 
951
    echo implode(' | ', $top_opt);
 
952
 
 
953
    echo '</td></tr>
 
954
    </table>';
 
955
 
 
956
    $p = $pid; //Just getting bored to write $pid
 
957
    //The first row that is Headers
 
958
    echo '<br /><table width="100%" cellpadding="0" cellspacing="0">
 
959
    <tr>
 
960
    <td>
 
961
    <table width="100%" cellpadding="0" cellspacing="0"><tr>
 
962
    <td class="pcbgl"></td>
 
963
    <td class="pcbg"><b>' . ($post[$p]['post_count'] == 0 || empty($post[$p]['post_title']) ? '&nbsp;' . $title . (empty($topic['description']) ? '' : ',&nbsp;' . $topic['description']) . '&nbsp;(' . $topic['n_posts'] . ' ' . $l['replies'] . ', ' . $l['read'] . ' ' . $topic['n_views'] . ' ' . $l['times'] . ')' : $post[$p]['post_title']) . '</b></td>
 
964
    <td class="pcbgr"></td>
 
965
    </tr>
 
966
    </table>
 
967
    </td>
 
968
    </tr>
 
969
 
 
970
    <tr>
 
971
    <td class="cbgbor">
 
972
    <table width="100%" cellpadding="1" cellspacing="0">
 
973
    <tr>
 
974
    <td class="posterbg" width="22%">
 
975
 
 
976
    <a href="' . (isset($post[$p]['is_guest']) ? 'mailto:' . $post[$p]['email'] : userlink($post[$p]['id'], $post[$p]['username'])) . '">
 
977
    ' . $post[$p]['username'] . '
 
978
    </a>
 
979
    </td>
 
980
 
 
981
    <td class="postdate" align="right">
 
982
    <div style="float:left">
 
983
    <a name="p' . $post[$p]['pid'] . '"></a>
 
984
    <img src="' . $theme['images'] . 'postedon.png" title="' . $l['posted_on'] . '" alt="" />
 
985
    ' . $post[$p]['pdate'];
 
986
 
 
987
    echo (($post[$p]['post_count']) ? ' | ' . $l['post_num_prefix'] . ': ' . $post[$p]['post_count'] : '');
 
988
 
 
989
    echo '</div>';
 
990
 
 
991
    $post_opt = array();
 
992
 
 
993
    //Can he post reply
 
994
    if (isset($post[$p]['can_reply'])) {
 
995
 
 
996
        $post_opt[] = '<a href="' . $globals['ind'] . 'act=post&amp;topid=' . $topic['tid'] . '&amp;pid=' . $post[$p]['pid'] . '">' . $l['quote'] . '</a>';
 
997
    }
 
998
 
 
999
    //Can he edit the post
 
1000
    if (isset($post[$p]['can_edit'])) {
 
1001
 
 
1002
        $post_opt[] = '<a href="' . $globals['ind'] . 'act=edit&amp;pid=' . $post[$p]['pid'] . '">' . $l['edit'] . '</a>';
 
1003
    }
 
1004
 
 
1005
    //Can he delete the post
 
1006
    if (isset($post[$p]['can_del']) && $post[$p]['post_count'] != 0) {
 
1007
 
 
1008
        $post_opt[] = '<a href="' . $globals['ind'] . 'act=delete&amp;pid=' . $post[$p]['pid'] . '" onclick="return confirm(\'' . $l['del_this_conf'] . '\');">' . $l['delete'] . '</a>';
 
1009
    }
 
1010
 
 
1011
    //Can he report this post
 
1012
    if (!empty($globals['report_posts']) && !empty($user['can_report_post'])) {
 
1013
 
 
1014
        $post_opt[] = '<a href="' . $globals['ind'] . 'act=report&amp;pid=' . $post[$p]['pid'] . '">' . $l['report'] . '</a>';
 
1015
    }
 
1016
 
 
1017
    echo implode(' | ', $post_opt) . '</td>
 
1018
    </tr>';
 
1019
 
 
1020
    echo '<tr>
 
1021
    <td class="posterinfo" valign="top">';
 
1022
 
 
1023
    if (!empty($post[$p]['avatarurl'])) {
 
1024
 
 
1025
        echo '<div style="text-align:center;"><a href="' . userlink($post[$p]['id'], $post[$p]['username']) . '"><img src="' . $post[$p]['avatarurl'][0] . '" width="' . $post[$p]['avatarurl'][1] . '" height="' . $post[$p]['avatarurl'][2] . '" alt="" /></a></div>';
 
1026
    }
 
1027
 
 
1028
    echo '<div class="pisub">' . $l['prefix_group'] . ' <span ' . (empty($post[$p]['mem_gr_colour']) ? '' : 'style="color:' . $post[$p]['mem_gr_colour'] . ';"') . '>' . $post[$p]['mem_gr_name'] . '</span><br />';
 
1029
 
 
1030
    //If the user group has some images as per Group
 
1031
    if ($post[$p]['image_count']) {
 
1032
 
 
1033
        for ($i = 0; $i < $post[$p]['image_count']; $i++) {
 
1034
            echo '<img src="' . $theme['images'] . $post[$p]['image_name'] . '" alt="" />';
 
1035
        }
 
1036
 
 
1037
        echo '</div>';
 
1038
    }
 
1039
 
 
1040
    echo '
 
1041
    ' . (!empty($post[$p]['post_gr_name']) ? '<div class="pisub">' . $l['prefix_post_group'] . ' ' . $post[$p]['post_gr_name'] . '</div>' : '') . '
 
1042
    ' . (!empty($post[$p]['posts']) ? '<div class="pisub">' . $l['prefix_posts'] . ' ' . $post[$p]['posts'] . '</div>' : '') . '
 
1043
    <div class="pisub">' . $l['prefix_status'] . ' ' . ($post[$p]['status'] ? '<img src="' . $theme['images'] . 'online.png" title="' . $l['online'] . '" alt="" />' : '<img src="' . $theme['images'] . 'offline.png" title="' . $l['offline'] . '" alt="" />') . '</div>
 
1044
    ' . ( (empty($post[$p]['users_text'])) ? '' : '<br />' . $post[$p]['users_text'] ) . '
 
1045
    </td>
 
1046
    <td class="post" align="left" valign="top">
 
1047
    ' . $post[$p]['post'] . '
 
1048
    ' . (!empty($attachments[$post[$p]['pid']]) ? '<br /><br />-----------------------<br />' . implode('<br />', $attachments[$post[$p]['pid']]) : '') . '
 
1049
    ' . (!empty($post[$p]['modifier']) ? '<br /><br />' . $l['edited_by'] . ' <b>' . $post[$p]['modifier'] . '</b> : ' . $post[$p]['modtime'] : '');
 
1050
 
 
1051
    if (!empty($post[$p]['sig'])) {
 
1052
 
 
1053
        echo '<br /><br />-----------------------<br />' . $post[$p]['sig'];
 
1054
    }
 
1055
 
 
1056
    echo '</td>
 
1057
    </tr>';
 
1058
 
 
1059
    echo '<tr>
 
1060
    <td class="ptip">
 
1061
    <b>' . $l['ip'] . ':</b> ' . ((isset($post[$p]['poster_ip'])) ? $post[$p]['poster_ip'] : '--' ) . '
 
1062
    </td>
 
1063
    <td class="specialrow">
 
1064
    &nbsp;<a href="' . (isset($post[$p]['is_guest']) ? 'mailto:' . $post[$p]['email'] : userlink($post[$p]['id'], $post[$p]['username'])) . '"><img src="' . $theme['images'] . 'profile.gif" title="' . $l['view_profile_of'] . ' ' . $post[$p]['username'] . '" alt="" /></a>&nbsp;
 
1065
 
 
1066
    ' . (!empty($post[$p]['email']) ? '<a href="mailto:' . $post[$p]['email'] . '"><img src="' . $theme['images'] . 'email.gif" title="' . $l['send_email_to'] . ' ' . $post[$p]['username'] . '" alt="" /></a>&nbsp;' : '') . '
 
1067
 
 
1068
    ' . ($logged_in ? '<a href="' . $globals['ind'] . 'act=usercp&amp;ucpact=writepm&amp;to=' . $post[$p]['id'] . '"><img src="' . $theme['images'] . 'pmuser.gif" title="' . $l['send_pm_to'] . ' ' . $post[$p]['username'] . '" alt="" /></a>&nbsp;' : '') . '
 
1069
 
 
1070
    ' . (!empty($post[$p]['www']) ? '<a href="' . $post[$p]['www'] . '" target="_blank"><img src="' . $theme['images'] . 'www.gif" title="' . $l['visit_website_of'] . ' ' . $post[$p]['username'] . '" alt="" /></a>&nbsp;' : '') . '
 
1071
 
 
1072
    ' . (!empty($post[$p]['msn']) ? '<a href="http://members.msn.com/' . $post[$p]['msn'] . '" target="_blank"><img src="' . $theme['images'] . 'msn.gif" title="' . $l['view_msn_profile'] . ' ' . $post[$p]['username'] . '" alt="" /></a>&nbsp;' : '') . '
 
1073
 
 
1074
    ' . (!empty($post[$p]['aim']) ? '<a href="aim:goim?screenname=' . $post[$p]['aim'] . '&amp;message=' . $l['aim_hello'] . '" target="_blank"><img src="' . $theme['images'] . 'aim.gif" title="' . $l['aim_username_is'] . ' ' . $post[$p]['username'] . ' ' . $l['is'] . ' ' . $post[$p]['aim'] . '" alt="" /></a>&nbsp;' : '') . '
 
1075
 
 
1076
    ' . (!empty($post[$p]['yim']) ? '<a href="http://edit.yahoo.com/config/send_webmesg?.target=' . $post[$p]['yim'] . '&amp;.src=pg" target="_blank"><img src="' . $theme['images'] . 'yim.gif" title="' . $l['yim_identity_is'] . ' ' . $post[$p]['username'] . ' ' . $l['is'] . ' ' . $post[$p]['yim'] . '" alt="" /></a>&nbsp;' : '') . '
 
1077
 
 
1078
    </td>
 
1079
    </tr>
 
1080
 
 
1081
    </table>
 
1082
 
 
1083
    </td>
 
1084
    </tr>
 
1085
 
 
1086
    <tr>
 
1087
    <td><img src="' . $theme['images'] . 'cbot.png" width="100%" height="10" alt="" /></td>
 
1088
    </tr>
 
1089
    </table>';
 
1090
 
 
1091
    //The post ends here
 
1092
    ///////////////////
 
1093
    // All the threads
 
1094
    ///////////////////
 
1095
 
 
1096
    echo '<br /><br /><table width="100%" cellpadding="0" cellspacing="0">
 
1097
    <tr>
 
1098
    <td>
 
1099
    <table width="100%" cellpadding="0" cellspacing="0"><tr>
 
1100
    <td class="pcbgl"></td>
 
1101
    <td class="pcbg"><b>' . $l['threads'] . '</b></td>
 
1102
    <td class="pcbgr"></td>
 
1103
    </tr>
 
1104
    </table>
 
1105
    </td>
 
1106
    </tr>
 
1107
 
 
1108
    <tr>
 
1109
    <td class="cbgbor">
 
1110
    <table width="100%" cellpadding="1" cellspacing="0">
 
1111
    <tr>
 
1112
    <td class="post" width="22%">';
 
1113
 
 
1114
    //The first post title
 
1115
    echo '<img src="' . $theme['images'] . 'postedon.png" alt="" />&nbsp;<b><a href="' . (isset($post[$fpid]['is_guest']) ? 'mailto:' . $post[$fpid]['email'] : userlink($post[$fpid]['id'], $post[$fpid]['username'])) . '">' . $post[$fpid]['username'] . '</a></b>&nbsp;&nbsp;&nbsp;<i>' . ($pid == $fpid ? '<b>' : '') . '<a href="' . $globals['ind'] . 'tid=' . $tid . '">' . $title . '</a>' . ($pid == $fpid ? '</b>' : '') . '</i>' . (empty($topic['description']) ? '' : ',&nbsp;' . $topic['description']) . '&nbsp;(' . $topic['n_posts'] . ' ' . $l['replies'] . ', ' . $l['read'] . ' ' . $topic['n_views'] . ' ' . $l['times'] . ')<br />';
 
1116
 
 
1117
    $tab = '&nbsp;&nbsp;&nbsp;&nbsp;';
 
1118
 
 
1119
    $tree = '|--';
 
1120
 
 
1121
    $parents = array();
 
1122
 
 
1123
    $before = '';
 
1124
 
 
1125
    $last_pid = 0;
 
1126
 
 
1127
    foreach ($post as $pk => $pv) {
 
1128
 
 
1129
        if ($post[$pk]['post_count'] == 0) {
 
1130
 
 
1131
            continue;
 
1132
        }
 
1133
 
 
1134
        $dasher = '';
 
1135
 
 
1136
        for ($t = 0; $t < $post[$pk]['level']; $t++) {
 
1137
 
 
1138
            $dasher .= $tab;
 
1139
        }
 
1140
 
 
1141
        $before = $dasher . $tree;
 
1142
 
 
1143
        echo $before . ' <img src="' . $theme['images'] . 'thread.png" alt="" />&nbsp;<b><a href="' . (isset($post[$pk]['is_guest']) ? 'mailto:' . $post[$pk]['email'] : userlink($post[$pk]['id'], $post[$pk]['username'])) . '">' . $post[$pk]['username'] . '</a></b>';
 
1144
 
 
1145
        if ($pid == $pk) {
 
1146
 
 
1147
            echo '&nbsp;&nbsp;&nbsp;<b><i><a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;pid=' . $post[$pk]['pid'] . '">' . $post[$pk]['post_thread'] . '</a></i></b>';
 
1148
        } else {
 
1149
 
 
1150
            echo '&nbsp;&nbsp;&nbsp;<i><a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;pid=' . $post[$pk]['pid'] . '">' . $post[$pk]['post_thread'] . '</a></i>';
 
1151
        }
 
1152
 
 
1153
        echo '&nbsp;&nbsp;&nbsp;<small>' . $l['on'] . '&nbsp;' . $post[$pk]['pdate'] . '</small><br />';
 
1154
 
 
1155
        $last_pid = $pk;
 
1156
    }
 
1157
 
 
1158
 
 
1159
 
 
1160
    echo '</td></tr></table>
 
1161
    </td>
 
1162
    </tr>
 
1163
 
 
1164
    <tr>
 
1165
    <td><img src="' . $theme['images'] . 'cbot.png" width="100%" height="10" alt="" /></td>
 
1166
    </tr>
 
1167
    </table>';
 
1168
 
 
1169
    if (!empty($globals['prenextopic'])) {
 
1170
 
 
1171
        echo '<br /><a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;pid=' . $pid . '&amp;previous" >&laquo;&nbsp;' . $l['previous'] . '</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;pid=' . $pid . '&amp;next" >' . $l['next'] . '&nbsp;&raquo;</a>';
 
1172
    }
 
1173
 
 
1174
    echo '<br /><br /><table width="100%" cellpadding="4" cellspacing="0" class="cbgbor">
 
1175
    <tr><td class="ptcbg1" align="right">';
 
1176
    echo implode(' | ', $top_opt);
 
1177
 
 
1178
    echo '</td></tr>
 
1179
    </table><br />';
 
1180
 
 
1181
 
 
1182
    //Can he post reply
 
1183
    if (!empty($user['can_reply_to_this_topic'])) {
 
1184
 
 
1185
        echo '<br /><a href="' . $globals['ind'] . 'act=post&amp;topid=' . $topic['tid'] . '&amp;par_id=' . $pid . '"><img src="' . $theme['images'] . 'buttons/reply.png" alt="" /></a>';
 
1186
    }
 
1187
 
 
1188
    if (!empty($user['can_poll_this_topic'])) {
 
1189
 
 
1190
        echo '&nbsp;&nbsp;<a href="' . $globals['ind'] . 'act=postpoll"><img src="' . $theme['images'] . 'buttons/addpoll.png" alt="" /></a>';
 
1191
    }
 
1192
 
 
1193
    if (!empty($users_who_read)) {
 
1194
 
 
1195
        echo '<br /><br />
 
1196
        <table border="0" width="100%" cellspacing="1" cellpadding="4" class="cbor">
 
1197
 
 
1198
            <tr>
 
1199
            <td colspan="2" class="cbg1" align="left">' . $l['users_who_read'] . '</td>
 
1200
            </tr>
 
1201
 
 
1202
            <tr>
 
1203
            <td align="center" class="miposts" width="5%">
 
1204
            <img src="' . $theme['images'] . 'online.gif" alt="" />
 
1205
            </td>
 
1206
            <td class="mifor">';
 
1207
 
 
1208
        foreach ($users_who_read as $u => $uv) {
 
1209
 
 
1210
            $users_who_read[$u] = '<a href="' . userlink($uv['id'], $uv['username']) . '" style="color: ' . $uv['mem_gr_colour'] . ';" >' . $uv['username'] . '</a>';
 
1211
        }
 
1212
 
 
1213
        echo implode(', ', $users_who_read) . '</td>
 
1214
            </tr>
 
1215
 
 
1216
        </table>';
 
1217
    }
 
1218
 
 
1219
    echo '<br /><br />
 
1220
    <table border="0" width="100%" cellspacing="1" cellpadding="4" class="cbor">
 
1221
 
 
1222
        <tr>
 
1223
        <td colspan="2" class="cbg1" align="left">' . $l['users_viewing'] . '</td>
 
1224
        </tr>
 
1225
 
 
1226
        <tr>
 
1227
        <td align="center" class="miposts" width="5%">
 
1228
        <img src="' . $theme['images'] . 'online.gif" alt="" />
 
1229
        </td>
 
1230
        <td class="mifor">
 
1231
        ' . $guests . ' ' . $l['guests'] . ', ' . count($active) . ' ' . $l['users'] . '' . (($anonymous) ? ', ' . $anonymous . ' ' . $l['viewing_anonymous'] : '.' ) . '
 
1232
        ' . (!empty($activeusers) ? '<hr />' . implode(', ', $activeusers) : '') . '
 
1233
        </td>
 
1234
        </tr>
 
1235
 
 
1236
        </table>';
 
1237
 
 
1238
    //The defualt footers
 
1239
    aeffooter();
 
1240
}
 
1241
 
 
1242
function printtopic_theme() {
 
1243
 
 
1244
    global $user, $logged_in, $globals, $AEF_SESS, $theme, $l;
 
1245
    global $categories, $forums, $active, $anonymous, $guests, $activeusers, $board, $poll, $user_group, $post_group, $tid, $tpg, $fid, $title, $topic, $post, $topicpages, $pg, $attachments, $page;
 
1246
 
 
1247
    //////////////////////////
 
1248
    // Count the topic pages
 
1249
    //////////////////////////
 
1250
 
 
1251
    $tpages = ceil(($topic['n_posts'] + 1) / $globals['maxpostsintopics']);
 
1252
 
 
1253
    $pg = ($page / $globals['maxpostsintopics']) + 1; //Current Page
 
1254
 
 
1255
    $topicpages = array();
 
1256
 
 
1257
    if ($tpages > 1) {
 
1258
 
 
1259
        if ($pg != 1) {
 
1260
 
 
1261
            $topicpages['&lt;&lt;'] = 1;
 
1262
 
 
1263
            $topicpages['&lt;'] = ($pg - 1);
 
1264
        }
 
1265
 
 
1266
        for ($i = ($pg - 4); $i < $pg; $i++) {
 
1267
 
 
1268
            if ($i >= 1) {
 
1269
 
 
1270
                $topicpages[$i] = $i;
 
1271
            }
 
1272
        }
 
1273
 
 
1274
        $topicpages[$pg] = $pg;
 
1275
 
 
1276
 
 
1277
        for ($i = ($pg + 1); $i <= ($pg + 4); $i++) {
 
1278
 
 
1279
            if ($i <= $tpages) {
 
1280
 
 
1281
                $topicpages[$i] = $i;
 
1282
            }
 
1283
        }
 
1284
 
 
1285
 
 
1286
        if ($pg != $tpages) {
 
1287
 
 
1288
            $topicpages['&gt;'] = ($pg + 1);
 
1289
 
 
1290
            $topicpages['&gt;&gt;'] = $tpages;
 
1291
        }
 
1292
 
 
1293
 
 
1294
        if ($tpages > 1) {
 
1295
 
 
1296
            $topicpages[$l['all']] = 'all';
 
1297
        }
 
1298
    }
 
1299
 
 
1300
    echo '
 
1301
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
1302
    <html xmlns="http://www.w3.org/1999/xhtml">
 
1303
    <head>
 
1304
    <meta http-equiv="Content-Type" content="text/html; charset=' . $globals['charset'] . '" />
 
1305
    <title>' . ((empty($title)) ? $globals['sn'] : $title) . '</title>
 
1306
    <link rel="stylesheet" type="text/css" href="' . $theme['url'] . '/style.css" />
 
1307
    </head>
 
1308
    <body>';
 
1309
 
 
1310
 
 
1311
    echo '<center><h1>' . $globals['sn'] . '</h1></center>
 
1312
    <hr />
 
1313
    <span size="4">' . $l['topic'] . ' : <b>' . $title . '</span></b>
 
1314
    <hr /><br /><br />';
 
1315
 
 
1316
    if (!empty($topicpages)) {
 
1317
 
 
1318
        $links = '<table class="cbgbor" cellspacing="1">
 
1319
<tr>';
 
1320
        $links .= '<td class="pagelinks">' . $l['page'] . ' ' . $pg . ' ' . $l['of'] . ' ' . $tpages . '</td>';
 
1321
        foreach ($topicpages as $k => $lv) {
 
1322
 
 
1323
            $links .= '<td class="' . ($k == $pg ? 'activepage' : 'pagelinks' ) . '"><a href="' . $globals['ind'] . 'tid=' . $tid . '&amp;tpg=' . $lv . '&amp;printtopic=true" >' . $k . '</a></td>';
 
1324
        }
 
1325
        $links .= '</tr>
 
1326
</table><br />';
 
1327
 
 
1328
        echo $links;
 
1329
    }
 
1330
 
 
1331
    foreach ($post as $p => $pv) {
 
1332
 
 
1333
        echo'<table width="100%" cellpadding="4" cellspacing="3" border="1" align="center">
 
1334
 
 
1335
    <tr>
 
1336
    <td>
 
1337
    <a name="p' . $post[$p]['pid'] . '"></a>
 
1338
    ' . $l['posted_by'] . ': <b>' . $post[$p]['username'] . '</b> ' . $l['on'] . ' ' . $post[$p]['pdate'] . (($post[$p]['post_count']) ? ' | ' . $l['post_num_prefix'] . ': ' . $post[$p]['post_count'] : '') . '
 
1339
    </td>
 
1340
    </tr>
 
1341
 
 
1342
    <tr>
 
1343
    <td align="left" valign="top">
 
1344
    ' . $post[$p]['post'] . '
 
1345
    ' . (!empty($post[$p]['modifier']) ? '<br /><br />' . $l['edited_by'] . ' <b>' . $post[$p]['modifier'] . '</b> : ' . $post[$p]['modtime'] : '') . '
 
1346
    ' . (!empty($post[$p]['sig']) ? '<br /><br />-----------------------<br />' . $post[$p]['sig'] : '') . '
 
1347
    </td>
 
1348
    </tr>
 
1349
 
 
1350
    </table>
 
1351
    <br />';
 
1352
    }
 
1353
 
 
1354
    echo '<center>' . copyright() . '</center>
 
1355
<br />
 
1356
</body>
 
1357
</html>';
 
1358
}
 
1359
 
 
1360
?>
 
 
b'\\ No newline at end of file'