Commit 81085b16 authored by Ayolo's avatar Ayolo

bleh

parent 6fdb7cca
......@@ -36,7 +36,7 @@ define("SUJET_ANNONCESITE",4);
/**
* Sujet dans un forum
*/
class sujet extends stdentity
class sujet extends basedb
{
var $id_utilisateur;
......@@ -62,18 +62,18 @@ class sujet extends stdentity
function load_by_id ( $id )
{
$req = new requete($this->db, "SELECT * FROM `frm_sujet`
WHERE `id_sujet` = '" .
mysql_real_escape_string($id) . "'
LIMIT 1");
WHERE `id_sujet` = '" .
mysql_real_escape_string($id) . "'
LIMIT 1");
if ( $req->lines == 1 )
{
$this->_load($req->get_row());
return true;
}
$this->id = null;
return false;
{
$this->_load($req->get_row());
return true;
}
$this->id = null;
return false;
}
function _load($row)
......@@ -143,14 +143,14 @@ class sujet extends stdentity
"id_groupe"=>$this->id_groupe
));
if ( $req )
{
$this->id = $req->get_id();
$this->auto_user_star($forum,true);
return true;
}
$this->id = null;
if ( $req )
{
$this->id = $req->get_id();
$this->auto_user_star($forum,true);
return true;
}
$this->id = null;
return false;
}
// $forum->update_last_sujet();
......@@ -185,7 +185,7 @@ class sujet extends stdentity
"id_nouvelle"=>$this->id_nouvelle,
"id_catph"=>$this->id_catph,
"id_sondage"=>$this->id_sondage,
"id_groupe"=>$this->id_groupe
"id_groupe"=>$this->id_groupe
),
array("id_sujet"=>$this->id) );
......@@ -235,8 +235,8 @@ class sujet extends stdentity
return;
$req = new requete($this->db,
"SELECT `id_utilisateur` FROM `asso_membre` " .
"WHERE `asso_membre`.`date_fin` IS NULL AND `asso_membre`.`id_asso`='".$forum->id_asso."' ");
"SELECT `id_utilisateur` FROM `asso_membre` " .
"WHERE `asso_membre`.`date_fin` IS NULL AND `asso_membre`.`id_asso`='".$forum->id_asso."' ");
while ( list($id_utilisateur) = $req->get_row() )
{
......@@ -251,14 +251,14 @@ class sujet extends stdentity
/**
* Met à jour le dernier message posté et le nombre de messages
*/
function update_last_message ( &$forum )
function update_last_message ( &$forum )
{
$req = new requete($this->db,
"SELECT id_message ".
"FROM `frm_message` ".
"WHERE `id_sujet` = '". mysql_real_escape_string($this->id) . "' ".
"ORDER BY `date_message` DESC ".
"LIMIT 1");
"WHERE `id_sujet` = '". mysql_real_escape_string($this->id) . "' ".
"ORDER BY `date_message` DESC ".
"LIMIT 1");
if ( $req->lines == 0 )
{
......@@ -271,8 +271,8 @@ class sujet extends stdentity
$req = new requete($this->db,
"SELECT COUNT(*) ".
"FROM `frm_message` ".
"WHERE `id_sujet` = '". mysql_real_escape_string($this->id) . "' ");
"WHERE `id_sujet` = '". mysql_real_escape_string($this->id) . "' ");
list($this->nb_messages) = $req->get_row();
$req = new update ($this->dbrw, "frm_sujet",
......@@ -284,14 +284,14 @@ class sujet extends stdentity
function get_user_infos ( $id_utilisateur )
{
$req = new requete($this->db, "SELECT id_message_dernier_lu, etoile_sujet FROM `frm_sujet_utilisateur`
WHERE `id_sujet` = '".mysql_real_escape_string($this->id) . "'
AND `id_utilisateur` = '".mysql_real_escape_string($id_utilisateur) . "'
LIMIT 1");
if ( $req->lines == 0 )
return null;
return $req->get_row();
WHERE `id_sujet` = '".mysql_real_escape_string($this->id) . "'
AND `id_utilisateur` = '".mysql_real_escape_string($id_utilisateur) . "'
LIMIT 1");
if ( $req->lines == 0 )
return null;
return $req->get_row();
}
/**
......@@ -307,7 +307,7 @@ class sujet extends stdentity
if ( is_null($row) )
return null;
return $row['id_message_dernier_lu'];
return $row['id_message_dernier_lu'];
}
/**
......@@ -379,12 +379,12 @@ class sujet extends stdentity
$req = new requete($this->db,$query);
$rows = array();
while ( $row = $req->get_row() )
$rows[] = $row;
return $rows;
$rows = array();
while ( $row = $req->get_row() )
$rows[] = $row;
return $rows;
}
}
......
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