1

Тема: Зафиксирование первого сообщения (сырое)

Будет ли работать данное улучшение предназначенное для версии пунбб 1.2
Улучшение не моё, а Вот откудова
Переписываю код:

ALTER TABLE #__topics ADD attach_first TINYINT( 1 ) DEFAULT '0' NOT NULL;



Открываем viewforum.php ищем

switch ($db_type)
{
    case 'mysql':
    case 'mysqli':
        $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.forum_id='.$id.' GROUP BY t.id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
        break;

    case 'sqlite':
        $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.id IN(SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'].') GROUP BY t.id ORDER BY t.sticky DESC, t.last_post DESC';
        break;

    default:
        $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.forum_id='.$id.' GROUP BY t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
        break;

}


Заменяем на


switch ($db_type)
{
    case 'mysql':
    case 'mysqli':
        $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.attach_first FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.forum_id='.$id.' GROUP BY t.id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
        break;

    case 'sqlite':
        $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.attach_first FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.id IN(SELECT id FROM '.$db->prefix.'topics WHERE forum_id='.$id.' ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'].') GROUP BY t.id ORDER BY t.sticky DESC, t.last_post DESC';
        break;

    default:
        $sql = 'SELECT p.poster_id AS has_posted, t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, t.attach_first FROM '.$db->prefix.'topics AS t LEFT JOIN '.$db->prefix.'posts AS p ON t.id=p.topic_id WHERE t.forum_id='.$id.' GROUP BY t.id, t.subject, t.poster, t.posted, t.last_post, t.last_post_id, t.last_poster, t.num_views, t.num_replies, t.closed, t.sticky, t.moved_to, p.poster_id ORDER BY sticky DESC, '.(($cur_forum['sort_by'] == '1') ? 'posted' : 'last_post').' DESC LIMIT '.$start_from.', '.$pun_user['disp_topics'];
        break;

}



То есть добавляем поле в запрос поле t.attach_first


Ищем

$num_pages_topic = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);


Добавляем после

$is_attach_first = ($pun_user['attach_first'] && $cur_topic['attach_first']) ? true : false;
        if ($is_attach_first && $num_pages_topic > 1)
            $num_pages_topic = ceil(($num_pages_topic + $cur_topic['num_replies']) / $pun_user['disp_posts']);


$is_attach_first каждый может определить по своему желанию, в данном случае первое сообщение прикрепляется только при наличии 2 галочек: в профиле и в теме.



Открываем post.php

Ищем:

$hide_smilies = isset($_POST['hide_smilies']) ? 1 : 0;
    $subscribe = isset($_POST['subscribe']) ? 1 : 0;

Добавляем после:
   

$attach_first = (isset($_POST['attach_first']) && $is_admmod) ? 1 : 0;



Ищем

// Create the topic
            $db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$fid.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());


Заменяем на:


// Create the topic
            $db->query('INSERT INTO '.$db->prefix.'topics (poster, subject, posted, last_post, last_poster, forum_id, attach_first) VALUES(\''.$db->escape($username).'\', \''.$db->escape($subject).'\', '.$now.', '.$now.', \''.$db->escape($username).'\', '.$fid.', '.$attach_first.')') or error('Unable to create topic', __FILE__, __LINE__, $db->error());



Ищем

else if ($pun_config['o_smilies'] == '1')
    $checkboxes[] = '<label><input type="checkbox" name="hide_smilies" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['hide_smilies']) ? ' checked="checked"' : '').' />'.$lang_post['Hide smilies'];


Добавляем после

if ($is_admmod && $fid)
        $checkboxes[] = '<label><input type="checkbox" name="attach_first" value="1" tabindex="'.($cur_index++).'"'.(isset($_POST['attach_first']) ? ' checked="checked"' : '').' />'.$lang_post['Attach first'];


Добавляем в lang/[lang]/post.php контстанту 'Attach first'

Открываем viewtopic.php

Ищем

// Fetch some info about the topic
if (!$pun_user['is_guest'])
    $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('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
    $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 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());




Заменяем на:



