id = DB::esc($id); } protected function getJournalResume() { if (empty($this->journal)) { $res = DB::aQuery('SELECT * FROM journaux WHERE id="'.$this->id.'";', false, DB::FETCH_ASSOC); $this->journal = $res[0]; } return $this->journal; } protected function resetEcrits() { $this->ecrits = false; } protected function getEcrit() { if ($this->ecrits === false) { $this->ecrits = DB::query('SELECT e.*, e2.texte AS texte_html FROM ecrits AS e, ecrits_html AS e2 WHERE e.journal="'.$this->id.'" AND e.id=e2.id AND e.status != '.Ecrit::OFFLINE.' ORDER BY e.date ASC;'); } return DB::fetchRow($this->ecrits, DB::FETCH_ASSOC); } protected function nbEcrits() { $res = DB::aQuery('SELECT COUNT(id) FROM ecrits WHERE journal = "'.$this->id.'" AND status != '.Ecrit::OFFLINE.';', false, DB::FETCH_NUM); return $res[0][0]; } protected function resetMessagesForum() { $this->messages = false; } protected function getMessageForum($all = false) { if ($this->messages === false) { $this->messages = DB::query('SELECT f.*, f2.texte AS texte_html FROM forums AS f, forums_textes AS f2 WHERE f.journal="'.$this->id.'" AND f.id = f2.id '.($all ? '' : 'AND f.status != '.Forum::OFFLINE).' ORDER BY f.id ASC;'); } return DB::fetchRow($this->messages, DB::FETCH_ASSOC); } protected function nbMessagesForum() { $res = DB::aQuery('SELECT COUNT(id) FROM forums WHERE journal = "'.$this->id.'";', false, DB::FETCH_NUM); return $res[0][0]; } } ?>