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

Проблема с переходом в топик


Вопрос

Вообщем проблемка такая - ставил я кучу разных модов на форум и видать где-то что-то не то подцепил и теперь если заходишь в топик по ссылке последнего сообщения((( например http://www.site.ru/forum/index.php?showtop...view=getnewpost ))), то открывает просто белую страницу... наверное накосячил в topics.php но так как сам движок не ковырял, то не уверен...

прошу помочь

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

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

  • 0

Так, всё проверил... проблемы точно с topics.php, ток не могу понять где именно...

 

вот мой код topics.php - гляньте пожалуйста что не так...

 

<?php

if ( ! defined( 'IN_IPB' ) )

{

print "<h1>Íåêîððåêòíûé àäðåñ</h1>Âû íå èìååòå äîñòóïà ê ýòîìó ôàéëó íàïðÿìóþ. Åñëè âû íåäàâíî îáíîâëÿëè ôîðóì, âû äîëæíû îáíîâèòü âñå ñîîòâåòñòâóþùèå ôàéëû.";

exit();

}

 

class topics

{

# Global

var $ipsclass;

 

var $output = "";

var $base_url = "";

var $html = "";

var $moderator = array();

var $forum = array();

var $topic = array();

var $mem_titles = array();

var $mod_action = array();

var $poll_html = "";

var $parser = "";

var $mimetypes = "";

var $nav_extra = "";

var $read_array = array();

var $mod_panel_html = "";

var $warn_range = 0;

var $warn_done = 0;

 

var $md5_check = "";

var $post_count = 0;

var $cached_members = array();

var $first_printed = 0;

var $pids = array();

var $attach_pids = array();

var $first = "";

var $qpids = "";

var $custom_fields = "";

var $last_read_tid = "";

 

# Permissions

var $can_vote = 0;

var $can_rate = 0;

 

/*-------------------------------------------------------------------------*/

//

// Our constructor, load words, load skin, print the topic listing

//

/*-------------------------------------------------------------------------*/

 

function auto_run()

{

//-----------------------------------------

// Build all permissions

//-----------------------------------------

 

$this->build_permissions();

 

//-----------------------------------------

// Are we just adding a poll vote?

//-----------------------------------------

 

if ( $this->ipsclass->input['addpoll'] )

{

$this->topic_add_vote_to_poll();

}

 

//-----------------------------------------

// INIT module

//-----------------------------------------

 

$this->init();

 

//-----------------------------------------

// Are we just adding a rating vote?

//-----------------------------------------

 

if ( $this->ipsclass->input['addrating'] )

{

$this->topic_add_vote_to_rating();

}

 

//-----------------------------------------

// Process the topic

//-----------------------------------------

 

$this->topic_set_up();

 

//-----------------------------------------

// Which view are we using?

//-----------------------------------------

 

if ( $this->ipsclass->input['mode'] )

{

$this->topic_view_mode = $this->ipsclass->input['mode'];

$this->ipsclass->my_setcookie( 'topicmode', $this->ipsclass->input['mode'], 1 );

}

else

{

$this->topic_view_mode = $this->ipsclass->my_getcookie('topicmode');

}

 

if ( ! $this->topic_view_mode )

{

//-----------------------------------------

// No cookie and no URL

//-----------------------------------------

 

$this->topic_view_mode = $this->ipsclass->vars['topicmode_default'] ? $this->ipsclass->vars['topicmode_default'] : 'linear';

}

 

//-----------------------------------------

// VIEWS

//-----------------------------------------

 

if ( isset($this->ipsclass->input['view']) )

{

if ($this->ipsclass->input['view'] == 'new')

{

//-----------------------------------------

// Newer

//-----------------------------------------

 

$this->ipsclass->DB->simple_construct( array( 'select' => 'tid',

'from' => 'topics',

'where' => "forum_id=".$this->forum['id']." AND approved=1 AND state <> 'link' AND last_post > ".$this->topic['last_post'],

'order' => 'last_post',

'limit' => array( 0,1 )

) );

 

$this->ipsclass->DB->simple_exec();

 

if ( $this->ipsclass->DB->get_num_rows() )

{

$this->topic = $this->ipsclass->DB->fetch_row();

 

$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid']);

}

else

{

$this->ipsclass->Error( array( LEVEL => 1, MSG => 'no_newer') );

}

}

else if ($this->ipsclass->input['view'] == 'old')

{

//-----------------------------------------

// Older

//-----------------------------------------

 

$this->ipsclass->DB->simple_construct( array( 'select' => 'tid',

'from' => 'topics',

'where' => "forum_id=".$this->forum['id']." AND approved=1 AND state <> 'link' AND last_post < ".$this->topic['last_post'],

'order' => 'last_post DESC',

'limit' => array( 0,1 )

) );

 

$this->ipsclass->DB->simple_exec();

 

if ( $this->ipsclass->DB->get_num_rows() )

{

$this->topic = $this->ipsclass->DB->fetch_row();

 

$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid']);

}

else

{

$this->ipsclass->Error( array( LEVEL => 1, MSG => 'no_older') );

}

}

else if ($this->ipsclass->input['view'] == 'getlastpost')

{

//-----------------------------------------

// Last post

//-----------------------------------------

 

$this->return_last_post();

}

else if ($this->ipsclass->input['view'] == 'getnewpost')

{

//-----------------------------------------

// Newest post

//-----------------------------------------

 

$st = 0;

$pid = "";

 

if ( $this->ipsclass->vars['db_topic_read_cutoff'] and $this->ipsclass->member['id'] )

{

$last_time = intval( $this->my_topics_read[ $this->topic['tid'] ] ) ? intval( $this->my_topics_read[ $this->topic['tid'] ] ) : intval( $this->db_row['marker_last_cleared'] );

}

 

$last_time = $last_time ? $last_time : $this->ipsclass->input['last_visit'];

 

$this->ipsclass->DB->simple_construct( array( 'select' => 'MIN(pid) as pid',

'from' => 'posts',

'where' => "queued=0 AND topic_id=".$this->topic['tid']." AND post_date > ".intval($last_time),

'limit' => array( 0,1 )

) );

 

$this->ipsclass->DB->simple_exec();

 

$post = $this->ipsclass->DB->fetch_row();

 

if ( $post['pid'] )

{

$pid = "entry".$post['pid'];

 

$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(*) as posts',

'from' => 'posts',

'where' => "topic_id=".$this->topic['tid']." AND pid <= ".$post['pid'],

) );

 

$this->ipsclass->DB->simple_exec();

 

$cposts = $this->ipsclass->DB->fetch_row();

 

if ( (($cposts['posts']) % $this->ipsclass->vars['display_max_posts']) == 0 )

{

$pages = ($cposts['posts']) / $this->ipsclass->vars['display_max_posts'];

}

else

{

$number = ( ($cposts['posts']) / $this->ipsclass->vars['display_max_posts'] );

$pages = ceil( $number);

}

 

$st = ($pages - 1) * $this->ipsclass->vars['display_max_posts'];

 

$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid']."&st=$st".$pid);

}

else

{

$this->return_last_post();

}

}

else if ($this->ipsclass->input['view'] == 'findpost')

{

//-----------------------------------------

// Find a post

//-----------------------------------------

 

$pid = intval($this->ipsclass->input['p']);

 

if ( $pid > 0 )

{

$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(*) as posts',

'from' => 'posts',

'where' => "topic_id=".$this->topic['tid']." AND pid <= ".$pid,

) );

 

$this->ipsclass->DB->simple_exec();

 

$cposts = $this->ipsclass->DB->fetch_row();

 

if ( (($cposts['posts']) % $this->ipsclass->vars['display_max_posts']) == 0 )

{

$pages = ($cposts['posts']) / $this->ipsclass->vars['display_max_posts'];

}

else

{

$number = ( ($cposts['posts']) / $this->ipsclass->vars['display_max_posts'] );

$pages = ceil( $number);

}

 

$st = ($pages - 1) * $this->ipsclass->vars['display_max_posts'];

 

$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid']."&st=$st&p=$pid"."entry".$pid);

}

else

{

$this->return_last_post();

}

}

}

 

//-----------------------------------------

// UPDATE TOPIC?

//-----------------------------------------

 

if ( ! $this->ipsclass->input['b'] )

{

if ( $this->topic['topic_firstpost'] < 1 )

{

//--------------------------------------

// No first topic set - old topic, update

//--------------------------------------

 

$this->ipsclass->DB->simple_construct( array (

'select' => 'pid',

'from' => 'posts',

'where' => 'topic_id='.$this->topic['tid'].' AND new_topic=1'

) );

 

$this->ipsclass->DB->simple_exec();

 

$post = $this->ipsclass->DB->fetch_row();

 

if ( ! $post['pid'] )

{

//-----------------------------------------

// Get first post info

//-----------------------------------------

 

$this->ipsclass->DB->simple_construct( array( 'select' => 'pid',

'from' => 'posts',

'where' => "topic_id={$this->topic['tid']}",

'order' => 'pid ASC',

'limit' => array(0,1) ) );

$this->ipsclass->DB->simple_exec();

 

$first_post = $this->ipsclass->DB->fetch_row();

$post['pid'] = $first_post['pid'];

}

 

if ( $post['pid'] )

{

$this->ipsclass->DB->simple_construct( array (

'update' => 'topics',

'set' => 'topic_firstpost='.$post['pid'],

'where' => 'tid='.$this->topic['tid']

) );

 

$this->ipsclass->DB->simple_exec();

}

 

//--------------------------------------

// Reload "fixed" topic

//--------------------------------------

 

$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid']."&b=1&st={$this->ipsclass->input['st']}&p={$this->ipsclass->input['p']}"."entry".$this->ipsclass->input['p']);

}

}

 

$find_pid = $this->ipsclass->input['pid'] == "" ? $this->ipsclass->input['p'] : $this->ipsclass->input['pid'];

 

if ( $find_pid )

{

$threaded_pid = '&pid='.$find_pid;

$linear_pid = '&view=findpost&p='.$find_pid;

}

 

if ( $this->topic_view_mode == 'threaded' )

{

$require = 'topic_threaded.php';

 

$this->topic['to_button_threaded'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_on( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=threaded".$threaded_pid, $this->ipsclass->lang['tom_outline'] );

$this->topic['to_button_standard'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_off( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=linear".$linear_pid, $this->ipsclass->lang['tom_standard'] );

$this->topic['to_button_linearpl'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_off( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=linearplus".$linear_pid, $this->ipsclass->lang['tom_linear'] );

 

}

else

{

$require = 'topic_linear.php';

 

$this->topic['to_button_threaded'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_off( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=threaded".$threaded_pid, $this->ipsclass->lang['tom_outline'] );

 

if ( $this->topic_view_mode == 'linearplus' )

{

$this->topic['to_button_standard'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_off( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=linear".$linear_pid, $this->ipsclass->lang['tom_standard'] );

$this->topic['to_button_linearpl'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_on( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=linearplus".$linear_pid, $this->ipsclass->lang['tom_linear'] );

}

else

{

$this->topic['to_button_standard'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_on( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=linear".$linear_pid, $this->ipsclass->lang['tom_standard'] );

$this->topic['to_button_linearpl'] = $this->ipsclass->compiled_templates['skin_topic']->toutline_mode_choice_off( "{$this->ipsclass->base_url}showtopic={$this->topic['tid']}&mode=linearplus".$linear_pid, $this->ipsclass->lang['tom_linear'] );

}

}

 

//-----------------------------------------

// Remove potential [attachmentid= tag in title

//-----------------------------------------

 

$this->topic['title'] = str_replace( '[attachmentid=', '[attachmentid=', $this->topic['title'] );

 

//-----------------------------------------

// Load and run lib

//-----------------------------------------

 

$this->func = $this->ipsclass->load_class( ROOT_PATH . 'sources/lib/func_'.$require, 'topic_display' );

 

$this->func->register_class( &$this );

$this->func->display_topic();

 

$this->output .= $this->func->output;

 

//-----------------------------------------

// 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 $this->ipsclass->member['id'] AND $this->ipsclass->member['g_post_polls'] AND $this->forum['allow_poll'] )

{

if (

( ($this->topic['starter_id'] == $this->ipsclass->member['id']) AND ($this->ipsclass->vars['startpoll_cutoff'] > 0) AND ( $this->topic['start_date'] + ($this->ipsclass->vars['startpoll_cutoff'] * 3600) > time() ) )

OR ( $this->ipsclass->member['g_is_supmod'] == 1 )

)

{

$this->output = str_replace( "<!--{IBF.START_NEW_POLL}-->", $this->ipsclass->compiled_templates['skin_topic']->start_poll_link($this->forum['id'], $this->topic['tid']), $this->output );

}

}

}

 

//-----------------------------------------

// ATTACHMENTS!!!

//-----------------------------------------

 

if ( $this->topic['topic_hasattach'] )

{

$this->output = $this->parse_attachments( $this->output, $this->attach_pids );

}

 

// Still seeing attachment tags?

if ( stristr( $this->output, "[attachmentid=" ) )

{

$this->output = preg_replace( "#\[attachmentid=(\d+)\]#is", "", $this->output );

}

 

//-----------------------------------------

// Process users active in this forum

//-----------------------------------------

 

if ($this->ipsclass->vars['no_au_topic'] != 1)

{

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

  • 0

а вот это вот ошибка

 

<script language="JavaScript">
<!--

function SymError()
{
 return true;
}

window.onerror = SymError;

var SymRealWinOpen = window.open;

function SymWinOpen(url, name, attributes)
{
 return (new Object());
}

window.open = SymWinOpen;

//-->
</script>

 

а тута кто-нить, когда-нить помогает?! :D))

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

  • 0

найди код от // VIEWS до // UPDATE TOPIC? , удали всё оттуда и вставь вот это:

		//-----------------------------------------
	// VIEWS
	//-----------------------------------------

	if ( isset($this->ipsclass->input['view']) )
	{
		if ($this->ipsclass->input['view'] == 'new')
		{
			//-----------------------------------------
			// Newer 
			//-----------------------------------------

			$this->ipsclass->DB->simple_construct( array( 'select' => 'tid',
														  'from'   => 'topics',
														  'where'  => "forum_id=".$this->forum['id']." AND approved=1 AND state <> 'link' AND last_post > ".$this->topic['last_post'],
														  'order'  => 'last_post',
														  'limit'  => array( 0,1 )
												)	  );

			$this->ipsclass->DB->simple_exec();

			if ( $this->ipsclass->DB->get_num_rows() )
			{
				$this->topic = $this->ipsclass->DB->fetch_row();

				$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid']);
			}
			else
			{
				$this->ipsclass->Error( array( LEVEL => 1, MSG => 'no_newer') );
			}
		}
		else if ($this->ipsclass->input['view'] == 'old')
		{
			//-----------------------------------------
			// Older
			//-----------------------------------------

			$this->ipsclass->DB->simple_construct( array( 'select' => 'tid',
														  'from'   => 'topics',
														  'where'  => "forum_id=".$this->forum['id']." AND approved=1 AND state <> 'link' AND last_post < ".$this->topic['last_post'],
														  'order'  => 'last_post DESC',
														  'limit'  => array( 0,1 )
												)	  );

			$this->ipsclass->DB->simple_exec();

			if ( $this->ipsclass->DB->get_num_rows() )
			{
				$this->topic = $this->ipsclass->DB->fetch_row();

				$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid']);
			}
			else
			{
				$this->ipsclass->Error( array( LEVEL => 1, MSG => 'no_older') );
			}
		}
		else if ($this->ipsclass->input['view'] == 'getlastpost')
		{
			//-----------------------------------------
			// Last post
			//-----------------------------------------

			$this->return_last_post();
		}
		else if ($this->ipsclass->input['view'] == 'getnewpost')
		{
			//-----------------------------------------
			// Newest post
			//-----------------------------------------

			$st  = 0;
			$pid = "";

			if ( $this->ipsclass->vars['db_topic_read_cutoff'] and $this->ipsclass->member['id'] )
			{
				$last_time = intval( $this->my_topics_read[ $this->topic['tid'] ] ) ? intval( $this->my_topics_read[ $this->topic['tid'] ] ) : intval( $this->db_row['marker_last_cleared'] );
			}

			$last_time = $last_time ? $last_time : $this->ipsclass->input['last_visit'];

			$this->ipsclass->DB->simple_construct( array( 'select' => 'MIN(pid) as pid',
														  'from'   => 'posts',
														  'where'  => "queued=0 AND topic_id=".$this->topic['tid']." AND post_date > ".intval($last_time),
														  'limit'  => array( 0,1 )
												)	  );

			$this->ipsclass->DB->simple_exec();

			$post = $this->ipsclass->DB->fetch_row();

			if ( $post['pid'] )
			{
				$pid = "entry".$post['pid'];

				$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(*) as posts',
															  'from'   => 'posts',
															  'where'  => "topic_id=".$this->topic['tid']." AND pid <= ".$post['pid'],
													)	  );

				$this->ipsclass->DB->simple_exec();

				$cposts = $this->ipsclass->DB->fetch_row();

				if ( (($cposts['posts']) % $this->ipsclass->vars['display_max_posts']) == 0 )
				{
					$pages = ($cposts['posts']) / $this->ipsclass->vars['display_max_posts'];
				}
				else
				{
					$number = ( ($cposts['posts']) / $this->ipsclass->vars['display_max_posts'] );
					$pages = ceil( $number);
				}

				$st = ($pages - 1) * $this->ipsclass->vars['display_max_posts'];

				$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid']."&st=$st".$pid);
			}
			else
			{
				$this->return_last_post();
			}
		}
		else if ($this->ipsclass->input['view'] == 'findpost')
		{
			//-----------------------------------------
			// Find a post
			//-----------------------------------------

			$pid = intval($this->ipsclass->input['p']);

			if ( $pid > 0 )
			{
				$this->ipsclass->DB->simple_construct( array( 'select' => 'COUNT(*) as posts',
															  'from'   => 'posts',
															  'where'  => "topic_id=".$this->topic['tid']." AND pid <= ".$pid,
													)	  );

				$this->ipsclass->DB->simple_exec();

				$cposts = $this->ipsclass->DB->fetch_row();

				if ( (($cposts['posts']) % $this->ipsclass->vars['display_max_posts']) == 0 )
				{
					$pages = ($cposts['posts']) / $this->ipsclass->vars['display_max_posts'];
				}
				else
				{
					$number = ( ($cposts['posts']) / $this->ipsclass->vars['display_max_posts'] );
					$pages = ceil( $number);
				}

				$st = ($pages - 1) * $this->ipsclass->vars['display_max_posts'];

				$this->ipsclass->boink_it($this->ipsclass->base_url."showtopic=".$this->topic['tid']."&st=$st&p=$pid"."entry".$pid);
			}
			else
			{
				$this->return_last_post();
			}
		}
	}

Если не поможет, значит это чудо

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

  • 0

вот у меня таже проблема..просто в темку из форума заходит, а вот с Главной страницы и по последнему сообщению-белая страница...как-то ставила на форум себе форму быстрого ответа, потом снесла её и видно что-то не то снесла, либо надо ещё что-то снести...но такой ламер как я не может найти ошибки :D ...плюс у меня ещё одна проблема: теперь темы не отображаются прочитанными пока не выйдёшь из форума, то есть прочитал темку-а она всё равно для тебя непрочитанная...может вы знаете где эти ошибки искать, в каких строках...вот Topics.php, помогите пожалуйста, хоть и понимаю, что это непростенькая задача ;)

 

<?php

 

$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 $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);

 

$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'],

);

}

 

//-------------------------------------

// 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',

'TOPIC_HISTORY' => '90',

);

 

 

//-------------------------------------

// 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' );

 

$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

//--------------------------------------------

 

$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..

//--------------------------------------------

 

$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, g.g_dohtml $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';

}

 

//--------------------------------------------------------------

 

$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['post_date'] = $std->get_date( $row['post_date'], 'LONG' );

$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)

: "";

 

//--------------------------------------------------------------

 

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>";

}

 

//--------------------------------------------------------------

// Parse HTML tag on the fly

//--------------------------------------------------------------

 

if ( $this->forum['use_html'] == 1 )

{

// So far, so good..

 

if ( stristr( $row['post'], '' ) )

{

// 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' ) )

{

$show = "none";

 

$sqr = $std->my_getcookie("open_qr");

 

if ( $sqr == 1 )

{

$show = "show";

}

$this->output = str_replace( "<!--IBF.QUICK_REPLY_CLOSED-->", $this->html->quick_reply_box_closed(), $this->output );

$this->output = str_replace( "<!--IBF.QUICK_REPLY_OPEN-->" , $this->html->quick_reply_box_open($this->topic['forum_id'], $this->topic['tid'], $show, $this->md5_check), $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>",

),

) );

 

}

 

//--------------------------------------------------------------

// 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['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>";

}

 

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=\"java script:PopUp('{$this->base_url}act=Profile&CODE=showcard&MID={$member['id']}','AddressCard','470','300','0','1','1','1')\" title='{$ibforums->lang['ac_title']}'><{ADDRESS_CARD}></a>";

}

 

//--------------------------------------------------------------

// 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'] and ( $ibforums->member['id'] == $member['id'] ) )

)

{

// 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 "";

}

 

//--------------------------------------------------------------

// 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']);

}

 

}

 

//--------------------------------------------------------------

// Render the topic multi-moderation

//--------------------------------------------------------------

 

function multi_moderation()

{

global $ibforums, $std, $DB;

 

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

  • 0

Блин, никогда про код [ codebox] [/codebox ] не слышали?!

Почитайте хелп на форуме.

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

Присоединиться к обсуждению

Вы можете ответить сейчас, а зарегистрироваться позже. Если у вас уже есть аккаунт, войдите, чтобы ответить от своего имени.

Гость
Ответить на вопрос...

×   Вы вставили отформатированный текст.   Удалить форматирование

  Допустимо не более 75 смайлов.

×   Ваша ссылка была автоматически заменена на медиа-контент.   Отображать как ссылку

×   Ваши публикации восстановлены.   Очистить редактор

×   Вы не можете вставить изображения напрямую. Загрузите или вставьте изображения по ссылке.

Зарузка...
×
×
  • Создать...

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

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