Ticket #520: install-image-build629.patch
| File install-image-build629.patch, 48.9 kB (added by sambauers, 2 years ago) |
|---|
-
bb-templates/style.css
old new 169 169 padding-bottom: 10px; 170 170 } 171 171 172 #front-page #main h2, h2.post-form, #userlogin, #currentfavorites, #register {172 #front-page #main h2, #category-page #main h2, h2.post-form, #userlogin, #currentfavorites, #register { 173 173 color: #333; 174 174 border-bottom: 1px solid #ddd; 175 175 margin: 0 0 10px; … … 180 180 181 181 .sticky { background: #a1d29a; } 182 182 183 tr.category { 184 background-color: #4fad4f; 185 color: #ffffff; 186 } 187 tr.category td { 188 border-top: 1px solid #91d691; 189 border-bottom: 1px solid #176e17; 190 } 191 .category:hover { 192 background-color: #339a33 !important; 193 } 194 tr.category a { 195 color: #cdf6cd; 196 } 197 tr.category h3 { 198 display: inline; 199 } 200 tr.category p { 201 margin: 0.3em 0 0 0; 202 } 203 183 204 /* Topic Page 184 205 =================================== */ 185 206 … … 196 217 197 218 .infobox ul li { padding-bottom: 3px; } 198 219 220 #topic-info { 221 float: left; 222 padding: 0 1em 0 0 ; 223 } 224 199 225 #topic-tags { 200 226 border-left: 1px solid #ccc; 201 227 float: right; 202 margin-top: -2em; 203 padding: 0 1em 1em; 228 padding: 0 0 0 1em ; 204 229 } 205 230 206 231 .nav { -
bb-templates/category.php
old new 1 <?php bb_get_header(); ?> 2 3 <h3 class="bbcrumb"><a href="<?php bb_option('uri'); ?>"><?php bb_option('name'); ?></a> » <?php category_name(); ?></h3> 4 5 <?php if ( $topics || $stickies ) : ?> 6 7 <h2><?php _e('Latest Discussions'); ?></h2> 8 9 <table id="latest"> 10 <tr> 11 <th><?php _e('Topic'); ?> — <?php new_topic(); ?></th> 12 <th><?php _e('Posts'); ?></th> 13 <th><?php _e('Last Poster'); ?></th> 14 <th><?php _e('Freshness'); ?></th> 15 </tr> 16 17 <?php if ( $stickies ) : foreach ( $stickies as $topic ) : ?> 18 <tr<?php topic_class(); ?>> 19 <td><?php _e('Sticky:'); ?> <big><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></big></td> 20 <td class="num"><?php topic_posts(); ?></td> 21 <td class="num"><?php topic_last_poster(); ?></td> 22 <td class="num"><small><?php topic_time(); ?></small></td> 23 </tr> 24 <?php endforeach; endif; ?> 25 26 <?php if ( $topics ) : foreach ( $topics as $topic ) : ?> 27 <tr<?php topic_class(); ?>> 28 <td><a href="<?php topic_link(); ?>"><?php topic_title(); ?></a></td> 29 <td class="num"><?php topic_posts(); ?></td> 30 <td class="num"><?php topic_last_poster(); ?></td> 31 <td class="num"><small><?php topic_time(); ?></small></td> 32 </tr> 33 <?php endforeach; endif; ?> 34 </table> 35 36 <?php endif; ?> 37 38 <h2><?php _e('Forums'); ?></h2> 39 40 <?php 41 add_filter('get_forums_where', 'get_forums_where_in_category_filter', 1); 42 $forums = get_forums(); 43 ?> 44 45 <p style="float:right;"><?php category_forums(); ?> <?php echo __ngettext('forum', 'forums', get_category_forums()); ?></p> 46 47 <p><?php category_description(); ?></p> 48 49 <?php if ( $forums ) : ?> 50 51 <table style="clear:both;" id="forumlist"> 52 53 <tr> 54 <th><?php _e('Main Theme'); ?></th> 55 <th><?php _e('Topics'); ?></th> 56 <th><?php _e('Posts'); ?></th> 57 </tr> 58 59 <?php foreach ( $forums as $forum ) : ?> 60 <tr<?php alt_class('forum'); ?>> 61 <td><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a> — <small><?php forum_description(); ?></small></td> 62 <td class="num"><?php forum_topics(); ?></td> 63 <td class="num"><?php forum_posts(); ?></td> 64 </tr> 65 <?php endforeach; // forums ?> 66 </table> 67 <?php endif; // forums ?> 68 69 <p><a href="<?php category_rss_link(); ?>"><?php _e('RSS feed for this category'); ?></a></p> 70 71 <?php bb_get_footer(); ?> -
bb-templates/topic.php
old new 1 1 <?php bb_get_header(); ?> 2 2 3 <h3 class="bbcrumb"><a href="<?php bb_option('uri'); ?>"><?php bb_option('name'); ?></a> » <a href="<?php forum_link(); ?>"><?php forum_name(); ?></a></h3> 3 <h3 class="bbcrumb"> 4 <a href="<?php bb_option('uri'); ?>"><?php bb_option('name'); ?></a> » 5 <?php if ( $category ): ?> 6 <a href="<?php category_link(); ?>"><?php category_name(); ?></a> » 7 <?php endif; ?> 8 <a href="<?php forum_link(); ?>"><?php forum_name(); ?></a> 9 </h3> 4 10 <div class="infobox"> 11 12 <div id="topic-info"> 5 13 <h2<?php topic_class( 'topictitle' ); ?>><?php topic_title(); ?></h2> <span id="topic_posts">(<?php topic_posts_link(); ?>)</span> 6 14 7 <?php topic_tags(); ?>8 9 15 <ul class="topicmeta"> 10 16 <li><?php printf(__('Started %1$s ago by %2$s'), get_topic_start_time(), get_topic_author()) ?></li> 11 17 <?php if ( 1 < get_topic_posts() ) : ?> … … 15 21 <li<?php echo $class;?> id="favorite-toggle"><?php user_favorites_link() ?></li> 16 22 <?php endif; do_action('topicmeta'); ?> 17 23 </ul> 24 </div> 25 26 <?php topic_tags(); ?> 27 18 28 <br clear="all" /> 19 29 </div> 20 30 <?php do_action('under_title', ''); ?> -
bb-templates/forum.php
old new 1 1 <?php bb_get_header(); ?> 2 2 3 <h3 class="bbcrumb"><a href="<?php bb_option('uri'); ?>"><?php bb_option('name'); ?></a> » <?php forum_name(); ?></h3> 3 <h3 class="bbcrumb"> 4 <a href="<?php bb_option('uri'); ?>"><?php bb_option('name'); ?></a> » 5 <?php if ( $category ): ?> 6 <a href="<?php category_link(); ?>"><?php category_name(); ?></a> » 7 <?php endif; ?> 8 <?php forum_name(); ?> 9 </h3> 4 10 5 11 <?php if ( $topics || $stickies ) : ?> 6 12 -
bb-templates/front-page.php
old new 40 40 </table> 41 41 <?php endif; ?> 42 42 43 <?php if ( $categories ) : ?> 44 43 45 <h2><?php _e('Forums'); ?></h2> 44 <table id="forumlist">45 46 47 <table style="clear:both;" id="forumlist"> 48 46 49 <tr> 47 50 <th><?php _e('Main Theme'); ?></th> 48 51 <th><?php _e('Topics'); ?></th> 49 52 <th><?php _e('Posts'); ?></th> 50 53 </tr> 51 54 55 <?php foreach ( $categories as $category ) : ?> 56 <?php 57 add_filter('get_forums_where', 'get_forums_where_in_category_filter', 1); 58 $forums = get_forums(); 59 ?> 60 <?php if ( $forums ) : ?> 61 <tr class="category"> 62 <td colspan="3"> 63 <h3><a href="<?php category_link(); ?>"><?php category_name(); ?></a></h3> — <?php category_forums(); ?> <?php echo __ngettext('forum', 'forums', get_category_forums()); ?> 64 <?php if ( get_category_description() ) : ?> 65 <p><small><?php category_description(); ?></small></p> 66 <?php endif; ?> 67 </td> 68 </tr> 69 70 52 71 <?php foreach ( $forums as $forum ) : ?> 53 72 <tr<?php alt_class('forum'); ?>> 54 73 <td><a href="<?php forum_link(); ?>"><?php forum_name(); ?></a> — <small><?php forum_description(); ?></small></td> 55 74 <td class="num"><?php forum_topics(); ?></td> 56 75 <td class="num"><?php forum_posts(); ?></td> 57 76 </tr> 58 <?php endforeach; ?> 77 <?php endforeach; // forums ?> 78 79 <?php endif; // forums ?> 80 81 <?php endforeach; // catagories ?> 82 59 83 </table> 60 84 85 <?php endif; // catagories ?> 86 61 87 <?php if ( $bb_current_user->ID ) : ?> 62 88 <div id="viewdiv"> 63 89 <h2><?php _e('Views'); ?></h2> -
bb-includes/capabilities.php
old new 37 37 'edit_users' => true, 38 38 'manage_tags' => true, // Rename, Merge, Destroy 39 39 'edit_others_favorites' => true, 40 'manage_categories' => true, 41 'delete_categories' => true, 40 42 'manage_forums' => true, // Add/Rename forum 41 43 'delete_forums' => true, // Delete forum 42 44 'manage_topics' => true, // Delete/Close/Stick … … 71 73 'edit_users' => true, //+ 72 74 'manage_tags' => true, //+ 73 75 'edit_others_favorites' => true, //+ 76 'manage_categories' => true, 77 'delete_categories' => true, 74 78 'manage_forums' => true, //+ 75 79 'delete_forums' => true, //+ 76 80 'manage_topics' => true, … … 404 408 case 'write_post': 405 409 $caps[] = 'write_posts'; 406 410 break; 411 case 'delete_category': 412 $caps[] = 'delete_categories'; 413 break; 407 414 case 'delete_forum': 408 415 $caps[] = 'delete_forums'; 409 416 break; -
bb-includes/cache.php
old new 137 137 return $posts; 138 138 } 139 139 140 function get_categories() { 141 global $bbdb; 142 143 $normal = true; 144 if ( '' != $where = apply_filters('get_categories_where', '') ) 145 $normal = false; 146 147 if ( $this->use_cache && $normal && file_exists(BBPATH . 'bb-cache/bb_categories') ) 148 return $this->read_cache(BBPATH . 'bb-cache/bb_categories'); 149 150 $categories = $bbdb->get_results("SELECT * FROM $bbdb->categories $where ORDER BY category_order"); 151 if ( $this->use_cache && $normal && $categories ) 152 $this->write_cache(BBPATH . 'bb-cache/bb_categories', $categories); 153 return $categories; 154 } 155 156 function get_category( $category_id ) { 157 global $bbdb; 158 $category_id = (int) $category_id; 159 160 $normal = true; 161 if ( '' != $where = apply_filters('get_category_where', '') ) 162 $normal = false; 163 164 if ( $this->use_cache && $normal && file_exists(BBPATH . 'bb-cache/bb_category-' . $category_id) ) 165 return $this->read_cache(BBPATH . 'bb-cache/bb_category-' . $category_id); 166 167 $category = $bbdb->get_row("SELECT * FROM $bbdb->categories WHERE category_id = $category_id $where"); 168 if ( $this->use_cache && $normal && $category ) 169 $this->write_cache(BBPATH . 'bb-cache/bb_category-' . $category_id, $category); 170 return $category; 171 } 172 140 173 function get_forums() { 141 174 global $bbdb; 142 175 143 176 $normal = true; 177 if ( '' != $join = apply_filters('get_forums_join', '') ) 178 $normal = false; 144 179 if ( '' != $where = apply_filters('get_forums_where', '') ) 145 180 $normal = false; 181 if ( 'ORDER BY forum_order' != $orderby = apply_filters('get_forums_orderby', 'ORDER BY forum_order')) 182 $normal = false; 146 183 147 184 if ( $this->use_cache && $normal && file_exists(BBPATH . 'bb-cache/bb_forums') ) 148 185 return $this->read_cache(BBPATH . 'bb-cache/bb_forums'); 149 186 150 $forums = $bbdb->get_results("SELECT * FROM $bbdb->forums $ where ORDER BY forum_order");187 $forums = $bbdb->get_results("SELECT * FROM $bbdb->forums $join $where $orderby"); 151 188 if ( $this->use_cache && $normal && $forums ) 152 189 $this->write_cache(BBPATH . 'bb-cache/bb_forums', $forums); 153 190 return $forums; -
bb-includes/functions.php
old new 1 1 <?php 2 2 3 function get_categories() { 4 global $bb_cache; 5 return apply_filters('get_categories',$bb_cache->get_categories()); 6 } 7 8 function get_category( $id ) { 9 global $bb_cache; 10 return $bb_cache->get_category( $id ); 11 } 12 3 13 function get_forums() { 4 14 global $bb_cache; 5 15 return apply_filters('get_forums',$bb_cache->get_forums()); … … 82 92 else return false; 83 93 } 84 94 95 function get_latest_category_topics( $category = 0, $page = 1, $exclude = '') { 96 global $bbdb, $bb_last_countable_query; 97 $category = (int) $category; 98 $page = (int) $page; 99 $where = 'WHERE topic_status = 0'; 100 if ( $category ) 101 $where .= " AND category_id = $category "; 102 if ( !empty( $exclude ) ) 103 $where .= " AND category_id NOT IN ('$exclude') "; 104 if ( is_category() || is_view() ) 105 $where .= " AND topic_sticky = 0 "; 106 $limit = bb_get_option('page_topics'); 107 $where = apply_filters('get_latest_category_topics_where', $where); 108 if ( 1 < $page ) 109 $limit = ($limit * ($page - 1)) . ", $limit"; 110 $bb_last_countable_query = "SELECT * FROM $bbdb->topics LEFT JOIN $bbdb->forums ON " . $bbdb->forums . ".forum_id = " . $bbdb->topics . ".forum_id $where ORDER BY topic_time DESC LIMIT $limit"; 111 if ( $topics = $bbdb->get_results($bb_last_countable_query) ) 112 return bb_append_meta( $topics, 'topic' ); 113 else 114 return false; 115 } 85 116 117 function get_sticky_category_topics( $category = 0, $display = 1 ) { 118 global $bbdb, $bb_last_countable_query; 119 if ( 1 != $display ) 120 return false; 121 $category = (int) $category; 122 $where = 'WHERE topic_sticky <> 0 AND topic_status = 0'; 123 if ( $category ) 124 $where .= " AND category_id = $category "; 125 $where = apply_filters('get_sticky_category_topics_where', $where); 126 $bb_last_countable_query = "SELECT * FROM $bbdb->topics LEFT JOIN $bbdb->forums ON " . $bbdb->forums . ".forum_id = " . $bbdb->topics . ".forum_id $where ORDER BY topic_time DESC"; 127 if ( $stickies = $bbdb->get_results($bb_last_countable_query) ) 128 return bb_append_meta( $stickies, 'topic' ); 129 else return false; 130 } 131 132 86 133 // Globalizes the result. 87 134 function bb_get_first_post( $_topic = false, $author_cache = true ) { 88 135 global $topic, $bb_first_post_cache, $bb_post; … … 216 263 return; 217 264 } 218 265 266 function bb_move_category_forums( $from_category_id, $to_category_id ) { 267 global $bb_cache, $bbdb; 268 269 $from_category_id = (int) $from_category_id ; 270 $to_category_id = (int) $to_category_id; 271 272 add_filter('get_category_where', 'no_where'); // Just in case 273 274 $from_category = get_category( $from_category_id ); 275 if ( !$to_category = get_category( $to_category_id ) ) 276 return false; 277 278 $bb_cache->flush_many( 'category', $from_category_id ); 279 $bb_cache->flush_many( 'category', $to_category_id ); 280 281 $forums = $to_category->forums + ( $from_category ? $from_category->forums : 0 ); 282 283 $bbdb->query("UPDATE $bbdb->categories SET forums = '$forums' WHERE category_id = '$to_category_id'"); 284 $bbdb->query("UPDATE $bbdb->categories SET forums = 0 WHERE category_id = '$from_category_id'"); 285 $forum_ids = $bbdb->get_col("SELECT forum_id FROM $bbdb->forums WHERE category_id = '$from_category_id'"); 286 $return = $bbdb->query("UPDATE $bbdb->forums SET category_id = '$to_category_id' WHERE category_id = '$from_category_id'"); 287 if ( $forum_ids ) 288 foreach ( $forum_ids as $forum_id ) { 289 $bb_cache->flush_one( 'forum', $forum_id ); 290 } 291 $bb_cache->flush_one( 'category', $to_category_id ); 292 $bb_cache->flush_many( 'category', $from_category_id ); 293 return $return; 294 } 295 219 296 function bb_move_forum_topics( $from_forum_id, $to_forum_id ) { 220 297 global $bb_cache, $bbdb; 221 298 … … 272 349 return $bbdb->get_results("SELECT * FROM $bbdb->posts $where ORDER BY post_time DESC LIMIT $limit"); 273 350 } 274 351 352 function get_latest_category_posts( $category_id, $limit = 0, $page = 1 ) { 353 global $bbdb; 354 $limit = (int) $limit; 355 $category_id = (int) $category_id; 356 if ( !$limit ) 357 $limit = bb_get_option( 'page_topics' ); 358 if ( 1 < $page ) 359 $limit = ($limit * ($page - 1)) . ", $limit"; 360 $where = apply_filters('get_latest_category_posts_where', "WHERE `" . $bbdb->forums . "`.category_id = '$category_id' AND post_status = 0"); 361 return $bbdb->get_results("SELECT * FROM $bbdb->posts LEFT JOIN $bbdb->forums ON `" . $bbdb->forums . "`.forum_id = `" . $bbdb->posts . "`.forum_id $where ORDER BY post_time DESC LIMIT $limit"); 362 } 363 275 364 function get_user_favorites( $user_id, $list = false ) { 276 365 global $bbdb, $page; 277 366 $user = bb_get_user( $user_id ); … … 823 912 824 913 825 914 826 function bb_new_ forum( $name, $desc, $order = 0 ) {915 function bb_new_category( $name, $desc, $order = 0 ) { 827 916 global $bbdb, $bb_cache, $bb_current_user; 917 if ( !bb_current_user_can('manage_categories') ) 918 return false; 919 if ( strlen($name) < 1 ) 920 return false; 921 $bbdb->query("INSERT INTO $bbdb->categories (category_name, category_desc, category_order) VALUES ('$name', '$desc', '$order')"); 922 $bb_cache->flush_one( 'categories' ); 923 return $bbdb->insert_id; 924 } 925 926 function bb_update_category( $category_id, $name, $desc, $order = 0 ) { 927 global $bbdb, $bb_cache, $bb_current_user; 928 if ( !bb_current_user_can('manage_categories') ) 929 return false; 930 if ( !$category_id = (int) $category_id ) 931 return false; 932 $order = (int) $order; 933 if ( strlen($name) < 1 ) 934 return false; 935 $bb_cache->flush_many( 'category', $category_id ); 936 return $bbdb->query("UPDATE $bbdb->categories SET category_name = '$name', category_desc = '$desc', category_order = '$order' WHERE category_id = $category_id"); 937 } 938 939 // When you delete a category, the underlying forums are given a category_id of 0 940 function bb_delete_category( $category_id ) { 941 global $bbdb, $bb_cache; 942 if ( !bb_current_user_can( 'delete_category', $category_id ) ) 943 return false; 944 if ( !$category_id = (int) $category_id ) 945 return false; 946 947 $category = get_forum( $category_id ); 948 949 if ( $forum_ids = $bbdb->get_col("SELECT forum_id FROM $bbdb->forums WHERE category_id = '$category_id'") ) { 950 $_forum_ids = join(',', $forum_ids); 951 $bbdb->query("UPDATE $bbdb->forums SET category_id = 0 WHERE forum_id IN ($_forum_ids)"); 952 } 953 954 $return = $bbdb->query("DELETE FROM $bbdb->categories WHERE category_id = $category_id"); 955 956 if ( $forum_ids ) 957 foreach ( $forum_ids as $forum_id ) { 958 $bb_cache->flush_one( 'forum', $forum_id ); 959 } 960 961 $bb_cache->flush_one( 'categories' ); 962 return $return; 963 } 964 965 function bb_new_forum( $name, $desc, $order = 0, $category_id = 0 ) { 966 global $bbdb, $bb_cache, $bb_current_user; 828 967 if ( !bb_current_user_can('manage_forums') ) 829 968 return false; 830 969 if ( strlen($name) < 1 ) 831 970 return false; 832 $bbdb->query("INSERT INTO $bbdb->forums (forum_name, forum_desc, forum_order) VALUES ('$name', '$desc', '$order')"); 971 $bbdb->query("INSERT INTO $bbdb->forums (category_id, forum_name, forum_desc, forum_order) VALUES ($category_id, '$name', '$desc', '$order')"); 972 $bbdb->query("UPDATE $bbdb->categories SET forums = forums + 1 WHERE category_id = $category_id"); 833 973 $bb_cache->flush_one( 'forums' ); 974 $bb_cache->flush_many( 'category', $category_id ); 834 975 return $bbdb->insert_id; 835 976 } 836 977 837 function bb_update_forum( $forum_id, $name, $desc, $order = 0 ) {978 function bb_update_forum( $forum_id, $name, $desc, $order = 0, $category_id = 0 ) { 838 979 global $bbdb, $bb_cache, $bb_current_user; 839 980 if ( !bb_current_user_can('manage_forums') ) 840 981 return false; … … 843 984 $order = (int) $order; 844 985 if ( strlen($name) < 1 ) 845 986 return false; 987 988 $forum = get_forum( $forum_id ); 989 990 $return = $bbdb->query("UPDATE $bbdb->forums SET category_id = $category_id, forum_name = '$name', forum_desc = '$desc', forum_order = '$order' WHERE forum_id = $forum_id"); 991 $bbdb->query("UPDATE $bbdb->categories SET forums = forums + 1 WHERE category_id = $category_id"); 992 $bbdb->query("UPDATE $bbdb->categories SET forums = forums - 1 WHERE category_id = $forum->category_id"); 846 993 $bb_cache->flush_many( 'forum', $forum_id ); 847 return $bbdb->query("UPDATE $bbdb->forums SET forum_name = '$name', forum_desc = '$desc', forum_order = '$order' WHERE forum_id = $forum_id"); 994 $bb_cache->flush_one( 'categories' ); 995 return $return; 848 996 } 849 997 850 998 // When you delete a forum, you delete *everything* … … 855 1003 if ( !$forum_id = (int) $forum_id ) 856 1004 return false; 857 1005 1006 $forum = get_forum( $forum_id ); 1007 858 1008 if ( $topic_ids = $bbdb->get_col("SELECT topic_id FROM $bbdb->topics WHERE forum_id = '$forum_id'") ) { 859 1009 $_topic_ids = join(',', $topic_ids); 860 1010 $bbdb->query("DELETE FROM $bbdb->posts WHERE topic_id IN ($_topic_ids) AND topic_id != 0"); … … 863 1013 } 864 1014 865 1015 $return = $bbdb->query("DELETE FROM $bbdb->forums WHERE forum_id = $forum_id"); 1016 $bbdb->query("UPDATE $bbdb->categories SET forums = forums - 1 WHERE category_id = $forum->category_id"); 866 1017 867 1018 if ( $topic_ids ) 868 1019 foreach ( $topic_ids as $topic_id ) { … … 871 1022 } 872 1023 873 1024 $bb_cache->flush_many( 'forum', $forum_id ); 1025 $bb_cache->flush_one( 'categories' ); 874 1026 return $return; 875 1027 } 876 1028 … … 1547 1699 1548 1700 do_action( 'pre_permalink', $permalink ); 1549 1701 1550 if ( is_forum() ) { 1702 if ( is_category() ) { 1703 global $category_id; 1704 $category_id = $permalink; 1705 $permalink = get_category_link( $permalink, $page ); 1706 } elseif ( is_forum() ) { 1551 1707 global $forum_id; 1552 1708 $forum_id = $permalink; 1553 1709 $permalink = get_forum_link( $permalink, $page ); -
bb-includes/bozo.php
old new 279 279 280 280 add_action( 'pre_permalink', 'bozo_pre_permalink' ); 281 281 add_action( 'bb_index.php_pre_db', 'bozo_latest_filter' ); 282 add_action( 'bb_category.php_pre_db', 'bozo_latest_filter' ); 282 283 add_action( 'bb_forum.php_pre_db', 'bozo_latest_filter' ); 283 284 add_action( 'bb_topic.php_pre_db', 'bozo_topic_db_filter' ); 284 285 add_action( 'bb_profile.php_pre_db', 'bozo_profile_db_filter' ); -
bb-includes/formatting-functions.php
old new 154 154 function closed_title( $title ) { 155 155 global $topic; 156 156 if ( '0' === $topic->topic_open ) 157 return sprintf(__('[closed] %s'), $title); 157 //return sprintf(__('[closed] %s'), $title); 158 return '<img src="' . bb_get_option('uri') . 'my-templates/images/closed.png" alt="[' . __('[closed]') . ']" style="vertical-align:top; margin-right:0.3em; width:14px; height:14px; border-width:0;" />' . $title; 158 159 return $title; 159 160 } 160 161 -
bb-includes/template-functions.php
old new 183 183 case 'index.php' : 184 184 return 'front-page'; 185 185 break; 186 case 'category.php' : 187 return 'category-page'; 188 break; 186 189 case 'forum.php' : 187 190 return 'forum-page'; 188 191 break; … … 226 229 return false; 227 230 } 228 231 232 function is_category() { 233 if ( 'category-page' == get_bb_location() ) 234 return true; 235 else 236 return false; 237 } 238 229 239 function is_forum() { 230 240 if ( 'forum-page' == get_bb_location() ) 231 241 return true; … … 300 310 $title = get_topic_title(). ' « '; 301 311 if ( is_forum() ) 302 312 $title = get_forum_name() . ' « '; 313 if ( is_category() ) 314 $title = get_category_name() . ' « '; 303 315 if ( is_tag() ) 304 316 $title = wp_specialchars( get_tag_name() ). ' « ' . __('Tags') . ' « '; 305 317 if ( is_bb_profile() ) … … 319 331 $feed_link = '<link rel="alternate" type="application/rss+xml" title="' . __('Tag') . ': ' . wp_specialchars( get_tag_name(), 1 ) . '" href="' . get_tag_rss_link() . '" />'; 320 332 elseif ( is_forum() ) 321 333 $feed_link = '<link rel="alternate" type="application/rss+xml" title="' . __('Forum') . ': ' . wp_specialchars( get_forum_name(), 1) . '" href="' . get_forum_rss_link() . '" />'; 334 elseif ( is_category() ) 335 $feed_link = '<link rel="alternate" type="application/rss+xml" title="' . __('Category') . ': ' . wp_specialchars( get_category_name(), 1) . '" href="' . get_category_rss_link() . '" />'; 322 336 elseif ( is_front() ) 323 337 $feed_link = '<link rel="alternate" type="application/rss+xml" title="' . __('Recent Posts') . '" href="' . get_recent_rss_link() . '" />'; 324 338 echo apply_filters('bb_feed_head', $feed_link); … … 332 346 return apply_filters( 'get_recent_rss_link', $link ); 333 347 } 334 348 349 // CATEGORIES 350 351 function get_forums_where_in_category_filter() { 352 global $category; 353 if ($category->category_id) 354 return 'WHERE category_id = ' . $category->category_id; 355 else return NULL; 356 } 357 358 function get_forums_join_categories_filter() { 359 global $bbdb; 360 return 'LEFT JOIN `' . $bbdb->categories . '` ON `' . $bbdb->categories . '`.`category_id` = `' . $bbdb->forums . '`.`category_id`'; 361 } 362 363 function get_forums_orderby_category_order_filter() { 364 return 'ORDER BY `category_order`, `forum_order`'; 365 } 366 367 function category_id() { 368 echo apply_filters( 'category_id', get_category_id() ); 369 } 370 371 function get_category_id() { 372 global $category; 373 return $category->category_id; 374 } 375 376 function category_link( $category_id = 0, $page = 1 ) { 377 echo apply_filters('category_link', get_category_link( $category_id, $page ), $category_id ); 378 } 379 380 function get_category_link( $category_id = 0, $page = 1 ) { 381 global $category; 382 383 if ( $category_id ) 384 $category = get_category( $category_id ); 385 if ( bb_get_option( 'mod_rewrite' ) ) 386 $link = bb_get_option( 'uri' ) . "category/$category->category_id" . ( 1 < $page ? "/page/$page" : '' ); 387 else { 388 $args = array(); 389 $link = bb_get_option( 'uri' ) . 'category.php'; 390 $args['id'] = $category->category_id; 391 $args['page'] = 1 < $page ? $page : ''; 392 $link = add_query_arg( $args, $link ); 393 } 394 395 return apply_filters( 'get_category_link', $link, $category->category_id ); 396 } 397 398 function category_name( $category_id = 0 ) { 399 echo apply_filters( 'category_name', get_category_name( $category_id ), $category_id ); 400 } 401 402 function get_category_name( $category_id = 0 ) { 403 global $category; 404 if ( $category_id ) 405 $category = get_category( $category_id ); 406 return apply_filters( 'get_category_name', $category->category_name, $forum->category_id ); 407 } 408 409 function category_description( $category_id = 0 ) { 410 echo apply_filters( 'category_description', get_category_description( $category_id ), $category_id ); 411 } 412 413 function get_category_description( $category_id = 0 ) { 414 global $category; 415 if ( $category_id ) 416 $category = get_forum( $category_id ); 417 return apply_filters( 'get_category_description', $category->category_desc, $category->category_id ); 418 } 419 420 function category_forums( $category_id = 0 ) { 421 echo apply_filters( 'category_forums', get_category_forums( $category_id ), $category_id ); 422 } 423 424 function get_category_forums( $category_id = 0 ) { 425 global $category; 426 if ( $category_id ) 427 $category = get_category( $category_id ); 428 return apply_filters( 'get_category_forums', $category->forums, $category->category_id ); 429 } 430 431 function category_rss_link( $category_id = 0 ) { 432 echo apply_filters('category_rss_link', get_category_rss_link( $category_id ) ); 433 } 434 435 function get_category_rss_link( $category_id = 0 ) { 436 global $category; 437 438 if ( $category_id ) 439 $category = get_category( $category_id ); 440 441 if ( bb_get_option('mod_rewrite') ) 442 $link = bb_get_option('uri') . "rss/category/$category->category_id"; 443 else 444 $link = bb_get_option('uri') . "rss.php?category=$category->category_id"; 445 446 return apply_filters( 'get_category_rss_link', $link, $category_id ); 447 } 448 335 449 // FORUMS 336 450 337 451 function forum_link( $forum_id = 0, $page = 1 ) { … … 744 858 $class[] = 'bozo'; 745 859 if ( '0' === $topic->topic_open ) 746 860 $class[] = 'closed'; 747 if ( 1 == $topic->topic_sticky && is_forum() )861 if ( 1 == $topic->topic_sticky && ( is_forum() || is_category() ) ) 748 862 $class[] = 'sticky'; 749 elseif ( 2 == $topic->topic_sticky && ( is_front() || is_forum() ) )863 elseif ( 2 == $topic->topic_sticky && ( is_front() || is_forum() || is_category() ) ) 750 864 $class[] = 'sticky super-sticky'; 751 865 $class = apply_filters( 'topic_class', $class, $topic->topic_id ); 752 866 $class = join(' ', $class); … … 760 874 761 875 if ( is_forum() || is_tag() ) 762 876 $url = '#postform'; 763 elseif ( is_front() )877 elseif ( is_front() || is_category() ) 764 878 $url = add_query_arg( 'new', '1', bb_get_option( 'uri' ) ); 765 879 if ( !bb_is_user_logged_in() ) 766 880 $url = add_query_arg( 're', urlencode($url), bb_get_option( 'uri' ) . 'bb-login.php' ); … … 1333 1447 1334 1448 function forum_dropdown() { 1335 1449 global $forum_id; 1336 $ forums = get_forums();1450 $categories = get_categories(); 1337 1451 echo '<select name="forum_id" id="forum_id" tabindex="5">'; 1338 1339 foreach ( $forums as $forum ) : 1340 $selected = ( $forum_id == $forum->forum_id ) ? " selected='selected'" : ''; 1341 echo "<option value='$forum->forum_id'$selected>$forum->forum_name</option>"; 1342 endforeach; 1452 if ($categories) : 1453 global $category; 1454 foreach ( $categories as $category ) : 1455 add_filter('get_forums_where', 'get_forums_where_in_category_filter', 1); 1456 $forums = get_forums(); 1457 if ( $forums ) : 1458 echo "<optgroup label='$category->category_name'>"; 1459 foreach ( $forums as $forum ) : 1460 $selected = ( $forum_id == $forum->forum_id ) ? " selected='selected'" : ''; 1461 echo "<option value='$forum->forum_id'$selected>$forum->forum_name</option>"; 1462 endforeach; 1463 echo "</optgroup>"; 1464 endif; 1465 endforeach; 1466 else : 1467 $forums = get_forums(); 1468 foreach ( $forums as $forum ) : 1469 $selected = ( $forum_id == $forum->forum_id ) ? " selected='selected'" : ''; 1470 echo "<option value='$forum->forum_id'$selected>$forum->forum_name</option>"; 1471 endforeach; 1472 endif; 1343 1473 echo '</select>'; 1344 1474 } 1345 1475 -
bb-includes/db.php
old new 17 17 var $queries; 18 18 19 19 // Our tables 20 var $categories; 20 21 var $forums; 21 22 var $posts; 22 23 var $topics; -
index.php
old new 6 6 do_action( 'bb_index.php_pre_db', '' ); 7 7 8 8 if ( isset($_GET['new']) && '1' == $_GET['new'] ) : 9 $categories = false; 9 10 $forums = false; 10 11 elseif ( !$bb_db_override ) : 12 $categories = get_categories(); // Comment to hide categories 11 13 $forums = get_forums(); // Comment to hide forums 12 14 $topics = get_latest_topics(); 13 15 $super_stickies = get_sticky_topics(); 16 17 if ( $forums && !$categories ) : 18 $categories = array( 19 0 => new stdClass() 20 ); 21 $categories[0]->category_id = 0; 22 $categories[0]->category_name = __('Forums'); 23 $categories[0]->category_desc = __('All available forums.'); 24 $categories[0]->forums = $forums ? count($forums) : 0; 25 endif; 14 26 endif; 15 27 16 28 do_action( 'bb_index.php', '' ); -
rss.php
old new 22 22 elseif ( 'forum' == get_path() ) 23 23 $forum_id = (int) get_path(2); 24 24 25 elseif ( isset($_GET['category']) ) 26 $category_id = (int) $_GET['category']; 27 elseif ( 'category' == get_path() ) 28 $category_id = (int) get_path(2); 29 25 30 $bb_db_override = false; 26 31 do_action( 'bb_rss.php_pre_db', '' ); 27 32 … … 48 53 if ( !$posts = get_latest_forum_posts( $forum_id ) ) 49 54 die(); 50 55 $title = wp_specialchars( bb_get_option( 'name' ) ) . ' ' . __('Forum') . ': ' . get_forum_name( $forum_id ); 56 } elseif ( isset($category_id) ) { 57 if ( !$posts = get_latest_category_posts( $category_id ) ) 58 die(); 59 $title = wp_specialchars( bb_get_option( 'name' ) ) . ' ' . __('Category') . ': ' . get_category_name( $category_id ); 51 60 } else { 52 61 if ( !$posts = get_latest_posts( 35 ) ) 53 62 die(); -
category.php
old new 1 <?php 2 3 require_once('./bb-load.php'); 4 5 $category_id = 0; 6 7 bb_repermalink(); 8 9 if ( !$category ) 10 bb_die(__('Category not found.')); 11 12 $bb_db_override = false; 13 do_action( 'bb_category.php_pre_db', $category_id ); 14 15 if ( !$bb_db_override ) : 16 add_filter('get_forums_where', 'get_forums_where_in_category_filter', 1); 17 $forums = get_forums(); 18 $topics = get_latest_category_topics( $category_id, $page ); 19 $stickies = get_sticky_category_topics( $category_id, $page ); 20 endif; 21 22 do_action( 'bb_category.php', $category_id ); 23 24 if (file_exists( BBPATH . 'my-templates/category.php' )) 25 require( BBPATH . 'my-templates/category.php' ); 26 else require( BBPATH . 'bb-templates/category.php' ); 27 28 ?> -
topic.php
old new 20 20 if ( !$bb_db_override ) : 21 21 $posts = get_thread( $topic_id, $page ); 22 22 $forum = get_forum ( $topic->forum_id ); 23 $category = get_category( $forum->category_id ); 23 24 24 25 $tags = get_topic_tags ( $topic_id ); 25 26 if ( $bb_current_user && $tags ) { -
bb-settings.php
old new 60 60 require( BBPATH . BBINC . '/db.php'); 61 61 } 62 62 63 $bbdb->categories = $bb_table_prefix . 'categories'; 63 64 $bbdb->forums = $bb_table_prefix . 'forums'; 64 65 $bbdb->posts = $bb_table_prefix . 'posts'; 65 66 $bbdb->topics = $bb_table_prefix . 'topics'; -
bb-admin/bb-do-counts.php
old new 70 70 echo "\n\t</li>\n"; 71 71 endif; 72 72 73 if ( isset($_POST['categories']) && 1 == $_POST['categories'] ): 74 echo "\t<li>\n"; 75 if ( $categories = (array) $bbdb->get_col("SELECT category_id, COUNT(forum_id) FROM $bbdb->forums GROUP BY category_id") ) : 76 echo "\t\t" . __('Counting category forums...') . "<br />\n"; 77 $counts = (array) $bbdb->get_col('', 1); 78 foreach ($categories as $t => $i) 79 $bbdb->query("UPDATE $bbdb->categories SET forums = '{$counts[$t]}' WHERE category_id = $i"); 80 unset($topics, $t, $i, $counts); 81 endif; 82 echo "\t\t" . __('Done counting category forums.'); 83 echo "\n\t</li>\n"; 84 endif; 85 73 86 if ( isset($_POST['topics-replied']) && 1 == $_POST['topics-replied'] ) : 74 87 echo "\t<li>\n"; 75 88 if ( $users = (array) $bbdb->get_col("SELECT ID FROM $bbdb->users") ) : -
bb-admin/bb-category.php
old new 1 <?php 2 require_once('admin.php'); 3 4 if ( !bb_current_user_can('manage_categories') ) 5 bb_die(__("You don't have the authority to mess with the categories.")); 6 7 if ( !isset($_POST['action']) ) 8 wp_redirect( bb_get_option( 'uri' ) . 'bb-admin/content-categories.php' ); 9 10 $sent_from = wp_get_referer(); 11 12 switch ( $_POST['action'] ) : 13 case 'add' : 14 if ( !isset($_POST['category']) || '' === $_POST['category'] ) 15 bb_die(__('Bad category name. Go back and try again.')); 16 17 bb_check_admin_referer( 'add-category' ); 18 19 $category_name = $_POST['category']; 20 $category_desc = $_POST['category-desc']; 21 $category_order = ( '' === $_POST['category-order'] ) ? 0 : (int) $_POST['category-order'];&nb