Ignore:
Timestamp:
Nov 14, 2011, 11:17:15 PM (13 years ago)
Author:
dj3c1t
Message:

passage a Fluxbb 1.4.7

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/rsr.v5.1.dev/web/punbb/viewtopic.php

    r1 r3  
    11<?php
    2 /***********************************************************************
    3 
    4   Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
    5 
    6   This file is part of PunBB.
    7 
    8   PunBB is free software; you can redistribute it and/or modify it
    9   under the terms of the GNU General Public License as published
    10   by the Free Software Foundation; either version 2 of the License,
    11   or (at your option) any later version.
    12 
    13   PunBB is distributed in the hope that it will be useful, but
    14   WITHOUT ANY WARRANTY; without even the implied warranty of
    15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16   GNU General Public License for more details.
    17 
    18   You should have received a copy of the GNU General Public License
    19   along with this program; if not, write to the Free Software
    20   Foundation, Inc., 59 Temple Place, Suite 330, Boston,
    21   MA  02111-1307  USA
    22 
    23 ************************************************************************/
    24 
    25 
    26 define('PUN_ROOT', './');
     2
     3/**
     4 * Copyright (C) 2008-2011 FluxBB
     5 * based on code by Rickard Andersson copyright (C) 2002-2008 PunBB
     6 * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher
     7 */
     8
     9define('PUN_ROOT', dirname(__FILE__).'/');
    2710require PUN_ROOT.'include/common.php';
     11
    2812
    2913if ($pun_user['g_read_board'] == '0')
     
    4428if ($pid)
    4529{
    46         $result = $db->query('SELECT topic_id FROM '.$db->prefix.'posts WHERE id='.$pid) or error('Impossible de retrouver les informations du message', __FILE__, __LINE__, $db->error());
     30        $result = $db->query('SELECT topic_id, posted FROM '.$db->prefix.'posts WHERE id='.$pid) or error('Unable to fetch topic ID', __FILE__, __LINE__, $db->error());
    4731        if (!$db->num_rows($result))
    4832                message($lang_common['Bad request']);
    4933
    50         $id = $db->result($result);
    51 
    52         // Determine on what page the post is located (depending on $pun_user['disp_posts'])
    53         $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY posted') or error('Impossible de retrouver les informations du message', __FILE__, __LINE__, $db->error());
    54         $num_posts = $db->num_rows($result);
    55 
    56         for ($i = 0; $i < $num_posts; ++$i)
    57         {
    58                 $cur_id = $db->result($result, $i);
    59                 if ($cur_id == $pid)
    60                         break;
    61         }
    62         ++$i;   // we started at 0
    63 
    64         $_GET['p'] = ceil($i / $pun_user['disp_posts']);
     34        list($id, $posted) = $db->fetch_row($result);
     35
     36        // Determine on what page the post is located (depending on $forum_user['disp_posts'])
     37        $result = $db->query('SELECT COUNT(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id.' AND posted<'.$posted) or error('Unable to count previous posts', __FILE__, __LINE__, $db->error());
     38        $num_posts = $db->result($result) + 1;
     39
     40        $_GET['p'] = ceil($num_posts / $pun_user['disp_posts']);
    6541}
    6642
    6743// If action=new, we redirect to the first new post (if any)
    68 else if ($action == 'new' && !$pun_user['is_guest'])
    69 {
    70         $result = $db->query('SELECT MIN(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id.' AND posted>'.$pun_user['last_visit']) or error('Impossible de retrouver les informations du message', __FILE__, __LINE__, $db->error());
    71         $first_new_post_id = $db->result($result);
    72 
    73         if ($first_new_post_id)
    74                 header('Location: viewtopic.php?pid='.$first_new_post_id.'#p'.$first_new_post_id);
    75         else    // If there is no new post, we go to the last post
    76                 header('Location: viewtopic.php?id='.$id.'&action=last');
    77 
     44else if ($action == 'new')
     45{
     46        if (!$pun_user['is_guest'])
     47        {
     48                // We need to check if this topic has been viewed recently by the user
     49                $tracked_topics = get_tracked_topics();
     50                $last_viewed = isset($tracked_topics['topics'][$id]) ? $tracked_topics['topics'][$id] : $pun_user['last_visit'];
     51
     52                $result = $db->query('SELECT MIN(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id.' AND posted>'.$last_viewed) or error('Unable to fetch first new post info', __FILE__, __LINE__, $db->error());
     53                $first_new_post_id = $db->result($result);
     54
     55                if ($first_new_post_id)
     56                {
     57                        header('Location: viewtopic.php?pid='.$first_new_post_id.'#p'.$first_new_post_id);
     58                        exit;
     59                }
     60        }
     61
     62        // If there is no new post, we go to the last post
     63        header('Location: viewtopic.php?id='.$id.'&action=last');
    7864        exit;
    7965}
     
    8268else if ($action == 'last')
    8369{
    84         $result = $db->query('SELECT MAX(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id) or error('Impossible de retrouver les informations du message', __FILE__, __LINE__, $db->error());
     70        $result = $db->query('SELECT MAX(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id) or error('Unable to fetch last post info', __FILE__, __LINE__, $db->error());
    8571        $last_post_id = $db->result($result);
    8672
     
    9581// Fetch some info about the topic
    9682if (!$pun_user['is_guest'])
    97         $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Impossible de retrouver les informations de la discussion', __FILE__, __LINE__, $db->error());
     83        $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'topic_subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
    9884else
    99         $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Impossible de retrouver les informations de la discussion', __FILE__, __LINE__, $db->error());
     85        $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
    10086
    10187if (!$db->num_rows($result))
     
    10692// Sort out who the moderators are and if we are currently a moderator (or an admin)
    10793$mods_array = ($cur_topic['moderators'] != '') ? unserialize($cur_topic['moderators']) : array();
    108 $is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_id'] == PUN_MOD && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
     94$is_admmod = ($pun_user['g_id'] == PUN_ADMIN || ($pun_user['g_moderator'] == '1' && array_key_exists($pun_user['username'], $mods_array))) ? true : false;
    10995
    11096// Can we or can we not post replies?
     
    11298{
    11399        if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1' || $is_admmod)
    114                 $post_link = '<a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>';
     100                $post_link = "\t\t\t".'<p class="postlink conr"><a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a></p>'."\n";
    115101        else
    116                 $post_link = '&#160;';
     102                $post_link = '';
    117103}
    118104else
     
    122108        if ($is_admmod)
    123109                $post_link .= ' / <a href="post.php?tid='.$id.'">'.$lang_topic['Post reply'].'</a>';
     110
     111        $post_link = "\t\t\t".'<p class="postlink conr">'.$post_link.'</p>'."\n";
     112}
     113
     114
     115// Add/update this topic in our list of tracked topics
     116if (!$pun_user['is_guest'])
     117{
     118        $tracked_topics = get_tracked_topics();
     119        $tracked_topics['topics'][$id] = time();
     120        set_tracked_topics($tracked_topics);
    124121}
    125122
     
    128125$num_pages = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);
    129126
    130 $p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : $_GET['p'];
     127$p = (!isset($_GET['p']) || $_GET['p'] <= 1 || $_GET['p'] > $num_pages) ? 1 : intval($_GET['p']);
    131128$start_from = $pun_user['disp_posts'] * ($p - 1);
    132129
    133130// Generate paging links
    134 $paging_links = $lang_common['Pages'].': '.paginate($num_pages, $p, 'viewtopic.php?id='.$id);
     131$paging_links = '<span class="pages-label">'.$lang_common['Pages'].' </span>'.paginate($num_pages, $p, 'viewtopic.php?id='.$id);
    135132
    136133
     
    141138$quickpost = false;
    142139if ($pun_config['o_quickpost'] == '1' &&
    143         !$pun_user['is_guest'] &&
    144140        ($cur_topic['post_replies'] == '1' || ($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1')) &&
    145141        ($cur_topic['closed'] == '0' || $is_admmod))
    146142{
     143        // Load the post.php language file
     144        require PUN_ROOT.'lang/'.$pun_user['language'].'/post.php';
     145
    147146        $required_fields = array('req_message' => $lang_common['Message']);
     147        if ($pun_user['is_guest'])
     148        {
     149                $required_fields['req_username'] = $lang_post['Guest name'];
     150                if ($pun_config['p_force_guest_email'] == '1')
     151                        $required_fields['req_email'] = $lang_common['Email'];
     152        }
    148153        $quickpost = true;
    149154}
    150155
    151 if (!$pun_user['is_guest'] && $pun_config['o_subscriptions'] == '1')
     156if (!$pun_user['is_guest'] && $pun_config['o_topic_subscriptions'] == '1')
    152157{
    153158        if ($cur_topic['is_subscribed'])
    154159                // I apologize for the variable naming here. It's a mix of subscription and action I guess :-)
    155                 $subscraction = '<p class="subscribelink clearb">'.$lang_topic['Is subscribed'].' - <a href="misc.php?unsubscribe='.$id.'">'.$lang_topic['Unsubscribe'].'</a></p>'."\n";
     160                $subscraction = "\t\t".'<p class="subscribelink clearb"><span>'.$lang_topic['Is subscribed'].' - </span><a href="misc.php?action=unsubscribe&amp;tid='.$id.'">'.$lang_topic['Unsubscribe'].'</a></p>'."\n";
    156161        else
    157                 $subscraction = '<p class="subscribelink clearb"><a href="misc.php?subscribe='.$id.'">'.$lang_topic['Subscribe'].'</a></p>'."\n";
     162                $subscraction = "\t\t".'<p class="subscribelink clearb"><a href="misc.php?action=subscribe&amp;tid='.$id.'">'.$lang_topic['Subscribe'].'</a></p>'."\n";
    158163}
    159164else
    160         $subscraction = '<div class="clearer"></div>'."\n";
    161 
    162 $page_title = pun_htmlspecialchars($pun_config['o_board_title'].' / '.$cur_topic['subject']);
     165        $subscraction = '';
     166
     167if ($pun_config['o_feed_type'] == '1')
     168        $page_head = array('feed' => '<link rel="alternate" type="application/rss+xml" href="extern.php?action=feed&amp;tid='.$id.'&amp;type=rss" title="'.$lang_common['RSS topic feed'].'" />');
     169else if ($pun_config['o_feed_type'] == '2')
     170        $page_head = array('feed' => '<link rel="alternate" type="application/atom+xml" href="extern.php?action=feed&amp;tid='.$id.'&amp;type=atom" title="'.$lang_common['Atom topic feed'].'" />');
     171
     172$page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), pun_htmlspecialchars($cur_topic['forum_name']), pun_htmlspecialchars($cur_topic['subject']));
    163173define('PUN_ALLOW_INDEX', 1);
     174define('PUN_ACTIVE_PAGE', 'index');
    164175require PUN_ROOT.'header.php';
    165176
    166177?>
    167178<div class="linkst">
    168         <div class="inbox">
    169                 <p class="pagelink conl"><?php echo $paging_links ?></p>
    170                 <p class="postlink conr"><?php echo $post_link ?></p>
    171                 <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&#160;&raquo;&#160;<a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li><li>&#160;&raquo;&#160;<?php echo pun_htmlspecialchars($cur_topic['subject']) ?></li></ul>
     179        <div class="inbox crumbsplus">
     180                <ul class="crumbs">
     181                        <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
     182                        <li><span>»&#160;</span><a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li>
     183                        <li><span>»&#160;</span><a href="viewtopic.php?id=<?php echo $id ?>"><strong><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></strong></a></li>
     184                </ul>
     185                <div class="pagepost">
     186                        <p class="pagelink conl"><?php echo $paging_links ?></p>
     187<?php echo $post_link ?>
     188                </div>
    172189                <div class="clearer"></div>
    173190        </div>
     
    179196require PUN_ROOT.'include/parser.php';
    180197
    181 $bg_switch = true;      // Used for switching background color in posts
    182 $post_count = 0;        // Keep track of post numbers
     198$post_count = 0; // Keep track of post numbers
     199
     200// Retrieve a list of post IDs, LIMIT is (really) expensive so we only fetch the IDs here then later fetch the remaining data
     201$result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY id LIMIT '.$start_from.','.$pun_user['disp_posts']) or error('Unable to fetch post IDs', __FILE__, __LINE__, $db->error());
     202
     203$post_ids = array();
     204for ($i = 0;$cur_post_id = $db->result($result, $i);$i++)
     205        $post_ids[] = $cur_post_id;
     206
     207if (empty($post_ids))
     208        error('The post table and topic table seem to be out of sync!', __FILE__, __LINE__);
    183209
    184210// Retrieve the posts (and their respective poster/online status)
    185 $result = $db->query('SELECT u.email, u.title, u.url, u.location, u.use_avatar, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], true) or error('Impossible de retrouver les informations des messages', __FILE__, __LINE__, $db->error());
     211$result = $db->query('SELECT u.email, u.title, u.url, u.location, u.signature, u.email_setting, u.num_posts, u.registered, u.admin_note, p.id, p.poster AS username, p.poster_id, p.poster_ip, p.poster_email, p.message, p.hide_smilies, p.posted, p.edited, p.edited_by, g.g_id, g.g_user_title, o.user_id AS is_online FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'users AS u ON u.id=p.poster_id INNER JOIN '.$db->prefix.'groups AS g ON g.g_id=u.group_id LEFT JOIN '.$db->prefix.'online AS o ON (o.user_id=u.id AND o.user_id!=1 AND o.idle=0) WHERE p.id IN ('.implode(',', $post_ids).') ORDER BY p.id', true) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
    186212while ($cur_post = $db->fetch_assoc($result))
    187213{
     
    194220        $signature = '';
    195221
    196         // If the poster is a registered user.
     222        // If the poster is a registered user
    197223        if ($cur_post['poster_id'] > 1)
    198224        {
    199                 $username = '<a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['username']).'</a>';
     225                if ($pun_user['g_view_users'] == '1')
     226                        $username = '<a href="profile.php?id='.$cur_post['poster_id'].'">'.pun_htmlspecialchars($cur_post['username']).'</a>';
     227                else
     228                        $username = pun_htmlspecialchars($cur_post['username']);
     229
    200230                $user_title = get_title($cur_post);
    201231
     
    204234
    205235                // Format the online indicator
    206                 $is_online = ($cur_post['is_online'] == $cur_post['poster_id']) ? '<strong>'.$lang_topic['Online'].'</strong>' : $lang_topic['Offline'];
    207 
    208                 if ($pun_config['o_avatars'] == '1' && $cur_post['use_avatar'] == '1' && $pun_user['show_avatars'] != '0')
    209                 {
    210                         if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif'))
    211                                 $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.gif" '.$img_size[3].' alt="" />';
    212                         else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg'))
    213                                 $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.jpg" '.$img_size[3].' alt="" />';
    214                         else if ($img_size = @getimagesize($pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png'))
    215                                 $user_avatar = '<img src="'.$pun_config['o_avatars_dir'].'/'.$cur_post['poster_id'].'.png" '.$img_size[3].' alt="" />';
    216                 }
    217                 else
    218                         $user_avatar = '';
     236                $is_online = ($cur_post['is_online'] == $cur_post['poster_id']) ? '<strong>'.$lang_topic['Online'].'</strong>' : '<span>'.$lang_topic['Offline'].'</span>';
     237
     238                if ($pun_config['o_avatars'] == '1' && $pun_user['show_avatars'] != '0')
     239                {
     240                        if (isset($user_avatar_cache[$cur_post['poster_id']]))
     241                                $user_avatar = $user_avatar_cache[$cur_post['poster_id']];
     242                        else
     243                                $user_avatar = $user_avatar_cache[$cur_post['poster_id']] = generate_avatar_markup($cur_post['poster_id']);
     244                }
    219245
    220246                // We only show location, register date, post count and the contact links if "Show user info" is enabled
     
    226252                                        $cur_post['location'] = censor_words($cur_post['location']);
    227253
    228                                 $user_info[] = '<dd>'.$lang_topic['From'].': '.pun_htmlspecialchars($cur_post['location']);
     254                                $user_info[] = '<dd><span>'.$lang_topic['From'].' '.pun_htmlspecialchars($cur_post['location']).'</span></dd>';
    229255                        }
    230256
    231                         $user_info[] = '<dd>'.$lang_common['Registered'].': '.date($pun_config['o_date_format'], $cur_post['registered']);
    232 
    233                         if ($pun_config['o_show_post_count'] == '1' || $pun_user['g_id'] < PUN_GUEST)
    234                                 $user_info[] = '<dd>'.$lang_common['Posts'].': '.$cur_post['num_posts'];
    235 
    236                         // Now let's deal with the contact links (E-mail and URL)
    237                         if (($cur_post['email_setting'] == '0' && !$pun_user['is_guest']) || $pun_user['g_id'] < PUN_GUEST)
    238                                 $user_contacts[] = '<a href="mailto:'.$cur_post['email'].'">'.$lang_common['E-mail'].'</a>';
    239                         else if ($cur_post['email_setting'] == '1' && !$pun_user['is_guest'])
    240                                 $user_contacts[] = '<a href="misc.php?email='.$cur_post['poster_id'].'">'.$lang_common['E-mail'].'</a>';
     257                        $user_info[] = '<dd><span>'.$lang_topic['Registered'].' '.format_time($cur_post['registered'], true).'</span></dd>';
     258
     259                        if ($pun_config['o_show_post_count'] == '1' || $pun_user['is_admmod'])
     260                                $user_info[] = '<dd><span>'.$lang_topic['Posts'].' '.forum_number_format($cur_post['num_posts']).'</span></dd>';
     261
     262                        // Now let's deal with the contact links (Email and URL)
     263                        if ((($cur_post['email_setting'] == '0' && !$pun_user['is_guest']) || $pun_user['is_admmod']) && $pun_user['g_send_email'] == '1')
     264                                $user_contacts[] = '<span class="email"><a href="mailto:'.$cur_post['email'].'">'.$lang_common['Email'].'</a></span>';
     265                        else if ($cur_post['email_setting'] == '1' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1')
     266                                $user_contacts[] = '<span class="email"><a href="misc.php?email='.$cur_post['poster_id'].'">'.$lang_common['Email'].'</a></span>';
    241267
    242268                        if ($cur_post['url'] != '')
    243                                 $user_contacts[] = '<a href="'.pun_htmlspecialchars($cur_post['url']).'">'.$lang_topic['Website'].'</a>';
    244                 }
    245 
    246                 if ($pun_user['g_id'] < PUN_GUEST)
    247                 {
    248                         $user_info[] = '<dd>IP: <a href="moderate.php?get_host='.$cur_post['id'].'">'.$cur_post['poster_ip'].'</a>';
     269                        {
     270                                if ($pun_config['o_censoring'] == '1')
     271                                        $cur_post['url'] = censor_words($cur_post['url']);
     272
     273                                $user_contacts[] = '<span class="website"><a href="'.pun_htmlspecialchars($cur_post['url']).'">'.$lang_topic['Website'].'</a></span>';
     274                        }
     275                }
     276
     277                if ($pun_user['is_admmod'])
     278                {
     279                        $user_info[] = '<dd><span><a href="moderate.php?get_host='.$cur_post['id'].'" title="'.$cur_post['poster_ip'].'">'.$lang_topic['IP address logged'].'</a></span></dd>';
    249280
    250281                        if ($cur_post['admin_note'] != '')
    251                                 $user_info[] = '<dd>'.$lang_topic['Note'].': <strong>'.pun_htmlspecialchars($cur_post['admin_note']).'</strong>';
     282                                $user_info[] = '<dd><span>'.$lang_topic['Note'].' <strong>'.pun_htmlspecialchars($cur_post['admin_note']).'</strong></span></dd>';
    252283                }
    253284        }
     
    258289                $user_title = get_title($cur_post);
    259290
    260                 if ($pun_user['g_id'] < PUN_GUEST)
    261                         $user_info[] = '<dd>IP: <a href="moderate.php?get_host='.$cur_post['id'].'">'.$cur_post['poster_ip'].'</a>';
    262 
    263                 if ($pun_config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$pun_user['is_guest'])
    264                         $user_contacts[] = '<a href="mailto:'.$cur_post['poster_email'].'">'.$lang_common['E-mail'].'</a>';
     291                if ($pun_user['is_admmod'])
     292                        $user_info[] = '<dd><span><a href="moderate.php?get_host='.$cur_post['id'].'" title="'.$cur_post['poster_ip'].'">'.$lang_topic['IP address logged'].'</a></span></dd>';
     293
     294                if ($pun_config['o_show_user_info'] == '1' && $cur_post['poster_email'] != '' && !$pun_user['is_guest'] && $pun_user['g_send_email'] == '1')
     295                        $user_contacts[] = '<span class="email"><a href="mailto:'.$cur_post['poster_email'].'">'.$lang_common['Email'].'</a></span>';
    265296        }
    266297
     
    269300        {
    270301                if (!$pun_user['is_guest'])
    271                         $post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>';
     302                        $post_actions[] = '<li class="postreport"><span><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a></span></li>';
    272303
    273304                if ($cur_topic['closed'] == '0')
     
    276307                        {
    277308                                if ((($start_from + $post_count) == 1 && $pun_user['g_delete_topics'] == '1') || (($start_from + $post_count) > 1 && $pun_user['g_delete_posts'] == '1'))
    278                                         $post_actions[] = '<li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>';
     309                                        $post_actions[] = '<li class="postdelete"><span><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a></span></li>';
    279310                                if ($pun_user['g_edit_posts'] == '1')
    280                                         $post_actions[] = '<li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>';
     311                                        $post_actions[] = '<li class="postedit"><span><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a></span></li>';
    281312                        }
    282313
    283314                        if (($cur_topic['post_replies'] == '' && $pun_user['g_post_replies'] == '1') || $cur_topic['post_replies'] == '1')
    284                                 $post_actions[] = '<li class="postquote"><a href="post.php?tid='.$id.'&amp;qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';
     315                                $post_actions[] = '<li class="postquote"><span><a href="post.php?tid='.$id.'&amp;qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a></span></li>';
    285316                }
    286317        }
    287318        else
    288                 $post_actions[] = '<li class="postreport"><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a>'.$lang_topic['Link separator'].'</li><li class="postdelete"><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a>'.$lang_topic['Link separator'].'</li><li class="postedit"><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a>'.$lang_topic['Link separator'].'</li><li class="postquote"><a href="post.php?tid='.$id.'&amp;qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a>';
    289 
    290 
    291         // Switch the background color for every message.
    292         $bg_switch = ($bg_switch) ? $bg_switch = false : $bg_switch = true;
    293         $vtbg = ($bg_switch) ? ' roweven' : ' rowodd';
    294 
     319        {
     320                $post_actions[] = '<li class="postreport"><span><a href="misc.php?report='.$cur_post['id'].'">'.$lang_topic['Report'].'</a></span></li>';
     321                $post_actions[] = '<li class="postdelete"><span><a href="delete.php?id='.$cur_post['id'].'">'.$lang_topic['Delete'].'</a></span></li>';
     322                $post_actions[] = '<li class="postedit"><span><a href="edit.php?id='.$cur_post['id'].'">'.$lang_topic['Edit'].'</a></span></li>';
     323                $post_actions[] = '<li class="postquote"><span><a href="post.php?tid='.$id.'&amp;qid='.$cur_post['id'].'">'.$lang_topic['Quote'].'</a></span></li>';
     324        }
    295325
    296326        // Perform the main parsing of the message (BBCode, smilies, censor words etc)
    297 
    298 // ----------------------------------------------------
    299 // ajout dj3c1t 01/2008
    300 //
    301 // pour pouvoir poster des players dans les éditos et les news, on autorise le code html
    302 // lorsque c'est la team RSR qui poste.
    303 //
    304 
    305         if($cur_post['g_id'] == 1)
    306         { $cur_post['message'] = str_replace
    307           ( array("&gt;", "&lt;", "&quot;"),
    308             array(">", "<", "\""),
    309             parse_message($cur_post['message'], $cur_post['hide_smilies'])
    310           );
    311         }
    312         else $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
     327        $cur_post['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);
    313328
    314329        // Do signature parsing/caching
    315         if ($cur_post['signature'] != '' && $pun_user['show_sig'] != '0')
     330        if ($pun_config['o_signatures'] == '1' && $cur_post['signature'] != '' && $pun_user['show_sig'] != '0')
    316331        {
    317332                if (isset($signature_cache[$cur_post['poster_id']]))
     
    325340
    326341?>
    327 <div id="p<?php echo $cur_post['id'] ?>" class="blockpost<?php echo $vtbg ?><?php if (($post_count + $start_from) == 1) echo ' firstpost'; ?>">
    328         <h2><span><span class="conr">#<?php echo ($start_from + $post_count) ?>&#160;</span><a href="viewtopic.php?pid=<?php echo $cur_post['id'].'#p'.$cur_post['id'] ?>"><?php echo format_time($cur_post['posted']) ?></a></span></h2>
     342<div id="p<?php echo $cur_post['id'] ?>" class="blockpost<?php echo ($post_count % 2 == 0) ? ' roweven' : ' rowodd' ?><?php if ($cur_post['id'] == $cur_topic['first_post_id']) echo ' firstpost'; ?><?php if ($post_count == 1) echo ' blockpost1'; ?>">
     343        <h2><span><span class="conr">#<?php echo ($start_from + $post_count) ?></span> <a href="viewtopic.php?pid=<?php echo $cur_post['id'].'#p'.$cur_post['id'] ?>"><?php echo format_time($cur_post['posted']) ?></a></span></h2>
    329344        <div class="box">
    330345                <div class="inbox">
    331                         <div class="postleft">
    332                                 <dl>
    333                                         <dt><strong><?php echo $username ?></strong></dt>
    334                                         <dd class="usertitle"><strong><?php echo $user_title ?></strong></dd>
    335                                         <dd class="postavatar"><?php echo $user_avatar ?></dd>
    336 <?php if (count($user_info)) echo "\t\t\t\t\t".implode('</dd>'."\n\t\t\t\t\t", $user_info).'</dd>'."\n"; ?>
    337 <?php if (count($user_contacts)) echo "\t\t\t\t\t".'<dd class="usercontacts">'.implode('&#160;&#160;', $user_contacts).'</dd>'."\n"; ?>
    338                                 </dl>
     346                        <div class="postbody">
     347                                <div class="postleft">
     348                                        <dl>
     349                                                <dt><strong><?php echo $username ?></strong></dt>
     350                                                <dd class="usertitle"><strong><?php echo $user_title ?></strong></dd>
     351<?php if ($user_avatar != '') echo "\t\t\t\t\t\t".'<dd class="postavatar">'.$user_avatar.'</dd>'."\n"; ?>
     352<?php if (count($user_info)) echo "\t\t\t\t\t\t".implode("\n\t\t\t\t\t\t", $user_info)."\n"; ?>
     353<?php if (count($user_contacts)) echo "\t\t\t\t\t\t".'<dd class="usercontacts">'.implode(' ', $user_contacts).'</dd>'."\n"; ?>
     354                                        </dl>
     355                                </div>
     356                                <div class="postright">
     357                                        <h3><?php if ($cur_post['id'] != $cur_topic['first_post_id']) echo $lang_topic['Re'].' '; ?><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></h3>
     358                                        <div class="postmsg">
     359                                                <?php echo $cur_post['message']."\n" ?>
     360<?php if ($cur_post['edited'] != '') echo "\t\t\t\t\t\t".'<p class="postedit"><em>'.$lang_topic['Last edit'].' '.pun_htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')</em></p>'."\n"; ?>
     361                                        </div>
     362<?php if ($signature != '') echo "\t\t\t\t\t".'<div class="postsignature postmsg"><hr />'.$signature.'</div>'."\n"; ?>
     363                                </div>
    339364                        </div>
    340                         <div class="postright">
    341                                 <h3><?php if (($post_count + $start_from) > 1) echo ' Re: '; ?><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></h3>
    342                                 <div class="postmsg">
    343                                         <?php echo $cur_post['message']."\n" ?>
    344 <?php if ($cur_post['edited'] != '') echo "\t\t\t\t\t".'<p class="postedit"><em>'.$lang_topic['Last edit'].' '.pun_htmlspecialchars($cur_post['edited_by']).' ('.format_time($cur_post['edited']).')</em></p>'."\n"; ?>
    345                                 </div>
    346 <?php if ($signature != '') echo "\t\t\t\t".'<div class="postsignature"><hr />'.$signature.'</div>'."\n"; ?>
     365                </div>
     366                <div class="inbox">
     367                        <div class="postfoot clearb">
     368                                <div class="postfootleft"><?php if ($cur_post['poster_id'] > 1) echo '<p>'.$is_online.'</p>'; ?></div>
     369<?php if (count($post_actions)) echo "\t\t\t\t".'<div class="postfootright">'."\n\t\t\t\t\t".'<ul>'."\n\t\t\t\t\t\t".implode("\n\t\t\t\t\t\t", $post_actions)."\n\t\t\t\t\t".'</ul>'."\n\t\t\t\t".'</div>'."\n" ?>
    347370                        </div>
    348                         <div class="clearer"></div>
    349                         <div class="postfootleft"><?php if ($cur_post['poster_id'] > 1) echo '<p>'.$is_online.'</p>'; ?></div>
    350                         <div class="postfootright"><?php echo (count($post_actions)) ? '<ul>'.implode($lang_topic['Link separator'].'</li>', $post_actions).'</li></ul></div>'."\n" : '<div>&#160;</div></div>'."\n" ?>
    351371                </div>
    352372        </div>
     
    359379?>
    360380<div class="postlinksb">
    361         <div class="inbox">
    362                 <p class="postlink conr"><?php echo $post_link ?></p>
    363                 <p class="pagelink conl"><?php echo $paging_links ?></p>
    364                 <ul><li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li><li>&#160;&raquo;&#160;<a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li><li>&#160;&raquo;&#160;<?php echo pun_htmlspecialchars($cur_topic['subject']) ?></li></ul>
    365                 <?php echo $subscraction ?>
     381        <div class="inbox crumbsplus">
     382                <div class="pagepost">
     383                        <p class="pagelink conl"><?php echo $paging_links ?></p>
     384<?php echo $post_link ?>
     385                </div>
     386                <ul class="crumbs">
     387                        <li><a href="index.php"><?php echo $lang_common['Index'] ?></a></li>
     388                        <li><span>»&#160;</span><a href="viewforum.php?id=<?php echo $cur_topic['forum_id'] ?>"><?php echo pun_htmlspecialchars($cur_topic['forum_name']) ?></a></li>
     389                        <li><span>»&#160;</span><a href="viewtopic.php?id=<?php echo $id ?>"><strong><?php echo pun_htmlspecialchars($cur_topic['subject']) ?></strong></a></li>
     390                </ul>
     391<?php echo $subscraction ?>
     392                <div class="clearer"></div>
    366393        </div>
    367394</div>
     
    373400{
    374401
    375 ?>
    376 <div class="blockform">
     402$cur_index = 1;
     403
     404?>
     405<div id="quickpost" class="blockform">
    377406        <h2><span><?php echo $lang_topic['Quick post'] ?></span></h2>
    378407        <div class="box">
    379                 <form id="post" method="post" action="post.php?tid=<?php echo $id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">
    380 
     408                <form id="quickpostform" method="post" action="post.php?tid=<?php echo $id ?>" onsubmit="this.submit.disabled=true;if(process_form(this)){return true;}else{this.submit.disabled=false;return false;}">
    381409                        <div class="inform">
    382410                                <fieldset>
     
    384412                                        <div class="infldset txtarea">
    385413                                                <input type="hidden" name="form_sent" value="1" />
    386                                                 <input type="hidden" name="form_user" value="<?php echo (!$pun_user['is_guest']) ? pun_htmlspecialchars($pun_user['username']) : 'Guest'; ?>" />
    387                                                 <?php require PUN_ROOT.'mod_easy_bbcode.php'; ?>
    388                                                 <label><textarea name="req_message" rows="7" cols="75" tabindex="1"></textarea></label>
     414<?php if ($pun_config['o_topic_subscriptions'] == '1' && ($pun_user['auto_notify'] == '1' || $cur_topic['is_subscribed'])): ?>                                          <input type="hidden" name="subscribe" value="1" />
     415<?php endif; ?>
     416<?php
     417
     418if ($pun_user['is_guest'])
     419{
     420        $email_label = ($pun_config['p_force_guest_email'] == '1') ? '<strong>'.$lang_common['Email'].' <span>'.$lang_common['Required'].'</span></strong>' : $lang_common['Email'];
     421        $email_form_name = ($pun_config['p_force_guest_email'] == '1') ? 'req_email' : 'email';
     422
     423?>
     424                                                <label class="conl required"><strong><?php echo $lang_post['Guest name'] ?> <span><?php echo $lang_common['Required'] ?></span></strong><br /><input type="text" name="req_username" value="<?php if (isset($_POST['req_username'])) echo pun_htmlspecialchars($username); ?>" size="25" maxlength="25" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
     425                                                <label class="conl<?php echo ($pun_config['p_force_guest_email'] == '1') ? ' required' : '' ?>"><?php echo $email_label ?><br /><input type="text" name="<?php echo $email_form_name ?>" value="<?php if (isset($_POST[$email_form_name])) echo pun_htmlspecialchars($email); ?>" size="50" maxlength="80" tabindex="<?php echo $cur_index++ ?>" /><br /></label>
     426                                                <div class="clearer"></div>
     427<?php
     428
     429        echo "\t\t\t\t\t\t".'<label class="required"><strong>'.$lang_common['Message'].' <span>'.$lang_common['Required'].'</span></strong><br />';
     430}
     431else
     432        echo "\t\t\t\t\t\t".'<label>';
     433
     434?>
     435<textarea name="req_message" rows="7" cols="75" tabindex="<?php echo $cur_index++ ?>"></textarea></label>
    389436                                                <ul class="bblinks">
    390                                                         <li><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a>: <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
    391                                                         <li><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a>: <?php echo ($pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
    392                                                         <li><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a>: <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></li>
     437                                                        <li><span><a href="help.php#bbcode" onclick="window.open(this.href); return false;"><?php echo $lang_common['BBCode'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
     438                                                        <li><span><a href="help.php#img" onclick="window.open(this.href); return false;"><?php echo $lang_common['img tag'] ?></a> <?php echo ($pun_config['p_message_bbcode'] == '1' && $pun_config['p_message_img_tag'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
     439                                                        <li><span><a href="help.php#smilies" onclick="window.open(this.href); return false;"><?php echo $lang_common['Smilies'] ?></a> <?php echo ($pun_config['o_smilies'] == '1') ? $lang_common['on'] : $lang_common['off']; ?></span></li>
    393440                                                </ul>
    394441                                        </div>
    395442                                </fieldset>
    396443                        </div>
    397                         <p><input type="submit" name="submit" tabindex="2" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /></p>
     444                        <p class="buttons"><input type="submit" name="submit" tabindex="<?php echo $cur_index++ ?>" value="<?php echo $lang_common['Submit'] ?>" accesskey="s" /> <input type="submit" name="preview" value="<?php echo $lang_topic['Preview'] ?>" tabindex="<?php echo $cur_index++ ?>" accesskey="p" /></p>
    398445                </form>
    399446        </div>
     
    404451
    405452// Increment "num_views" for topic
    406 $low_prio = ($db_type == 'mysql') ? 'LOW_PRIORITY ' : '';
    407 $db->query('UPDATE '.$low_prio.$db->prefix.'topics SET num_views=num_views+1 WHERE id='.$id) or error('Impossible de modifier la discussion', __FILE__, __LINE__, $db->error());
     453if ($pun_config['o_topic_views'] == '1')
     454        $db->query('UPDATE '.$db->prefix.'topics SET num_views=num_views+1 WHERE id='.$id) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
    408455
    409456$forum_id = $cur_topic['forum_id'];
Note: See TracChangeset for help on using the changeset viewer.