Changeset 74
- Timestamp:
- 03/18/2005 07:05:50 PM (21 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 6 edited
-
bb-admin/sticky.php (added)
-
bb-admin/upgrade-schema.php (modified) (1 diff)
-
bb-includes/functions.php (modified) (3 diffs)
-
bb-includes/template-functions.php (modified) (1 diff)
-
bb-templates/forum.php (modified) (1 diff)
-
bb-templates/topic.php (modified) (2 diffs)
-
forum.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bb-admin/upgrade-schema.php
r73 r74 38 38 topic_open tinyint(1) NOT NULL default '1', 39 39 topic_last_post_id bigint(20) NOT NULL default '1', 40 topic_sticky tinyint(1) NOT NULL default '0', 40 41 topic_posts bigint(20) NOT NULL default '0', 41 42 PRIMARY KEY (topic_id), -
trunk/bb-includes/functions.php
r73 r74 50 50 $limit = ($limit * $page) . ", $limit"; 51 51 return $bbdb->get_results("SELECT * FROM $bbdb->topics WHERE topic_status = 0 $where ORDER BY topic_time DESC LIMIT $limit"); 52 } 53 54 function get_sticky_topics( $forum = 0, $page = 0 ) { 55 global $bbdb, $bb; 56 $where = ''; 57 if ( $forum ) 58 $where = "AND forum_id = $forum"; 59 return $bbdb->get_results("SELECT * FROM $bbdb->topics WHERE topic_status = 0 AND topic_sticky = '1' $where ORDER BY topic_time DESC"); 52 60 } 53 61 … … 419 427 } 420 428 429 function bb_stick_topic ( $topic_id ) { 430 global $bbdb; 431 bb_do_action('stick_topic', $topic_id); 432 return $bbdb->query("UPDATE $bbdb->topics SET topic_sticky = '1' WHERE topic_id = $topic_id"); 433 } 434 435 function bb_unstick_topic ( $topic_id ) { 436 global $bbdb; 437 bb_do_action('unstick_topic', $topic_id); 438 return $bbdb->query("UPDATE $bbdb->topics SET topic_sticky = '0' WHERE topic_id = $topic_id"); 439 } 440 421 441 function bb_update_post( $post, $post_id ) { 422 442 global $bbdb, $current_user; … … 507 527 $topic = get_topic( $topic_id ); 508 528 if ( 1 == $topic->topic_open ) 529 return true; 530 else 531 return false; 532 } 533 534 function topic_is_sticky ( $topic_id ) { 535 $topic = get_topic( $topic_id ); 536 if ( 1 == $topic->topic_sticky ) 509 537 return true; 510 538 else -
trunk/bb-includes/template-functions.php
r73 r74 369 369 } 370 370 } 371 372 function topic_sticky_link() { 373 global $current_user; 374 if ( $current_user->user_type > 1 ) { 375 if ( topic_is_sticky( get_topic_id() ) ) 376 $text = 'Unstick topic'; 377 else 378 $text = 'Stick topic'; 379 echo "<a href='" . bb_get_option('uri') . 'bb-admin/sticky.php?id=' . get_topic_id() . "'>$text</a>"; 380 } 381 } 382 371 383 372 384 function post_author_id() { -
trunk/bb-templates/forum.php
r5 r74 19 19 </tr> 20 20 21 <?php if ( $stickies) : foreach ( $stickies as $topic ) : ?> 22 <tr<?php alt_class('topic'); ?>> 23 <td>Sticky: <a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td> 24 <td class="num"><?php topic_posts(); ?></td> 25 <td class="num"><?php topic_last_poster(); ?></td> 26 <td class="num"><small><?php topic_time(); ?></small></td> 27 </tr> 28 <?php endforeach; endif; ?> 21 29 22 30 <?php foreach ( $topics as $topic ) : ?> -
trunk/bb-templates/topic.php
r73 r74 5 5 <h3><a href="<?php option('uri'); ?>"><?php option('name'); ?></a> » <a href="<?php forum_link(); ?>"><?php forum_name(); ?></a></h3> 6 6 <h2><?php topic_title(); ?></h2> 7 <?php bb_do_action('under_title', ''); ?> 7 8 <?php if ($posts) : ?> 8 9 <div class="nav"> … … 41 42 <?php endif; ?> 42 43 <div class="admin"> 43 <?php topic_delete_link(); ?> <?php topic_close_link(); ?> 44 <?php topic_delete_link(); ?> <?php topic_close_link(); ?> <?php topic_sticky_link(); ?> 44 45 </div> 45 46 <?php get_footer(); ?> -
trunk/forum.php
r59 r74 15 15 die('Forum not found.'); 16 16 17 $topics = get_latest_topics( $forum_id, $page ); 17 $topics = get_latest_topics( $forum_id, $page ); 18 $stickies = get_sticky_topics( $forum_id ); 18 19 19 20 include('bb-templates/forum.php');
Note: See TracChangeset
for help on using the changeset viewer.