Skip to:
Content

bbPress.org

Changeset 21


Ignore:
Timestamp:
12/28/2004 09:56:41 PM (17 years ago)
Author:
matt
Message:

Added RSS support, used gmdate everywhere. Fixes #3.

Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/bb-includes/functions.php

    r18 r21  
    1919}
    2020
    21 function get_thread( $topic, $page = 0 ) {
    22     global $bbdb, $bb;
     21function get_thread( $topic, $page = 0, $reverse = 0 ) {
     22    global $bbdb;
    2323
    2424    $limit = bb_get_option('page_topics');
    2525    if ( $page )
    2626        $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");
    2830}
    2931
     
    4244        $limit = ($limit * $page) . ", $limit";
    4345    return $bbdb->get_results("SELECT * FROM $bbdb->topics $where ORDER BY topic_time DESC LIMIT $limit");
     46}
     47
     48function 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");
    4452}
    4553
  • trunk/bb-includes/template-functions.php

    r19 r21  
    152152}
    153153
     154function topic_rss_link( $id = 0 ) {
     155    echo bb_apply_filters('topic_link', get_topic_rss_link($id) );
     156}
     157
     158function get_topic_rss_link( $id = 0 ) {
     159    global $topic;
     160
     161    if ( $id )
     162        $topic = get_topic( $id );
     163
     164    if ( bb_get_option('mod_rewrite') )
     165        $link = bb_get_option('uri') . $topic->topic_id . '/rss/';
     166    else
     167        $link = bb_get_option('uri') . "rss.php?topic=$topic->topic_id";
     168
     169    return bb_apply_filters('get_topic_rss_link', $link);
     170}
     171
    154172function get_topic_link( $id = 0 ) {
    155     global $topic, $bb;
     173    global $topic;
    156174
    157175    if ( $id )
     
    159177
    160178    if ( bb_get_option('mod_rewrite') )
    161         $link = bb_get_option('path') . $topic->topic_id;
    162     else
    163         $link = bb_get_option('path') . "topic.php?id=$topic->topic_id";
     179        $link = bb_get_option('uri') . $topic->topic_id;
     180    else
     181        $link = bb_get_option('uri') . "topic.php?id=$topic->topic_id";
    164182
    165183    return bb_apply_filters('get_topic_link', $link);
     
    199217
    200218function topic_date( $format = '', $id = 0 ) {
    201     echo date( $format, get_topic_timestamp( $id ) );
     219    echo gmdate( $format, get_topic_timestamp( $id ) );
    202220}
    203221
     
    280298
    281299function post_date( $format ) {
    282     echo date( $format, get_post_timestamp() );
     300    echo gmdate( $format, get_post_timestamp() );
    283301}
    284302
  • trunk/bb-templates/profile.php

    r18 r21  
    55<dl id="userinfo">
    66<dt>Member Since</dt>
    7 <dd><?php echo date('F j, Y', $ts); ?> (<?php echo bb_since($ts); ?>)</dd>
     7<dd><?php echo gmdate('F j, Y', $ts); ?> (<?php echo bb_since($ts); ?>)</dd>
    88<?php
    99if ($user->user_website) :
  • trunk/bb-templates/search.php

    r16 r21  
    1717?>
    1818<li><h4><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></h4>
    19 <small><?php echo $count; ?> replies &#8212; Last reply <?php echo date('F j, Y', $topic->posttime); ?> </small>
     19<small><?php echo $count; ?> replies &#8212; Last reply <?php echo gmdate('F j, Y', $topic->posttime); ?> </small>
    2020</li>
    2121<?php endforeach; ?>
  • trunk/bb-templates/topic.php

    r10 r21  
    33<?php login_form(); ?>
    44
    5 <h2><a href="<?php option('uri'); ?>"><?php option('name'); ?></a> &raquo; <a href="<?php forum_link(); ?>"><?php forum_name(); ?></a></h2>
    6 <h3><?php topic_title(); ?></h3>
     5<h3><a href="<?php option('uri'); ?>"><?php option('name'); ?></a> &raquo; <a href="<?php forum_link(); ?>"><?php forum_name(); ?></a></h3>
     6<h2><?php topic_title(); ?></h2>
    77<?php if ($posts) : ?>
    88<div class="nav">
     
    2828</ol>
    2929<div class="clearit"><br style=" clear: both;" /></div>
     30<p><a href="<?php topic_rss_link(); ?>">RSS feed for this thread</a></p>
    3031<div class="nav">
    3132<?php topic_pages(); ?>
Note: See TracChangeset for help on using the changeset viewer.