// Fetch some info about the topic
if (!$pun_user['is_guest'])
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.attach_first, 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('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.attach_first, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies 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());


Ищем

// Determine the post offset (based on $_GET['p'])
$num_pages = ceil(($cur_topic['num_replies'] + 1) / $pun_user['disp_posts']);


Добавляем после:

$is_attach_first = ($pun_user['attach_first'] && $cur_topic['attach_first']) ? true : false;
if ($is_attach_first && $num_pages > 1)
    $num_pages = ceil(($num_pages + $cur_topic['num_replies']) / $pun_user['disp_posts']);



Ищем

// Retrieve the posts (and their respective poster/online status)
$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.idle=0) WHERE p.topic_id='.$id.' ORDER BY p.id LIMIT '.$start_from.','.$pun_user['disp_posts'], false) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); //Attachment Mod, changed the true to false...



Добавляем перед (лучше перед запросом, но после комментария):



if ($is_attach_first && $cur_topic['num_replies'] > $pun_user['disp_posts'] && $start_from > 0)
{
    $result = $db->query('SELECT MIN(id) FROM '.$db->prefix.'posts WHERE topic_id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
    $first_post_id = $db->result($result);
    $start_from = $start_from-$p+1;
    $result = $db->query('SELECT id FROM '.$db->prefix.'posts WHERE topic_id='.$id.' ORDER BY id LIMIT '.$start_from.', 1') or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());
    $second_post_id = $db->result($result);
    $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.idle=0) WHERE p.id='.$first_post_id.' OR (p.id > '.$second_post_id.' AND p.topic_id='.$id.') ORDER BY p.id LIMIT '.$pun_user['disp_posts'], false) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error()); //Attachment Mod, changed the true to false...
}
    else

Ищем

<h2><span><span class="conr">#<?php echo ($start_from + $post_count) ?>&nbsp;</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>


Заменяем на

<h2><span><span class="conr">#<?php echo ($is_attach_first && $post_count == 1) ? '1' : ($start_from + $post_count) ?>&nbsp;</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>



Открываем edit.php

Ищем

// Fetch some info about the post, the topic and the forum
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id 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 p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());


Заменяем на

// Fetch some info about the post, the topic and the forum
$result = $db->query('SELECT f.id AS fid, f.forum_name, f.moderators, f.redirect_url, fp.post_replies, fp.post_topics, t.id AS tid, t.subject, t.posted, t.closed, t.attach_first, p.poster, p.poster_id, p.message, p.hide_smilies FROM '.$db->prefix.'posts AS p INNER JOIN '.$db->prefix.'topics AS t ON t.id=p.topic_id 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 p.id='.$id) or error('Unable to fetch post info', __FILE__, __LINE__, $db->error());


Ищем

$hide_smilies = isset($_POST['hide_smilies']) ? intval($_POST['hide_smilies']) : 0;
    if ($hide_smilies != '1') $hide_smilies = '0';

Добавляем после

$attach_first = isset($_POST['attach_first']) ? intval($_POST['attach_first']) : 0;
    if ($attach_first != '1') $attach_first = '0';


Ищем

if ($can_edit_subject)
        {
            // Update the topic and any redirect topics
            $db->query('UPDATE '.$db->prefix.'topics SET subject=\''.$db->escape($subject).'\' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());

            // We changed the subject, so we need to take that into account when we update the search words
            update_search_index('edit', $id, $message, $subject);
        }
        else
            update_search_index('edit', $id, $message);


Добавляем после

if ($id == $topic_post_id && $is_admmod)
        {
            // Update the topic and any redirect topics
            $db->query('UPDATE '.$db->prefix.'topics SET attach_first='.$attach_first.' WHERE id='.$cur_post['tid'].' OR moved_to='.$cur_post['tid']) or error('Unable to update topic', __FILE__, __LINE__, $db->error());
        }


Ищем

if ((isset($_POST['form_sent']) && isset($_POST['silent'])) || !isset($_POST['form_sent']))
        $checkboxes[] = '<label><input type="checkbox" name="silent" value="1" tabindex="'.($cur_index++).'" checked="checked" />&nbsp;'.$lang_post['Silent edit'];
    else
        $checkboxes[] = '<label><input type="checkbox" name="silent" value="1" tabindex="'.($cur_index++).'" />&nbsp;'.$lang_post['Silent edit'];



Добавляем после

if($id == $topic_post_id)
        if ((isset($_POST['form_sent']) && isset($_POST['attach_first']) || $cur_post['attach_first'] == '1'))
            $checkboxes[] = '<label><input type="checkbox" name="attach_first" value="1" tabindex="'.($cur_index++).'" checked="checked" />&nbsp;'.$lang_post['Attach first'];
        else
            $checkboxes[] = '<label><input type="checkbox" name="attach_first" value="1" tabindex="'.($cur_index++).'" />&nbsp;'.$lang_post['Attach first'];

Читай FAQ по Flazy
Лучший альтернативный движок PunBB )))

