Changeset 2367
- Timestamp:
- 08/17/2009 01:54:27 AM (16 years ago)
- Location:
- branches/1.0
- Files:
-
- 21 edited
- 1 copied
-
bb-admin/admin-base.php (modified) (1 diff)
-
bb-admin/admin.php (modified) (2 diffs)
-
bb-admin/includes/functions.bb-admin.php (modified) (4 diffs)
-
bb-admin/includes/functions.bb-recount.php (copied) (copied from trunk/bb-admin/includes/functions.bb-recount.php)
-
bb-admin/index.php (modified) (2 diffs)
-
bb-admin/tools-recount.php (modified) (2 diffs)
-
bb-cron.php (modified) (3 diffs)
-
bb-includes/class.bp-options.php (modified) (1 diff)
-
bb-includes/functions.bb-core.php (modified) (1 diff)
-
bb-includes/functions.bb-deprecated.php (modified) (1 diff)
-
bb-includes/functions.bb-pluggable.php (modified) (3 diffs)
-
bb-includes/functions.bb-template.php (modified) (4 diffs)
-
bb-includes/functions.bb-users.php (modified) (3 diffs)
-
bb-templates/kakumei-blue/style.css (modified) (1 diff)
-
bb-templates/kakumei/favorites.php (modified) (1 diff)
-
bb-templates/kakumei/forum.php (modified) (2 diffs)
-
bb-templates/kakumei/front-page.php (modified) (2 diffs)
-
bb-templates/kakumei/post-form.php (modified) (2 diffs)
-
bb-templates/kakumei/style.css (modified) (1 diff)
-
bb-templates/kakumei/tag-single.php (modified) (1 diff)
-
bb-templates/kakumei/view.php (modified) (2 diffs)
-
rss.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/bb-admin/admin-base.php
r1299 r2367 11 11 <?php if ( is_callable($bb_admin_page) ) : call_user_func( $bb_admin_page ); else : ?> 12 12 13 <p><?php _e('Nothing to see here.'); ?><p> 13 <h2><?php _e( 'Page not found' ); ?></h2> 14 <?php 15 bb_admin_notice( __( 'There is no administration page at the requested address. Please check the address you entered and try again.' ), 'error' ); 16 do_action( 'bb_admin_notices' ); 17 ?> 14 18 15 19 <?php endif; ?> -
branches/1.0/bb-admin/admin.php
r2101 r2367 17 17 $bb_admin_page = bb_find_filename( $_SERVER['PHP_SELF'] ); 18 18 19 $_check_callback = false; 19 20 if ( $bb_admin_page == 'admin-base.php' ) { 20 $bb_admin_page = $_GET['plugin']; 21 $bb_admin_page = (string) @$_GET['plugin']; 22 $_check_callback = true; 21 23 } 22 24 … … 35 37 bb_admin_menu_generator(); 36 38 bb_get_current_admin_menu(); 39 40 if ( $_check_callback ) { 41 if ( empty( $bb_registered_plugin_callbacks ) || empty( $bb_admin_page ) || !in_array( $bb_admin_page, $bb_registered_plugin_callbacks ) ) { 42 unset( $bb_admin_page ); 43 } 44 } 37 45 ?> -
branches/1.0/bb-admin/includes/functions.bb-admin.php
r2290 r2367 118 118 { 119 119 global $bb_menu; 120 global $bb_registered_plugin_callbacks; 121 if ( empty( $bb_registered_plugin_callbacks ) ) { 122 $bb_registered_plugin_callbacks = array(); 123 } 120 124 121 125 if ( $display_name && $capability && $file_name ) { … … 165 169 } 166 170 171 if ( strpos( $file_name, '.php' ) === false ) { 172 $bb_registered_plugin_callbacks[] = $file_name; 173 } 174 167 175 // Add the menu item at the given key 168 176 $bb_menu[$plugin_menu_next] = array( $display_name, $capability, $file_name, $class, $id ); … … 179 187 { 180 188 global $bb_submenu; 189 global $bb_registered_plugin_callbacks; 190 if ( empty( $bb_registered_plugin_callbacks ) ) { 191 $bb_registered_plugin_callbacks = array(); 192 } 193 181 194 if ( $display_name && $capability && $file_name ) { 195 if ( strpos( $file_name, '.php' ) === false ) { 196 $bb_registered_plugin_callbacks[] = $file_name; 197 } 182 198 $bb_submenu[$parent][] = array( $display_name, $capability, $file_name ); 183 199 ksort( $bb_submenu ); … … 398 414 function bb_user_row( $user, $role = '', $email = false ) { 399 415 $actions = "<a href='" . esc_attr( get_user_profile_link( $user->ID ) ) . "'>" . __('View') . "</a>"; 400 if ( bb_current_user_can( 'edit_user', $user_id ) ) 416 $title = ''; 417 if ( bb_current_user_can( 'edit_user', $user_id ) ) { 401 418 $actions .= " | <a href='" . esc_attr( get_profile_tab_link( $user->ID, 'edit' ) ) . "'>" . __('Edit') . "</a>"; 419 $title = " title='" . esc_attr( sprintf( __( 'User ID: %d' ), $user->ID ) ) . "'"; 420 } 402 421 $r = "\t<tr id='user-$user->ID'" . get_alt_class("user-$role") . ">\n"; 403 $r .= "\t\t<td class=\"user\">" . bb_get_avatar( $user->ID, 32 ) . "<span class=\"row-title\"><a href='" . get_user_profile_link( $user->ID ) . "' >" . get_user_name( $user->ID ) . "</a></span><div><span class=\"row-actions\">$actions</span> </div></td>\n";422 $r .= "\t\t<td class=\"user\">" . bb_get_avatar( $user->ID, 32 ) . "<span class=\"row-title\"><a href='" . get_user_profile_link( $user->ID ) . "'" . $title . ">" . get_user_name( $user->ID ) . "</a></span><div><span class=\"row-actions\">$actions</span> </div></td>\n"; 404 423 $r .= "\t\t<td><a href='" . get_user_profile_link( $user->ID ) . "'>" . get_user_display_name( $user->ID ) . "</a></td>\n"; 405 424 if ( $email ) { -
branches/1.0/bb-admin/index.php
r2217 r2367 30 30 $rn_topic_tags_average = sprintf(__ngettext('<span>%d</span> tag', '<span>%d</span> tags', $rn_topic_tags_average), $rn_topic_tags_average); 31 31 32 $rn = apply_filters( 'bb_admin_right_now', array( 33 'forums' => array( $rn_forums, '-' ), 34 'topics' => array( $rn_topics, $rn_topics_average ), 35 'posts' => array( $rn_posts, $rn_posts_average ), 36 'topic_tags' => array( $rn_topic_tags, $rn_topic_tags_average ), 37 'users' => array( $rn_users, $rn_users_average ) 38 ) ); 39 32 40 $bb_admin_body_class = ' bb-admin-dashboard'; 33 41 … … 49 57 </tr> 50 58 </thead> 59 <?php 60 if ( !empty( $rn ) && is_array( $rn ) ) { 61 ?> 51 62 <tbody> 63 <?php 64 foreach ( $rn as $rn_row ) { 65 ?> 52 66 <tr> 53 <td><?php echo $rn_ forums; ?></td>54 <td> -</td>67 <td><?php echo $rn_row[0]; ?></td> 68 <td><?php echo $rn_row[1]; ?></td> 55 69 </tr> 56 <tr> 57 <td><?php echo $rn_topics; ?></td> 58 <td><?php echo $rn_topics_average; ?></td> 59 </tr> 60 <tr> 61 <td><?php echo $rn_posts; ?></td> 62 <td><?php echo $rn_posts_average; ?></td> 63 </tr> 64 <tr> 65 <td><?php echo $rn_topic_tags; ?></td> 66 <td><?php echo $rn_topic_tags_average; ?></td> 67 </tr> 68 <tr> 69 <td><?php echo $rn_users; ?></td> 70 <td><?php echo $rn_users_average; ?></td> 71 </tr> 70 <?php 71 } 72 ?> 72 73 </tbody> 74 <?php 75 } 76 ?> 73 77 </table> 74 78 </div> -
branches/1.0/bb-admin/tools-recount.php
r2236 r2367 1 1 <?php 2 require_once('admin.php'); 2 require_once( 'admin.php' ); 3 require_once( 'includes/functions.bb-recount.php' ); 3 4 4 5 if ( 'post' == strtolower( $_SERVER['REQUEST_METHOD'] ) ) { 5 6 bb_check_admin_referer( 'do-counts' ); 6 7 8 // Stores messages 7 9 $messages = array(); 8 if ( isset($_POST['topic-posts']) && 1 == $_POST['topic-posts'] ) { 9 if ( $topics = (array) $bbdb->get_results("SELECT topic_id, COUNT(post_id) AS count FROM $bbdb->posts WHERE post_status = '0' GROUP BY topic_id") ) { 10 $messages[] = __('Counted posts'); 11 foreach ($topics as $topic) { 12 $topic_id = (int) $topic->topic_id; 13 $bbdb->query( $bbdb->prepare( "UPDATE $bbdb->topics SET topic_posts = %s WHERE topic_id = %s" ), $topic->count, $topic_id ); 14 } 15 unset($topics, $topic, $topic_id); 16 } 10 11 if ( !empty( $_POST['topic-posts'] ) ) { 12 $messages[] = bb_recount_topic_posts(); 17 13 } 18 14 19 if ( isset($_POST['topic-voices']) && 1 == $_POST['topic-voices'] ) { 20 if ( $topics = (array) $bbdb->get_results("SELECT topic_id FROM $bbdb->topics ORDER BY topic_id") ) { 21 $messages[] = __('Counted voices'); 22 foreach ($topics as $topic) { 23 $topic_id = (int) $topic->topic_id; 24 if ( $voices = $bbdb->get_col( $bbdb->prepare( "SELECT DISTINCT poster_id FROM $bbdb->posts WHERE topic_id = %s AND post_status = '0';", $topic_id ) ) ) { 25 $voices = count( $voices ); 26 bb_update_topicmeta( $topic_id, 'voices_count', $voices ); 27 } 28 } 29 unset($topics, $topic, $topic_id); 30 } 15 if ( !empty( $_POST['topic-voices'] ) ) { 16 $messages[] = bb_recount_topic_voices(); 31 17 } 32 18 33 if ( isset($_POST['topic-deleted-posts']) && 1 == $_POST['topic-deleted-posts'] ) { 34 $old = (array) $bbdb->get_col("SELECT object_id FROM $bbdb->meta WHERE object_type = 'bb_topics' AND meta_key = 'deleted_posts'"); 35 $old = array_flip($old); 36 if ( $topics = (array) $bbdb->get_results("SELECT topic_id, COUNT(post_id) AS count FROM $bbdb->posts WHERE post_status != '0' GROUP BY topic_id") ) { 37 $messages[] = __('Counting deleted posts…'); 38 foreach ( $topics as $topic ) { 39 bb_update_topicmeta( $topic->topic_id, 'deleted_posts', $topic->count ); 40 unset($old[$topic->topic_id]); 41 } 42 unset($topics, $topic); 43 } 44 if ( $old ) { 45 $old = join(',', array_flip($old)); 46 $bbdb->query("DELETE FROM $bbdb->meta WHERE object_type = 'bb_topic' AND object_id IN ($old) AND meta_key = 'deleted_posts'"); 47 $messages[] = __('…counted deleted posts'); 48 } else { 49 $messages[] = __('…no deleted posts to count'); 50 } 19 if ( !empty( $_POST['topic-deleted-posts'] ) ) { 20 $messages[] = bb_recount_topic_deleted_posts(); 51 21 } 52 22 53 if ( isset($_POST['forums']) && 1 == $_POST['forums'] ) { 54 if ( $all_forums = (array) $bbdb->get_col("SELECT forum_id FROM $bbdb->forums") ) { 55 $messages[] = __('Counted forum topics and posts'); 56 $all_forums = array_flip( $all_forums ); 57 $forums = $bbdb->get_results("SELECT forum_id, COUNT(topic_id) AS topic_count, SUM(topic_posts) AS post_count FROM $bbdb->topics WHERE topic_status = 0 GROUP BY forum_id"); 58 foreach ( (array) $forums as $forum ) { 59 $bbdb->query("UPDATE $bbdb->forums SET topics = '$forum->topic_count', posts = '$forum->post_count' WHERE forum_id = '$forum->forum_id'"); 60 unset($all_forums[$forum->forum_id]); 61 } 62 if ( $all_forums ) { 63 $all_forums = implode(',', array_flip( $all_forums ) ); 64 $bbdb->query("UPDATE $bbdb->forums SET topics = 0, posts = 0 WHERE forum_id IN ($all_forums)"); 65 } 66 unset($all_forums, $forums, $forum); 67 } 23 if ( !empty( $_POST['forums'] ) ) { 24 $messages[] = bb_recount_forum_topics(); 25 $messages[] = bb_recount_forum_posts(); 68 26 } 69 27 70 if ( isset($_POST['topics-replied']) && 1 == $_POST['topics-replied'] ) { 71 if ( $users = (array) $bbdb->get_col("SELECT ID FROM $bbdb->users") ) { 72 $messages[] = __('Counted topics to which each user has replied'); 73 foreach ( $users as $user ) 74 bb_update_topics_replied( $user ); 75 unset($users, $user); 76 } 28 if ( !empty( $_POST['topics-replied'] ) ) { 29 $messages[] = bb_recount_user_topics_replied(); 77 30 } 78 31 79 if ( isset($_POST['topic-tag-count']) && 1 == $_POST['topic-tag-count'] ) { 80 // Reset tag count to zero 81 $bbdb->query( "UPDATE $bbdb->topics SET tag_count = 0" ); 82 83 // Get all tags 84 $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag' ); 85 86 if ( !is_wp_error( $terms ) && is_array( $terms ) ) { 87 $messages[] = __('Counted topic tags'); 88 foreach ( $terms as $term ) { 89 $topic_ids = bb_get_tagged_topic_ids( $term->term_id ); 90 if ( !is_wp_error( $topic_ids ) && is_array( $topic_ids ) ) { 91 $bbdb->query( 92 "UPDATE $bbdb->topics SET tag_count = tag_count + 1 WHERE topic_id IN (" . join( ',', $topic_ids ) . ")" 93 ); 94 } 95 unset( $topic_ids ); 96 } 97 } 98 unset( $terms, $term ); 32 if ( !empty( $_POST['topic-tag-count'] ) ) { 33 $messages[] = bb_recount_topic_tags(); 99 34 } 100 35 101 if ( isset($_POST['tags-tag-count']) && 1 == $_POST['tags-tag-count'] ) { 102 // Get all tags 103 $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', array( 'hide_empty' => false ) ); 104 105 if ( !is_wp_error( $terms ) && is_array( $terms ) ) { 106 $messages[] = __('Counted tagged topics'); 107 $_terms = array(); 108 foreach ( $terms as $term ) { 109 $_terms[] = $term->term_id; 110 } 111 if ( count( $_terms ) ) { 112 $wp_taxonomy_object->update_term_count( $_terms, 'bb_topic_tag' ); 113 } 114 } 115 unset( $term, $_terms ); 36 if ( !empty( $_POST['tags-tag-count'] ) ) { 37 $messages[] = bb_recount_tag_topics(); 116 38 } 117 39 118 if ( isset($_POST['tags-delete-empty']) && 1 == $_POST['tags-delete-empty'] ) { 119 // Get all tags 120 if ( !isset( $terms ) ) { 121 $terms = $wp_taxonomy_object->get_terms( 'bb_topic_tag', array( 'hide_empty' => false ) ); 122 } 123 124 if ( !is_wp_error( $terms ) && is_array( $terms ) ) { 125 $messages[] = __('Deleted tags with no topics'); 126 foreach ( $terms as $term ) { 127 $topic_ids = bb_get_tagged_topic_ids( $term->term_id ); 128 if ( !is_wp_error( $topic_ids ) && is_array( $topic_ids ) ) { 129 if ( false === $topic_ids || ( is_array( $topic_ids ) && !count( $topic_ids ) ) ) { 130 bb_destroy_tag( $term->term_taxonomy_id ); 131 } 132 } 133 unset( $topic_ids ); 134 } 135 } 136 unset( $terms, $term ); 40 if ( !empty( $_POST['tags-delete-empty'] ) ) { 41 $messages[] = bb_recount_tag_delete_empty(); 137 42 } 138 43 139 if ( isset($_POST['clean-favorites']) && 1 == $_POST['clean-favorites'] ) { 140 $favorites_key = $bbdb->prefix . 'favorites'; 141 if ( $users = $bbdb->get_results("SELECT user_id AS id, meta_value AS favorites FROM $bbdb->usermeta WHERE meta_key = '" . $favorites_key . "'") ) { 142 $messages[] = __('Removed deleted topics from users\' favorites'); 143 $topics = $bbdb->get_col("SELECT topic_id FROM $bbdb->topics WHERE topic_status = '0'"); 144 foreach ( $users as $user ) { 145 foreach ( explode(',', $user->favorites) as $favorite ) { 146 if ( !in_array($favorite, $topics) ) { 147 bb_remove_user_favorite( $user->id, $favorite ); 148 } 149 } 150 } 151 unset($topics, $users, $user, $favorite); 152 } 44 if ( !empty( $_POST['clean-favorites'] ) ) { 45 $messages[] = bb_recount_clean_favorites(); 153 46 } 154 47 … … 156 49 foreach ( (array) $recount_list as $item ) { 157 50 if ( isset($item[2]) && isset($_POST[$item[0]]) && 1 == $_POST[$item[0]] && is_callable($item[2]) ) { 158 call_user_func( $item[2] );51 $messages[] = call_user_func( $item[2] ); 159 52 } 160 53 } 161 54 55 wp_cache_flush(); 56 162 57 if ( count( $messages ) ) { 163 58 $messages = join( '</p>' . "\n" . '<p>', $messages ); -
branches/1.0/bb-cron.php
r2011 r2367 12 12 ignore_user_abort( true ); 13 13 14 if ( !empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) { 15 die(); 16 } 17 14 18 /** 15 19 * Tell bbPress we are doing the CRON task. … … 22 26 require_once( './bb-load.php' ); 23 27 24 if ( $_GET['check'] != backpress_get_option( 'cron_check') ) {25 exit;28 if ( false === $crons = _get_cron_array() ) { 29 die(); 26 30 } 27 31 28 if ( bb_get_option( 'doing_cron' ) > time() ) { 29 exit; 30 } 32 $keys = array_keys( $crons ); 33 $local_time = time(); 31 34 32 bb_update_option( 'doing_cron', time() + 30 ); 33 34 $crons = _get_cron_array(); 35 $keys = array_keys( $crons ); 36 if ( !is_array( $crons ) || $keys[0] > time() ) { 37 return; 35 if ( !is_array( $crons ) || ( isset($keys[0]) && $keys[0] > $local_time ) ) { 36 die(); 38 37 } 39 38 40 39 foreach ( $crons as $timestamp => $cronhooks ) { 41 if ( $timestamp > time()) {40 if ( $timestamp > $local_time ) { 42 41 break; 43 42 } … … 54 53 } 55 54 } 56 57 bb_update_option( 'doing_cron', 0 ); -
branches/1.0/bb-includes/class.bp-options.php
r2274 r2367 25 25 case 'cron_uri': 26 26 return bb_get_uri( 'bb-cron.php', array( 'check' => BP_Options::get( 'cron_check' ) ), BB_URI_CONTEXT_WP_HTTP_REQUEST ); 27 break;28 case 'cron_check':29 return bb_hash( '187425' );30 27 break; 31 28 case 'wp_http_version': -
branches/1.0/bb-includes/functions.bb-core.php
r2342 r2367 733 733 } else { 734 734 if ( bb_get_option( 'mod_rewrite' ) === 'slugs') { 735 $user = bb_get_user_by_nicename( $id ); // Get by the user_nicename 735 if ( !$user = bb_get_user_by_nicename( $id ) ) { 736 $user = bb_get_user( $id ); 737 } 736 738 } else { 737 $user = bb_get_user( $id ); // Get by the ID 739 if ( !$user = bb_get_user( $id ) ) { 740 $user = bb_get_user_by_nicename( $id ); 741 } 738 742 } 739 743 } -
branches/1.0/bb-includes/functions.bb-deprecated.php
r2313 r2367 641 641 // $length parameter is deprecated 642 642 function bb_random_pass( $length ) { 643 bb_log_deprecated('function', __FUNCTION__, 'wp_generate_password'); 644 return wp_generate_password(); 643 bb_log_deprecated('function', __FUNCTION__, 'bb_generate_password'); 644 if ( 12 < (int) $length ) { 645 $length = 12; 646 } 647 return bb_generate_password( $length ); 645 648 } 646 649 -
branches/1.0/bb-includes/functions.bb-pluggable.php
r2319 r2367 369 369 endif; 370 370 371 function _bb_get_key( $key, $default_key = false ) { 372 if ( !$default_key ) { 373 global $bb_default_secret_key; 374 $default_key = $bb_default_secret_key; 375 } 376 377 if ( defined( $key ) && '' != constant( $key ) && $default_key != constant( $key ) ) { 371 function _bb_get_key( $key, $default_key = false ) 372 { 373 global $bb_default_secret_key; 374 375 if ( defined( $key ) && '' != constant( $key ) && $bb_default_secret_key != constant( $key ) ) { 378 376 return constant( $key ); 379 377 } 380 378 381 return $default_key; 382 } 383 384 function _bb_get_salt( $constants, $option = false ) { 379 return ''; 380 } 381 382 function _bb_get_salt( $constants, $option = false ) 383 { 385 384 if ( !is_array( $constants ) ) { 386 385 $constants = array( $constants ); … … 399 398 $salt = bb_get_option( $option ); 400 399 if ( empty( $salt ) ) { 401 $salt = bb_generate_password( );400 $salt = bb_generate_password( 64 ); 402 401 bb_update_option( $option, $salt ); 403 402 } … … 420 419 * @return string Salt value for the given scheme 421 420 */ 422 function bb_salt($scheme = 'auth') { 421 function bb_salt( $scheme = 'auth' ) 422 { 423 // Deprecated 423 424 $secret_key = _bb_get_key( 'BB_SECRET_KEY' ); 424 425 425 426 switch ($scheme) { 426 427 case 'auth': 427 $secret_key = _bb_get_key( 'BB_AUTH_KEY' , $secret_key);428 $secret_key = _bb_get_key( 'BB_AUTH_KEY' ); 428 429 $salt = _bb_get_salt( array( 'BB_AUTH_SALT', 'BB_SECRET_SALT' ) ); 429 430 break; 430 431 431 432 case 'secure_auth': 432 $secret_key = _bb_get_key( 'BB_SECURE_AUTH_KEY' , $secret_key);433 $secret_key = _bb_get_key( 'BB_SECURE_AUTH_KEY' ); 433 434 $salt = _bb_get_salt( 'BB_SECURE_AUTH_SALT' ); 434 435 break; 435 436 436 437 case 'logged_in': 437 $secret_key = _bb_get_key( 'BB_LOGGED_IN_KEY' , $secret_key);438 $secret_key = _bb_get_key( 'BB_LOGGED_IN_KEY' ); 438 439 $salt = _bb_get_salt( 'BB_LOGGED_IN_SALT' ); 439 440 break; 440 441 441 442 case 'nonce': 442 $secret_key = _bb_get_key( 'BB_NONCE_KEY' , $secret_key);443 $secret_key = _bb_get_key( 'BB_NONCE_KEY' ); 443 444 $salt = _bb_get_salt( 'BB_NONCE_SALT' ); 444 445 break; -
branches/1.0/bb-includes/functions.bb-template.php
r2333 r2367 255 255 global $page, $topic, $forum; 256 256 257 if ( is_string( $args ) ) {258 $args['h2'] = $args;259 }260 257 $defaults = array( 261 258 'h2' => '', 262 259 'last_page_only' => true 263 260 ); 261 if ( is_string( $args ) ) { 262 $defaults['h2'] = $args; 263 } 264 264 $args = wp_parse_args( $args, $defaults ); 265 265 extract( $args, EXTR_SKIP ); … … 1524 1524 return; 1525 1525 1526 $r = $before . '<form id="topic-move" method="post" action="' . bb_get_uri( 'bb-admin/topic-move.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ) . '">' . "\n"; 1527 $r .= '<fieldset>' . "\n"; 1528 $r .= '<div>' . "\n"; 1526 $r = $before . '<form id="topic-move" method="post" action="' . bb_get_uri( 'bb-admin/topic-move.php', null, BB_URI_CONTEXT_FORM_ACTION + BB_URI_CONTEXT_BB_ADMIN ) . '"><fieldset><div>' . "\n"; 1529 1527 $r .= '<input type="hidden" name="topic_id" value="' . $topic->topic_id . '" />' . "\n"; 1530 1528 $r .= '<label for="forum-id">'. __( 'Move to' ) . '</label>' . "\n"; … … 1532 1530 $r .= bb_nonce_field( 'move-topic_' . $topic->topic_id, '_wpnonce', true , false ); 1533 1531 $r .= '<input type="submit" name="Submit" value="' . __( 'Move' ) . '" />' . "\n"; 1534 $r .= '</div>' . "\n"; 1535 $r .= '</fieldset>' . "\n"; 1536 $r .= '</form>' . $after; 1532 $r .= '</div></fieldset></form>' . $after; 1537 1533 1538 1534 return $r; … … 3507 3503 $format = 'Y-m-d H:i:s'; 3508 3504 break; 3505 case 'datetime' : 3506 $format = bb_get_option( 'datetime_format' ); 3507 break; 3509 3508 endswitch; 3510 3509 -
branches/1.0/bb-includes/functions.bb-users.php
r2313 r2367 253 253 * @return bool 254 254 */ 255 function bb_reset_email( $user_login ) { 255 function bb_reset_email( $user_login ) 256 { 256 257 global $bbdb; 257 258 258 259 $user_login = sanitize_user( $user_login, true ); 259 260 260 if ( !$user = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM $bbdb->users WHERE user_login = %s", $user_login ) ) ) 261 return new WP_Error('user_does_not_exist', __('The specified user does not exist.')); 262 263 $resetkey = substr(md5(bb_generate_password()), 0, 15); 261 if ( !$user = $bbdb->get_row( $bbdb->prepare( "SELECT * FROM $bbdb->users WHERE user_login = %s", $user_login ) ) ) { 262 return new WP_Error( 'user_does_not_exist', __( 'The specified user does not exist.' ) ); 263 } 264 265 $resetkey = substr( md5( bb_generate_password() ), 0, 15 ); 264 266 bb_update_usermeta( $user->ID, 'newpwdkey', $resetkey ); 265 267 268 $reseturi = bb_get_uri( 269 'bb-reset-password.php', 270 array( 'key' => $resetkey ), 271 BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_BB_USER_FORMS 272 ); 273 266 274 $message = sprintf( 267 __("If you wanted to reset your password, you may do so by visiting the following address:\n\n%s\n\nIf you don't want to reset your password, just ignore this email. Thanks!"), 268 bb_get_uri( 269 'bb-reset-password.php', 270 array('key' => $resetkey), 271 BB_URI_CONTEXT_TEXT + BB_URI_CONTEXT_BB_USER_FORMS 272 ) 273 ); 275 __( "If you wanted to reset your password, you may do so by visiting the following address:\n\n%s\n\nIf you don't want to reset your password, just ignore this email. Thanks!" ), 276 $reseturi 277 ); 278 $message = apply_filters( 'bb_reset_email_message', $message, $user, $reseturi, $resetkey ); 279 280 $subject = sprintf( 281 __( '%s: Password Reset' ), 282 bb_get_option( 'name' ) 283 ); 284 $subject = apply_filters( 'bb_reset_email_subject', $subject, $user ); 274 285 275 286 $mail_result = bb_mail( 276 287 bb_get_user_email( $user->ID ), 277 bb_get_option('name') . ': ' . __('Password Reset'),288 $subject, 278 289 $message 279 290 ); 280 291 281 if ( !$mail_result) {282 return new WP_Error( 'sending_mail_failed', __('The email containing the password reset link could not be sent.'));283 } else {284 return true; 285 }292 if ( !$mail_result ) { 293 return new WP_Error( 'sending_mail_failed', __( 'The email containing the password reset link could not be sent.' ) ); 294 } 295 296 return true; 286 297 } 287 298 … … 298 309 * @return unknown 299 310 */ 300 function bb_reset_password( $key ) { 301 global $bbdb; 311 function bb_reset_password( $key ) 312 { 313 global $bbdb; 314 302 315 $key = sanitize_user( $key, true ); 303 if ( empty( $key ) ) 304 return new WP_Error('key_not_found', __('Key not found.')); 305 if ( !$user_id = $bbdb->get_var( $bbdb->prepare( "SELECT user_id FROM $bbdb->usermeta WHERE meta_key = 'newpwdkey' AND meta_value = %s", $key ) ) ) 306 return new WP_Error('key_not_found', __('Key not found.')); 307 if ( $user = new BP_User( $user_id ) ) { 308 if ( bb_has_broken_pass( $user->ID ) ) 309 bb_block_current_user(); 310 if ( !$user->has_cap( 'change_user_password', $user->ID ) ) 311 return new WP_Error('permission_denied', __('You are not allowed to change your password.')); 312 $newpass = bb_generate_password(); 313 bb_update_user_password( $user->ID, $newpass ); 314 if (!bb_send_pass( $user->ID, $newpass )) { 315 return new WP_Error('sending_mail_failed', __('The email containing the new password could not be sent.')); 316 } else { 317 bb_update_usermeta( $user->ID, 'newpwdkey', '' ); 318 return true; 319 } 320 } else { 321 return new WP_Error('key_not_found', __('Key not found.')); 322 } 316 317 if ( empty( $key ) || !is_string( $key ) ) { 318 return new WP_Error( 'invalid_key', __( 'Invalid key' ) ); 319 } 320 321 if ( !$user_id = $bbdb->get_var( $bbdb->prepare( "SELECT user_id FROM $bbdb->usermeta WHERE meta_key = 'newpwdkey' AND meta_value = %s", $key ) ) ) { 322 return new WP_Error( 'invalid_key', __( 'Invalid key' ) ); 323 } 324 325 $user = new BP_User( $user_id ); 326 327 if ( !$user || is_wp_error( $user ) ) { 328 return new WP_Error( 'invalid_key', __( 'Invalid key' ) ); 329 } 330 331 if ( bb_has_broken_pass( $user->ID ) ) { 332 bb_block_current_user(); 333 } 334 335 if ( !$user->has_cap( 'change_user_password', $user->ID ) ) { 336 return new WP_Error( 'permission_denied', __( 'You are not allowed to change your password.' ) ); 337 } 338 339 $newpass = bb_generate_password(); 340 bb_update_user_password( $user->ID, $newpass ); 341 if ( !bb_send_pass( $user->ID, $newpass ) ) { 342 return new WP_Error( 'sending_mail_failed', __( 'The email containing the new password could not be sent.' ) ); 343 } 344 345 bb_update_usermeta( $user->ID, 'newpwdkey', '' ); 346 return true; 323 347 } 324 348 … … 358 382 * @return bool 359 383 */ 360 function bb_send_pass( $user, $pass ) { 361 if ( !$user = bb_get_user( $user ) ) 362 return false; 363 364 $message = __("Your username is: %1\$s \nYour password is: %2\$s \nYou can now log in: %3\$s \n\nEnjoy!"); 384 function bb_send_pass( $user, $pass ) 385 { 386 if ( !$user = bb_get_user( $user ) ) { 387 return false; 388 } 389 390 $message = sprintf( 391 __( "Your username is: %1\$s \nYour password is: %2\$s \nYou can now log in: %3\$s \n\nEnjoy!" ), 392 $user->user_login, 393 $pass, 394 bb_get_uri( null, null, BB_URI_CONTEXT_TEXT ) 395 ); 396 $message = apply_filters( 'bb_send_pass_message', $message, $user, $pass ); 397 398 $subject = sprintf( 399 __( '%s: Password' ), 400 bb_get_option( 'name' ) 401 ); 402 $subject = apply_filters( 'bb_send_pass_subject', $subject, $user ); 365 403 366 404 return bb_mail( 367 405 bb_get_user_email( $user->ID ), 368 bb_get_option('name') . ': ' . __('Password'),369 sprintf($message, $user->user_login, $pass, bb_get_uri(null, null, BB_URI_CONTEXT_TEXT))406 $subject, 407 $message 370 408 ); 371 409 } -
branches/1.0/bb-templates/kakumei-blue/style.css
r2177 r2367 23 23 #thread li.pingback { background-color: #d8dcf2; border-color: #d8dcf2; } 24 24 #thread li.pingback .threadpost { background-color: #d8dcf2; } 25 #topic-move input { color: #32689b; } 26 #topic-move input:hover { color: #001364; } 25 27 #latest tr:hover, #forumlist tr:hover, #favorites tr:hover { background: #d8dcf2; } 26 28 #profile-menu li a:hover { background: #d8dcf2; } -
branches/1.0/bb-templates/kakumei/favorites.php
r2202 r2367 30 30 <!-- <td class="num"><?php bb_topic_voices(); ?></td> --> 31 31 <td class="num"><?php topic_last_poster(); ?></td> 32 <td class="num"><a href="<?php topic_last_post_link(); ?>" ><?php topic_time(); ?></a></td>32 <td class="num"><a href="<?php topic_last_post_link(); ?>" title="<?php topic_time(array('format'=>'datetime')); ?>"><?php topic_time(); ?></a></td> 33 33 <?php if ( bb_current_user_can( 'edit_favorites_of', $user_id ) ) : ?> 34 34 <td class="num">[<?php user_favorites_link('', array('mid'=>'×'), $user_id); ?>]</td> -
branches/1.0/bb-templates/kakumei/forum.php
r2177 r2367 20 20 <!-- <td class="num"><?php bb_topic_voices(); ?></td> --> 21 21 <td class="num"><?php topic_last_poster(); ?></td> 22 <td class="num"><a href="<?php topic_last_post_link(); ?>" ><?php topic_time(); ?></a></td>22 <td class="num"><a href="<?php topic_last_post_link(); ?>" title="<?php topic_time(array('format'=>'datetime')); ?>"><?php topic_time(); ?></a></td> 23 23 </tr> 24 24 <?php endforeach; endif; ?> … … 30 30 <!-- <td class="num"><?php bb_topic_voices(); ?></td> --> 31 31 <td class="num"><?php topic_last_poster(); ?></td> 32 <td class="num"><a href="<?php topic_last_post_link(); ?>" ><?php topic_time(); ?></a></td>32 <td class="num"><a href="<?php topic_last_post_link(); ?>" title="<?php topic_time(array('format'=>'datetime')); ?>"><?php topic_time(); ?></a></td> 33 33 </tr> 34 34 <?php endforeach; endif; ?> -
branches/1.0/bb-templates/kakumei/front-page.php
r2300 r2367 28 28 <!-- <td class="num"><?php bb_topic_voices(); ?></td> --> 29 29 <td class="num"><?php topic_last_poster(); ?></td> 30 <td class="num"><a href="<?php topic_last_post_link(); ?>" ><?php topic_time(); ?></a></td>30 <td class="num"><a href="<?php topic_last_post_link(); ?>" title="<?php topic_time(array('format'=>'datetime')); ?>"><?php topic_time(); ?></a></td> 31 31 </tr> 32 32 <?php endforeach; endif; // $super_stickies ?> … … 38 38 <!-- <td class="num"><?php bb_topic_voices(); ?></td> --> 39 39 <td class="num"><?php topic_last_poster(); ?></td> 40 <td class="num"><a href="<?php topic_last_post_link(); ?>" ><?php topic_time(); ?></a></td>40 <td class="num"><a href="<?php topic_last_post_link(); ?>" title="<?php topic_time(array('format'=>'datetime')); ?>"><?php topic_time(); ?></a></td> 41 41 </tr> 42 42 <?php endforeach; endif; // $topics ?> -
branches/1.0/bb-templates/kakumei/post-form.php
r2286 r2367 2 2 <p id="post-form-title-container"> 3 3 <label for="topic"><?php _e('Title'); ?> 4 <input name="topic" type="text" id="topic" size="50" maxlength=" 80" tabindex="1" />4 <input name="topic" type="text" id="topic" size="50" maxlength="100" tabindex="1" /> 5 5 </label> 6 6 </p> … … 12 12 </p> 13 13 <p id="post-form-tags-container"> 14 <label for="tags-input"><?php printf(__('Tags (comma sep erated)'), bb_get_tag_page_link()) ?>14 <label for="tags-input"><?php printf(__('Tags (comma separated)'), bb_get_tag_page_link()) ?> 15 15 <input id="tags-input" name="tags" type="text" size="50" maxlength="100" value="<?php bb_tag_name(); ?>" tabindex="4" /> 16 16 </label> -
branches/1.0/bb-templates/kakumei/style.css
r2287 r2367 645 645 } 646 646 647 #topic-move { margin-top: 1em; } 647 #topic-move, 648 #topic-move fieldset, 649 #topic-move fieldset div { 650 display: inline; 651 } 652 653 #topic-move input { 654 font-family: inherit; 655 background: none; 656 border: none; 657 cursor: pointer; 658 color: #2e6e15; 659 font-size: 1em; 660 } 661 662 #topic-move input:hover { color: #006400; } 648 663 649 664 /* Other -
branches/1.0/bb-templates/kakumei/tag-single.php
r2150 r2367 22 22 <!-- <td class="num"><?php bb_topic_voices(); ?></td> --> 23 23 <td class="num"><?php topic_last_poster(); ?></td> 24 <td class="num"><a href="<?php topic_last_post_link(); ?>" ><?php topic_time(); ?></a></td>24 <td class="num"><a href="<?php topic_last_post_link(); ?>" title="<?php topic_time(array('format'=>'datetime')); ?>"><?php topic_time(); ?></a></td> 25 25 </tr> 26 26 <?php endforeach; ?> -
branches/1.0/bb-templates/kakumei/view.php
r2150 r2367 20 20 <!-- <td class="num"><?php bb_topic_voices(); ?></td> --> 21 21 <td class="num"><?php topic_last_poster(); ?></td> 22 <td class="num"><a href="<?php topic_last_post_link(); ?>" ><?php topic_time(); ?></a></td>22 <td class="num"><a href="<?php topic_last_post_link(); ?>" title="<?php topic_time(array('format'=>'datetime')); ?>"><?php topic_time(); ?></a></td> 23 23 </tr> 24 24 <?php endforeach; endif; ?> … … 30 30 <!-- <td class="num"><?php bb_topic_voices(); ?></td> --> 31 31 <td class="num"><?php topic_last_poster(); ?></td> 32 <td class="num"><a href="<?php topic_last_post_link(); ?>" ><?php topic_time(); ?></a></td>32 <td class="num"><a href="<?php topic_last_post_link(); ?>" title="<?php topic_time(array('format'=>'datetime')); ?>"><?php topic_time(); ?></a></td> 33 33 </tr> 34 34 <?php endforeach; endif; ?> -
branches/1.0/rss.php
r2333 r2367 109 109 die(); 110 110 } 111 $title = esc_html( sprintf( __( '%1$s » User Favorites: %2$s' ), bb_get_option( 'name' ), $user->user_ login) );111 $title = esc_html( sprintf( __( '%1$s » User Favorites: %2$s' ), bb_get_option( 'name' ), $user->user_nicename ) ); 112 112 $link = bb_get_profile_link($feed_id); 113 113 $link_self = get_favorites_rss_link($feed_id);
Note: See TracChangeset
for help on using the changeset viewer.