Changeset 205
- Timestamp:
- 07/02/08 22:15:38 (2 months ago)
- Location:
- ez_publish/ezfluxbb/trunk
- Files:
-
- 3 modified
-
classes/ezfluxbb.php (modified) (1 diff)
-
classes/ezfluxbbfetchfonctions.php (modified) (2 diffs)
-
modules/ezfluxbb/function_definition.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']); -
ez_publish/ezfluxbb/trunk/classes/ezfluxbbfetchfonctions.php
r204 r205 100 100 * @return array 101 101 */ 102 function fetchTopics( $forum_id_filter_type, $forum_id_filter_array, $limit, $offset, $sort_by, $g et_first_message )102 function fetchTopics( $forum_id_filter_type, $forum_id_filter_array, $limit, $offset, $sort_by, $group_id, $get_first_message ) 103 103 { 104 104 $sortingString = 't.posted'; … … 154 154 'offset' => $offset, 155 155 'sort_by' => $sortingString . ' ' . $sortingOrder, 156 'group_id' => $group_id, 156 157 'get_first_message' => $get_first_message); 157 158 -
ez_publish/ezfluxbb/trunk/modules/ezfluxbb/function_definition.php
r204 r205 106 106 'default' => array( 't.posted', false ) 107 107 ), 108 array( 'name' => 'group_id', 109 'type' => 'integer', 110 'required' => false, 111 'default' => false 112 ), 108 113 array( 'name' => 'get_first_message', 109 114 'type' => 'boolean',
