Changeset 205 for ez_publish/ezfluxbb/trunk/classes/ezfluxbb.php
- Timestamp:
- 07/02/08 22:15:38 (6 months ago)
- Files:
-
- 1 modified
-
ez_publish/ezfluxbb/trunk/classes/ezfluxbb.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ez_publish/ezfluxbb/trunk/classes/ezfluxbb.php
r204 r205 203 203 $db = eZFluxBBDB::instance(); 204 204 205 $select = 't.id topic_id, t.poster, t.subject, t.num_replies'; 206 $leftJoin = ''; 205 $select = 't.id topic_id, t.subject topic_name, t.poster creator, t.num_replies, t.posted published, ' . 206 't.last_post_id, t.last_post last_post_published, t.last_poster last_post_creator'; 207 $leftJoin = array(); 208 $innerJoin = array(); 209 $where = array(); 210 211 /* Jointure groupe_id */ 212 if ( $params['group_id'] ) 213 { 214 $select .= ', f.id forum_id, f.forum_name'; 215 $innerJoin[] = 'INNER JOIN '.$this->fluxBBConfig['db_prefix'].'forums AS f ON f.id=t.forum_id'; 216 $leftJoin[] = 'LEFT JOIN '.$this->fluxBBConfig['db_prefix'].'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=' . $params['group_id'] . ')'; 217 $where[] = '(fp.read_forum IS NULL OR fp.read_forum=1)'; 218 $where[] = 't.moved_to IS NULL'; 219 } 207 220 208 221 /* Jointure avec les messages */ 209 222 if ( $params['get_first_message'] ) 210 223 { 211 $select .= ' ,p.id post_id, p.message'; 212 $leftJoin .= 'LEFT JOIN '.$this->fluxBBConfig['db_prefix'].'posts p ON (p.topic_id=t.id AND t.posted = p.posted)'; 224 $select .= ', p.id post_id, p.message'; 225 $leftJoin[] = 'LEFT JOIN '.$this->fluxBBConfig['db_prefix'].'posts p ON (p.topic_id=t.id AND t.posted = p.posted)'; 226 } 227 228 if ( count($where) > 0 ) 229 { 230 $where = ' AND ' . implode( ' AND ', $where) . ' '; 231 } 232 else 233 { 234 $where = ''; 213 235 } 214 236 215 237 $topics = $db->arrayQuery( 'SELECT ' . $select . ' ' . 216 238 'FROM '.$this->fluxBBConfig['db_prefix'].'topics t ' . 217 $leftJoin . ' ' . 218 'WHERE forum_id ' . $params['forum_id'] . ' ' . 239 implode( ' ', $innerJoin) . ' ' . 240 implode( ' ', $leftJoin) . ' ' . 241 'WHERE t.forum_id ' . $params['forum_id'] . ' ' . 242 $where . ' ' . 219 243 'ORDER BY ' . $params['sort_by'] .' ' . 220 244 'LIMIT ' . $params['offset'] . ', ' . $params['limit']);
