Перейти к контенту

[1.x.x]Нумерация сообщений


Рекомендуемые сообщения

если сообщение на которое ссылаются будет перемещено в другой форум/топик? Можно, чтобы и тогда оно находилось?

Насколько я знаю, при перемещении топика сами посты не перенумеруются. Если останется в старом месте ссылка на перемещенный топик, то вроде должен найти.

Ссылка на комментарий
Поделиться на других сайтах

Да, при смене форума находит нормально. Правда, если из phpMyAdmin'a перекинуть в другой топик -- никак, но это уже экзотика :D
Ссылка на комментарий
Поделиться на других сайтах

  • 1 год спустя...

;) я наверное уже поздно

а для 1.3.1 покатит!?

а то аж страшно, полтора года хаку, врятли всё осталось так же! :):D

Ссылка на комментарий
Поделиться на других сайтах

  • 6 месяцев спустя...

Ребята, в Topics.php нету:

 

$this->output .= $this->html->RenderRow( array( 'POST' => $row, 'POSTER' => $poster ) );

 

[1120079869:1120079905]Версия 1.3.1 не от Bestfilez!

Ссылка на комментарий
Поделиться на других сайтах

  • 1 год спустя...
  • 1 год спустя...

Стоит 1.3 от Игорька, нужно чтобы над постом был его номер и при нажатие на не его номер открывался диал как в ipb 2, с полным адресом к посту для его копирования.

 

ставил мод: http://www.ibresource.ru/db/58/ - не работает потому что в файле sources/Topics.php нету строки:

 

$this->output .= $this->html->RenderRow( array( 'POST' => $row, 'POSTER' => $poster ) );

пробывал менять строку:

$this->output .= $this->html->RenderRow( $row0, $poster0 );

на:

$this->output .= $this->html->RenderRow( array( 'POST' => $row, 'POSTER' => $poster ) );

но толку ни какого

 

ВОТ ИСХОДНИК МОЕГО TOPICS.PHP:

<?php

/*
+--------------------------------------------------------------------------
|   Invision Power Board v1.3 Final
|   ========================================
|   by Matthew Mecham
|   (c) 2001 - 2003 Invision Power Services
|   http://www.invisionpower.com
|   ========================================
|   Web: http://www.invisionboard.com
|   Time: Thu, 20 Nov 2003 01:15:27 GMT
|   Release: 322f4d4bcd09dcb3058f62ae41ab3e8b
|   Email: matt@invisionpower.com
|   Licence Info: http://www.invisionboard.com/?license
+---------------------------------------------------------------------------
|
|   > Topic display module
|   > Module written by Matt Mecham
|   > Date started: 18th February 2002
|
|    > Module Version Number: 1.1.0
+--------------------------------------------------------------------------
*/


$idx = new Topics;

class Topics {

    var $output    = "";
    var $base_url  = "";
    var $html      = "";
    var $moderator = array();
    var $forum     = array();
    var $topic     = array();
    var $category  = array();
    var $mem_titles = array();
    var $mod_action = array();
    var $poll_html  = "";
    var $colspan    = 0;
    var $parser     = "";
    var $mimetypes  = "";
    var $nav_extra  = "";
     var $rep_ranks  = array();
    var $rep_hide   = array();
    var $rep_exclude = array();

    var $read_array = array();
    var $mod_panel_html = "";
    var $warn_range = 0;
    var $warn_done  = 0;
    var $pfields    = array();
    var $pfields_dd = array();
    var $md5_check  = "";
    
    /********************************************************************************
***/
    //
    // Our constructor, load words, load skin, print the topic listing
    //
    /********************************************************************************
***/
    
