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)) { ...@@ -61,8 +61,6 @@ if (!$site->get_param ("forum_open", false)) {
$site->add_css("css/forum.css"); $site->add_css("css/forum.css");
$site->add_css("css/doku.css"); $site->add_css("css/doku.css");
$site->add_css("css/planning2.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")) if($site->user->is_in_group("ban_forum"))
{ {
...@@ -159,8 +157,14 @@ if ( isset($_REQUEST["setnosecret"]) ) ...@@ -159,8 +157,14 @@ if ( isset($_REQUEST["setnosecret"]) )
setcookie ("nosecret", $_REQUEST["setnosecret"], time() + 31536000, "/", $domain, 0); 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 $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) ) if ( !$forum->is_right($site->user,DROIT_LECTURE) )
{ {
...@@ -265,7 +269,7 @@ if ( $_REQUEST["action"] == "post" && !$forum->categorie ) ...@@ -265,7 +269,7 @@ if ( $_REQUEST["action"] == "post" && !$forum->categorie )
if ( $_REQUEST['page'] == 'delete' ) if ( $_REQUEST['page'] == 'delete' )
{ {
$site->allow_only_logged_users("forum"); $site->allow_only_logged_users("forum");
if ( $message->is_valid() ) if ( $message->is_valid() )
{ {
...@@ -327,7 +331,7 @@ if ( $_REQUEST['page'] == 'delete' ) ...@@ -327,7 +331,7 @@ if ( $_REQUEST['page'] == 'delete' )
elseif ((($forum->is_admin($site->user)) || ($message->id_utilisateur == $site->user->id)) elseif ((($forum->is_admin($site->user)) || ($message->id_utilisateur == $site->user->id))
&& isset($_POST["___i_am_really_sure"])) && isset($_POST["___i_am_really_sure"]))
{ {
$raison = trim($_REQUEST["raison"]); $raison = trim($_REQUEST["raison"]);
if( empty($raison) && ($message->id_utilisateur != $site->user->id)) if( empty($raison) && ($message->id_utilisateur != $site->user->id))
{ {
$cts = new contents("Raison manquante", $cts = new contents("Raison manquante",
......
...@@ -38,7 +38,11 @@ if( isset($_REQUEST['id_utilisateur']) ...@@ -38,7 +38,11 @@ if( isset($_REQUEST['id_utilisateur'])
{ {
$user->load_by_service_ident($_REQUEST['id_utilisateur'],$_REQUEST['serviceident']); $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(); $rss->output();
......
...@@ -67,6 +67,7 @@ class utilisateur extends stdentity ...@@ -67,6 +67,7 @@ class utilisateur extends stdentity
var $tel_maison; var $tel_maison;
var $tel_portable; var $tel_portable;
var $alias; var $alias;
var $serviceident;
var $utbm; var $utbm;
var $etudiant; var $etudiant;
...@@ -403,6 +404,7 @@ class utilisateur extends stdentity ...@@ -403,6 +404,7 @@ class utilisateur extends stdentity
$this->tel_maison = $row['tel_maison_utl']; $this->tel_maison = $row['tel_maison_utl'];
$this->tel_portable = $row['tel_portable_utl']; $this->tel_portable = $row['tel_portable_utl'];
$this->alias = $row['alias_utl']; $this->alias = $row['alias_utl'];
$this->serviceident = $row['serviceident'];
$this->utbm = $row['utbm_utl']; $this->utbm = $row['utbm_utl'];
$this->etudiant = $row['etudiant_utl']; $this->etudiant = $row['etudiant_utl'];
$this->ancien_etudiant = $row['ancien_etudiant_utl']; $this->ancien_etudiant = $row['ancien_etudiant_utl'];
...@@ -2480,6 +2482,7 @@ L'équipe info AE"; ...@@ -2480,6 +2482,7 @@ L'équipe info AE";
if(!$this->is_valid()) if(!$this->is_valid())
return; return;
$uid=gen_uid(); $uid=gen_uid();
$this->serviceident = $uid;
new update($this->dbrw, new update($this->dbrw,
"utilisateurs", "utilisateurs",
array("serviceident"=>$uid), array("serviceident"=>$uid),
......
...@@ -35,20 +35,22 @@ class rssfeedforum extends rssfeed ...@@ -35,20 +35,22 @@ class rssfeedforum extends rssfeed
{ {
var $nb; var $nb;
var $db; 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; $this->db = $db;
if(is_null($user)) if(is_null($user))
$user=new utilisateur($this->db); $user=new utilisateur($this->db);
$this->user = &$user; $this->user = &$user;
$this->id_forum = $id_forum;
if (intval($nbmessage) < 0) if (intval($nbmessage) < 0)
$nbmessage = 50; $nbmessage = 50;
$this->nb = $nbmessage; $this->nb = $nbmessage;
$this->title = "Les " . $nbmessage . " derniers messages du forum de l'AE"; $this->title = "Les " . $nbmessage . " derniers messages du forum de l'AE";
$this->description = $this->title; $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->link = $this->pubUrl;
$this->rssfeed(); $this->rssfeed();
...@@ -66,6 +68,14 @@ class rssfeedforum extends rssfeed ...@@ -66,6 +68,14 @@ class rssfeedforum extends rssfeed
"(id_groupe_admin IN ($grps)) OR " . "(id_groupe_admin IN ($grps)) OR " .
"((droits_acces_forum & 0x100) AND frm_forum.id_utilisateur='".$this->user->id."')) "; "((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 $req = new requete ($this->db, "SELECT
COALESCE(`surnom_utbm`,CONCAT(`prenom_utl`,' ',`nom_utl`)) AS `nom_utilisateur` COALESCE(`surnom_utbm`,CONCAT(`prenom_utl`,' ',`nom_utl`)) AS `nom_utilisateur`
, `frm_message`.`id_message` , `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