Voila un script que j'ai trouvé sur ce forum (je remercie d'ailleurs son auteur).
- Code: Tout sélectionner
<head><?php
define('IN_PHPBB', true);
define('IN_SITE', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : 'forum/';
$phpEx = "php";
include($phpbb_root_path . 'common.' . $phpEx);
include($phpbb_root_path . 'includes/functions_display.' . $phpEx);
include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
?>
<head/>
<body>
<?php
function obtain_word_list()
{
global $config, $user, $db;
$sql = 'SELECT word, replacement FROM ' . WORDS_TABLE;
$result = $db->sql_query($sql);
$censors = array();
while ($row = $db->sql_fetchrow($result))
{
$censors['match'][] = '#(?<!\w)(' . str_replace('\*', '\w*?', preg_quote($row['word'], '#')) . ')(?!\w)#i';
$censors['replace'][] = $row['replacement'];
}
$db->sql_freeresult($result);
return $censors;
}
function smiley_msg($text)
{
global $config, $phpbb_root_path;
return preg_replace('#<!\-\- s(.*?) \-\-><img src="\{SMILIES_PATH\}\/(.*?) \/><!\-\- s\1 \-\->#', '<img src="' . $phpbb_root_path . $config['smilies_path'] . '/\2 />', $text);
}
function nl2br_msg($text)
{
$text = str_replace(array("\n", "\r"), array('<br clear="all"/>', "\n"), $text);
return $text;
}
function censor_msg($text)
{
if (!isset($censors) || !is_array($censors))
{
$censors = obtain_word_list();
}
if (sizeof($censors))
{
return preg_replace($censors['match'], $censors['replace'], $text);
}
return $text;
}
$table_prefix = 'phpbb_';
$sql = "SELECT p.*, t.topic_replies, t.topic_first_poster_name
FROM phpbb_posts p, phpbb_forums f, phpbb_topics t
WHERE f.forum_id=2
AND p.topic_id = t.topic_id
AND p.forum_id = f.forum_id
AND f.forum_id = t.forum_id
AND p.post_id = t.topic_first_post_id
ORDER BY topic_time DESC";
$req = mysql_query($sql);
//Initialisation de la variable "qui compte les news"
$j = 1;
// Instantiate BBCode if need be
if ($bbcode_bitfield !== '')
{
$bbcode = new bbcode(base64_encode($bbcode_bitfield));
}
while($data = @mysql_fetch_array($req))
{
$subject = $data['post_subject']; //
$subject = censor_msg($subject); //Le titre de la news
$subject = smiley_msg($subject); //
$message = $data['post_text'];
$message = censor_msg($message);
if ($data['bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($message, $data['bbcode_uid'], $data['bbcode_bitfield']);
}
$message = nl2br_msg($message);
$message = smiley_msg($message);
$chaine_date = $message; // On a une chaîne
$array_chaine = explode('[suite]', $message); // On transforme cette chaîne en array
$message = $array_chaine[0];
$news = utf8_decode($message); //Le text de la news
$lien1 = $phpbb_root_path.'memberlist.php?mode=viewprofile&u='.$data['poster_id']; //Lien vers profil de l'auteur
$auteur = ucfirst(strtolower($data['topic_first_poster_name'])); //Nom de l'auteur
$time = date('d/m/y', $data['post_time']); //Quand sa a ete poste
$lien2 = $phpbb_root_path.'viewtopic.php?t='.$data['topic_id']; //Lien au topic de la news
$commentaire = $data['topic_replies']; //nombre de commentaire
echo "<table border=0 cellpadding=0 cellspacing=0>
<tr>
<td class=titre><a href=$lien2>$subject</a></td>
</tr>
<tr>
<td class=news>$news</td>
</tr>
<tr>
<td class=basauteur>Postée par <a href=$lien1>$auteur</a> le $time - <a href=$lien2> [$commentaire] commentaire(s)</a></td>
</tr>
<tr>
<td class=bas>----------------------------------------------------------</td>
</tr>
</table>";
//Si on atteints 5 news, on arrête
if($j >= 5)
{
break;
}
$j++;
}
@mysql_free_result($req);
?>
<table align="right" border=0 cellpadding=0 cellspacing=0>
<tr>
<td class="suite"><a href="phpBB3/viewforum.php?f=2">Voir les news suivantes >></a></td>
</tr>
</table>
<body/>
Cependant après avoir longuement cherché (même sur des sites Anglais {Si !Si } ) pour ajouter les avatars je ne trouve toujours pas la solution j'en fais donc appelle à vous.
Merci par avance.