    function Topics()
    {
    
        global $ibforums, $DB, $std, $print, $skin_universal;
        
        $this->md5_check = $std->return_md5_check();
         
        //-------------------------------------
        // Compile the language file
        //-------------------------------------
        
        $ibforums->lang = $std->load_words($ibforums->lang, 'lang_topic', $ibforums->lang_id);

        $ibforums->lang = $std->load_words($ibforums->lang, 'lang_post', $ibforums->lang_id);

        $this->html     = $std->load_template('skin_topic');
        
        require ROOT_PATH."sources/lib/post_parser.php";
        
        $this->parser = new post_parser();
        
        //-------------------------------------
        // Check the input
        //-------------------------------------
        
        $ibforums->input['t'] = intval($ibforums->input['t']);
        
        if ( $ibforums->input['t'] < 0  )
        {
            $std->Error( array( LEVEL => 1, MSG => 'missing_files') );
        }
        
        
        //-------------------------------------
        // Get the forum info based on the forum ID,
        // get the category name, ID, and get the topic details
        //-------------------------------------
        
        if ( ! $ibforums->topic_cache['tid'] )
        {
            $DB->query("SELECT t.*, f.topic_mm_id, f.name as forum_name, f.quick_reply, f.id as forum_id, f.read_perms, f.reply_perms, f.parent_id, f.use_html,
                               f.start_perms, f.allow_poll, f.password, f.posts as forum_posts, f.topics as forum_topics, f.upload_perms,
                               f.show_rules, f.rules_text, f.rules_title,
                               c.name as cat_name, c.id as cat_id
                        FROM ibf_topics t, ibf_forums f , ibf_categories c where t.tid=".$ibforums->input['t']." and f.id = t.forum_id and f.category=c.id");
            
            $this->topic = $DB->fetch_row();
        }
        else
        {
            $this->topic = $ibforums->topic_cache;
        }
        
        $this->forum = array( 'id'           => $this->topic['forum_id']          ,
                              'name'         => $this->topic['forum_name']        ,
                              'posts'        => $this->topic['forum_posts']       ,
                              'topics'       => $this->topic['forum_topics']      ,
                              'read_perms'   => $this->topic['read_perms']        ,
                              'reply_perms'  => $this->topic['reply_perms']       , 
                              'allow_poll'   => $this->topic['allow_poll']        ,
                              'upload_perms' => $this->topic['upload_perms']      ,
                              'parent_id'    => $this->topic['parent_id']         ,
                              'password'     => $this->topic['password']          ,
                              'quick_reply'  => $this->topic['quick_reply']       ,
                              'use_html'     => $this->topic['use_html']          ,
                              'topic_mm_id'  => $this->topic['topic_mm_id']       
                            );
                            
        $this->category = array( 'name'   => $this->topic['cat_name'],
                                 'id'     => $this->topic['cat_id']  ,
                               );
                               
        $ibforums->input['f'] = $this->forum['id'];
        
        //-------------------------------------
        // Error out if we can not find the forum
        //-------------------------------------
        
        if (!$this->forum['id'])
        {
            $std->Error( array( LEVEL => 1, MSG => 'is_broken_link') );
        }
        
        //-------------------------------------
        // Error out if we can not find the topic
        //-------------------------------------
        
        if (!$this->topic['tid'])
        {
            $std->Error( array( LEVEL => 1, MSG => 'is_broken_link') );
        }
        
        //-------------------------------------
        // Error out if the topic is not approved
        //-------------------------------------
        
        if ($this->topic['approved'] != 1)
        {
            $std->Error( array( LEVEL => 1, MSG => 'missing_files') );
        }
        
        //-------------------------------------
        // If this forum is a link, then 
        // redirect them to the new location
        //-------------------------------------
        
        if ($this->topic['state'] == 'link')
        {
            $f_stuff = explode("&", $this->topic['moved_to']);
            $print->redirect_screen( $ibforums->lang['topic_moved'], "showtopic={$f_stuff[0]}" );
        }
        
        //-------------------------------------
        // Unserialize the read array and parse into
        // array
        //-------------------------------------
        
        if ( $read = $std->my_getcookie('topicsread') )
        {
            $this->read_array = unserialize(stripslashes($read));
            
            if (! is_array($this->read_array) )
            {
                $this->read_array = array();
            }
        }
        
        //--------------------------------------------------------------------
        // Are we looking for an older / newer topic?
        //--------------------------------------------------------------------
        
        if ( isset($ibforums->input['view']) )
        {
            if ($ibforums->input['view'] == 'new')
            {
                $DB->query("SELECT * from ibf_topics WHERE forum_id=".$this->forum['id']." AND approved=1 AND state <> 'link' AND last_post > ".$this->topic['last_post']." "
                          ."ORDER BY last_post ASC LIMIT 0,1");
                          
                if ( $DB->get_num_rows() )
                {
                    $this->topic = $DB->fetch_row();
                    $std->boink_it($ibforums->base_url."showtopic=".$this->topic['tid']);
                    //$ibforums->input['t'] = $this->topic['tid'];
                }
                else
                {
                    $std->Error( array( LEVEL => 1, MSG => 'no_newer') );
                }
            }
            else if ($ibforums->input['view'] == 'old')
            {
                $DB->query("SELECT * from ibf_topics WHERE forum_id=".$this->forum['id']." AND approved=1 AND state <> 'link' AND last_post < ".$this->topic['last_post']." "
                          ."ORDER BY last_post DESC LIMIT 0,1");
                          
                if ( $DB->get_num_rows() )
                {
                    $this->topic = $DB->fetch_row();
                    $std->boink_it($ibforums->base_url."showtopic=".$this->topic['tid']);
                    //$ibforums->input['t'] = $this->topic['tid'];
                }
                else
                {
                    $std->Error( array( LEVEL => 1, MSG => 'no_older') );
                }
            }
            else if ($ibforums->input['view'] == 'getlastpost')
            {
                
                $this->return_last_post();
                
            }
            else if ($ibforums->input['view'] == 'getnewpost')
            {
                
                $st  = 0;
                $pid = "";
                
                $last_time = isset($this->read_array[ $this->topic['tid'] ]) ? $this->read_array[ $this->topic['tid'] ] : $ibforums->input['last_visit'];
            
                $DB->query("SELECT pid, post_date FROM ibf_posts WHERE queued <> 1 AND topic_id='".$this->topic['tid']."' AND post_date > '".$last_time."' ORDER BY post_date LIMIT 1");
                
                if ( $post = $DB->fetch_row() )
                {
                
                    $pid = "entry".$post['pid'];
                
                    $DB->query("SELECT COUNT(pid) as posts FROM ibf_posts WHERE topic_id='".$this->topic['tid']."' AND pid <= '".$post['pid']."'");
                    
                    $cposts = $DB->fetch_row();
                    
                    if ( (($cposts['posts']) % $ibforums->vars['display_max_posts']) == 0 )
                    {
                        $pages = ($cposts['posts']) / $ibforums->vars['display_max_posts'];
                    }
                    else
                    {
                        $number = ( ($cposts['posts']) / $ibforums->vars['display_max_posts'] );
                        $pages = ceil( $number);
                    }
                    
                    $st = ($pages - 1) * $ibforums->vars['display_max_posts'];
                    
                    $std->boink_it($ibforums->base_url."showtopic=".$this->topic['tid']."&st=$st".$pid);
                    exit();
                }
                else
                {
                    $this->return_last_post();
                }
            }
            else if ($ibforums->input['view'] == 'findpost')
            {
                $pid = intval($ibforums->input['p']);
                
                if ( $pid > 0 )
                {
                    $DB->query("SELECT COUNT(pid) as posts FROM ibf_posts WHERE topic_id='".$this->topic['tid']."' AND pid <= '".$pid."'");
                    
                    $cposts = $DB->fetch_row();
                    
                    if ( (($cposts['posts']) % $ibforums->vars['display_max_posts']) == 0 )
                    {
                        $pages = ($cposts['posts']) / $ibforums->vars['display_max_posts'];
                    }
                    else
                    {
                        $number = ( ($cposts['posts']) / $ibforums->vars['display_max_posts'] );
                        $pages = ceil( $number);
                    }
                    
                    $st = ($pages - 1) * $ibforums->vars['display_max_posts'];
                    
                    $std->boink_it($ibforums->base_url."showtopic=".$this->topic['tid']."&st=$st"."entry".$pid);
                    exit();
                }
                else
                {
                    $this->return_last_post();
                }
            }
        }
        
        $this->base_url = $ibforums->base_url;
        
        $this->forum['JUMP'] = $std->build_forum_jump();
        
        //-------------------------------------
        // Check viewing permissions, private forums,
        // password forums, etc
        //-------------------------------------
        
        if ( (!$this->topic['pinned']) and ( ( ! $ibforums->member['g_other_topics'] ) AND ( $this->topic['starter_id'] != $ibforums->member['id'] ) ) )
        {
            $std->Error( array( LEVEL => 1, MSG => 'no_view_topic') );
        }
        
        $bad_entry = $this->check_access();
        
        if ($bad_entry == 1)
        {
            $std->Error( array( LEVEL => 1, MSG => 'no_view_topic') );
        }      
        
        //-------------------------------------
        // Update the topic views counter
        //-------------------------------------
        
        $DB->query("UPDATE ibf_topics SET views=views+1 WHERE tid='".$this->topic['tid']."'");
        
        //-------------------------------------
        // Update the topic read cookie
        //-------------------------------------
        
        if ($ibforums->member['id'])
        {
            $this->read_array[$this->topic['tid']] = time();
            
            $std->my_setcookie('topicsread', serialize($this->read_array), -1 );
        }
        
        //----------------------------------------
        // If this is a sub forum, we need to get
        // the cat details, and parent details
        //----------------------------------------
        
        if ($this->forum['parent_id'] > 0)
        {
        
            $DB->query("SELECT f.id as forum_id, f.name as forum_name, c.id, c.name FROM ibf_forums f, ibf_categories c WHERE f.id=".$this->forum['parent_id']." AND c.id=f.category");
            
            $row = $DB->fetch_row();
            
            $this->category['id']   = $row['id'];
            $this->category['name'] = $row['name'];
        
            $this->nav_extra = "<a href='".$this->base_url."showforum={$row['forum_id']}'>{$row['forum_name']}</a>";
        }
        
        
        //-------------------------------------
        // Get all the member groups and
        // member title info
        //-------------------------------------
        
        $DB->query("SELECT id, title, pips, posts from ibf_titles ORDER BY posts DESC");
        while ($i = $DB->fetch_row())
        {
             $this->mem_titles[ $i['id'] ] = array(
                                                 'TITLE' => $i['title'],
                                                 'PIPS'  => $i['pips'],
                                                 'POSTS' => $i['posts'],
                                               );
        }

if ($ibforums->vars['rep_use_ranks'])
        {
            $DB->query("SELECT id, title, amount FROM ibf_reput_ranks ORDER BY amount DESC");
            while ($row = $DB->fetch_row())
            {
                 $this->rep_ranks[ $row['id'] ] = array(
                                                     'TITLE'  => $row['title'],
                                                     'AMOUNT' => $row['amount'],
                                                   );
            }
        }
        
        $this->rep_exclude    = explode(",", $ibforums->vars['rep_total_exclude']);
        $this->rep_hide        = explode(",", $ibforums->vars['rep_change_exclude']);

        
        //-------------------------------------
        // Are we a moderator?
        //-------------------------------------
        
        if ( ($ibforums->member['id']) and ($ibforums->member['g_is_supmod'] != 1) )
        {
            $DB->query("SELECT * FROM ibf_moderators WHERE forum_id=".$this->forum['id']." AND (member_id=".$ibforums->member['id']." OR (is_group=1 AND group_id='".$ibforums->member['mgroup']."'))");
            $this->moderator = $DB->fetch_row();
        }
        
        $this->mod_action = array( 'CLOSE_TOPIC'  => '00',
                                   'OPEN_TOPIC'   => '01',
                                   'MOVE_TOPIC'   => '02',
                                   'DELETE_TOPIC' => '03',
                                   'EDIT_TOPIC'   => '05',
                                   'PIN_TOPIC'    => '15',
                                   'UNPIN_TOPIC'  => '16',
                                   'UNSUBBIT'     => '30',
                                   'SPLIT_TOPIC'  => '50',
                                   'MERGE_TOPIC'  => '60',
                                   'DELETE_POSTZ' => '66',
                                   'MOVE_POSTZ'   => '67',
                                   'TOPIC_HISTORY' => '90',
                                   'PIN_FIRST'        => '100',
                                   'UNPIN_FIRST'        => '101',
                                 );
        
        
        //-------------------------------------
        // Get the reply, and posting buttons
        //------------------------------------- 
        
        $this->topic['POLL_BUTTON'] = $this->forum['allow_poll']
                                         ? "<a href='".$this->base_url."act=Post&CODE=10&f=".$this->forum['id']."'><{A_POLL}></a>"
                                         : '';
                                         
        $this->topic['REPLY_BUTTON']  = $this->reply_button();
        
        
        //-------------------------------------
        // Generate the forum page span links
        //-------------------------------------
        
        if ($ibforums->input['hl'])
        {
            $hl = '&hl='.$ibforums->input['hl'];
        }
        
        $this->topic['SHOW_PAGES']
            = $std->build_pagelinks( array( 'TOTAL_POSS'  => ($this->topic['posts']+1),
                                            'PER_PAGE'    => $ibforums->vars['display_max_posts'],
                                            'CUR_ST_VAL'  => $ibforums->input['st'],
                                            'L_SINGLE'    => "",
                                            'BASE_URL'    => $this->base_url."showtopic=".$this->topic['tid'].$hl,
                                          )
                                   );
                                   
        if ( ($this->topic['posts'] + 1) > $ibforums->vars['display_max_posts'])
        {
            $this->topic['go_new'] = $this->html->golastpost_link($this->forum['id'], $this->topic['tid'] );
        }
                                   
        
        //-------------------------------------
        // Fix up some of the words
        //-------------------------------------
        
        $this->topic['TOPIC_START_DATE'] = $std->get_date( $this->topic['start_date'], 'LONG' );

if ($ibforums->vars['status_set'] ==  1)
{

$off_text = ($ibforums->vars['off_status_color']);
$on_text = ($ibforums->vars['on_status_color']);
$off_image = ($ibforums->vars['off_status_image']);
$on_image = ($ibforums->vars['on_status_image']);
$img_dir = ($ibforums->vars['img_url']);
$s_pre = ($ibforums->vars['status_prefix']);
$user_name = 'Member'; // Will be a username variable in v3.5


$ibforums->lang['M_On_T'] = preg_replace( "/<#ON_COLOR#>/", $on_text, $ibforums->lang['M_On_T']);
$ibforums->lang['M_On_T'] = preg_replace( "/<#S_PRE#>/", $s_pre, $ibforums->lang['M_On_T']);
$ibforums->lang['M_Off_T'] = preg_replace( "/<#OFF_COLOR#>/", $off_text, $ibforums->lang['M_Off_T']);
$ibforums->lang['M_Off_T'] = preg_replace( "/<#S_PRE#>/", $s_pre, $ibforums->lang['M_Off_T']);

$ibforums->lang['M_On_I'] = preg_replace( "/<#ON_IMAGE#>/", $img_dir.'/'.$on_image, $ibforums->lang['M_On_I']);
$ibforums->lang['M_On_I'] = preg_replace( "/<#U_NAME#>/", $user_name, $ibforums->lang['M_On_I']);
$ibforums->lang['M_On_I'] = preg_replace( "/<#S_PRE#>/", $s_pre, $ibforums->lang['M_On_I']);
$ibforums->lang['M_Off_I'] = preg_replace( "/<#U_NAME#>/", $user_name, $ibforums->lang['M_Off_I']);
$ibforums->lang['M_Off_I'] = preg_replace( "/<#OFF_IMAGE#>/", $img_dir.'/'.$off_image, $ibforums->lang['M_Off_I']);
$ibforums->lang['M_Off_I'] = preg_replace( "/<#S_PRE#>/", $s_pre, $ibforums->lang['M_Off_I']);

}
        
        $ibforums->lang['topic_stats'] = preg_replace( "/<#START#>/", $this->topic['TOPIC_START_DATE'], $ibforums->lang['topic_stats']);
        $ibforums->lang['topic_stats'] = preg_replace( "/<#POSTS#>/", $this->topic['posts']           , $ibforums->lang['topic_stats']);
        
        if ($this->topic['description'])
        {
            $this->topic['description'] = ', '.$this->topic['description'];
        }
        

        //-------------------------------------
        // Render the page top
        //-------------------------------------
        
        $this->output .= $this->html->PageTop( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ) );
        
        //-------------------------------------
        // Do we have a poll?
        //-------------------------------------
        
        if ($this->topic['poll_state'])
        {
            $this->output = str_replace( "<!--{IBF.POLL}-->", $this->parse_poll(), $this->output );
        }
        else
        {
            // Can we start a poll? Is this our topic and is it still open?
            
            if ( $this->topic['state'] != "closed" AND $ibforums->member['id'] AND $ibforums->member['g_post_polls'] AND $this->forum['allow_poll'] )
            {
                if ( 
                     ( ($this->topic['starter_id'] == $ibforums->member['id']) AND ($ibforums->vars['startpoll_cutoff'] > 0) AND ( $this->topic['start_date'] + ($ibforums->vars['startpoll_cutoff'] * 3600) > time() ) )
                     OR ( $ibforums->member['g_is_supmod'] == 1 )
                   )
                {
                    $this->output = str_replace( "<!--{IBF.START_NEW_POLL}-->", $this->html->start_poll_link($this->forum['id'], $this->topic['tid']), $this->output );
                }
            }
        }
        
        //--------------------------------------------
        // Extra queries?
        //--------------------------------------------
        
        $join_profile_query = "";
        $join_get_fields    = "";
        
        if ( $ibforums->vars['custom_profile_topic'] == 1 )
        {
            //--------------------------------------------
            // Get the data for the profile fields
            //--------------------------------------------
            
            $DB->query("SELECT fid, ftype, fhide, fcontent FROM ibf_pfields_data");
            
            while ( $r = $DB->fetch_row() )
            {
                $this->pfields['field_'.$r['fid']] = $r;
                
                if ( $r['ftype'] == 'drop' )
                {
                    foreach( explode( '|', $r['fcontent'] ) as $i )
                    {
                        list($k, $v) = explode( '=', $i, 2 );
                        
                        $this->pfields_dd['field_'.$r['fid']][$k] = $v;
                    }
                }
            }
        
            $join_profile_query = "LEFT JOIN ibf_pfields_content pc ON (pc.member_id=p.author_id)";
            $join_get_fields    = ", pc.*";
        }
        
        //--------------------------------------------
        // Grab the posts we'll need
        //--------------------------------------------

if ($ibforums->vars['status_set'] ==  1)
{

$time=time()-900;

$online_ornot = Array();

$DB->query( "SELECT s.member_id FROM ibf_sessions s, ibf_posts p WHERE p.topic_id='".$this->topic['tid']."' and p.queued !='1' AND s.member_id<>'0' AND s.running_time > $time AND s.member_id=p.author_id AND  s.login_type !='1'");

while ($stuff = $DB->fetch_row())
{
$online_ornot[$stuff['member_id']] = 1;
}

}

        $first = intval($ibforums->input['st']);
        
        if ( $ibforums->vars['post_order_column'] != 'post_date' )
        {
            $ibforums->vars['post_order_column'] = 'pid';
        }
        
        if ( $ibforums->vars['post_order_sort'] != 'desc' )
        {
            $ibforums->vars['post_order_sort'] = 'asc';
        }
        
        //--------------------------------------------
        // Optimized query?
        // MySQL.com insists that forcing LEFT JOIN or
        // STRAIGHT JOIN helps the query optimizer, so..
        //--------------------------------------------
        
        // start oska modified
        
        if ($first > 0 and $this->topic['firstpost'] == 1) {
        $DB->query( "SELECT p.*,
                    m.id,m.name,m.mgroup,m.email,m.joined,m.avatar,m.avatar_size,m.posts,m.aim_
name,m.icq_number,
                    m.signature, m.website,m.yahoo,m.title,m.hide_email,m.msnname,
                    g.g_id, g.g_title, g.g_icon
                    FROM ibf_posts p
                      LEFT JOIN ibf_members m ON (p.author_id=m.id)
                      LEFT JOIN ibf_groups g ON (g.g_id=m.mgroup)
                    WHERE p.topic_id='".$this->topic['tid']."' and p.queued !='1'
                    ORDER BY p.pid LIMIT 0, 1");
        
        $cached_members0 = array();
        
        while ( $row0 = $DB->fetch_row() ) {
             
            $poster0 = array();
        
            // Get the member info. We parse the data and cache it.
            // It's likely that the same member posts several times in
            // one page, so it's not efficient to keep parsing the same
            // data
            
            if ($row0['author_id'] != 0)
            {
                // Is it in the hash?
                if ( isset($cached_members0[ $row0['author_id'] ]) )
                {
                    // Ok, it's already cached, read from it
                    $poster0 = $cached_members0[ $row0['author_id'] ];
                    $row0['name_css'] = 'normalname';
                }
                else
                {
                    $row0['name_css'] = 'normalname';
                    $poster0 = $this->parse_member( &$row0 );
                    // Add it to the cached list
                    $cached_members0[ $row0['author_id'] ] = $poster0;
                }
            }
            else
            {
                // It's definately a guest...
                $poster0 = $std->set_up_guest( $row0['author_name'] );
                $row0['name_css'] = 'unreg';
            }
            
            //--------------------------------------------------------------
            
            $row0['post_css'] = $post_count0 % 2 ? 'post1' : 'post2';
            
            
            //--------------------------------------------------------------
            
            if ( ($row0['append_edit'] == 1) and ($row0['edit_time'] != "") and ($row0['edit_name'] != "") )
            {
                $e_time0 = $std->get_date( $row0['edit_time'] , 'LONG' );
                
                $row0['post'] .= "<br><br><span class='edit'>".sprintf($ibforums->lang['edited_by'], $row0['edit_name'], $e_time0)."</span>";
            }
            
            //--------------------------------------------------------------
            
            if (!$ibforums->member['view_img'])
            {
                // unconvert smilies first, or it looks a bit crap.
                
                $row0['post'] = preg_replace( "#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1" , $row0['post'] );
                
                $row0['post'] = preg_replace( "/<img src=[\"'](.+?)[\"'].+?".">/", "(IMG:<a href='\\1' target='_blank'>\\1</a>)", $row0['post'] );
            }
            
            //--------------------------------------------------------------
            
            if ($ibforums->input['hl'])
            {
            
                $keywords0 = str_replace( "+", " ", $ibforums->input['hl'] );
                
                if ( preg_match("/,(and|or),/i", $keywords0) )
                {
                    while ( preg_match("/,(and|or),/i", $keywords0, $match0) )
                    {
                        $word_array0 = explode( ",".$match0[1].",", $keywords0 );
                        
                        if (is_array($word_array0))
                        {
                            foreach ($word_array0 as $keywords0)
                            {
                                $row0['post'] = preg_replace( "/(^|\s)($keywords0)(\s|$)/i", "\\1<span class='highlight'>\\2</span>\\3", $row0['post'] );
                            }
                        }
                    }
                }
                else
                {
                    $row0['post'] = preg_replace( "/(^|\s)($keywords0)(\s|$)/i", "\\1<span class='highlight'>\\2</span>\\3", $row0['post'] );
                }
            }
                
            //--------------------------------------------------------------
            
            
            $row0['edit_button']   = $this->edit_button($row0['pid'], $poster0, $row0['post_date']);
            $row0['post_date']     = $std->get_date( $row0['post_date'], 'LONG' );
            $row0['post_icon']     = $row0['icon_id']
                              ? "<img src='".$ibforums->vars['img_url']."/icon{$row0['icon_id']}.gif' alt=''>  "
                              : "";
            
            $row0['ip_address']  = $this->view_ip($row0, $poster0);
            
            $row0['report_link'] = (($ibforums->vars['disable_reportpost'] != 1) and ( $ibforums->member['id'] ))
                                ? $this->html->report_link($row0)
                                : "";
            
            //--------------------------------------------------------------
                              
            if ($row0['attach_id'])
            {
                // If we've not already done so, lets grab our mime-types
                
                if ( !is_array($this->mimetypes) )
                {
                    require "./conf_mime_types.php";
                    $this->mimetypes = $mime_types;
                    unset($mime_types);
                }
            
                // Is it an image, and are we viewing the image in the post?
                if ( 
                     ($ibforums->vars['show_img_upload'])
                       and
                     (
                            $row0['attach_type'] == 'image/gif'
                         or $row0['attach_type'] == 'image/jpeg'
                         or $row0['attach_type'] == 'image/pjpeg'
                         or $row0['attach_type'] == 'image/x-png'
                         or $row0['attach_type'] == 'image/png'
                     )
                    ) {
                    $row0['attachment'] = $this->html->Show_attachments_img( array( 'file_name' => $row0['attach_id']) );
                } else {
                    $row0['attachment'] = $this->html->Show_attachments( array (
                                                                                      'hits'  => $row0['attach_hits'],
                                                                                      'image' => $this->mimetypes[ $row0['attach_type'] ][1],
                                                                                      'name'  => $row0['attach_file'],
                                                                                      'pid'   => $row0['pid'],
                                                                                    )
                                                                            );
                }
            }
            
            //--------------------------------------------------------------
            // Siggie stuff
            //--------------------------------------------------------------
            
            if (!$ibforums->vars[SIG_SEP]) $ibforums->vars[SIG_SEP] = "<br><br>--------------------<br>";
            
            if ($poster0['signature'] and $ibforums->member['view_sigs'])
            {
                if ($row['use_sig'] == 1)
                {
                    $row0['signature'] = "<!--Signature-->{$ibforums->vars[SIG_SEP]}<span class='signature'>{$poster0['signature']}</span><!--E-Signature-->";
                }
                else
                {
                    $row0['signature'] = "";
                }
                                
            }
            else
            {
                $row0['signature'] = "";
            }
            
            // Fix up the membername so it links to the members profile
            
            if ($poster0['id'])
            {
                $poster0['name'] = "<a href='{$this->base_url}&act=Profile&CODE=03&MID={$poster0['id']}'>{$poster0['name']}</a>";
            }
            
            $this->output .= $this->html->RenderRow( $row0, $poster0 );
            
            
        }
        
            }
        // end oska modified
           
        $DB->query( "SELECT p.*,
                    m.id,m.name,m.mgroup,m.email,m.joined,m.avatar,m.avatar_size,m.posts,m.aim_
name,m.icq_number,
                    m.signature, m.website,m.yahoo,m.integ_msg,m.title,m.hide_email,m.msnname, m.warn_level, m.warn_lastwarn,
                    g.g_id, g.g_title, g.g_icon, m.rep, g.g_dohtml, m.files, m.downloads $join_get_fields
                    FROM ibf_posts p
                      LEFT JOIN ibf_members m ON (p.author_id=m.id)
                      LEFT JOIN ibf_groups g ON (g.g_id=m.mgroup)
                      $join_profile_query
                    WHERE p.topic_id=".$this->topic['tid']." and p.queued != 1
                    ORDER BY p.{$ibforums->vars['post_order_column']} {$ibforums->vars['post_order_sort']} LIMIT $first, ".$ibforums->vars['display_max_posts']);
                    
        if ( ! $DB->get_num_rows() )
        {
            if ($first >= $ibforums->vars['display_max_posts'])
            {
                // Get the correct number of replies...
                
                $newq = $DB->query("SELECT COUNT(pid) as pcount FROM ibf_posts p, ibf_members m WHERE p.topic_id=".$this->topic['tid']." and p.queued !=1 AND p.author_id=m.id");
                $pcount = $DB->fetch_row($newq);
                
                $pcount['pcount'] = $pcount['pcount'] > 0 ? $pcount['pcount'] - 1 : 0;
                
                // Update the post table...
                
                if ($pcount['pcount'] > 1)
                {
                    $DB->query("UPDATE ibf_topics SET posts=".$pcount['pcount']." WHERE tid='".$this->topic['tid']."'");
                }
                
                $std->boink_it($ibforums->base_url."act=ST&f={$this->forum['id']}&t={$this->topic['tid']}&view=getlastpost");
                exit();
            }
        }
                
                    
        $cached_members = array();
        
        //-------------------------------------
        // Format and print out the topic list
        //-------------------------------------
        
        $post_count = 0;  // Use this as our master bater, er... I mean counter.
        
        while ( $row = $DB->fetch_row() )
        {
        
            $poster = array();
        
            // Get the member info. We parse the data and cache it.
            // It's likely that the same member posts several times in
            // one page, so it's not efficient to keep parsing the same
            // data
            
            if ($row['author_id'] != 0)
            {
                // Is it in the hash?
                if ( isset($cached_members[ $row['author_id'] ]) )
                {
                    // Ok, it's already cached, read from it
                    $poster = $cached_members[ $row['author_id'] ];
                    $row['name_css'] = 'normalname';
                }
                else
                {
                    $row['name_css'] = 'normalname';
                    $poster = $this->parse_member( &$row );
                    // Add it to the cached list
                    $cached_members[ $row['author_id'] ] = $poster;
                }
            }
            else
            {
                // It's definately a guest...
                $poster = $std->set_up_guest( $row['author_name'] );
                $row['name_css'] = 'unreg';
            }
            
            //--------------------------------------------------------------

if ($ibforums->vars['status_set'] ==  1)
{

if ($ibforums->vars['status_type'] == "text")
{
    $Shadow_ON = $ibforums->lang['M_On_T'];
    $Shadow_OFF = $ibforums->lang['M_Off_T'];
}
else if ($ibforums->vars['status_type'] == "image")
{
    $Shadow_ON = $ibforums->lang['M_On_I'];
    $Shadow_OFF = $ibforums->lang['M_Off_I'];
}
else if ($ibforums->vars['status_type'] == "")
{
    $Shadow_ON = "";
    $Shadow_OFF = "";
}
else
{
    $Shadow_ON = "";
    $Shadow_OFF = "";
}

if ($online_ornot[$row['author_id']])
  {
  $poster['member_status']= "$Shadow_ON";
  }
  else if ($row['author_id'])
  {
  $poster['member_status']= "$Shadow_OFF";
  }
  else
  {
  $poster['member_status']="";
  }

}

            $row['post_css'] = $post_count % 2 ? 'post1' : 'post2';
            
            
            //--------------------------------------------------------------
            
            if ( ($row['append_edit'] == 1) and ($row['edit_time'] != "") and ($row['edit_name'] != "") )
            {
                $e_time = $std->get_date( $row['edit_time'] , 'LONG' );
                
                $row['post'] .= "<br /><br /><span class='edit'>".sprintf($ibforums->lang['edited_by'], $row['edit_name'], $e_time)."</span>";
            }
            
            //--------------------------------------------------------------
            
            if (!$ibforums->member['view_img'])
            {
                // unconvert smilies first, or it looks a bit crap.
                
                $row['post'] = preg_replace( "#<!--emo&(.+?)-->.+?<!--endemo-->#", "\\1" , $row['post'] );
                
                $row['post'] = preg_replace( "/<img src=[\"'](.+?)[\"'].+?".">/", "(IMG:<a href='\\1' target='_blank'>\\1</a>)", $row['post'] );
            }
            
            //--------------------------------------------------------------
            
            if ($ibforums->input['hl'])
            {
                $keywords = str_replace( "+", " ", $ibforums->input['hl'] );
                
                if ( preg_match("/,(and|or),/i", $keywords) )
                {
                    while ( preg_match("/,(and|or),/i", $keywords, $match) )
                    {
                        $word_array = explode( ",".$match[1].",", $keywords );
                        
                        if (is_array($word_array))
                        {
                            foreach ($word_array as $keywords)
                            {
                                $row['post'] = preg_replace( "/(^|\s)(".preg_quote($keywords, '/').")(\s|,|\.|!|<br|$)/is", "\\1<span class='searchlite'>\\2</span>\\3", $row['post'] );
                            }
                        }
                    }
                }
                else
                {
                    while( preg_match( "/(^|\s)(".preg_quote($keywords, '/').")(\s|,|\.|!|<br|$)/i", $row['post'] ) )
                    {
                        $row['post'] = preg_replace( "/(^|\s)(".preg_quote($keywords, '/').")(\s|,|\.|!|<br|$)/is", "\\1<span class='searchlite'>\\2</span>\\3", $row['post'] );
                    }
                }
            }
                
            //--------------------------------------------------------------
            
            if ( ($post_count != 0 and $first == 0) or ($first > 0) )
            {
                $row['delete_button'] = $this->delete_button($row['pid'], $poster);
            }
            
            
            $row['edit_button']   = $this->edit_button($row['pid'], $poster, $row['post_date']);
            $row['checkbox'] = $row['new_topic'] ? '' : $this->checkbox($row['pid']);
            $row['post_date']     = $std->get_date( $row['post_date'], 'LONG' );
            $row['c_mood']       = ($row['c_mood']) ? $this->html->current_mood($row) : "";
            $row['c_music']       = ($row['c_music']) ? $this->html->current_music($row) : "";


            $row['post_icon']     = $row['icon_id']
                              ? "<img src='".$ibforums->vars['img_url']."/icon{$row['icon_id']}.gif' alt='' />  "
                              : "";
            
            $row['ip_address']  = $this->view_ip($row, $poster);
            
            $row['report_link'] = (($ibforums->vars['disable_reportpost'] != 1) and ( $ibforums->member['id'] ))
                                ? $this->html->report_link($row)
                                : "";
            $row['rep_options'] = $this->rep_options($poster['id'], $row['pid']);

            
            //--------------------------------------------------------------
                              
            if ($row['attach_id'])
            {
                //----------------------------------------------------
                // If we've not already done so, lets grab our mime-types
                //----------------------------------------------------
                
                if ( !is_array($this->mimetypes) )
                {
                    require "./conf_mime_types.php";
                    $this->mimetypes = $mime_types;
                    unset($mime_types);
                }
                
                //----------------------------------------------------
                // Is it an image, and are we viewing the image in the post?
                //----------------------------------------------------
                
                if ( 
                     ($ibforums->vars['show_img_upload'])
                       and
                     (
                            $row['attach_type'] == 'image/gif'
                         or $row['attach_type'] == 'image/jpeg'
                         or $row['attach_type'] == 'image/pjpeg'
                         or $row['attach_type'] == 'image/x-png'
                         or $row['attach_type'] == 'image/png'
                     )
                    )
                {
                    if ( $ibforums->vars['siu_thumb'] AND $ibforums->vars['siu_width'] AND $ibforums->vars['siu_height'] )
                    {
                        //----------------------------------------------------
                        // Tom Thumb!
                        //----------------------------------------------------
                        
                        $img_size = array();
                        
                        $img_size = @GetImageSize( $ibforums->vars['upload_url']."/".$row['attach_id'] );
                        
                        if ( $img_size[0] < 1 )
                        {
                            $img_size    = array();
                            $img_size[0] = $ibforums->vars['siu_width'] + 1;
                            $img_size[1] = $ibforums->vars['siu_height']+ 1;
                        }
                        
                        //----------------------------------------------------
                        // Do we need to scale?
                        //----------------------------------------------------
                        
                        if ( ( $img_size[0] <= $ibforums->vars['siu_width'] ) AND ( $img_size[1] <= $ibforums->vars['siu_height'] ) )
                        {
                            $row['attachment'] = $this->html->Show_attachments_img( $row['attach_id'] );
                        }
                        else
                        {
                            $im = $std->scale_image( array(
                                                            'max_width'  => $ibforums->vars['siu_width'],
                                                            'max_height' => $ibforums->vars['siu_height'],
                                                            'cur_width'  => $img_size[0],
                                                            'cur_height' => $img_size[1]
                                                   )      );
                                                   
                            $row['attachment'] = $this->html->Show_attachments_img_thumb( $row['attach_id'], $im['img_width'], $im['img_height'], $row['pid'] );
                        }
                    }
                    else
                    {
                        //----------------------------------------------------
                        // Standard size..
                        //----------------------------------------------------
                        
                        $row['attachment'] = $this->html->Show_attachments_img( $row['attach_id'] );
                    }
                }
                else
                {
                    //----------------------------------------------------
                    // Full attachment thingy
                    //----------------------------------------------------
                    
                    $row['attachment'] = $this->html->Show_attachments( array (
                                                                                'hits'  => $row['attach_hits'],
                                                                                'image' => $this->mimetypes[ $row['attach_type'] ][1],
                                                                                'name'  => $row['attach_file'],
                                                                                'pid'   => $row['pid'],
                                                                      )        );
                }
            }
            
            //--------------------------------------------------------------
            // Siggie stuff
            //--------------------------------------------------------------
            
            $row['signature'] = "";
            
            if ($poster['signature'] and $ibforums->member['view_sigs'])
            {
                if ($row['use_sig'] == 1)
                {
                    if ( $ibforums->vars['sig_allow_html'] == 1 )
                    {
                        $poster['signature'] = $this->parser->parse_html($poster['signature'], 0);
                    }
                    
                    if ( $ibforums->vars['post_wordwrap'] > 0 )
                    {
                        $poster['signature'] = $this->parser->my_wordwrap( $poster['signature'], $ibforums->vars['post_wordwrap']);
                    }
                    
                    $row['signature'] = $skin_universal->signature_separator($poster['signature']);
                }
            }
            
            //--------------------------------------------------------------
            // Fix up the membername so it links to the members profile
            //--------------------------------------------------------------
  
  if ($poster['id'])
  {
  // $poster['name'] = "<a href='{$this->base_url}showuser={$poster['id']}'>{$poster['name']}</a>";
     $poster['name']=str_replace(" ", " ", $poster['name']);
           $poster['name']="<a href=\"java script:ins('{$poster['name']}')\">{$poster['name']}</a>";
  }
            //--------------------------------------------------------------
            // Parse HTML tag on the fly
            //--------------------------------------------------------------
            
            if ( $this->forum['use_html'] == 1 )
            {
                // So far, so good..
                
                if ( stristr( $row['post'], '[dohtml]' ) )
                {
                    // [doHTML] tag found..
                    
                    $parse = ($this->forum['use_html'] AND $row['g_dohtml']) ? 1 : 0;
                    
                    $row['post'] = $this->parser->post_db_parse($row['post'], $parse );
                }
            }
            
            //--------------------------------------------------------------
            // Do word wrap?
            //--------------------------------------------------------------
            
            if ( $ibforums->vars['post_wordwrap'] > 0 )
            {
                $row['post'] = $this->parser->my_wordwrap( $row['post'], $ibforums->vars['post_wordwrap']);
            }
            
            //--------------------------------------------------------------
            // A bit hackish - but there are lots of <br> => <br /> changes to make
            //--------------------------------------------------------------
            
            $row['post']      = str_replace( "<br>", "<br />", $row['post'] );
            $row['signature'] = str_replace( "<br>", "<br />", $row['signature'] );
            
            $this->output .= $this->html->RenderRow( $row, $poster );
            
            $post_count++;
                
        }
        
        //-------------------------------------
        // Print the footer
        //-------------------------------------
        
        $this->output .= $this->html->TableFooter( array( 'TOPIC' => $this->topic, 'FORUM' => $this->forum ) );
        
        //+----------------------------------------------------------------
        // Process users active in this forum
        //+----------------------------------------------------------------
        
        if ($ibforums->vars['no_au_topic'] != 1)
        {    
            //+-----------------------------------------
            // Get the users
            //+-----------------------------------------
            
            $cut_off = ($ibforums->vars['au_cutoff'] != "") ? $ibforums->vars['au_cutoff'] * 60 : 900;
             
            $time = time() - $cut_off;
                       
            $DB->query("SELECT s.member_id, s.member_name, s.login_type, s.location, g.suffix, g.prefix, g.g_perm_id, m.org_perm_id
                        FROM ibf_sessions s
                         LEFT JOIN ibf_groups g ON (g.g_id=s.member_group)
                         LEFT JOIN ibf_members m on (s.member_id=m.id)
                        WHERE s.in_topic={$this->topic['tid']}
                        AND s.running_time > $time
                         ORDER BY s.running_time DESC");
            
            //+-----------------------------------------
            // Cache all printed members so we don't double print them
            //+-----------------------------------------
            
            $cached = array();
            $active = array( 'guests' => 0, 'anon' => 0, 'members' => 0, 'names' => "");
            
            while ($result = $DB->fetch_row() )
            {
                // Quick check
                
                $result['g_perm_id'] = $result['org_perm_id'] ? $result['org_perm_id'] : $result['g_perm_id'];
                
                if ( $this->forum['read_perms'] != '*' )
                {
                    if ( $result['g_perm_id'] )
                    {
                        if ( ! preg_match("/(^|,)(".str_replace( ",", '|', $result['g_perm_id'] ).")(,|$)/", $this->forum['read_perms'] ) )
                        {
                            continue;
                        }
                    }
                    else
                    {
                        continue;
                    }
                }
                
                if ($result['member_id'] == 0)
                {
                    $active['guests']++;
                }
                else
                {
                    if (empty( $cached[ $result['member_id'] ] ) )
                    {
                        $cached[ $result['member_id'] ] = 1;
                        
                        if ($result['login_type'] == 1)
                        {
                            if ( ($ibforums->member['mgroup'] == $ibforums->vars['admin_group']) and ($ibforums->vars['disable_admin_anon'] != 1) )
                            {
                                $active['names'] .= "<a href='{$ibforums->base_url}showuser={$result['member_id']}'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>*, ";
                                $active['anon']++;
                            }
                            else
                            {
                                $active['anon']++;
                            }
                        }
                        else
                        {
                            $active['members']++;
                            $active['names'] .= "<a href='{$ibforums->base_url}showuser={$result['member_id']}'>{$result['prefix']}{$result['member_name']}{$result['suffix']}</a>, ";
                        }
                    }
                }
            }
            
            $active['names'] = preg_replace( "/,\s+$/", "" , $active['names'] );
            
            $ibforums->lang['active_users_title']   = sprintf( $ibforums->lang['active_users_title']  , ($active['members'] + $active['guests'] + $active['anon'] ) );
            $ibforums->lang['active_users_detail']  = sprintf( $ibforums->lang['active_users_detail'] , $active['guests'],$active['anon'] );
            $ibforums->lang['active_users_members'] = sprintf( $ibforums->lang['active_users_members'], $active['members'] );
            
            
            $this->output = str_replace( "<!--IBF.TOPIC_ACTIVE-->", $this->html->topic_active_users($active), $this->output );
        
        }
    
        //+----------------------------------------------------------------
        // Print it
        //+----------------------------------------------------------------
        
        $this->output = str_replace( "<!--IBF.MOD_PANEL-->", $this->moderation_panel(), $this->output );
        
        // Enable quick reply box?
        
        if (   ( $this->topic['quick_reply'] == 1 )
       and ( $std->check_perms( $this->topic['reply_perms']) == TRUE )
       and ( $this->topic['state'] != 'closed' )
       and ( $this->topic['poll_state'] != 'closed' ) )
    {
        // ADD QUICK REPLY
        $this->output = str_replace("<!--IBF.QUICK_REPLY_NEW-->",$this->html->quick_reply_new($this->topic['forum_id'],$this->topic['tid'],$this->md5_check),$this->output);
        // ADD SMILIES
        $this->quick_add_smilie();
        // ADD CHECKBOXES
        $this->html_checkboxes($this->topic['tid']);
        // ADD NAMEFIELD
        $this->output = str_replace("<!--IBF.NAME_FIELD-->",$this->html_name_field(),$this->output);
    }
        
        $this->output = str_replace( "<!--IBF.TOPIC_OPTIONS_CLOSED-->", $this->html->topic_opts_closed(), $this->output );
        $this->output = str_replace( "<!--IBF.TOPIC_OPTIONS_OPEN-->"  , $this->html->topic_opts_open($this->topic['forum_id'], $this->topic['tid']), $this->output );
        
        $this->topic['id'] = $this->topic['forum_id'];
        
        $this->output = str_replace( "<!--IBF.FORUM_RULES-->", $std->print_forum_rules($this->topic), $this->output );
        
        //+----------------------------------------------------------------
        // Topic multi-moderation - yay!
        //+----------------------------------------------------------------
        
        $this->output = str_replace( "<!--IBF.MULTIMOD-->", $this->multi_moderation(), $this->output );
        
        // Pass it to our print routine
        
        $print->add_output("$this->output");
        $print->do_output( array( 'TITLE'    => $ibforums->vars['board_name']." -> {$this->topic['title']}",
                                   'JS'       => 1,
                                   'NAV'      => array( 
                                                          "<a href='".$this->base_url."act=SC&c={$this->category['id']}'>{$this->category['name']}</a>",
                                                          $this->nav_extra,
                                                          "<a href='".$this->base_url."showforum={$this->forum['id']}'>{$this->forum['name']}</a>",
                                                        ),
                              ) );
                        
    }
    
    function html_name_field() {
        global $ibforums;

        return $ibforums->member['id'] ? $this->html->nameField_reg() : $this->html->nameField_unreg($ibforums->input['UserName']);
    }

    function html_checkboxes($tid="")
    {
        global $ibforums, $DB;

        $default_checked = array(
                                  'sig' => 'checked="checked"',
                                    'emo' => 'checked="checked"',
                                    'tra' => $ibforums->member['auto_track'] ? 'checked="checked"' : ''
                                );

        // Make sure we're not previewing them and they've been unchecked!

        if ( isset( $ibforums->input['enablesig'] ) AND ( ! $ibforums->input['enablesig'] ) )
        {
            $default_checked['sig'] = "";
        }

        if ( isset( $ibforums->input['enableemo'] ) AND ( ! $ibforums->input['enableemo'] ) )
        {
            $default_checked['emo'] = "";
        }

        if ( isset( $ibforums->input['enabletrack'] ) AND ( ! $ibforums->input['enabletrack'] ) )
        {
            $default_checked['tra'] = "";
        }
        else if ( isset( $ibforums->input['enabletrack'] ) AND ( $ibforums->input['enabletrack'] == 1 ) )
        {
            $default_checked['tra'] = 'checked="checked"';
        }

        $this->output = str_replace( '<!--IBF.EMO-->'  , $this->html->get_box_enableemo( $default_checked['emo'] )  , $this->output );

        $this->output = str_replace( '<!--IBF.SIG-->'  , $this->html->get_box_enablesig( $default_checked['sig'] )  , $this->output );

        if ( $tid and $ibforums->member['id'] )
        {
            $DB->query("SELECT trid FROM ibf_tracker WHERE topic_id=$tid AND member_id=".$ibforums->member['id']);

            if ( $DB->get_num_rows() )
            {
                $this->output = str_replace( '<!--IBF.TRACK-->',$this->html->get_box_alreadytrack(), $this->output );
            }
            else
            {
                $this->output = str_replace( '<!--IBF.TRACK-->', $this->html->get_box_enabletrack( $default_checked['tra'] ), $this->output );
            }
        }
    }

    function quick_add_smilie() {
        global $ibforums, $DB;

        $show_table = 0;
        $count      = 0;
        $smilies    = "<tr align='center'>\n";

        // Get the smilies from the DB
        $DB->query("SELECT * FROM ibf_emoticons WHERE clickable='1'");

        while ($elmo = $DB->fetch_row() ) {

            $show_table++;
            $count++;

            // Make single quotes as URL's with html entites in them
            // are parsed by the browser, so ' causes JS error :o

            if (strstr( $elmo['typed'], "'" ) )
            {
                $in_delim  = '"';
                $out_delim = "'";
            }
            else
            {
                $in_delim  = "'";
                $out_delim = '"';
            }

            $smilies .= "<td><a href={$out_delim}java script:emoticon($in_delim".$elmo['typed']."$in_delim){$out_delim}><img src=\"".$ibforums->vars['EMOTICONS_URL']."/".$elmo['image']."\" alt='".$elmo['typed']."' border='0' /></a> </td>\n";

            if ($count == $ibforums->vars['emo_per_row']) {
                $smilies .= "</tr>\n\n<tr align='center'>";
                $count = 0;
            }
        }

        if ($count != $ibforums->vars['emo_per_row']) {
            for ($i = $count; $i < $ibforums->vars['emo_per_row']; ++$i) {
                $smilies .= "<td> </td>\n";
            }
            $smilies .= "</tr>";
        }

        $table = $this->html->smilie_table();

        if ($show_table != 0) {
            $table = preg_replace( "/<!--THE SMILIES-->/", $smilies, $table );
            $this->output = preg_replace( "/<!--SMILIE TABLE-->/", $table, $this->output );
        }

    }
    
    //--------------------------------------------------------------
    // Parse the member info
    //--------------------------------------------------------------
    
    function parse_member($member=array()) {
        global $ibforums, $std, $DB;
    
        $member['avatar'] = $std->get_avatar( $member['avatar'], $ibforums->member['view_avs'], $member['avatar_size'] );
        
        $pips = 0;
        
        foreach($this->mem_titles as $k => $v)
        {
            if ($member['posts'] >= $v['POSTS'])
            {
                if (!$member['title'])
                {
                    $member['title'] = $this->mem_titles[ $k ]['TITLE'];
                }
                $pips = $v['PIPS'];
                break;
            }
        }
        
        
        if ($member['g_icon'])
        {
            $member['member_rank_img'] = "<img src='{$ibforums->vars[TEAM_ICON_URL]}/{$member['g_icon']}' border='0' alt='Group Icon' />";
        }
        else
        {
            if ($pips)
            {
                if ( preg_match( "/^\d+$/", $pips ) )
                {
                    for ($i = 1; $i <= $pips; ++$i)
                    {
                        $member['member_rank_img'] .= "<{A_STAR}>";
                    }
                }
                else
                {
                    $member['member_rank_img'] = "<img src='{$ibforums->vars['TEAM_ICON_URL']}/$pips' border='0' alt='*' />";
                }
            }
        }
                               
        $member['member_joined'] = $ibforums->lang['m_joined'].' '.$std->get_date( $member['joined'], 'JOINED' );
        
        $member['profile']="<a href='{$this->base_url}showuser={$member['id']}'>{$ibforums->lang['link_profile']}</a>";
        
        $member['member_group'] = $ibforums->lang['m_group'].' '.$member['g_title'];
        
        $member['member_posts'] = $ibforums->lang['m_posts'].' '.$std->do_number_format($member['posts']);
        
        $member['member_number'] = $ibforums->lang['member_no'].' '.$std->do_number_format($member['id']);
        
        $member['profile_icon'] = "<a href='{$this->base_url}showuser={$member['id']}'><{P_PROFILE}></a>";
        
        $member['message_icon'] = "<a href='{$this->base_url}act=Msg&CODE=04&MID={$member['id']}'><{P_MSG}></a>";
        
        if (!$member['hide_email'])
        {
            $member['email_icon'] = "<a href='{$this->base_url}act=Mail&CODE=00&MID={$member['id']}'><{P_EMAIL}></a>";
        }
        
        if ( $member['website'] and preg_match( "/^http:\/\/\S+$/", $member['website'] ) )
        {
            $member['website_icon'] = "<a href='{$member['website']}' target='_blank'><{P_WEBSITE}></a>";
        }
        
        if ($member['icq_number'])
        {
            $member['icq_icon'] = "<a href=\"java script:PopUp('{$this->base_url}act=ICQ&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_ICQ}></a>";
        }
        
        if ($member['aim_name'])
        {
            $member['aol_icon'] = "<a href=\"java script:PopUp('{$this->base_url}act=AOL&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_AOL}></a>";
        }
        
        if ($member['yahoo'])
        {
            $member['yahoo_icon'] = "<a href=\"java script:PopUp('{$this->base_url}act=YAHOO&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_YIM}></a>";
        }
        
        if ($member['msnname'])
        {
            $member['msn_icon'] = "<a href=\"java script:PopUp('{$this->base_url}act=MSN&MID={$member['id']}','Pager','450','330','0','1','1','1')\"><{P_MSN}></a>";
        }

         $tmp_rep = empty ($member['rep']) ? 0 : $member['rep'];
        if ($ibforums->vars['rep_goodnum'] and $tmp_rep >= $ibforums->vars['rep_goodnum']) $member['title'] = $ibforums->vars['rep_goodtitle'].' '.$member['title'];
        if ($ibforums->vars['rep_badnum']  and $tmp_rep <= $ibforums->vars['rep_badnum'])  $member['title'] = $ibforums->vars['rep_badtitle']. ' '.$member['title'];
        
        if ($ibforums->vars['rep_use_ranks'] && is_array($this->rep_ranks))
        {
            foreach($this->rep_ranks as $k => $v)
            {
                if ($member['rep'] >= $v['AMOUNT'])
                {
                    $member['rep'] = $this->rep_ranks[ $k ]['TITLE'];
                    break;
                }
            }
            
            if (empty($member['rep'])) $member['rep'] = $ibforums->lang['rep_none'];
        }
        else
        {
            if( empty($member['rep']) )
            {
                if (! is_numeric( $member['rep'] ))
                {
                    $member['rep'] = $ibforums->lang['rep_none'];
                }
                else
                {
                    $member['rep'] .= " ".$ibforums->lang['rep_postfix'];
                }
            }
            else
            {
                $member['rep'] .= " ".$ibforums->lang['rep_postfix'];
            }
        }
        
        if ($ibforums->member['id'])
        {
            $stuff = array( 't' => $this->topic['tid'],
                            'f' => $this->forum['id'],
                            'mid' => $member['id'] );
            
            $member['rep'] = "<a href='{$ibforums->base_url}act=rep&CODE=03&mid=".$stuff['mid']."'>".$ibforums->lang['rep_name'].":</a> ".$member['rep'];
        }
        else
        {
            $member['rep'] = $ibforums->lang['rep_name'].": ".$member['rep'];
        }
        
        if (in_array( $this->forum['id'], $this->rep_exclude)) $member['rep'] = "";


        
        if ($member['integ_msg'])
        {
            $member['integ_icon'] = "<a href=\"java script:PopUp('{$this->base_url}act=integ&MID={$member['id']}','Pager','750','450','0','1','1','1')\"><{INTEGRITY_MSGR}></a>";
        }
        
        if ($ibforums->member['id'])
        {
            $member['addresscard'] = "<a href='{$this->base_url}showuser={$member['id']}'><{ADDRESS_CARD}></a>";
        }
        
        if ($ibforums->vars['d_topic']) {
            if ( $member['files'] != "0") {
                                   $member['files'] = "{$ibforums->lang['d_upload']} <a href='{$this->base_url}act=Downloads&do=search&type=do_search&author={$member['name']}'>{$member['files']}</a> "; 
                          } else {
                                   $member['files'] = "{$ibforums->lang['d_upload']} <i>{$ibforums->lang['d_no_upload']}</i>";
                          }
        } else {
            $member['files'] = "";
        }

        if ($ibforums->vars['d_downloads']) {
            if ($member['downloads'] !="0"){
                $member['downloads'] = "{$ibforums->lang['d_download']} {$member['downloads']}";
            }else{
                $member['downloads'] ="{$ibforums->lang['d_download']} <i>{$ibforums->lang['d_no_download']}</i>";
            }
        } else {
            $member['downloads'] = "";
        }
        
        //--------------------------------------------------------------
        // Warny porny?
        //--------------------------------------------------------------
        
        if ( $ibforums->vars['warn_on'] and ( ! stristr( $ibforums->vars['warn_protected'], ','.$member['mgroup'].',' ) ) )
        {
            if (
                ( $ibforums->member['is_mod'] AND $ibforums->member['allow_warn'] )
                or ( $ibforums->member['g_is_supmod'] == 1 )
                or ( $ibforums->vars['warn_show_own'] == 1 )
               )
            {
                
                // Work out which image to show.
                
                if ( ! $ibforums->vars['warn_show_rating'] )
                {
                    if ( $member['warn_level'] <= $ibforums->vars['warn_min'] )
                    {
                        $member['warn_img']     = '<{WARN_0}>';
                        $member['warn_percent'] = 0;
                    }
                    else if ( $member['warn_level'] >= $ibforums->vars['warn_max'] )
                    {
                        $member['warn_img']     = '<{WARN_5}>';
                        $member['warn_percent'] = 100;
                    }
                    else
                    {
                        
                        $member['warn_percent'] = $member['warn_level'] ? sprintf( "%.0f", ( ($member['warn_level'] / $ibforums->vars['warn_max']) * 100) ) : 0;
                        
                        if ( $member['warn_percent'] > 100 )
                        {
                            $member['warn_percent'] = 100;
                        }
                        
                        if ( $member['warn_percent'] >= 81 )
                        {
                            $member['warn_img'] = '<{WARN_5}>';
                        }
                        else if ( $member['warn_percent'] >= 61 )
                        {
                            $member['warn_img'] = '<{WARN_4}>';
                        }
                        else if ( $member['warn_percent'] >= 41 )
                        {
                            $member['warn_img'] = '<{WARN_3}>';
                        }
                        else if ( $member['warn_percent'] >= 21 )
                        {
                            $member['warn_img'] = '<{WARN_2}>';
                        }
                        else if ( $member['warn_percent'] >= 1 )
                        {
                            $member['warn_img'] = '<{WARN_1}>';
                        }
                        else
                        {
                            $member['warn_img'] = '<{WARN_0}>';
                        }
                    }
                    
                    if ( $member['warn_percent'] < 1 )
                    {
                        $member['warn_percent'] = 0;
                    }
                    
                    $member['warn_text']  = $this->html->warn_level_warn($member['id'], $member['warn_percent'] );
                    
                }
                else
                {
                    // Ratings mode..
                    
                    $member['warn_text']  = $ibforums->lang['tt_rating'];
                    $member['warn_img']   = $this->html->warn_level_rating($member['id'], $member['warn_level'], $ibforums->vars['warn_min'], $ibforums->vars['warn_max']);
                }
                                
                if ( ( $ibforums->member['is_mod'] AND $ibforums->member['allow_warn'] ) or ( $ibforums->member['g_is_supmod'] == 1 ) )
                {
                    $member['warn_add']   = "<a href='{$ibforums->base_url}act=warn&type=add&mid={$member['id']}&t={$this->topic['tid']}&st=".intval($ibforums->input['st'])."' title='{$ibforums->lang['tt_warn_add']}'><{WARN_ADD}></a>";
                    $member['warn_minus'] = "<a href='{$ibforums->base_url}act=warn&type=minus&mid={$member['id']}&t={$this->topic['tid']}&st=".intval($ibforums->input['st'])."' title='{$ibforums->lang['tt_warn_minus']}'><{WARN_MINUS}></a>";
                }
            }
        }
        
        //--------------------------------------------------------------
        // Profile fields stuff
        //--------------------------------------------------------------
        
        if ( $ibforums->vars['custom_profile_topic'] == 1 )
        {
            foreach( $this->pfields as $id => $pf )
            {
                if ( $member[ $id ] != "" )
                {
                    if ( $pf['fhide'] == 1 and $ibforums->member['g_is_supmod'] != 1 )
                    {
                        $member[ $id ] = "";
                    }
                    else if ( $pf['ftype'] == 'drop' )
                    {
                        $member[ $id ] = $this->pfields_dd[$id][$member[ $id ]]; // You just know that's going to make no sense tomorrow.
                    }
                }
            }
        }
        
        return $member;
    
    }
    
    //--------------------------------------------------------------
    // Render the delete button
    //--------------------------------------------------------------
    
    function delete_button($post_id, $poster)
    {
        global $ibforums, $std;
        
        if ($ibforums->member['id'] == "" or $ibforums->member['id'] == 0)
        {
            return "";
        }
        
        $button = "<a href=\"java script:delete_post('{$this->base_url}act=Mod&CODE=04&f={$this->forum['id']}&t={$this->topic['tid']}&p={$post_id}&st={$ibforums->input[st]}&auth_key=".$this->md5_check."')\"><{P_DELETE}></a>";
        
        if ($ibforums->member['g_is_supmod']) return $button;
        if ($this->moderator['delete_post']) return $button;
        if ($poster['id'] == $ibforums->member['id'] and ($ibforums->member['g_delete_own_posts'])) return $button;
        
        return "";
    }

    function checkbox($pid)
    {
        global $ibforums;
        
        if (!$ibforums->member['id']) return "";
        
        $checkbox = '<input class="forminput" type="checkbox" name="pozt'.$pid.'" value="1" />';
        
        if ($ibforums->member['g_is_supmod']) return $checkbox;
        if ($this->moderator['delete_post'] OR $this->moderator['split_merge']) return $checkbox;
        
        return "";
    }

    
    //--------------------------------------------------------------
    // Render the edit button
    //--------------------------------------------------------------
    
    function edit_button($post_id, $poster, $post_date)
    {
        global $ibforums;
        
        if ($ibforums->member['id'] == "" or $ibforums->member['id'] == 0)
        {
            return "";
        }
        
        $button = "<a href=\"{$this->base_url}act=Post&CODE=08&f={$this->forum['id']}&t={$this->topic['tid']}&p={$post_id}&st={$ibforums->input[st]}\"><{P_EDIT}></a>";
        
        if ($ibforums->member['g_is_supmod']) return $button;
        
        if ($this->moderator['edit_post']) return $button;
        
        if ($poster['id'] == $ibforums->member['id'] and ($ibforums->member['g_edit_posts']))
        {
        
            // Have we set a time limit?
            
            if ($ibforums->member['g_edit_cutoff'] > 0)
            {
                if ( $post_date > ( time() - ( intval($ibforums->member['g_edit_cutoff']) * 60 ) ) )
                {
                    return $button;
                }
                else
                {
                    return "";
                }
            }
            else
            {
                return $button;
            }
        }
        
        return "";
    }
    
    
    //--------------------------------------------------------------
    // Render the IP address
    //--------------------------------------------------------------
    
    function view_ip($row, $poster)
    {
        global $ibforums;
        
        if ($ibforums->member['g_is_supmod'] != 1 && $this->moderator['view_ip'] != 1)
        {
            return "";
        }
        else
        {
            $row['ip_address'] = $poster['mgroup'] == $ibforums->vars['admin_group']
                          ? "[ ---------- ]"
                          : "[ <a href='{$ibforums->base_url}act=modcp&CODE=ip&incoming={$row['ip_address']}' target='_blank'>{$row['ip_address']}</a> ]";
            return $this->html->ip_show($row['ip_address']);
        }
    
    }

     function rep_options($memid, $pid)
    {
        global $ibforums;
        
        if (!$ibforums->member['id'] or in_array($this->forum['id'], $this->rep_exclude) or in_array($this->forum['id'], $this->rep_hide))
        {
            return "";
        }
        else
        {
            if (($memid) and ($ibforums->member['id'] != $memid)) {
                $stuff = array( 't' => $this->topic['tid'], 'f' => $this->forum['id'], 'mid' => $memid, 'p' => $pid );
                return $this->html->rep_options_links($stuff);
            }
        }
    }

    
    //--------------------------------------------------------------
    // Render the topic multi-moderation
    //--------------------------------------------------------------
    
    function multi_moderation()
    {
        global $ibforums, $std, $DB;
        
        $mm_html = "";
        
        $pass_go = FALSE;
        
        if ( $ibforums->member['id'] )
        {
            if ( $ibforums->member['g_is_supmod'] )
            {
                $pass_go = TRUE;
            }
            else if ( $this->moderator['can_mm'] == 1 )
            {
                $pass_go = TRUE;
            }
        }
        
        if ( $pass_go != TRUE )
        {
            return "";
        }
        
        $this->forum['topic_mm_id'] = $std->clean_perm_string($this->forum['topic_mm_id']);
        
        if ( $this->forum['topic_mm_id'] == "" )
        {
            return "";
        }
        
        //----------------------------------------
        // Get the topic mod thingies
        //----------------------------------------
        
        $DB->query("SELECT mm_id, mm_title FROM ibf_topic_mmod WHERE mm_id IN(".implode( ",", explode( ",", $this->forum['topic_mm_id'] ) ).") ORDER BY mm_title");
        
        if ( $DB->get_num_rows() )
        {
            $mm_html = $this->html->mm_start($this->topic['tid']);
            
            while ( $r = $DB->fetch_row() )
            {
                $mm_html .= $this->html->mm_entry( $r['mm_id'], $r['mm_title'] );
            }
            
            $mm_html .= $this->html->mm_end();
        }
        
        return $mm_html;
    }
    
    //--------------------------------------------------------------
    // Render the moderator links
    //--------------------------------------------------------------
    
    function moderation_panel() {
        global $ibforums, $std;
        
        $mod_links = "";
        
        if (!isset($ibforums->member['id'])) return "";
        
        $skcusgej = 0;
        
        if ($ibforums->member['id'] == $this->topic['starter_id'])
        {
            $skcusgej = 1;
        }
        
        if ($ibforums->member['g_is_supmod'] == 1)
        {
            $skcusgej = 1;
        }
        
        if ($this->moderator['mid'] != "")
        {
            $skcusgej = 1;
        }
        
        if ($skcusgej == 0)
        {
                   return "";
        }
        

$actions = array( 'MOVE_TOPIC', 'CLOSE_TOPIC', 'OPEN_TOPIC', 'DELETE_TOPIC', 'EDIT_TOPIC', 'PIN_TOPIC', 'UNPIN_TOPIC', 'UNSUBBIT', 'MERGE_TOPIC', 'SPLIT_TOPIC', 'DELETE_POSTZ', 'MOVE_POSTZ' );


        
        foreach( $actions as $key )
        {
            if ($ibforums->member['g_is_supmod'])
            {
                $mod_links .= $this->append_link($key);
            }
            elseif ($this->moderator['mid'])
            {
                if ($key == 'MERGE_TOPIC' or $key == 'SPLIT_TOPIC' or $key == 'MOVE_POSTZ')
                {
                    if ($this->moderator['split_merge'] == 1)
                    {
                        $mod_links .= $this->append_link($key);
                    }
                }
                else if ($key == 'DELETE_POSTZ')
                {
                    if ($this->moderator['delete_post'] == 1)
                    {
                        $mod_links .= $this->append_link($key);
                    }
                }
            // start oska pin first hack modified
            elseif ($key == 'PIN_FIRST' or $key == 'UNPIN_FIRST')
            {
                if ($this->moderator['pin_first_post_topic'] == 1)
                {
                    $mod_links .= $this->append_link($key);
                }
            }
            // end oska pin first hack modified
                else
                {
                    if ($this->moderator[ strtolower($key) ])
                    {
                        $mod_links .= $this->append_link($key);
                    }
                }
            }
            elseif ($key == 'OPEN_TOPIC' or $key == 'CLOSE_TOPIC')
            {
                if ($ibforums->member['g_open_close_posts'])
                {
                    $mod_links .= $this->append_link($key);
                }
            }
            elseif ($key == 'DELETE_TOPIC')
            {
                if ($ibforums->member['g_delete_own_topics'])
                {
                    $mod_links .= $this->append_link($key);
                }
            }
        }
        
        if ($ibforums->member['g_access_cp'] == 1)
        {
            $mod_links .= $this->append_link('TOPIC_HISTORY');
        }
        
        if ($mod_links != "")
        {
            return $this->html->Mod_Panel($mod_links, $this->forum['id'], $this->topic['tid'], $this->md5_check);
            
        }
    
    }
    
    function append_link( $key="" ) {
        global $ibforums;
        
        if ($key == "") return "";
        
        if ($this->topic['state'] == 'open'   and $key == 'OPEN_TOPIC') return "";
        if ($this->topic['state'] == 'closed' and $key == 'CLOSE_TOPIC') return "";
        // start oska pin first hack modified
        if ($this->topic['firstpost'] == '1'   and $key == 'PIN_FIRST') return "";
        if ($this->topic['firstpost'] == '0' and $key == 'UNPIN_FIRST') return "";
        // end oska pin first hack modified
        if ($this->topic['state'] == 'moved'  and ($key == 'CLOSE_TOPIC' or $key == 'MOVE_TOPIC')) return "";
        if ($this->topic['pinned'] == 1 and $key == 'PIN_TOPIC')   return "";
        if ($this->topic['pinned'] == 0 and $key == 'UNPIN_TOPIC') return "";
        
        ++$this->colspan;
        
        return $this->html->mod_wrapper($this->mod_action[$key], $ibforums->lang[ $key ]);
    }
    
    //--------------------------------------------------------------
    // Render the reply button
    //--------------------------------------------------------------

    function reply_button()
    {
        global $ibforums;
        
        if ($this->topic['state'] == 'closed')
        {
            // Do we have the ability to post in
            // closed topics?
            
            if ($ibforums->member['g_post_closed'] == 1)
            {
                return "<a href='{$this->base_url}act=Post&CODE=02&f=".$this->forum['id']."&t=".$this->topic['tid']."'><{A_LOCKED_B}></a>";
            }
            else
            {
                return "<{A_LOCKED_B}>";
            }
        }
        
        if ($this->topic['state'] == 'moved')
        {
            return "<{A_MOVED_B}>";
        }
        
        if ($this->topic['poll_state'] == 'closed')
        {
            return "<{A_POLLONLY_B}>";
        }
        
        return "<a href='{$this->base_url}act=Post&CODE=02&f=".$this->forum['id']."&t=".$this->topic['tid']."'><{A_REPLY}></a>";
    
    }
    
    function check_access()
    {
        global $ibforums, $std, $HTTP_COOKIE_VARS;
        
        $return = 1;
        
        if ( $std->check_perms($this->forum['read_perms']) == TRUE )
        {
            $return = 0;
        }
        
        if ($this->forum['password'] != "")
        {
        
            if ( ! $c_pass = $std->my_getcookie('ibresource'.$this->forum['id']) )
            {
                return 1;
            }
        
            if ( $c_pass == $this->forum['password'] )
            {
                return 0;
            }
            else
            {
                return 1;
            }
        }
        
        return $return;
    
    }
    
    //--------------------------------------------------------------
    // Process and parse the poll
    //--------------------------------------------------------------  
    
    function parse_poll()
    {
        global $ibforums, $DB, $std;
        
        $html        = "";
        $check       = 0;
        $poll_footer = "";
        
        $ibforums->lang  = $std->load_words($ibforums->lang, 'lang_post', $ibforums->lang_id);
        
        $this->poll_html = $std->load_template('skin_poll');
        
        //----------------------------------
        // Get the poll information...
        //----------------------------------
        
        $DB->query("SELECT * FROM ibf_polls WHERE tid=".$this->topic['tid']);
        $poll_data = $DB->fetch_row();
        
        if (! $poll_data['pid']) {
            return;
        }
        
        if ( ! $poll_data['poll_question'] )
        {
            $poll_data['poll_question'] = $this->topic['title'];
        }
        
        //----------------------------------
        
        $delete_link = "";
        $edit_link   = "";
        $can_edit    = 0;
        $can_delete  = 0;
        
        if ($this->moderator['edit_post'])
        {
            $can_edit = 1;
        }
        if ($this->moderator['delete_post'])
        {
            $can_delete = 1;
        }
        
        if ($ibforums->member['g_is_supmod'] == 1)
        {
            $can_edit   = 1;
            $can_delete = 1;
        }
        
        if ($can_edit == 1)
        {
            $edit_link   = $this->poll_html->edit_link($this->topic['tid'], $this->forum['id'], $this->md5_check );
        }
        
        if ($can_delete == 1)
        {
            $delete_link = $this->poll_html->delete_link($this->topic['tid'], $this->forum['id'], $this->md5_check );
        }
        
        //----------------------------------
        
        $voter = array( 'id' => 0 );
        
        //----------------------------------
        // Have we voted in this poll?
        //----------------------------------
        
        $DB->query("SELECT member_id from ibf_voters WHERE member_id=".$ibforums->member['id']." and tid=".$this->topic['tid']);
        $voter = $DB->fetch_row();
        
        if ($voter['member_id'] != 0)
        {
            $check = 1;
            $poll_footer = $ibforums->lang['poll_you_voted'];
        }
        
        if ( ($poll_data['starter_id'] == $ibforums->member['id']) and ($ibforums->vars['allow_creator_vote'] != 1) )
        {
            $check = 1;
            $poll_footer = $ibforums->lang['poll_you_created'];
        }
            
        if (! $ibforums->member['id'] ) {
            $check = 1;
            $poll_footer = $ibforums->lang['poll_no_guests'];
        }
        
        //----------------------------------
        // is the topic locked?
        //----------------------------------
        
        if ( $this->topic['state'] == 'closed' )
        {
            $check = 1;
            $poll_footer = ' ';
        }
        
        if ( $ibforums->vars['allow_result_view'] == 1 )
        {
            if ( $ibforums->input['mode'] == 'show' )
            {
                $check       = 1;
                $poll_footer = "";
            }
        }
        
        if ($check == 1)
        {
            //---------------------
            // Show the results
            //---------------------
            
            $total_votes = 0;
            
            $html = $this->poll_html->poll_header($this->topic['tid'], $poll_data['poll_question'], $edit_link, $delete_link);
            
            $poll_answers = unserialize(stripslashes($poll_data['choices']));
            
            reset($poll_answers);
            foreach ($poll_answers as $entry)
            {
                $id     = $entry[0];
                $choice = $entry[1];
                $votes  = $entry[2];
                
                $total_votes += $votes;
                
                if ( strlen($choice) < 1 )
                {
                    continue;
                }
                
                if ($ibforums->vars['poll_tags'])
                {
                    $choice = $this->parser->parse_poll_tags($choice);
                }
                if ( $ibforums->vars['post_wordwrap'] > 0 )
                {
                    $choice = $this->parser->my_wordwrap( $choice, $ibforums->vars['post_wordwrap']);
                }
                
                $percent = $votes == 0 ? 0 : $votes / $poll_data['votes'] * 100;
                $percent = sprintf( '%.2f' , $percent );
                $width   = $percent > 0 ? (int) $percent * 2 : 0;
                $html   .= $this->poll_html->Render_row_results($votes, $id, $choice, $percent, $width);
            }
            
            $html   .= $this->poll_html->show_total_votes($total_votes);
            
        }
        else
        {
            $poll_answers = unserialize(stripslashes($poll_data['choices']));
            reset($poll_answers);
            
            //---------------------
            // Show poll form
            //---------------------
            
            $html = $this->poll_html->poll_header($this->topic['tid'], $poll_data['poll_question'], $edit_link, $delete_link);
            
            foreach ($poll_answers as $entry)
            {
                $id     = $entry[0];
                $choice = $entry[1];
                $votes  = $entry[2];
                
                if ( strlen($choice) < 1 )
                {
                    continue;
                }
                
                if ($ibforums->vars['poll_tags'])
                {
                    $choice = $this->parser->parse_poll_tags($choice);
                }
                if ( $ibforums->vars['post_wordwrap'] > 0 )
                {
                    $choice = $this->parser->my_wordwrap( $choice, $ibforums->vars['post_wordwrap']);
                }
                
                $html   .= $this->poll_html->Render_row_form($votes, $id, $choice);
            }
            
        }
        
        $html .= $this->poll_html->ShowPoll_footer();
        
        if ( $poll_footer != "" )
        {
            //-----------------------------
            // Already defined..
            //-----------------------------
            
            $html = str_replace( "<!--IBF.VOTE-->", $poll_footer, $html );
        }
        else
        {
            //-----------------------------
            // Not defined..
            //-----------------------------
            
            if ( $ibforums->vars['allow_result_view'] == 1 )
            {
                if ( $ibforums->input['mode'] == 'show' )
                {
                    // We are looking at results..
                    
                    $html = str_replace( "<!--IBF.SHOW-->", $this->poll_html->button_show_voteable(), $html );
                }
                else
                {
                    $html = str_replace( "<!--IBF.SHOW-->", $this->poll_html->button_show_results(), $html );
                    $html = str_replace( "<!--IBF.VOTE-->", $this->poll_html->button_vote(), $html );
                }
            }
            else
            {
                //-----------------------------
                // Do not allow result viewing
                //-----------------------------
                
                $html = str_replace( "<!--IBF.VOTE-->", $this->poll_html->button_vote(), $html );
                $html = str_replace( "<!--IBF.SHOW-->", $this->poll_html->button_null_vote(), $html );
            }
                
        }
        
        $html = str_replace( "<!--IBF.POLL_JS-->", $this->poll_html->poll_javascript($this->topic['tid'], $this->forum['id']), $html );
        
        return $html;
    }
    
    
    function return_last_post()
    {
        global $ibforums, $DB, $std;
        
        $st = 0;
            
        if ($this->topic['posts'])
        {
            if ( (($this->topic['posts'] + 1) % $ibforums->vars['display_max_posts']) == 0 )
            {
                $pages = ($this->topic['posts'] + 1) / $ibforums->vars['display_max_posts'];
            }
            else
            {
                $number = ( ($this->topic['posts'] + 1) / $ibforums->vars['display_max_posts'] );
                $pages = ceil( $number);
            }
            
            $st = ($pages - 1) * $ibforums->vars['display_max_posts'];
        }
        
        $DB->query("SELECT pid FROM ibf_posts WHERE queued <> 1 AND topic_id='".$this->topic['tid']."' ORDER BY pid DESC LIMIT 1");
        $post = $DB->fetch_row();
        
        $std->boink_it($ibforums->base_url."showtopic=".$this->topic['tid']."&st=$st&"."#entry".$post['pid']);
        exit();
                
    }
}

?>

 

В ЧЕМ МОЖЕТ БЫТЬ ПРОБЛЕМА

Ссылка на комментарий
Поделиться на других сайтах

Так в 1.3 от Игорька и так есть эта ссылка, нажмите на "Дата" над постом :D
Ссылка на комментарий
Поделиться на других сайтах

:D;):) Ой!! ну, не заметил, бывает!!!

 

Тогда еще подобный вопросик... в файле установки написано что установлен мод "Чтобы можно было делать сообщение всегда вверху", но при написании сообщения нигде нету этой функции... КАК узнать установлена ли она, или где скачать мод.. спс!

 

Еще по поводу Нумерации... ссылка то есть, но как вывести именно сам номер сообщения, т.е. (Сообщение №1)

Ссылка на комментарий
Поделиться на других сайтах

у меня на форуме первое сообщение под номером "Сообщение #5065", как сделать чтобы в теме они нумеровались 1, 2, 3, 4, 5, 6 ... и т.д. а при нажатии пусть ссылка будет как угодно????!
Ссылка на комментарий
Поделиться на других сайтах

у меня это мод "Нумерация сообщений" установлен, ток показывал не "Сообщение №", а "Дата (ввиде ссылки)"! Я сделал чтобы было написано "Сообщение №
{$post['pid']}

" и у меня первое сообщение в 32 теме под номером "Сообщение № 5310".... КАК СДЕЛАТЬ чтобы именно в теме отображался порядковый номер сообщения, вообщем как на этом форуме????

Ссылка на комментарий
Поделиться на других сайтах

Коротко мысль:

В ./sources/Topics.php найти:

$row['post_css'] = $post_count % 2 ? 'post1' : 'post2';

, добавить после:

$row['post_number'] = $post_count+1;

В шаблоне использовать

{$post['post_number']}

 

P.S. Это без учёта мода прикрепления поста, в нём номера не будет. И наверное не надо.

Ссылка на комментарий
Поделиться на других сайтах

×
×
  • Создать...

Важная информация

Находясь на нашем сайте, вы соглашаетесь на использование файлов cookie, а также с нашим положением о конфиденциальности Политика конфиденциальности и пользовательским соглашением Условия использования.