Ответ: Зафиксирование первого сообщения (сырое)

В вот виде в каком это здесь представлено - невозможно. Но на первый взгляд трудности переписать код под flazy не должно возникнуть.
ЗЫ: беру под свой контроль.

Вы стали счастливие?

3

Ответ: Зафиксирование первого сообщения (сырое)

вот за сегодняшний день что я получил

//Начало первого сообщения в веру темы
if($forum_page['page'] > 1)
{
    $query = array(
    'SELECT'    => 'u.email, u.title, u.signature, u.email_setting, u.num_posts, u.admin_note, u.rep_plus, u.rep_minus, u.rep_enable, p.id, p.poster AS username, p.poster_id, p.poster_email, p.message, p.hide_smilies, p.posted, g.g_id, g.g_user_title, o.user_id AS is_online',
    'FROM'        => 'posts AS p',
    'JOINS'        => array(
        array(
            'INNER JOIN'    => 'users AS u',
            'ON'        => 'u.id=p.poster_id'
        ),
        array(
            'INNER JOIN'    => 'groups AS g',
            'ON'        => 'g.g_id=u.group_id'
        ),
        array(
            'LEFT JOIN'    => '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'        => '0, 1'
    );
    $result = $forum_db->query_build($query) or error(__FILE__, __LINE__);
    $user_data_cache = array();
    $cur_post = $forum_db->fetch_assoc($result);
    $forum_page['post_ident'] = array();
    $forum_page['author_ident'] = array();
    $forum_page['author_info'] = array();
    $forum_page['post_options'] = array();
    $forum_page['post_contacts'] = array();
    $forum_page['post_identity'] = array();
    $forum_page['post_actions'] = array();
    $forum_page['message'] = array();

    // Generate the post heading
    $forum_page['post_ident']['num'] = '<span class="post-num">1</span>';

    if ($cur_post['poster_id'] > 1 && !$forum_user['is_guest'])
        $forum_page['post_ident']['byline'] = '<span class="post-byline">'.sprintf((($cur_post['id'] == $cur_topic['first_post_id']) ? $lang_topic['Topic byline'] : $lang_topic['Reply byline']), (($forum_user['g_view_users']) ? '<a title="Ответить" href="javascript:to(\''.$cur_post['username'].'\')">'.forum_htmlencode($cur_post['username']).'</a>' : '<strong>'.forum_htmlencode($cur_post['username']).'</strong>')).'</span>';
    else
        $forum_page['post_ident']['byline'] = '<span class="post-byline">'.sprintf((($cur_post['id'] == $cur_topic['first_post_id']) ? $lang_topic['Topic byline'] : $lang_topic['Reply byline']), '<a title="'.sprintf($lang_topic['Go to profile'], forum_htmlencode($cur_post['username'])).'" href="'.forum_link($forum_url['user'], $cur_post['poster_id']).'">'.$cur_post['username'].'</a>').'</span>';

    $forum_page['post_ident']['link'] = '<span class="post-link"><a class="permalink" rel="bookmark" title="'.$lang_topic['Permalink post'].'" href="'.forum_link($forum_url['post'], $cur_post['id']).'">'.format_time($cur_post['posted']).$lang_common['Title separator'].flazy_format_time($cur_post['posted']).'</a></span>';

    ($hook = get_hook('vt_row_pre_post_ident_merge')) ? eval($hook) : null;

    if (isset($user_data_cache[$cur_post['poster_id']]['author_ident']))
        $forum_page['author_ident'] = $user_data_cache[$cur_post['poster_id']]['author_ident'];
    else
    {
        // Generate author identification
        if ($cur_post['poster_id'] > 1)
        {
            $forum_page['author_ident']['usertitle'] = '<li class="usertitle"><span>'.get_title($cur_post).'</span></li>';

            $forum_page['author_ident']['username'] = '<li class="username">'.(($forum_user['g_view_users']) ? '<a title="'.sprintf($lang_topic['Go to profile'], forum_htmlencode($cur_post['username'])).'" href="'.forum_link($forum_url['user'], $cur_post['poster_id']).'">'.forum_htmlencode($cur_post['username']).'</a>' : '<strong>'.forum_htmlencode($cur_post['username']).'</strong>').'</li>';

        }
        else
        {
            $forum_page['author_ident']['username'] = '<li class="username"><strong>'.forum_htmlencode($cur_post['username']).'</strong></li>';
            $forum_page['author_ident']['usertitle'] = '<li class="usertitle"><span>'.get_title($cur_post).'</span></li>';
        }
    }

    if (isset($user_data_cache[$cur_post['poster_id']]['author_info']))
        $forum_page['author_info'] = $user_data_cache[$cur_post['poster_id']]['author_info'];
    else
    {
        // Generate author information
        if ($cur_post['poster_id'] > 1)
        {
            if ($forum_config['o_show_user_info'])
            {
                if ($cur_post['location'] != '')
                {
                    if ($forum_config['o_censoring'])
                        $cur_post['location'] = censor_words($cur_post['location']);
                }

            }

            if ($forum_config['o_show_post_count'] || $forum_user['is_admmod'])
                $forum_page['author_info']['posts'] = '<li><span>'.$lang_topic['Posts info'].' <strong><a href="'.forum_link($forum_url['search_user_posts'], $cur_post['poster_id']).'">'.forum_number_format($cur_post['num_posts']).'</a></strong></span></li>';

            if ($forum_config['o_rep_enabled'] && $forum_user['rep_enable'] && $forum_user['rep_enable_adm'] && $forum_user['g_rep_enable'] && $cur_post['rep_enable'] && $cur_post['poster_id'] != 1)
            {
                if (!$forum_user['is_guest'] && $forum_user['username'] != $cur_post['username'])
                    $vote = '<a href="'.forum_link($forum_url['reputation_change'], array($cur_post['id'], $cur_post['poster_id'], 1)).'"><img src="'.$base_url.'/img/style/plus.gif" alt="+" /></a>  <strong>'.forum_number_format($cur_post['rep_plus'] - $cur_post['rep_minus']).'</strong>  <a href="'.forum_link($forum_url['reputation_change'], array($cur_post['id'], $cur_post['poster_id'], 2)).'"><img src="'.$base_url.'/img/style/minus.gif" alt="-" /></a>';
                else
                    $vote = '<strong>'.forum_number_format($cur_post['rep_plus'] - $cur_post['rep_minus']).'</strong>';    

                $forum_page['author_info']['reputation'] = '<li><span><a href="'.forum_link($forum_url['reputation'], $cur_post['poster_id']).'">'.$lang_topic['Reputation'].'</a>: '.$vote.'</span></li>';
            }

            if ($forum_user['is_admmod'])
            {
                if ($cur_post['admin_note'] != '')
                    $forum_page['author_info']['note'] = '<li><span>'.$lang_topic['Note'].' <strong> '.forum_htmlencode($cur_post['admin_note']).'</strong></span></li>';
            }
        }
    }

    // Создать контактную информацию об авторе
    if ($forum_config['o_show_user_info'])
    {
        if (isset($user_data_cache[$cur_post['poster_id']]['post_contacts']))
            $forum_page['post_contacts'] = $user_data_cache[$cur_post['poster_id']]['post_contacts'];
        else
        {
            if ($cur_post['poster_id'] > 1)
            {
                if(!$forum_user['is_guest'])
                {
                    $forum_page['post_contacts']['profile']='<span class="user-profile"><a class="external" title="'.sprintf($lang_topic['Go to profile'], forum_htmlencode($cur_post['username'])).'" href="'.forum_link($forum_url['user'], $cur_post['poster_id']).'">Профиль</a>';
                }
                if ($cur_post['url'] != '')
                    $forum_page['post_contacts']['url'] = '<span class="user-url'.(empty($forum_page['post_contacts']) ? ' item1' : '').'"><a class="external" href="'.forum_link('click.php').'?'.forum_htmlencode(($forum_config['o_censoring']) ? censor_words($cur_post['url']) : $cur_post['url']).'" onclick="window.open(this.href); return false" rel="nofollow">'.sprintf($lang_topic['Visit website'], '<span>'.sprintf($lang_topic['User possessive'], forum_htmlencode($cur_post['username'])).'</span>').'</a></span>';
                if ((($cur_post['email_setting'] == '0' && !$forum_user['is_guest']) || $forum_user['is_admmod']) && $forum_user['g_send_email'])
                    $forum_page['post_contacts']['email'] = '<span class="user-email'.(empty($forum_page['post_contacts']) ? ' item1' : '').'"><a href="mailto:'.forum_htmlencode($cur_post['email']).'">'.$lang_topic['E-mail'].'<span>&#160;'.forum_htmlencode($cur_post['username']).'</span></a></span>';
                else if ($cur_post['email_setting'] == '1' && !$forum_user['is_guest'] && $forum_user['g_send_email'])
                    $forum_page['post_contacts']['email'] = '<span class="user-email'.(empty($forum_page['post_contacts']) ? ' item1' : '').'"><a href="'.forum_link($forum_url['email'], $cur_post['poster_id']).'">'.$lang_topic['E-mail'].'<span>&#160;'.forum_htmlencode($cur_post['username']).'</span></a></span>';
                if (!$forum_user['is_guest'] && $forum_user['id'] != $cur_post['poster_id'])
                    $forum_page['post_contacts']['pm'] = '<span class="user-pm'.(empty($forum_page['post_contacts']) ? ' item1' : '').'"><a href="'.forum_link($forum_url['pm_post_link'], array($forum_user['id'], $cur_post['poster_id'])).'" title="'.$lang_topic['Send PM'].'">'.$lang_topic['PM'].'</a></span>';
            }
            else
            {
                if ($cur_post['poster_email'] != '' && !$forum_user['is_guest'] && $forum_user['g_send_email'])
                    $forum_page['post_contacts']['email'] = '<span class="user-email'.(empty($forum_page['post_contacts']) ? ' item1' : '').'"><a href="mailto:'.forum_htmlencode($cur_post['poster_email']).'">'.$lang_topic['E-mail'].'<span>&#160;'.forum_htmlencode($cur_post['username']).'</span></a></span>';
            }
        }

        ($hook = get_hook('vt_row_pre_post_contacts_merge')) ? eval($hook) : null;

        if (!empty($forum_page['post_contacts']))
            $forum_page['post_options']['contacts'] = '<p class="post-contacts">'.implode(' ', $forum_page['post_contacts']).'</p>';

        if (isset($user_data_cache[$cur_post['poster_id']]['post_identity']))
            $forum_page['post_identity'] = $user_data_cache[$cur_post['poster_id']]['post_identity'];
        else
        {
            if ($cur_post['poster_id'] > 1 && !$forum_user['is_guest'])
            {
                if ($cur_post['jabber'] != '')
                    $forum_page['post_identity']['jabber'] = '<a href="xmpp:'.forum_htmlencode($cur_post['jabber']).'"><img src="'.$base_url.'/img/style/p_jabber.png" /></a>';
                if ($cur_post['icq'] != '')
                    $forum_page['post_identity']['icq'] = '<a href="'.forum_link('click.php').'?http://icq.com/people/about_me.php?uin='.forum_htmlencode($cur_post['icq']).'" onclick="window.open(this.href); return false" rel="nofollow"><img src="'.$base_url.'/img/style/p_icq.png" /></a>';
                if ($cur_post['msn'] != '')
                    $forum_page['post_identity']['msn'] = '<a href="'.forum_link('click.php').'?http://members.msn.com/'.forum_htmlencode($cur_post['msn']).'" onclick="window.open(this.href); return false" rel="nofollow"><img src="'.$base_url.'/img/style/p_msn.png" /></a>';
                if ($cur_post['yahoo'] != '')
                    $forum_page['post_identity']['yahoo'] = '<a href="'.forum_link('click.php').'?http://edit.yahoo.com/config/send_webmesg?.target='.forum_htmlencode($cur_post['yahoo']).'" onclick="window.open(this.href); return false" rel="nofollow"><img src="'.$base_url.'/img/style/p_yahoo.png" /></a>';
                if ($cur_post['magent'] != '')
                    $forum_page['post_identity']['magent'] = '<a href="'.forum_link('click.php').'?http://mail.ru/agent?message&amp;to='.forum_htmlencode($cur_post['magent']).'" onclick="window.open(this.href); return false" rel="nofollow"><img src="'.$base_url.'/img/style/p_magent.png" /></a>';
                if ($cur_post['vkontakte'] != '')
                    $forum_page['post_identity']['vkontakte'] = '<a href="'.forum_link('click.php').'?http://vkontakte.ru/id'.forum_htmlencode($cur_post['vkontakte']).'" onclick="window.open(this.href); return false" rel="nofollow"><img src="'.$base_url.'/img/style/p_vk.png" /></a>';
                if ($cur_post['classmates'] != '')
                    $forum_page['post_identity']['classmates'] = '<a href="'.forum_link('click.php').'?'.forum_htmlencode($cur_post['classmates']).'" onclick="window.open(this.href); return false" rel="nofollow"><img src="'.$base_url.'/img/style/p_odkl.png" /></a>';
                if ($cur_post['mirtesen'] != '')
                    $forum_page['post_identity']['mirtesen'] = '<a href="'.forum_link('click.php').'?http://mirtesen.ru/people/'.forum_htmlencode($cur_post['mirtesen']).'" onclick="window.open(this.href); return false" rel="nofollow"><img src="'.$base_url.'/img/style/p_mirtesen.png" /></a>';
                if ($cur_post['moikrug'] != '')
                    $forum_page['post_identity']['moikrug'] = '<a href="'.forum_link('click.php').'?http://'.forum_htmlencode($cur_post['moikrug']).'.moikrug.ru/" onclick="window.open(this.href); return false" rel="nofollow"><img src="'.$base_url.'/img/style/p_moikrug.png" /></a>';
                if ($cur_post['twitter'] != '')
                    $forum_page['post_identity']['twitter'] = '<a href="'.forum_link('click.php').'?http://twitter.com/'.forum_htmlencode($cur_post['twitter']).'" onclick="window.open(this.href); return false" rel="nofollow"><img src="'.$base_url.'/img/style/p_twitter.png" /></a>';
                if ($cur_post['lastfm'] != '')
                    $forum_page['post_identity']['lastfm'] = '<a href="'.forum_link('click.php').'?http://last.fm/user/'.forum_htmlencode($cur_post['lastfm']).'" onclick="window.open(this.href); return false" rel="nofollow"><img src="'.$base_url.'/img/style/p_lastfm.png" /></a>';
            }
        }

        ($hook = get_hook('vt_row_pre_post_identity_merge')) ? eval($hook) : null;

        if (!empty($forum_page['post_identity']))
            $forum_page['post_options']['identity'] = '<p class="post-identity">'.implode(' ', $forum_page['post_identity']).'</p>';
    }

    // Generate the post options links
    if (!$forum_user['is_guest'])
    {
        if ($forum_config['o_report_enabled'])
            $forum_page['post_actions']['report'] = '<span class="report-post'.(empty($forum_page['post_actions']) ? ' item1' : '').'"><a href="'.forum_link($forum_url['report'], $cur_post['id']).'">'.$lang_topic['Report'].'<span> '.$lang_topic['Post'].' '.forum_number_format($forum_page['start_from'] + $forum_page['item_count']).'</span></a>'.(($cur_post['reported']) ? '<span class="warn"><strong>'.$lang_topic['Already reported'].'</strong></span>' : '' ).'</span>';

        if (!$forum_page['is_admmod'])
        {
            if (!$cur_topic['closed'])
            {
                if ($cur_post['poster_id'] == $forum_user['id'])
                {
                    if ($forum_user['g_delete_topics'])
                        $forum_page['post_actions']['delete'] = '<span class="delete-topic'.(empty($forum_page['post_actions']) ? ' item1' : '').'"><a href="'.forum_link($forum_url['delete'], $cur_topic['first_post_id']).'">'.$lang_topic['Delete topic'].'</a></span>';
                    if ($forum_user['g_edit_posts'])
                        $forum_page['post_actions']['edit'] = '<span class="edit-post'.(empty($forum_page['post_actions']) ? ' item1' : '').'"><a href="'.forum_link($forum_url['edit'], $cur_post['id']).'">'.$lang_topic['Edit'].'<span> '.$lang_topic['Post'].' '.forum_number_format($forum_page['start_from'] + $forum_page['item_count']).'</span></a></span>';
                }

                if (($cur_topic['post_replies'] == '' && $forum_user['g_post_replies']) || $cur_topic['post_replies'] == '1')
                    $forum_page['post_actions']['reply'] = '<span class="reply-post'.(empty($forum_page['post_actions']) ? ' first-item' : '').'"><a href="javascript:Reply('.$id. ','.$cur_post['id'].')">'.$lang_topic['Reply'].'<span>&#160;'.$lang_topic['Post'].' '.($forum_page['start_from'] + $forum_page['item_count']).'</span></a></span>';
                    $forum_page['post_actions']['quote'] = '<span class="quote-post'.(empty($forum_page['post_actions']) ? ' first-item' : '').'"><a href="'.forum_link($forum_url['quote'], array($id, $cur_post['id'])).'" onClick="return quote(\''.$cur_post['username'].'\');">'.$lang_topic['Quote'].'<span>&#160;'.$lang_topic['Post'].' '.($forum_page['start_from'] + $forum_page['item_count']).'</span></a></span>';
            }
        }
        else
        {
            $forum_page['post_actions']['delete'] = '<span class="delete-topic'.(empty($forum_page['post_actions']) ? ' item1' : '').'"><a href="'.forum_link($forum_url['delete'], $cur_topic['first_post_id']).'">'.$lang_topic['Delete topic'].'</a></span>';

            $forum_page['post_actions']['edit'] = '<span class="edit-post'.(empty($forum_page['post_actions']) ? ' item1' : '').'"><a href="'.forum_link($forum_url['edit'], $cur_post['id']).'">'.$lang_topic['Edit'].'<span> '.$lang_topic['Post'].' '.forum_number_format($forum_page['start_from'] + $forum_page['item_count']).'</span></a></span>';
            $forum_page['post_actions']['reply'] = '<span class="reply-post first-item"><a href="javascript:Reply('.$id. ','.$cur_post['id'].')">'.$lang_topic['Reply'].'<span>&#160;'.$lang_topic['Post'].' '.($forum_page['start_from'] + $forum_page['item_count']).'</span></a></span>';
            $forum_page['post_actions']['quote'] = '<span class="quote-post first-item"><a href="'.forum_link($forum_url['quote'], array($id, $cur_post['id'])).'" onClick="return quote(\''.$cur_post['username'].'\');">'.$lang_topic['Quote'].'<span>&#160;'.$lang_topic['Post'].' '.($forum_page['start_from'] + $forum_page['item_count']).'</span></a></span>';
        }
    }
    else
    {
        if (!$cur_topic['closed'])
        {
            if (($cur_topic['post_replies'] == '' && $forum_user['g_post_replies']) || $cur_topic['post_replies'] == '1')
                $forum_page['post_actions']['reply'] = '<span class=""quote-post'.(empty($forum_page['post_actions']) ? ' first-item' : '').'"><a href="javascript:Reply('.$id. ','.$cur_post['id'].')">'.$lang_topic['Quote'].'<span>&#160;'.$lang_topic['Post'].' '.($forum_page['start_from'] + $forum_page['item_count']).'</span></a></span>';
        }
    }

    ($hook = get_hook('vt_row_pre_post_actions_merge')) ? eval($hook) : null;


    if (!empty($forum_page['post_actions']))
        $forum_page['post_options']['actions'] = '<p class="post-actions">'.implode(' ', $forum_page['post_actions']).'</p>';

    // Give the post some class
    $forum_page['item_status'] = array(
        'post',
        ($forum_page['item_count'] % 2 == 0) ? 'even' : 'odd'
    );

    if ($forum_page['item_count'] == 1)
        $forum_page['item_status']['firstpost'] = 'firstpost';

    if (($forum_page['start_from'] + $forum_page['item_count']) == $forum_page['finish_at'])
        $forum_page['item_status']['lastpost'] = 'lastpost';

    if ($cur_post['id'] == $cur_topic['first_post_id'])
        $forum_page['item_status']['topicpost'] = 'topicpost';
    else
        $forum_page['item_status']['replypost'] = 'replypost';


    // Generate the post title
    if ($cur_post['id'] == $cur_topic['first_post_id'])
        $forum_page['item_subject'] = sprintf($lang_topic['Topic title'], $cur_topic['subject']);
    else
        $forum_page['item_subject'] = sprintf($lang_topic['Reply title'], $cur_topic['subject']);

    $forum_page['item_subject'] = forum_htmlencode($forum_page['item_subject']);

    // Perform the main parsing of the message (BBCode, smilies, censor words etc)
    $forum_page['message']['message'] = parse_message($cur_post['message'], $cur_post['hide_smilies']);

    if ($cur_post['edited'] != '')
        $forum_page['message']['edited'] = '<p class="lastedit"><em>'.sprintf($lang_topic['Last edited'], forum_htmlencode($cur_post['edited_by']), format_time($cur_post['edited'])).'</em></p>';

    // Do signature parsing/caching
    if ($cur_post['signature'] != '' && $forum_user['show_sig'] && $forum_config['o_signatures'])
    {
        if (!isset($signature_cache[$cur_post['poster_id']]))
            $signature_cache[$cur_post['poster_id']] = parse_signature($cur_post['signature']);

        $forum_page['message']['signature'] = '<div class="sig-content"><span class="sig-line"><!-- --></span>'.$signature_cache[$cur_post['poster_id']].'</div>';
    }

    ($hook = get_hook('vt_row_pre_display')) ? eval($hook) : null;

    // Do user data caching for the post
    if ($cur_post['poster_id'] > 1 && !isset($user_data_cache[$cur_post['poster_id']]))
    {
        $user_data_cache[$cur_post['poster_id']] = array(
            'author_ident'    => $forum_page['author_ident'],
            'author_info'    => $forum_page['author_info'],
            'post_contacts'    => $forum_page['post_contacts'],
            'post_identity' => $forum_page['post_identity']
        );

        ($hook = get_hook('vt_row_add_user_data_cache')) ? eval($hook) : null;
    }

?>
        <div id="p<?php echo $cur_post['id'] ?>" class="<?php echo implode(' ', $forum_page['item_status']) ?>">
            <div class="posthead">
                <h3 class="hn post-ident"><?php echo implode(' ', $forum_page['post_ident']) ?></h3>
            </div>
            <div class="postbody<?php echo ($cur_post['is_online'] == $cur_post['poster_id']) ? ' online' : '' ?>">
                <div class="post-author">
                    <ul class="author-ident">
                        <?php echo implode("\n\t\t\t\t\t\t", $forum_page['author_ident'])."\n" ?>
                    </ul>
                    <ul class="author-info">
                        <?php echo implode("\n\t\t\t\t\t\t", $forum_page['author_info'])."\n" ?>
                    </ul>
                </div>
                <div class="post-entry">
                    <h4 class="entry-title hn"><?php echo $forum_page['item_subject'] ?></h4>
                    <div class="entry-content">
                        <?php echo implode("\n\t\t\t\t\t\t", $forum_page['message'])."\n" ?>
                    </div>
<?php ($hook = get_hook('vt_row_new_post_entry_data')) ? eval($hook) : null; ?>
                </div>
            </div>
<?php if (!empty($forum_page['post_options'])): ?>
            <div class="postfoot">
                <div class="post-options">
                    <?php echo implode("\n\t\t\t\t\t", $forum_page['post_options'])."\n" ?>
                </div>
            </div>
<?php endif; ?>
        </div>
        <form action="post.php" method="post" id="qq">
            <div class="hidden">
                <input type="hidden" value="" id="post_msg" name="post_msg"/>
                <input type="hidden" value="<?php echo forum_link($forum_url['quote'], array($id, $cur_post['id'])) ?>" id="quote_url" name="quote_url" />
            </div>
        </form>
<?php

    if ($forum_page['item_count'] == $forum_config['o_topicbox'] && !defined('FORUM_DISABLE_HTML'))
    {
?>
        <div class="post">
            <div class="post-entry">
                <div class="entry-content">
                    <?php echo $forum_config['o_topicbox_message'] ?>
                </div>
            </div>
        </div>

<?php

    }
}
//Конец первого сообщения

Вставлять это до в файл viewtopic.php перед последним while циклом, до строки содержащей следующее

$query = array(
    'SELECT'    => 'u.email, u.title, u.sex, u.country, u.signature, u.email_setting, u.num_posts, u.admin_note, u.user_agent, u.rep_plus, u.rep_minus, u.rep_enable, 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'        => 'posts AS p',
    'JOINS'        => array(

это примерно строка 743

Сделано мое не очень грамотно, скорее очень неграмотно, простой копи паст, ненужное выкинул. Выводит в информации о авторе только его ник, Количество сообщений и репутацию

Отредактировал mkusher (2009-11-15 02:28:56)

4

Ответ: Зафиксирование первого сообщения (сырое)

совсем забыл, при клике по нику ничего не будет происходить, а вот появиться ссылка "профиль" около "вебсайт", "e-mail" и т.д.