Commit e135b718 authored by Ayolo's avatar Ayolo

faux rhum

parent 731d0322
......@@ -236,7 +236,6 @@ class forum extends basedb
if ( $user->is_valid() && $searchforunread )
{
$grps = $user->get_groups_csv();
$query .= "EXISTS( ".
"SELECT ".
"sujet.id_sujet ".
......@@ -248,7 +247,6 @@ class forum extends basedb
"LEFT JOIN frm_message AS message ON ( message.id_message = sujet.id_message_dernier ) ".
"LEFT JOIN frm_sujet_utilisateur AS sujet_util ON ( sujet_util.id_sujet=sujet.id_sujet AND sujet_util.id_utilisateur='".$user->id."' ) ".
"WHERE ".
"sujet.id_groupe IN ($grps) AND ".
"(sujet.id_forum=frm_forum.id_forum OR ".
"level1.id_forum=frm_forum.id_forum OR ".
"level2.id_forum=frm_forum.id_forum OR ".
......@@ -279,8 +277,9 @@ class forum extends basedb
{
$grps = $user->get_groups_csv();
$query .= "AND ((droits_acces_forum & 0x1) OR " .
"((droits_acces_forum & 0x10) AND id_groupe IN ($grps)) OR " .
"(id_groupe_admin IN ($grps))) ";
"((droits_acces_forum & 0x10) AND frm_forum.id_groupe IN ($grps)) OR " .
"(id_groupe_admin IN ($grps))) "
"AND frm_sujet.id_groupe IN ($grps)";
}
$query .= "ORDER BY frm_forum.ordre_forum";
......@@ -296,6 +295,7 @@ class forum extends basedb
function get_sujets ( &$user, $st, $npp )
{
$grps = $user->get_groups_csv();
$query = "SELECT frm_sujet.*, ".
"frm_message.date_message, " .
"frm_message.id_message, " .
......@@ -309,7 +309,6 @@ class forum extends basedb
CONCAT(premier_auteur.prenom_utl,' ',premier_auteur.nom_utl)
) AS `nom_utilisateur_premier_auteur`, " .
"premier_auteur.id_utilisateur AS `id_utilisateur_premier`, ";
if ( !$user->is_valid() )
$query .= "0 AS `nonlu`, 0 AS `etoile` ";
elseif( is_null($user->tout_lu_avant))
......@@ -336,6 +335,8 @@ class forum extends basedb
$query .= "WHERE " .
"id_forum='".$this->id."' ";
if ( !$this->is_admin( $user ) )
$query .= "AND id_groupe IN ($grps) ";
$query .= "ORDER BY frm_sujet.type_sujet=2 DESC, frm_message.date_message DESC ";
$query .= "LIMIT $st, $npp";
......
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