Перейти к публикации
Дизайн и модификация IPS Community IPBSkinsBETA
Поиск в
  • Дополнительно...
Искать результаты, содержащие...
Искать результаты в...
SergeyC

Как экспортировать сообщения из IPB?

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

Здравствуйте.

Задача - вывести на определенную прелестницу сайта - соообщения из определенной темы в IPB.

Как это сделать?

Я гуглил, нашел такую штуку ssi.php

но насколько я понял, она работает только со 2 версией.

А как быть, если у меня 3.4 версия? Как вывести сообщения в таком случае?

Спасибо!

Поделиться сообщением


Ссылка на сообщение
Обратите внимание

"Board url", указанный вами в профиле, некорректен, либо недоступен на данный момент. Пожауйста, заполните его, потому что он скорее всего потребуется при диагностике вашей проблемы.

Поделиться сообщением


Ссылка на сообщение

Я гуглил, нашел такую штуку ssi.php

но насколько я понял, она работает только со 2 версией.

Работает он с теми версиями с которыми входит в дистрибутиве.

Поделиться сообщением


Ссылка на сообщение

Да? Ну это уже хорошо, значит изобретать велосипед не придется.

А вы не знаете, почему тогда у меня может не работать? :-)

Я ему allow_url_fopen и allow_url_include включил, вроде бы там больше ничего настраивать не нужно?

Поделиться сообщением


Ссылка на сообщение

Не знаю. Читайте документацию (описание вначале файла), смотрите логи сервера. Я телепатить не умею.

 

вроде бы там больше ничего настраивать не нужно?

Там нужно шаблоны настроить - ssi_templates.

Поделиться сообщением


Ссылка на сообщение

Да, вы прямо в точку,

 

Во что пишет теперь:

 

Template file does not exist

 

Хотя папку я загрузил на сервер, находится рядом с ssi.php

Поделиться сообщением


Ссылка на сообщение

А, нашел, получилось :-)

Поделиться сообщением


Ссылка на сообщение

Все таки основной функционал эта штука не выполняет.

НАстроить для вывода статистики с авторов тем с определенных форумов уменя получилось, а вот вывод последних сообщений из заданной темы - нет.

 

Вот тут нашел дополнение, установил как в мануле, но не работает.

https://github.com/Sannis/ipb_modifications/tree/master/modifications/2.1_2.3_ssi_last_topics_and_posts

 

Собственно код, который там написан, и должен отвечать за вывод сообщений:

 

 

