Nous utilisons sur la page d'accueil de notre site associatif un MOD récupéré sur phpbb-fr.com, mais ceux-ci ne veulent plus en entendre parler.
Il s'agit d'un plug-in phpBB qui affiche les 5 derniers posts de nos forums sur la home de notre site :
Ce plug-in PHP est imbriqué en include sur l'accueil :
Code : Tout sélectionner
<?php
// Session
// $user->session_begin();
$auth->acl($user->data);
$user->setup();
$forum_id = request_var('forum_id', 0);
$sql = 'SELECT forum_id, topic_id, topic_time, topic_title, topic_views, topic_replies, topic_poster, topic_first_poster_name, topic_first_poster_colour, topic_last_post_id, topic_last_poster_id, topic_last_poster_name, topic_last_poster_colour, topic_last_post_time FROM ' . TOPICS_TABLE . ' ORDER BY topic_last_post_time DESC';
if ( $forum_id )
{
$sql = str_replace(TOPICS_TABLE, TOPICS_TABLE . ' WHERE forum_id = ' . (int) $forum_id, $sql);
}
$result = $db->sql_query_limit($sql, 5);
echo '<table width="100%" class="newsforum">';
echo '<tr>';
echo '<th align="left">Sujets</th>';
echo '<th align="center">Réponses</th>';
echo '<th align="center">Vus</th>';
echo '<th align="right">Dernier message</th>';
echo '</tr>';
while ( $row = $db->sql_fetchrow($result) )
{
$row['topic_title'] = utf8_encode_ncr($row['topic_title']);
$row['topic_first_poster_name'] = utf8_encode_ncr($row['topic_first_poster_name']);
$row['topic_last_poster_name'] = utf8_encode_ncr($row['topic_last_poster_name']);
$row['topic_time'] = $row['topic_time'];
$row['topic_last_post_time'] = $row['topic_last_post_time'];
$topic_id = (int) $row['topic_id'];
$view_topic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", 'f=' . ($row['forum_id'] ? $row['forum_id'] : $forum_id) . '&t=' . $topic_id);
echo '<tr>';
echo '<td align="left">';
echo '<a href="' . $view_topic_url . '" onclick="window.open(this.href); return false;">' . censor_text($row['topic_title']) . '</a><br />';
echo $user->lang['POST_BY_AUTHOR'] . ' ' . get_username_string('full', $row['topic_poster'], $row['topic_first_poster_name'], $row['topic_first_poster_colour']);
echo ' ' . $user->lang['POSTED_ON_DATE'] . ' ' . utf8_decode($user->format_date($row['topic_time'])) . '</td>';
echo '<td align="center">' . $row['topic_replies'] . '</td>';
echo '<td align="center">' . $row['topic_views'] . '</td>';
echo '<td align="right">' . $user->lang['POST_BY_AUTHOR'] . ' ' . get_username_string('full', $row['topic_last_poster_id'], $row['topic_last_poster_name'], $row['topic_last_poster_colour']);
echo ' <a href="' . $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'] . '" onclick="window.open(this.href); return false;"><img src="' . $phpbb_root_path . 'styles/' . $user->theme['imageset_path'] . '/imageset/icon_topic_latest.gif" border="0" alt="' . $user->lang['VIEW_LATEST_POST'] . '" title="' . $user->lang['VIEW_LATEST_POST'] . '" />' . '</a><br />';
// Code WDA - echo ' <a href="' . $view_topic_url . '&p=' . $row['topic_last_post_id'] . '#p' . $row['topic_last_post_id'] . '" target="_blank"><img src="' . $phpbb_root_path . 'styles/' . $user->theme['imageset_path'] . '/imageset/icon_topic_latest.gif" border="0" alt="' . $user->lang['VIEW_LATEST_POST'] . '" title="' . $user->lang['VIEW_LATEST_POST'] . '" />' . '</a><br />';
echo $user->lang['POSTED_ON_DATE'] . ' ' . utf8_decode($user->format_date($row['topic_last_post_time'])) . '</td>';
echo '</tr>';
}
echo '</table>';
?>
Code : Tout sélectionner
<?php
define('IN_PHPBB', true);
// $phpbb_root_path = './forum/';
$phpbb_root_path = defined('PHPBB_ROOT_PATH') ? PHPBB_ROOT_PATH : './forum/';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include $phpbb_root_path . 'common.' . $phpEx;
$user->session_begin();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html dir="ltr">
<?php
$descriheader = "Association pour la preservation, la conservation et la restauration du patrimoine numerique. Premier musee virtuel Francophone de l'informatique & des jeux video, la WDA est une association a but non lucratif, regie par la loi du 1er juillet 1901. Fruit de la rencontre entre deux bidouilleurs de carcasses informatiques passionnes, l'association se veut aussi presente aupres des utilisateurs neophytes, en leurs apportant l'aide d'un forum de discussion, en mettant a leur disposition un espace de telechargements (freewares, emulateurs, drivers, etc.), un grand lexique, des fiches de procedures et d'assistance, un espace de destockage, des conseils materiels ou logiciels, tout en cherchant a retracer l'histoire du numerique !";
$menuhaut = "menuh.php";
$menugauche = "menug.php";
$pub = "pub.php";
(...)
$rep = "./contenu";
$pageinc = "$rep/".$_GET[page].".php";
//test si page non vide mais fichier n'existe pas
if (!file_exists($pageinc) && $_GET[page] != '')
{
$pageinc = "errors/404.php";
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="fr-FR">
<meta http-equiv="pics-label" content='(pics-1.1 "http://www.icra.org/ratingsv02.html" l gen true for "http://wda-fr.org" r (nz 1 vz 1 lz 1 oz 1 ca 1 cb 1))'>
<?php require_once './title.php'; ?>
<title><?php echo $titre; ?></title>
<meta name="robots" content="index,follow,all">
<meta name="rating" content="General">
<meta name="distribution" content="Global">
<meta name="Date-Creation-yyyymmdd" content="19971020">
<meta name="Date-Revision-yyyymmdd" content="20131124">
<meta name="revisit-after" content="7 days">
<?php require_once './descriheader.php'; ?>
(...)
<h2 align="left" id="pageName" class="atype2"><a href="http://forum.wda-fr.org/search.php?search_id=active_topics" target="_blank">Dernières contributions</a> sur <a href="http://forum.wda-fr.org" name="Forum" target="_blank">nos forums de discussions</a> :</h2>
<div align="center"><?php include $news; ?></div>
(...)Voici le code situé aux alentours de la ligne 219 de ce fichu theme pour mobile :[phpBB Debug] PHP Warning: in file [ROOT]/includes/mobile.php on line 219: Cannot modify header information - headers already sent by (output started at /homepages/19/d179416033/htdocs/WDA/index.php:14)
Code : Tout sélectionner
(...)
/**
* Set cookie value
*
* param string $value Cookie value
* param bool $long If true, cookie will be set for full duration. If false, cookie will be set for browser session duration
*/
protected static function set_cookie($value, $long = true)
{
global $config;
$cookietime = ($long && empty($_SERVER['HTTP_DNT'])) ? time() + (($config['max_autologin_time']) ? 86400 * (int) $config['max_autologin_time'] : 31536000) : 0;
$name_data = rawurlencode(self::$cookie_var) . '=' . rawurlencode($value);
$expire = ($cookietime) ? gmdate('D, d-M-Y H:i:s \\G\\M\\T', $cookietime) : '';
$domain = (!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain'];
header('Set-Cookie: ' . $name_data . (($cookietime) ? '; expires=' . $expire : '') . '; path=' . $config['cookie_path'] . $domain . ((!$config['cookie_secure']) ? '' : '; secure') . '; HttpOnly', false);
}
(...)A vous lire,