Commit de2f875d authored by Skia's avatar Skia

Make RSS forum specific

parent 7b2c10cc
......@@ -61,8 +61,6 @@ if (!$site->get_param ("forum_open", false)) {
$site->add_css("css/forum.css");
$site->add_css("css/doku.css");
$site->add_css("css/planning2.css");
$site->add_rss("Les 40 derniers messages du forum de l'AE",
"rss.php");
if($site->user->is_in_group("ban_forum"))
{
......@@ -159,8 +157,14 @@ if ( isset($_REQUEST["setnosecret"]) )
setcookie ("nosecret", $_REQUEST["setnosecret"], time() + 31536000, "/", $domain, 0);
if ( !$forum->is_valid() )
if ( !$forum->is_valid() ) {
$site->add_rss("Les 40 derniers messages du forum de l'AE",
"rss.php?id_utilisateur=".$site->user->id."&serviceident=".$site->user->serviceident);
$forum->load_by_id(1); // Le forum id=1 est la racine
} else {
$site->add_rss("Les 40 derniers messages du forum de l'AE",
"rss.php?id_utilisateur=".$site->user->id."&serviceident=".$site->user->serviceident."&id_forum=".$forum->id);
}
if ( !$forum->is_right($site->user,DROIT_LECTURE) )
{
......@@ -265,7 +269,7 @@ if ( $_REQUEST["action"] == "post" && !$forum->categorie )
if ( $_REQUEST['page'] == 'delete' )
{
$site->allow_only_logged_users("forum");
if ( $message->is_valid() )
{
......@@ -327,7 +331,7 @@ if ( $_REQUEST['page'] == 'delete' )
elseif ((($forum->is_admin($site->user)) || ($message->id_utilisateur == $site->user->id))
&& isset($_POST["___i_am_really_sure"]))
{
$raison = trim($_REQUEST["raison"]);
$raison = trim($_REQUEST["raison"]);
if( empty($raison) && ($message->id_utilisateur != $site->user->id))
{
$cts = new contents("Raison manquante",
......
......@@ -38,7 +38,11 @@ if( isset($_REQUEST['id_utilisateur'])
{
$user->load_by_service_ident($_REQUEST['id_utilisateur'],$_REQUEST['serviceident']);
}
$rss = new rssfeedforum($db, 40, $user);
$id_forum=null;
if (isset($_REQUEST['id_forum'])) {
$id_forum = mysql_real_escape_string($_REQUEST['id_forum']);
}
$rss = new rssfeedforum($db, 40, $user, $id_forum);
$rss->output();
......
......@@ -67,6 +67,7 @@ class utilisateur extends stdentity
var $tel_maison;
var $tel_portable;
var $alias;
var $serviceident;
var $utbm;
var $etudiant;
......@@ -403,6 +404,7 @@ class utilisateur extends stdentity
$this->tel_maison = $row['tel_maison_utl'];
$this->tel_portable = $row['tel_portable_utl'];
$this->alias = $row['alias_utl'];
$this->serviceident = $row['serviceident'];
$this->utbm = $row['utbm_utl'];
$this->etudiant = $row['etudiant_utl'];
$this->ancien_etudiant = $row['ancien_etudiant_utl'];
......@@ -2480,6 +2482,7 @@ L'équipe info AE";
if(!$this->is_valid())
return;
$uid=gen_uid();
$this->serviceident = $uid;
new update($this->dbrw,
"utilisateurs",
array("serviceident"=>$uid),
......
......@@ -35,20 +35,22 @@ class rssfeedforum extends rssfeed
{
var $nb;
var $db;
var $id_forum;
function rssfeedforum(&$db, $nbmessage = 50, &$user=null)
function rssfeedforum(&$db, $nbmessage = 50, &$user=null, $id_forum=null)
{
$this->db = $db;
if(is_null($user))
$user=new utilisateur($this->db);
$this->user = &$user;
$this->id_forum = $id_forum;
if (intval($nbmessage) < 0)
$nbmessage = 50;
$this->nb = $nbmessage;
$this->title = "Les " . $nbmessage . " derniers messages du forum de l'AE";
$this->description = $this->title;
$this->pubUrl = "http://ae.utbm.fr". $GLOBALS["wwwtopdir"]."forum2/";
$this->pubUrl = "https://ae.utbm.fr". $GLOBALS["wwwtopdir"]."forum2/";
$this->link = $this->pubUrl;
$this->rssfeed();
......@@ -66,6 +68,14 @@ class rssfeedforum extends rssfeed
"(id_groupe_admin IN ($grps)) OR " .
"((droits_acces_forum & 0x100) AND frm_forum.id_utilisateur='".$this->user->id."')) ";
}
if ( $this->id_forum != null ) {
if ($query != '') {
$query .= ' AND ';
} else {
$query .= ' WHERE ';
}
$query .= "(`frm_forum`.`id_forum` = ".$this->id_forum.")";
}
$req = new requete ($this->db, "SELECT
COALESCE(`surnom_utbm`,CONCAT(`prenom_utl`,' ',`nom_utl`)) AS `nom_utilisateur`
, `frm_message`.`id_message`
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment