ragazzi non riesco a integrare il bbcode a questo script
in modo ke se su una discussione del forum inserisco un bbcode lo legga lo script e quindi lo codifichi per renderlo visibile e funzionale.
ki mi saprebbe aiutare?
Codice PHP:
<html><?php
//conf
define('IN_PHPBB', true);
$phpbb_root_path = 'theclub/'; //ES:PATH_FORUM/ (con slash finale "/")
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
include($phpbb_root_path . 'includes/bbcode.'.$phpEx);
// configurazione script
$dbname = 'my_username'; //Nome del database dove risiedono le tabelle del forum
$dbhost = 'localhost'; //Host del database
$dbuser = 'username'; //User per accedere al database
$dbpasswd = 'password'; //Pass per accedere al database
$prefix = 'phpbb_'; //Prefisso tabelle nel database con la "_" finale (es: phpbb_)
$forum = "id"; //inserisci qui l' id relativo al forum dove inserirai le news
$n_topic = nt; //Numero massimo di topic visualizzati in home page
//connessione al mysql
$connect = mysql_connect($dbhost, $dbuser, $dbpasswd) or die ("Errore Db Conn");
$db = mysql_select_db($dbname, $connect) or die ("Errore Db select");
//Recupero dati dal mysql
$query = "SELECT a.topic_id as tid, a.topic_title as name, a.topic_last_post_id as pid, d.post_text as message
FROM ".$prefix."topics a, ".$prefix."posts b, ".$prefix."forums c, ".$prefix."posts_text d
WHERE a.forum_id in (".$forum.")
and a.topic_id = b.topic_id
and a.forum_id = c.forum_id
and a.topic_time = b.post_time
and d.post_id = b.post_id
ORDER BY b.post_time desc
LIMIT 0, $n_topic";
$risultati = mysql_query($query, $connect);
while($mess = mysql_fetch_array($risultati, MYSQL_ASSOC)) {
$message = $mess[message];
$message = convSmilies($message);
$message = nl2br($message);
echo "<a href=\"".$phpbb_root_path."viewtopic.php?t=".$mess[tid]."\">".$mess[name]."</a><br><br>\n";
echo "".$message."<br />\n";
echo "<a href=\"".$phpbb_root_path."posting.php?mode=reply&t=".$mess[tid]."\">Commenta Questa News..</a><br>\n";
echo "<a href=\"".$phpbb_root_path."viewforum.php?f=".$forum[tid]."\">Archivio News..</a><br>\n";
}
//
// Converte i caratteri nei corrispondenti Smilies
//
function convSmilies($message)
{
static $orig, $repl;
if (!isset($orig))
{
global $board_config;
$orig = $repl = array();
$sql = "SELECT * FROM phpbb_smilies";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result))
$smilies[] = $row;
if (count($smilies))
usort($smilies, 'smiley_sort');
for ($i = 0; $i < count($smilies); $i++)
{
$orig[] = "/(?<=.\W|\W.|^\W)" . phpbb_preg_quote($smilies[$i]['code'], "/") . "(?=.\W|\W.|\W$)/";
$repl[] = '<img src="theclub/images/smiles/' . $smilies[$i]['smile_url'] . '" alt="' . $smilies[$i]['emoticon'] . '" border="0" />';
}
}
if (count($orig))
{
$message = preg_replace($orig, $repl, ' ' . $message . ' ');
$message = substr($message, 1, -1);
}
return $message;
}
mysql_close();
?>
</html>