). Please make sure you fill in all items in the ’config’ section. A side note: you mySQL tables has to have the standard prefix: "phpbb_" if this is not the case edit the 3 SQL connection (example: if your prefix is forum_ change phpbb_users to forum_users. ) <?php
/*
---------------------------------------------------------------------
phpBB snippet v0.001 upadte 1
---------------------------------------------------------------------
Original code (tnx for letting me using it) by:
* Cyst
* ColdIce aka Furiouz (http://clan12.com)
Ported / re-coding for modX:
* RWQ (http://crea-design.nl - htpp://sesil.nl }
Also many many tnx to:
* Doze - for making the placeholders and adding the TPL and CSS params
oh before i forgot please don't mind my bad english
---------------------------------------------------------------------
// Docu:
---------------------------------------------------------------------
phpBB Snippet v0.001 is a very simpel "get topic" script for modX. It works with phpBB 2.X. phpBB 3.0 support will be added later on (at least i hope :P ). Please make sure you fill in all items in the 'config' section. A side note: you mySQL tables has to have the standard prefix: "phpbb_" if this is not the case edit the 3 SQL connection (example: if your prefix is forum_ change phpbb_topic to forum_topic.
Functions:
* Gets a x number of topics from a forum
* Max char. to display
* Template system
* Select the language of the script (otherwise would the list be so short :P)
For the peaple don't know how to find the id of a certain forum: follow the link of the forum you want to include, then look at the url: http://crea-design.nl/test/viewforum.php?f=1 f=1 so id=1 and so on.
Params:
&forumid --> ID of the forum (in phpBB) in wich you want to fetch the post (default=1).
&numberoftopics --> Number of posts you want to include.(default=5)
&maxchar --> Max number of characters (leave empty for full article)
&cssTpl --> Css path (default: assets/snippets/phpbb/css.css)
&topicTpl --> path to yout TPL file (defaulr assets/snippets/phpbb/topicTpl.html
Example call:
[[phpbb? &forumid=`1` &numberoftopics=`1` &maxchar=`100` ]]
[[phpbb? &forumid=`12` &numberoftopics=`6` ]]
[[phpbb? &forumid=`7` &numberoftopics=`3` &maxchar=`350` &topicTpl=`assets/snippets/phpbb/test.html` &cssTpl='assets/snippets/phpbb/style.css` ]]
There is one Tpl file called topicTpl.html, you can edit it or create a new one. list of placeholders:
[+userAvatar+] --> containing the link to the ava of a user
[+topicUrl+] --> containing a link to the topic
[+topicPoster+]--> The topic poster
[+topicTitle+] --> Topic Title
[+topicDate+] --> Date of publishing the topic
[+postContent+]--> The topic text
[+replyCount+] --> The number of replies
[+userRank+] --> The rank of a user
[+userEmail+] --> User Email (in text so make link with html command mailto)
[+userSig+] --> User Signature
Then the language placeholders:
[+lang.writtenby+]
[+lang.on+]
[+lang.replytxt+]
Things that will be added later on (al least i hope):
* support for UserGroups (example: a members list)
* more place holders
---------------------------------------------------------------------
// Config section :
-------------------------------------------------------------------*/
$forumpath="http://www.crea-design.nl/test/"; // path to your phpbb2 install
$dbname= 'DBname'; // Database Name
$dbuser= 'DBuser'; // Your MySQL username
$dbpass='pass'; // Your MySQ password
$dbhost= 'localhost'; // MySQL host (mostly: localhost)
$date='%d-%m-%y'; // Time and Ddte default: Days - Month - Year
// Language:
$phpbb_lang['writtenby']='written by:';
$phpbb_lang['gototopic']='go to topic';
$phpbb_lang['quote']='Quote:';
$phpbb_lang['code']='Code:';
$phpbb_lang['replytxt']=' replies';
$phpbb_lang['by']='Quote By:';
$phpbb_lang['on']='On:';
$phpbb_lang['gototopiclink']='<i>... <b><a href=[+topicUrl+] target=_blank>[+lang.gototopic+]</a></b></i>';
/* -------------------------------------------------------------
// End config start code - if you know even less of php/mySQL then I do don't mess around alot :P.
--------------------------------------------------------------*/
// param list:
$forumid=(isset($forumid))? $forumid: 1;
$numberoftopics=(isset($numberoftopics))? $numberoftopics: 5;
$maxchar=(isset($maxchar))? $maxchar: true;
$cssTpl=(isset($cssTpl))? $cssTpl: 'assets/snippets/phpbb/css.css'; // template css
$topicTpl=(isset($topicTpl))? $topicTpl: 'assets/snippets/phpbb/topicTpl.html'; // template chunk
// TPL code
if(!function_exists(phpbbGetTemplate)) {
function phpbbGetTemplate($tpl){
global $modx;
$template = "";
if ($modx->getChunk($tpl) != "") {
$template = $modx->getChunk($tpl);
} else if(is_file($tpl)) {
$template = file_get_contents($tpl);
} else {
$template = $tpl;
}
return $template;
}
}
// css code:
if ($cssTpl != "") {
if ($modx->getChunk($cssTpl) != "") {
$modx->regClientCSS($modx->getChunk($cssTpl));
} else if (file_exists($modx->config['base_path'].$cssTpl)) {
$modx->regClientCSS('<link rel="stylesheet" href="'. $modx->config['base_url'].$cssTpl.'" type="text/css" media="screen" />');
} else {
$modx->regClientCSS($cssTpl);
}
}
// Create a SQL connection
mysql_connect("$dbhost", "$dbuser","$dbpass");
mysql_select_db ("$dbname");
// Result 1. ( get topic info)
$result = mysql_query("SELECT topic_id,topic_title,topic_poster,topic_time,topic_replies,topic_first_post_id FROM phpbb_topics WHERE forum_id='$forumid' ORDER BY topic_id DESC LIMIT $numberoftopics ");
while(list($topic_id,$topic_title,$topic_poster,$topic_time,$topic_replies,$topic_first_post_id) = mysql_fetch_array($result))
{
// Result 2. ( get user info (inc ava)
$result2 = mysql_query("SELECT username,user_avatar,user_email,user_sig,user_rank FROM phpbb_users WHERE user_id='$topic_poster'");
list($topic_poster_name,$user_avatar,$user_email,$user_sig,$user_rank) = mysql_fetch_array($result2);
// Result 3. ( get topic text and BB code )
$result3 = mysql_query("SELECT bbcode_uid,post_text FROM phpbb_posts_text WHERE post_id='$topic_first_post_id'");
list($bbcode_uid,$post_content) = mysql_fetch_array($result3);
// Replace BB code with (x)HTML code
$post_content = preg_replace("/\\n/",'<br>', $post_content);
$post_content = str_replace("[quote:$bbcode_uid]", "<div class='quote'>$quote <br />", $post_content);
$post_content = str_replace("[/quote:$bbcode_uid]", "</div>", $post_content);
$post_content = str_replace("[code:1:$bbcode_uid]", "<div class='code'>$code
", $post_content);
$post_content = str_replace("[/code:1:$bbcode_uid]", "</div>", $post_content);
$post_content = preg_replace("#\[quote=\\\"(.*?)\\\":$bbcode_uid\]#si", "$by" , $post_content);
$post_content = str_replace("[list:$bbcode_uid]", "<ul>", $post_content);
$post_content = str_replace("[*:$bbcode_uid]", "<li>", $post_content);
$post_content = str_replace("[/list:u:$bbcode_uid]", "</ul>", $post_content);
$post_content = str_replace("[/list:o:$bbcode_uid]", "</ol>", $post_content);
$post_content = preg_replace("/\[list=([a1]):$bbcode_uid\]/si", "<ol type=\\1>", $post_content);
$post_content = str_replace("[b:$bbcode_uid]", "<b>", $post_content);
$post_content = str_replace("[/b:$bbcode_uid]", "</b>", $post_content);
$post_content = str_replace("[i:$bbcode_uid]", "<i>", $post_content);
$post_content = str_replace("[/i:$bbcode_uid]", "</i>", $post_content);
$post_content = str_replace("[u:$bbcode_uid]", "<u>", $post_content);
$post_content = str_replace("[/u:$bbcode_uid]", "</u>", $post_content);
$post_content = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+):$bbcode_uid\]/si", "<font color=\\1>", $post_content);
$post_content = str_replace("[/color:$bbcode_uid]", "</font>", $post_content);
$post_content = preg_replace("/\[size=([1-2]?[0-9]):$bbcode_uid\]/si", "<font size=\\1>", $post_content);
$post_content = str_replace("[/size:$bbcode_uid]", "</font>", $post_content);
$post_content = str_replace("[img:$bbcode_uid]", "<img src=", $post_content);
$post_content = str_replace("[/img:$bbcode_uid]", " ' alt='' />", $post_content);
// date and stuff.
$datum = strftime ("$date",$topic_time + $timeadjust);
// Getting the smilies (the basic ones that come with the first install. Edit/Add the lines below for costum images)
$post_content = str_replace (":oops:","<img src=$forumpath/images/smiles/icon_redface.gif alt= border=0 />", $post_content);
$post_content = str_replace (":?:","<img src=$forumpath/images/smiles/icon_question.gif alt= border=0 />", $post_content);
$post_content = str_replace (":D","<img src=$forumpath/images/smiles/icon_biggrin.gif alt= border=0 />", $post_content);
$post_content = str_replace (":)","<img src=$forumpath/images/smiles/icon_smile.gif alt= border=0 />", $post_content);
$post_content = str_replace (":(","<img src=$forumpath/images/smiles/icon_sad.gif alt= border=0 />", $post_content);
$post_content = str_replace (":o","<img src=$forumpath/images/smiles/icon_surprised.gif alt= border=0 />", $post_content);
$post_content = str_replace (":shock:","<img src=$forumpath/images/smiles/icon_eek.gif alt= border=0 />", $post_content);
$post_content = str_replace (":?","<img src=$forumpath/images/smiles/icon_confused.gif alt= border=0 />", $post_content);
$post_content = str_replace ("8)","<img src=$forumpath/images/smiles/icon_cool.gif alt= border=0 />", $post_content);
$post_content = str_replace (":lol:","<img src=$forumpath/images/smiles/icon_lol.gif alt= border=0 />", $post_content);
$post_content = str_replace (":x","<img src=$forumpath/images/smiles/icon_mad.gif alt= border=0 />", $post_content);
$post_content = str_replace (":P","<img src=$forumpath/images/smiles/icon_razz.gif alt= border=0 />", $post_content);
$post_content = str_replace (":cry:","<img src=$forumpath/images/smiles/icon_cry.gif alt= border=0 />", $post_content);
$post_content = str_replace (":evil:","<img src=$forumpath/images/smiles/icon_evil.gif alt= border=0 />", $post_content);
$post_content = str_replace (":twisted:","<img src=$forumpath/images/smiles/icon_twisted.gif alt= border=0 />", $post_content);
$post_content = str_replace (":roll:","<img src=$forumpath/images/smiles/icon_rolleyes.gif alt= border=0 />", $post_content);
$post_content = str_replace (":wink:","<img src=$forumpath/images/smiles/icon_wink.gif alt= border=0 />", $post_content);
$post_content = str_replace (":!:","<img src=$forumpath/images/smiles/icon_exclaim.gif alt= border=0 />", $post_content);
$post_content = str_replace (":idea:","<img src=$forumpath/images/smiles/icon_idea.gif alt= border=0 />", $post_content);
$post_content = str_replace (":arrow:","<img src=$forumpath/images/smiles/icon_arrow.gif alt= border=0 />", $post_content);
// Max char. code :
if( strlen($post_content)>$maxchar ) {
$post_content = substr($post_content, 0, $maxchar) . "[+lang.gototopiclink+]";
}
//get template
$template = phpbbGetTemplate($topicTpl);
//replace language placeholders
foreach ($phpbb_lang as $key => $value) {
$template = str_replace('[+lang.'.$key.'+]', $value, $template);
}
//replace content placeholders and append to $output
$placeholders = array('[+userAvatar+]', '[+topicUrl+]', '[+topicTitle+]', '[+topicPoster+]', '[+topicDate+]', '[+postContent+]', '[+replyCount+]', '[+userRank+]', '[+userEmail+]', '[+userSig+]');
$phContent = array($user_avatar, $forumpath.'/viewtopic.php?t='.$topic_id, $topic_title, $topic_poster_name, $datum, $post_content, $topic_replies, $user_email, $user_sig, $user_rank);
$output .= str_replace($placeholders, $phContent, $template);
}
// output for modX
return $output;
?>
<?php $cssTpl=(isset($cssTpl))? $cssTpl: 'assets/snippets/phpbb/css.css'; //to make possible define css chunk, file, string in snippet param $topicTpl=(isset($topicTpl))? $topicTpl: 'assets/snippets/phpbb/topicTpl.html'; //template chunk for the topic/post items ?>
<?php
if(!function_exists(phpbbGetTemplate)) {
function phpbbGetTemplate($tpl){
global $modx;
$template = "";
if ($modx->getChunk($tpl) != "") {
$template = $modx->getChunk($tpl);
} else if(is_file($tpl)) {
$template = file_get_contents($tpl);
} else {
$template = $tpl;
}
return $template;
}
}
?>
<?php
if ($cssTpl != "") {
if ($modx->getChunk($cssTpl) != "") {
$modx->regClientCSS($modx->getChunk($cssTpl));
} else if (file_exists($modx->config['base_path'].$cssTpl)) {
$modx->regClientCSS('<link rel="stylesheet" href="'. $modx->config['base_url'].$cssTpl.'" type="text/css" media="screen" />');
} else {
$modx->regClientCSS($cssTpl);
}
}
?><?php $phpbb_lang['writtenby']='written by:'; $phpbb_lang['gototopic']='go to topic'; $phpbb_lang['quote']='Quote:'; $phpbb_lang['code']='Code:'; $phpbb_lang['replytxt']=' replies'; $phpbb_lang['by']='Quote By:'; $phpbb_lang['on']='On:'; $phpbb_lang['gototopiclink']='<i>... <b><a href=[+topicUrl+] target=_blank>[+lang.gototopic+]</a></b></i>'; ?>
<?php if( strlen($post_content)>$maxchar ) $post_content = substr($post_content, 0, $maxchar) . "<i>... <b><a href=$forumpath/viewtopic.php?t=$topic_id target=_blank>$gototopic</a></b></i>"; echo " <div class='postbase'> <div class='top'> <div class='topleft'><img src=$user_avatar alt=''/></div> <div class='topright'> <a href=$forumpath/viewtopic.php?t=$topic_id target=_blank><h3 class='toph3'>$topic_title</h3></a> $writtenby <b>$topic_poster_name</b> <br />$on $datum </div> </div> <div class='contentphpbb'> $post_content <br /> <p align='right'><a href=$forumpath/viewtopic.php?t=$topic_id target=_blank>$topic_replies $replytxt</a></p> <br /> </div> </div> "; ?>
<?php
//add link if needed
if( strlen($post_content)>$maxchar ) {
$post_content = substr($post_content, 0, $maxchar) . "[+lang.gototopiclink+]";
}
//get template
$template = phpbbGetTemplate($topicTpl);
//replace language placeholders
foreach ($phpbb_lang as $key => $value) {
$template = str_replace('[+lang.'.$key.'+]', $value, $template);
}
//replace content placeholders and append to $output
$placeholders = array('[+userAvatar+]', '[+topicUrl+]', '[+topicTitle+]', '[+topicPoster+]', '[+topicDate+]', '[+postContent+]', '[+replyCount+]');
$phContent = array($user_avatar, $forumpath.'/viewtopic.php?t='.$topic_id, $topic_title, $topic_poster_name, $datum, $post_content, $topic_replies);
$output .= str_replace($placeholders, $phContent, $template);
?>
<div class='postbase'> <div class='top'> <div class='topleft'><img src=[+user_avatar+] alt=''/></div> <div class='topright'> <a href=[+topicUrl+] target=_blank><h3 class='toph3'>[+topicTitle+]</h3></a> [+lang.writtenby+] <b>[+topicPoster+]</b> <br />[+lang.on+] [+topicDate+] </div> </div> <div class='contentphpbb'> [+postContent+] <br /> <p align='right'><a href=[+topicUrl+] target=_blank>[+replyCount+] [+lang.replytxt+]</a></p> <br /> </div> </div>
<?php
$post_content = str_replace("[quote:$bbcode_uid]", "<div class='quote'>$quote <br />", $post_content);
$post_content = str_replace("[code:1:$bbcode_uid]", "<div class='code'>$code
", $post_content);
$post_content = preg_replace("#\#si", "$by" , $post_content);
?>
<?php
$post_content = str_replace("", "<div class='quote'>$phpbb_lang['quote']
", $post_content);
$post_content = str_replace("[code:1:$bbcode_uid]", "<div class='code'>$phpbb_lang['code']<br />", $post_content); $post_content = preg_replace("#\[quote=\\\"(.*?)\\\":$bbcode_uid\]#si", "$phpbb_lang['by']" , $post_content); ?>
<?php
// snippet parameter
$lang = (isset($lang)) ? $lang : "en"; // default language english
$langfile = $modx->config['base_path'].'assets/snippets/phpbb/lang_'.$lang.'.php';
if(file_exists($langfile)){
include($langfile);
} else {
return 'phpbb snippet error: language file is missing!';
}
?>
<?php
/**
* ======================================================================================
* !!! IMPORTANT !!!
* ======================================================================================
*
* I had to change a line in the modx file "includes/document.parser.class.inc.php"
* in order to get this thing to work.
*
* Change
* $ds= @mysql_query($sql);
* to
* $ds= $this->dbQuery($sql);
*
* See http://modxcms.com/bugs/task/866
*
* Have fun with the script!
* Gigi
*
* ======================================================================================
* ======================================================================================
*
*
* ---------------------------------------------------------------------
* phpBB snippet v0.0.2
* ---------------------------------------------------------------------
*
* Original code (tnx for letting me using it) by:
* - Cyst
* - ColdIce aka Furiouz (http://clan12.com)
*
*
* Ported / re-coding for modX:
* - RWQ (http://crea-design.nl - htpp://sesil.nl }
*
* Also many many tnx to:
* - Doze - for making the placeholders and adding the TPL and CSS params
*
* Modifications for PHPBB3:
* - Christoph 'Gigi' Fuchs (http://cgf.at, gigi33 [at] gmx _dot_ at)
*
*
* ---------------------------------------------------------------------
* Documentation:
* ---------------------------------------------------------------------
*
*
* Functions:
* - Gets a x number of topics from a forum
* - Max char. to display
* - Template system
* - Select the language of the script (otherwise would the list be so short :P)
*
* For everyone who doesn't know how to find the ID of a certain forum:
* Follow the link of the forum you want to include, then look at the url: 'http://www.example.com/forum/viewforum.php?f=1' f=1 so id=1.
*
*
* Params:
*
* &forumid ID of the forum (in phpBB) in wich you want to fetch the post (default=1).
* &numberoftopics Number of posts you want to include.(default=5)
* &maxchar Max number of characters (leave empty for full article)
* &cssTpl Css path (default: assets/snippets/phpbb/style.css)
* &topicTpl path to yout TPL file (defaulr assets/snippets/phpbb/chunk.topic.tpl
*
*
* Example calls:
*
* [[phpbb? &forumid=`1` &numberoftopics=`1` &maxchar=`100` ]]
* [[phpbb? &forumid=`12` &numberoftopics=`6` ]]
* [[phpbb? &forumid=`7` &numberoftopics=`3` &maxchar=`350` &topicTpl=`assets/snippets/phpbb/chunk.topic.tpl` &cssTpl='assets/snippets/phpbb/style.css` ]]
*
*
* There is one Tpl file called chunk.topic.tpl, you can edit it or create a new one. list of placeholders:
*
* [+userAvatar+] --> containing the link to the ava of a user
* [+topicUrl+] --> containing a link to the topic
* [+topicPoster+]--> The topic poster
* [+topicTitle+] --> Topic Title
* [+topicDate+] --> Date of publishing the topic
* [+postContent+]--> The topic text
* [+replyCount+] --> The number of replies
* [+userRank+] --> The rank of a user
* [+userEmail+] --> User Email (in text so make link with html command mailto)
* [+userSig+] --> User Signature
*
* Language specific placeholders:
*
* [+lang.writtenby+]
* [+lang.on+]
* [+lang.replytxt+]
*
*/
/** -------------------------------------------------------------------
* Configuration
*/
$forumpath = 'forum'; // path to your phpbb3 install (do not at a trailing slash)
$snipdir = 'assets/snippets/phpbb'; // path to your phpbb snippet (do not add a trailing slash)
$dbname = 'dbname'; // Database Name
$dbuser = 'dbuser'; // Your MySQL username
$dbpass = '*********'; // Your MySQ password
$dbhost = 'localhost'; // MySQL host (mostly: localhost)
$date = '%d.%m.%Y'; // Time and Ddte default: Days - Month - Year
// (see http://php.net/date for formating strings)
$lang = 'de'; // Language (available: en, de)
/** -------------------------------------------------------------------
* End of configuration
* Don't change the following code if you don't know what you're doing.
*/
// Language:
$languagefile = $snipdir . '/' . $lang . '.lang.inc.php';
if (!file_exists($languagefile)) {
return "<strong>[PHPBB Snippet] Error:</strong> Language file '$languagefile' not found. Language: '$lang'.<br />";
}
include_once($languagefile);
$phpbb_lang['gototopiclink']='<i>... <b><a href=[+topicUrl+] target=_blank>[+lang.gototopic+]</a></b></i>';
// param list:
$forumid = (isset($forumid)) ? $forumid : 1;
$numberoftopics = (isset($numberoftopics)) ? $numberoftopics : 5;
$maxchar = (isset($maxchar)) ? $maxchar : true;
$cssTpl = (isset($cssTpl)) ? $cssTpl : $snipdir . '/style.css'; // template css
$topicTpl = (isset($topicTpl)) ? $topicTpl : $snipdir . '/chunk.topic.tpl'; // template chunk
// TPL code
if(!function_exists(phpbbGetTemplate)) {
function phpbbGetTemplate($tpl){
global $modx;
$template = "";
if ($modx->getChunk($tpl) != "") {
$template = $modx->getChunk($tpl);
} else if(is_file($tpl)) {
$template = file_get_contents($tpl);
} else {
$template = $tpl;
}
return $template;
}
}
// css code:
if ($cssTpl != "") {
if ($modx->getChunk($cssTpl) != "") {
$modx->regClientCSS($modx->getChunk($cssTpl));
} else if (file_exists($modx->config['base_path'].$cssTpl)) {
$modx->regClientCSS('<link rel="stylesheet" href="'. $modx->config['base_url'].$cssTpl.'" type="text/css" media="screen" />');
} else {
$modx->regClientCSS($cssTpl);
}
}
// Create a mySQL connection
mysql_connect("$dbhost", "$dbuser","$dbpass");
mysql_select_db("$dbname");
// Result 1. ( get topic info )
$result = mysql_query("SELECT topic_id,topic_title,topic_poster,topic_time,topic_replies,topic_first_post_id FROM phpbb_topics WHERE forum_id='$forumid' ORDER BY topic_id DESC LIMIT $numberoftopics ");
while(list($topic_id,$topic_title,$topic_poster,$topic_time,$topic_replies,$topic_first_post_id) = mysql_fetch_array($result)) {
// Result 2. ( get user info (incl. avatar) )
$result2 = mysql_query("SELECT username,user_avatar,user_email,user_sig,user_rank FROM phpbb_users WHERE user_id='$topic_poster'");
list($topic_poster_name,$user_avatar,$user_email,$user_sig,$user_rank) = mysql_fetch_array($result2);
// Result 3. ( get topic text and BB code )
$result3 = mysql_query("SELECT bbcode_uid,post_text FROM phpbb_posts WHERE post_id='$topic_first_post_id'");
list($bbcode_uid,$post_content) = mysql_fetch_array($result3);
$post_content = str_replace("{SMILIES_PATH}", "$forumpath/images/smilies", $post_content);
// Replace BB code with (x)HTML code
$post_content = preg_replace("/\\n/",'<br />', $post_content);
$post_content = str_replace("[quote:$bbcode_uid]", "<div class='quote'>$quote <br />", $post_content);
$post_content = str_replace("[/quote:$bbcode_uid]", "</div>", $post_content);
$post_content = str_replace("[code:1:$bbcode_uid]", "<div class='code'>$code
", $post_content);
$post_content = str_replace("[/code:1:$bbcode_uid]", "</div>", $post_content);
$post_content = preg_replace("#\[quote=\\\"(.*?)\\\":$bbcode_uid\]#si", "$by" , $post_content);
$post_content = str_replace("[list:$bbcode_uid]", "<ul>", $post_content);
$post_content = str_replace("[*:$bbcode_uid]", "<li>", $post_content);
$post_content = str_replace("[/list:u:$bbcode_uid]", "</ul>", $post_content);
$post_content = str_replace("[/list:o:$bbcode_uid]", "</ol>", $post_content);
$post_content = preg_replace("/\[list=([a1]):$bbcode_uid\]/si", "<ol type=\\1>", $post_content);
$post_content = str_replace("[b:$bbcode_uid]", "<strong>", $post_content);
$post_content = str_replace("[/b:$bbcode_uid]", "</strong>", $post_content);
$post_content = str_replace("[i:$bbcode_uid]", "<i>", $post_content);
$post_content = str_replace("[/i:$bbcode_uid]", "</i>", $post_content);
$post_content = str_replace("[u:$bbcode_uid]", "<u>", $post_content);
$post_content = str_replace("[/u:$bbcode_uid]", "</u>", $post_content);
$post_content = preg_replace("/\[color=(\#[0-9A-F]{6}|[a-z]+):$bbcode_uid\]/si", "<font color=\\1>", $post_content);
$post_content = str_replace("[/color:$bbcode_uid]", "</font>", $post_content);
$post_content = preg_replace("/\[size=([1-2]?[0-9]):$bbcode_uid\]/si", "<font size=\\1>", $post_content);
$post_content = str_replace("[/size:$bbcode_uid]", "</font>", $post_content);
$post_content = str_replace("[img:$bbcode_uid]", "<img src=", $post_content);
$post_content = str_replace("[/img:$bbcode_uid]", " ' alt='' />", $post_content);
$post_content = preg_replace("/\[url=(.*):$bbcode_uid\](.*)\[\/url:$bbcode_uid\]/Usi", "<a href='\\1'>\\2</a>", $post_content);
$post_content = preg_replace("/\[url:$bbcode_uid\](.*)\[\/url:$bbcode_uid\]/Usi", "<a href='\\1'>\\1</a>", $post_content);
$user_avatar = "$forumpath/download.php?avatar=" . $user_avatar;
// date and stuff.
$datum = strftime ("$date", $topic_time + $timeadjust);
// Max char. code :
if( strlen($post_content)>$maxchar ) {
$post_content = substr($post_content, 0, $maxchar) . "[+lang.gototopiclink+]";
}
//get template
$template = phpbbGetTemplate($topicTpl);
//replace language placeholders
foreach ($phpbb_lang as $key => $value) {
$template = str_replace('[+lang.'.$key.'+]', $value, $template);
}
//replace content placeholders and append to $output
$placeholders = array('[+userAvatar+]', '[+topicUrl+]', '[+topicTitle+]', '[+topicPoster+]', '[+topicDate+]', '[+postContent+]', '[+replyCount+]', '[+userRank+]', '[+userEmail+]', '[+userSig+]');
$phpbbContent = array($user_avatar, $forumpath.'/viewtopic.php?t='.$topic_id, $topic_title, $topic_poster_name, $datum, $post_content, $topic_replies, $user_email, $user_sig, $user_rank);
$output .= str_replace($placeholders, $phpbbContent, $template);
}
// output for modX
return $output;
?>