Changeset 21 for trunk/bb-includes/functions.php
- Timestamp:
- 12/28/2004 09:56:41 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-includes/functions.php
r18 r21 19 19 } 20 20 21 function get_thread( $topic, $page = 0 ) {22 global $bbdb , $bb;21 function get_thread( $topic, $page = 0, $reverse = 0 ) { 22 global $bbdb; 23 23 24 24 $limit = bb_get_option('page_topics'); 25 25 if ( $page ) 26 26 $limit = ($limit * $page) . ", $limit"; 27 return $bbdb->get_results("SELECT * FROM $bbdb->posts WHERE topic_id = $topic ORDER BY post_time ASC LIMIT $limit"); 27 $order = ($reverse) ? 'DESC' : 'ASC'; 28 29 return $bbdb->get_results("SELECT * FROM $bbdb->posts WHERE topic_id = $topic ORDER BY post_time $order LIMIT $limit"); 28 30 } 29 31 … … 42 44 $limit = ($limit * $page) . ", $limit"; 43 45 return $bbdb->get_results("SELECT * FROM $bbdb->topics $where ORDER BY topic_time DESC LIMIT $limit"); 46 } 47 48 function get_latest_posts( $num ) { 49 global $bbdb; 50 $num = (int) $num; 51 return $bbdb->get_results("SELECT * FROM $bbdb->posts ORDER BY post_time DESC LIMIT $num"); 44 52 } 45 53
Note: See TracChangeset
for help on using the changeset viewer.