1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<title> News </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Language" content="fr" />
<link rel="StyleSheet" type="text/css" href="style.css" />
</head>
<div id="conteneur">
<div id="contenu">
<?php
define('IN_PHPBB', true);
define('IN_SITE', true);
$phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
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('viewtopic', 0);
$host = '****';
$user = '****';
$pass = '****';
$bdd = '****';
mysql_connect($host, $user, $pass);
mysql_select_db("$bdd") or die('Impossible de se connecter');
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_news = '" . TRUE . "'
AND p.topic_id = t.topic_id
AND p.forum_id = f.forum_id
AND f.forum_id = t.forum_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);
$subject = smiley_msg($subject);
//Affichage du titre
echo '<h5>'.$subject.'</h5>';
$message = $data['post_text'];
$message = censor_msg($message);
if ($data['bbcode_bitfield'])
{
$bbcode->bbcode_second_pass($message, $data['bbcode_uid'], $data['bbcode_bitfield']);
}
/*
Pseudo Fix du parse du BBcode Quote...
$get_text = preg_match_all( '`<blockquote class="uncited"><div>(.*)`Us' , $message, $words);
if ($words)
{
foreach($words[0] as $val)
{
$message = $message.'</div></blockquote>';
}
}
*/
$message = nl2br_msg($message);
$message = smiley_msg($message);
$message = utf8_decode($message);
//Affichage du contenu de la news
echo '<p>'.$message.'</p>';
//Affichage de l'auteur
echo '<h4>Poster par <a href="'.$phpbb_root_path.'memberlist.php?mode=viewprofile&u=2'.$data['user_id'].'">'.ucfirst(strtolower($data['topic_first_poster_name'])).'</a>';
//De l'heure
echo ' le ' .$tmp[date] =strftime(" %d/%m/%Y, %T",$data[post_time]).' - ';
//Des commentaires
echo '<a href="'.$phpbb_root_path.'viewtopic.php?t='.$data['topic_id'].'"> ['.$data['topic_replies'].'] commentaire(s)</a><br></br><img src="fond/line_news.jpg"></h4>';
//Si on atteints 5 news, on arrête
if($j >= 5)
{
break;
}
$j++;
}
@mysql_free_result($req);
?>
</div>
</html> |
Partager