Hm.. walczę z tym skryptem i udało mi się takie coś napisać :
[php]<?php
//--------------------------------------------
// ZINTEGROWANE NEWSY (:
//--------------------------------------------
if ( !defined('IN_POKEXP') )
{
die ('Wassup\' ?');
}
// Wybieramy ilość newsów..
$conf['how_many_news'] = '6';
// Długość newsa
$conf['news_length'] = '200';
// ID forum, gdzie są newsy
$conf['news_forum'] = '1';
function bbencode_strip($text, $uid)
{
// [CODE] and [ /CODE ] for posting code (HTML, PHP, C etc etc) in your posts.
$text = str_replace("[code:1:$uid]","", $text);
$text = str_replace("[/code:1:$uid]", "", $text);
$text = str_replace("[code:$uid]", "", $text);
$text = str_replace("[/code:$uid]", "", $text);
//
Cytuj:
and
for posting replies with quote, or just for quoting stuff.
$text = str_replace("[quote:1:$uid]","", $text);
$text = str_replace("[/quote:1:$uid]", "", $text);
$text = str_replace("[quote:$uid]", "", $text);
$text = str_replace("[/quote:$uid]", "", $text);
// New one liner to deal with opening quotes with usernames...
// replaces the two line version that I had here before..
$text = preg_replace("/\[quote:$uid=(?:\"?([^\"]*)\"?)\]/si", "", $text);
$text = preg_replace("/\[quote:1:$uid=(?:\"?([^\"]*)\"?)\]/si", "", $text);
// [list] and [list=x] for (un)ordered lists.
// unordered lists
$text = str_replace("[list:$uid]", "", $text);
// li tags
$text = str_replace("[*:$uid]", "", $text);
// ending tags
$text = str_replace("[/list:u:$uid]", "", $text);
$text = str_replace("[/list:o:$uid]", "", $text);
// Ordered lists
$text = preg_replace("/\[list=([a1]):$uid\]/si", "", $text);
// colours
$text = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+):$uid\]/si", "", $text);
$text = str_replace("[/color:$uid]", "", $text);
// url #2
$text = str_replace("[url]","", $text);
$text = str_replace("[/url]", "", $text);
// url
$text = preg_replace("/\[url=([a-z0-9\-\.,\?!%\*_\/:;~\\&$@\/=\+]+)\]/si", "", $text);
$text = str_replace("[/url:$uid]", "", $text);
// img
$text = str_replace("[img:$uid]","", $text);
$text = str_replace("[/img:$uid]", "", $text);
// email
$text = str_replace("[email:$uid]","", $text);
$text = str_replace("[/email:$uid]", "", $text);
// size
$text = preg_replace("/\[size=([\-\+]?[1-2]?[0-9]):$uid\]/si", "", $text);
$text = str_replace("[/size:$uid]", "", $text);
// align
$text = preg_replace("/\[align=(left|right|center|justify):$uid\]/si", "", $text);
$text = str_replace("[/align:$uid]", "", $text);
//
and for bolding text.
$text = str_replace("[b:$uid]","", $text);
$text = str_replace("[/b:$uid]", "", $text);
//
and for underlining text.
$text = str_replace("[u:$uid]", "", $text);
$text = str_replace("[/u:$uid]", "", $text);
//
and for italicizing text.
$text = str_replace("[i:$uid]", "", $text);
$text = str_replace("[/i:$uid]", "", $text);
// Remove our padding from the string..
$text = substr($text, 1);
return $text;
}
include_once ($phpbb_root_path . 'includes/bbcode.' . $phpEx);
$sql = 'SELECT
t.topic_id,
t.topic_time,
t.topic_title,
pt.post_text,
u.username,
u.user_id,
u.user_rank,
u.user_posts,
t.topic_replies,
pt.bbcode_uid,
t.forum_id,
t.topic_poster,
t.topic_first_post_id,
t.topic_status,
pt.post_id,
p.post_id,
p.enable_smilies
FROM
' . TOPICS_TABLE . ' AS t,
' . USERS_TABLE . ' AS u,
' . POSTS_TEXT_TABLE . ' AS pt,
' . POSTS_TABLE . ' AS p
WHERE
t.forum_id IN (' . $conf['news_forum'] . ') AND
t.topic_time <= ' . time() . ' AND
t.topic_poster = u.user_id AND
t.topic_first_post_id = pt.post_id AND
t.topic_first_post_id = p.post_id AND
t.topic_status <> 2
ORDER BY
t.topic_time DESC LIMIT 0, ' . $conf['how_many_news'] . '';
$query = mysql_query($sql)
or die();
while ($row = mysql_fetch_array($query))
{
$posts['bbcode_uid'] = $row['bbcode_uid'];
$posts['enable_smilies'] = $row['enable_smilies'];
$posts['post_text'] = $row['post_text'];
$posts['topic_id'] = $row['topic_id'];
$posts['topic_replies'] = $row['topic_replies'];
$posts['topic_time'] = create_date($board_config['default_dateformat'], $row['topic_time'], $board_config['board_timezone']);
$posts['topic_title'] = $row['topic_title'];
$posts['user_id'] = $row['user_id'];
$posts['username'] = $row['username'];
$row['username'] = color_username($row['user_id'], $row['username'], $row['user_rank'], $row['user_posts'], USERNAME_STATIC);
$posts['post_text'] = stripslashes($posts['post_text']);
if (($conf['news_length'] == 0) or (strlen($posts['post_text']) <= $conf['news_length']))
{
$posts['post_text'] = bbencode_second_pass($posts['post_text'], $posts['bbcode_uid']);
$posts['striped'] = 0;
}
else
{
$posts['post_text'] = bbencode_strip($posts['post_text'], $posts['bbcode_uid']);
$posts['post_text'] = substr($posts['post_text'], 0, $conf['news_length']) . '...';
$posts['striped'] = 1;
}
//
// Smilies
//
if ($posts['enable_smilies'] == 1)
{
$posts['post_text'] = smilies_pass($posts['post_text']);
}
$posts['post_text'] = make_clickable($posts['post_text']);
//
// define censored word matches
//
$orig_word = array();
$replacement_word = array();
obtain_word_list($orig_word, $replacement_word);
//
// censor text and title
//
if (count($orig_word))
{
$posts['topic_title'] = preg_replace($orig_word, $replacement_word, $posts['topic_title']);
$posts['post_text'] = preg_replace($orig_word, $replacement_word, $posts['post_text']);
}
$posts['post_text'] = nl2br($posts['post_text']);
$link = append_sid('forum/viewtopic.' . $phpEx . '?t=' . $row['topic_id']);
$avatar_img = '';
if ( $userdata['user_avatar_type'] && $userdata['user_allowavatar'] )
{
switch( $userdata['user_avatar_type'] )
{
case USER_AVATAR_UPLOAD:
$avatar_img = ( $board_config['allow_avatar_upload'] ) ? '<img src="' . $board_config['avatar_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_REMOTE:
$avatar_img = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
case USER_AVATAR_GALLERY:
$avatar_img = ( $board_config['allow_avatar_local'] ) ? '<img src="' . $board_config['avatar_gallery_path'] . '/' . $userdata['user_avatar'] . '" alt="" border="0" />' : '';
break;
}
}
echo '<tr><td width="350" height="10" colspan="3"></td></tr>
<tr valign="top"><td width="13"></td><td width="323"><a href="'.$link.'">'.$row['topic_title'].'</a><hr width="90%" align"center"><span>'.$row['post_text'].'</span><div align="right"><br /><span><a href="forum/profile.php?mode=viewprofile&u='.$row['user_id'].'">'.$row['username'].'</a> :: </span><a href="'.$link.'">Komentarzy: <span>'.$row['topic_replies'].'</span></a></div></td><td width="14"></td></tr>
<tr><td width="350" height="11" colspan="3"></td></tr><tr><td height="25">'.$avatar_img.'</td></tr>';
}
?>[/php]
Ale to nie chce działać

Jeżeli usunę funkcję bbencode_strip całą, to skrypt działa poprawnie.. Ktoś pomoże
"Wszystko powinno zostać uproszczone tak bardzo, jak to tylko możliwe, ale nie bardziej"
Albert Einstein