/**
* Do Last Posts
*
* Show last posts
*/
function do_last_posts()
{
	$this->ipsclass->load_language('lang_global');

	require_once( ROOT_PATH.'sources/handlers/han_parse_bbcode.php' );
	$parser                      =  new parse_bbcode();
	$parser->ipsclass            =& $this->ipsclass;
	$parser->allow_update_caches = 0;
	$parser->parse_smilies = 0;

	$perpage = (isset($this->ipsclass->input['show']) AND intval($this->ipsclass->input['show']) > 0) ? intval($this->ipsclass->input['show']) : 10;
	$perpage = ( $perpage > SSI_MAX_SHOW ) ? SSI_MAX_SHOW : $perpage;

	$post_template = $this->load_template('last_posts.html');

	$to_echo = '';

	$wheretopics = '';
	$whereposts = '';

	if( count($this->disable_forums) > 0 )
	{
		$wheretopics .= 't.forum_id NOT IN ('.implode(',', $this->disable_forums).') AND ';
	}

	// Sort out the forum ids
	if( isset($this->ipsclass->input['f']) && $this->ipsclass->input['f'] ) {
		$forums = $this->ipsclass->clean_int_array( explode( ",", $this->ipsclass->input['f'] ) );

		if( count($forums) > 0 )
		{
			$wheretopics .= "t.forum_id IN (".implode(',', $forums).") AND ";
		}
	}

	if( intval($this->ipsclass->input['notopics']) == 1 )
	{
		$whereposts .= 'p.new_topic!=1 AND ';
	}

	if( isset($this->ipsclass->input['topic']) AND intval($this->ipsclass->input['topic']) > 0 )
	{
		$wheretopics .= 't.tid='.intval($this->ipsclass->input['topic']).' AND ';
		$one_topic = 1;
	}
	else
	{
		$one_topic = 0;
	}

	if( intval($this->ipsclass->input['onepertopic']) == 1 )
	{
		$wheretopics .= 'p.post_date = t.last_post AND ';
	}

	$this->ipsclass->DB->build_query( array( 'select'   => 'p.*',
						 'from'     => array( 'posts' => 'p' ),
						 'where'    => $wheretopics.$whereposts.'p.queued=0',
						 'order'    => 'p.post_date DESC',
						 'limit'    => array( 0, $perpage ),
						 'add_join' => array( 0 => array( 'select' => 'm.members_display_name as member_name, m.id as member_id, m.title as member_title',
														  'from'   => array( 'members' => 'm' ),
														  'where'  => 'm.id=p.author_id',
														  'type'   => 'left' ),
											  1 => array( 'select' => 'me.avatar_location, me.avatar_size, me.avatar_type',
														  'from'   => array( 'member_extra' => 'me' ),
														  'where'  => 'me.id=p.author_id',
														  'type'   => 'left' ),
											  2 => array( 'select' => 't.tid, t.title',
														  'from'   => array( 'topics' => 't' ),
														  'where'  => "p.topic_id=t.tid AND t.approved=1 AND t.state != 'closed' AND (t.moved_to is null or t.moved_to = '') AND t.starter_id <> 0",
														  'type'   => 'left' )  )
				)      );

	$sql_result = $this->ipsclass->DB->exec_query();

	if ( !$this->ipsclass->DB->get_num_rows($sql_result) )
	{
		fatal_error("Could not get the information from the database");
	}

	$newsize = (isset($this->ipsclass->input['asize']) AND intval($this->ipsclass->input['asize']) > 0) ? intval($this->ipsclass->input['asize']) : 0;
	$len = (isset($this->ipsclass->input['len']) AND intval($this->ipsclass->input['len']) > 0) ? intval($this->ipsclass->input['len']) : 0;

	while( $row = $this->ipsclass->DB->fetch_row($sql_result) )
	{
		$parser->parse_html  = ( $this->ipsclass->cache['forum_cache'][ $row['forum_id'] ]['use_html'] and $this->ipsclass->cache['group_cache'][ $row['mgroup'] ]['g_dohtml'] and $row['post_htmlstate'] ) ? 1 : 0;
		$parser->parse_nl2br = $row['post_htmlstate'] == 2 ? 1 : 0;
		$parser->parse_wordwrap = $this->ipsclass->vars['post_wordwrap'];

		$row['post']         = $parser->pre_display_parse( $row['post'] );
		$row['member_name']  = $row['member_name'] ? $row['member_name'] : $row['author_name'];
		$row['member_avatar'] = $this->ipsclass->get_avatar( $row['avatar_location'], 1, $row['avatar_size'], $row['avatar_type'] );

		if( $newsize )
		{
			$row['member_avatar'] = preg_replace("#width='(\d+)'#is", "width='$newsize'", $row['member_avatar']);
			$row['member_avatar'] = preg_replace("#height='(\d+)'#is", "height='$newsize'", $row['member_avatar']);
		}

		$row['post'] = $parser->strip_all_tags( $row['post'] );
		$row['post'] = preg_replace("#([^\s<>'\"/\.\\-\?&\n\r\%]{80})#i", " \\1"."<br />", $row['post']);
		$row['post'] = str_replace( "\n", '<br />', trim($row['post']) );
		if( $len and (strlen( $row['post'] ) > $len) )
		{
			$row['post'] = substr( $row['post'], 0, $len ) . '...';
			$row['post'] = preg_replace( "/&(#(\d+;?)?)?\.\.\.$/", '...', $row['post'] );
		}

		$to_echo .= $this->parse_template( $post_template,
								    array (
										'profile_link'	=> $this->ipsclass->base_url.'?showuser='.$row['member_id'],
										'member_name'	=> $row['member_name'],
										'member_title'	=> $row['member_title'] ? '<br />'.$row['member_title'] : '',
										'post_date'	=> $this->ipsclass->get_date( $row['post_date'], 'LONG', 1 ),
										'topic_link'	=> $this->ipsclass->base_url.'?showtopic='.$row['tid'],
										'topic_title'	=> $row['title'],
										'forum_link'	=> $this->ipsclass->base_url.'?showforum='.$row['forum_id'],
										'forum_title'	=> $this->ipsclass->cache['forum_cache'][ $row['forum_id'] ]['name'],
										'post'			=> $row['post'],
										'posts'		=> $row['posts'],
										'view_all_link'=> $this->ipsclass->base_url.'?showtopic='.$row['tid'].'&view=findpost&p='.$row['pid'],
										'member_avatar'=> $row['member_avatar']
								    	  )
								    );
	}

	if( $one_topic AND isset($this->ipsclass->input['showtopicinfo']) AND $this->ipsclass->input['showtopicinfo'] )
	{			
		$this->ipsclass->DB->build_query( array( 'select'   => 'tid,title,posts,starter_id,starter_name,forum_id',
												 'from'     => 'topics',
												 'where'    => 'tid='.intval($this->ipsclass->input['topic']),
										)      );

		$sql_result = $this->ipsclass->DB->exec_query();

		if( $row = $this->ipsclass->DB->fetch_row($sql_result) )
		{			
			if( in_array($row['forum_id'], $this->disable_forums) )
			{
				fatal_error("You can't access this topic.");
			}

			$topicinfo_template = $this->load_template('last_posts_topicinfo.html');

			$topic_info = $this->parse_template( $topicinfo_template,
									array (
											 'profile_link'	=> $this->ipsclass->base_url.'?act=Profile&CODE=03&MID='.$row['starter_id'],
											 'starter_name'	=> $row['starter_name'],
											 'topic_link'	=> $this->ipsclass->base_url.'?act=st&t='.$row['tid'],
											 'topic_link_last'	=> $this->ipsclass->base_url.'?act=st&t='.$row['tid'].'&view=getlastpost',
											 'topic_title'	=> $row['title'],
											 'forum_link'	=> $this->ipsclass->base_url.'?act=sf&f='.$row['forum_id'],
											 'forum_title'	=> $this->ipsclass->cache['forum_cache'][ $row['forum_id'] ]['name'],
											 'posts'		=> $row['posts'],
										  )
									);
			$to_echo = $topic_info.$to_echo;
		}
	}

	//-----------------------------------------
      	// Get the macros and replace them
      	//-----------------------------------------

      	if ( is_array( $this->ipsclass->skin['_macros'] ) )
      	{
		foreach( $this->ipsclass->skin['_macros'] as $i => $row )
		{
			if ( $row['macro_value'] != "" )
			{
				$to_echo = str_replace( "<{".$row['macro_value']."}>", $row['macro_replace'], $to_echo );
			}
		}
	}

	$to_echo = str_replace( "<#IMG_DIR#>", $this->ipsclass->skin['_imagedir'], $to_echo );
	$to_echo = str_replace( "<#EMO_DIR#>", $this->ipsclass->skin['_emodir']  , $to_echo );

	echo $to_echo;

	exit();
}

 

 

Поделиться сообщением


Ссылка на сообщение

А вот, ошибка из лога:

22.244.237.26 - - [18/Feb/2013:21:37:28 +0400] "GET /ssi.php?a=lastposts&show=1&topic=48 HTTP/1.1" 500 545
[Mon Feb 18 21:37:33 2013] [error] [client 22.244.237.26] PHP Fatal error:  Call to a member function load_language() on a non-object in /var/www/site/ssi.php on line 462

 

Я эту строчку удаляю, а результата нет.

Поделиться сообщением


Ссылка на сообщение
Вот тут нашел дополнение, установил как в мануле, но не работает.

 

For 2.1-2.3

Поделиться сообщением


Ссылка на сообщение

Создайте аккаунт или войдите в него для комментирования

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

Создать аккаунт

Зарегистрируйтесь для получения аккаунта. Это просто!

Зарегистрировать аккаунт

Войти

Уже зарегистрированы? Войдите здесь.

Войти сейчас

  • Сейчас на странице   0 пользователей

    Нет пользователей, просматривающих эту страницу.

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