Skip to:
Content

bbPress.org

Ticket #842: bbPress_global.patch

File bbPress_global.patch, 13.2 KB (added by momo360modena, 18 years ago)
  • bb-admin/admin-functions.php

     
    119119
    120120function bb_admin_add_submenu($display_name, $capability, $file_name, $parent = 'plugins.php')
    121121{
    122         global $bb_menu, $bb_submenu;
     122        global $bb_submenu;
    123123        if ($display_name && $capability && $file_name) {
    124124                $bb_submenu[$parent][] = array($display_name, $capability, $file_name);
    125125        }
     
    620620
    621621function bb_forum_form( $forum_id = 0 ) {
    622622        $forum_id = (int) $forum_id;
    623         if ( $forum_id && !$forum = get_forum( $forum_id ) )
     623        if ( $forum_id && !get_forum( $forum_id ) )
    624624                return;
    625625        $action = $forum_id ? 'update' : 'add';
    626626?>
  • bb-admin/class-install.php

     
    993993                $config_lines = array();
    994994               
    995995                // Loop through the sample config and write lines to the new config file
    996                 foreach ($sample_config as $line_num => $line) {
     996                foreach ($sample_config as $line) {
    997997                        switch (substr($line,0,18)) {
    998998                                case "define('BBDB_NAME'":
    999999                                        $config_lines[] = str_replace("'bbpress'", "'" . $data['bbdb_name']['value'] . "'", $line);
     
    13251325                if ($data['keymaster_user_login']['value'] != sanitize_user($data['keymaster_user_login']['value'])) {
    13261326                        $this->strings[3]['form_errors']['keymaster_user_login'][] = 'userlogin';
    13271327                }
    1328                 $data['keymaster_user_login']['value'] == sanitize_user($data['keymaster_user_login']['value']);
     1328                $data['keymaster_user_login']['value'] = sanitize_user($data['keymaster_user_login']['value']);
    13291329               
    13301330                // bb_verify_email() needs this
    13311331                require_once(BB_PATH . BB_INC . 'registration-functions.php');
     
    15231523                                        $config_lines = array();
    15241524                                       
    15251525                                        // Loop through the sample config and write lines to the new config file
    1526                                         foreach ($config as $line_num => $line) {
     1526                                        foreach ($config as $line) {
    15271527                                                if (substr($line,0,18) == "define('BB_SECRET_") {
    15281528                                                        $config_lines[] = str_replace("'" . BB_SECRET_KEY . "'", "'" . $data2['wp_secret_key']['value'] . "'", $line);
    15291529                                                } else {
  • bb-admin/content-forums.php

     
    3838<?php break; case 'delete' : ?>
    3939<div class="ays narrow">
    4040        <p><big><?php printf(__('Are you sure you want to delete the "<strong>%s</strong>" forum?'), $deleted_forum->forum_name); ?></big></p>
    41         <p>This forum contains</p>
     41        <p><?php _e('This forum contains:'); ?></p>
    4242        <ul>
    4343                <li><?php printf(__ngettext('%d topic', '%d topics', $deleted_forum->topics), $deleted_forum->topics); ?></li>
    4444                <li><?php printf(__ngettext('%d post', '%d posts', $deleted_forum->posts), $deleted_forum->posts); ?></li>
  • bb-admin/content-posts.php

     
    2626$h2_author = $h2_author ? ' ' . sprintf( __('by %s')                    , wp_specialchars( get_user_name( $h2_author ) ) ) : '';
    2727
    2828$stati = array( 0 => __('Normal') . ' ', 1 => __('Deleted') . ' ', 'all' => '' );
     29$h2_noun = ( 'all' == $h2_status ) ?  __('Posts') : sprintf( __( '%1$sposts'), $stati[$h2_status], $topic_open[$h2_open] );
    2930
    30 if ( 'all' == $h2_status )
    31         $h2_noun = __('Posts');
    32 else
    33         $h2_noun = sprintf( __( '%1$sposts'), $stati[$h2_status], $topic_open[$h2_open] );
    34 
    3531printf( __( '%1$s%2$s%3$s%4$s%5$s' ), $h2_noun, $h2_search, $h2_forum, $h2_tag, $h2_author );
    3632
    3733?></h2>
  • bb-admin/export.php

     
    221221
    222222function bb_export_topic_tags( $r, $topic_id ) {
    223223        global $topic_tag_cache;
    224         if ( !$topic = get_topic( $topic_id ) )
     224        if ( !get_topic( $topic_id ) )
    225225                return;
    226226
    227227        if ( !$tags = bb_get_topic_tags( $topic_id ) )
     
    238238
    239239function bb_export_topic_posts( $r, $topic_id ) {
    240240        global $bb_post_cache;
    241         if ( !$topic = get_topic( $topic_id ) )
     241        if ( !get_topic( $topic_id ) )
    242242                return;
    243243
    244244        $r .= "\n";
     
    271271                                echo bb_export_user( $user->ID );
    272272                        $bb_user_cache = array(); // For the sake of memory
    273273                }
    274                 unset($users, $user_ids, $user_id, $page);
     274                unset($users, $user, $page);
    275275        }
    276276
    277277        if (BB_EXPORT_LEVEL & BB_EXPORT_FORUMS) {
  • bb-admin/upgrade-functions.php

     
    428428        global $bbdb;
    429429
    430430        $bbdb->hide_errors();
    431         if ( !$ids = $bbdb->get_var("SELECT forum_slug FROM $bbdb->forums ORDER BY forum_order ASC LIMIT 1" ) )
     431        if ( !$bbdb->get_var("SELECT forum_slug FROM $bbdb->forums ORDER BY forum_order ASC LIMIT 1" ) )
    432432                return; // Wait till after dbDelta
    433433        $bbdb->show_errors();
    434434
  • bb-includes/class-bb-taxonomy.php

     
    169169                else if ( 'all_with_object_id' == $fields )
    170170                        $select_this = 't.*, tt.*, tr.object_id';
    171171
    172                 $query = "SELECT $select_this FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON tt.term_id = t.term_id INNER JOIN {$this->db->term_relationships} AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids)$usr_sql ORDER BY $orderby $order";
     172                $query = "SELECT $select_this FROM {$this->db->terms} AS t INNER JOIN {$this->db->term_taxonomy} AS tt ON tt.term_id = t.term_id INNER JOIN {$this->db->term_relationships} AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) {$user_sql} ORDER BY $orderby $order";
    173173
    174174                if ( 'all' == $fields || 'all_with_object_id' == $fields ) {
    175175                        $terms = $this->db->get_results($query);
  • bb-includes/functions.php

     
    5252                foreach ( $_leaves as $leaf ) // Attach orphans to root
    5353                        $branch[$leaf->forum_id] = true;
    5454                $_leaves = false;
    55                 return $tree = empty($branch) ? false : $branch;
     55                return (empty($branch) ? false : $branch);
    5656        }
    5757
    5858        return $branch ? $branch : true;
  • bb-includes/l10n.php

     
    6666}
    6767
    6868function load_default_textdomain() {
    69         global $l10n;
    70 
    7169        $locale = get_locale();
    7270        $mofile = BB_LANG_DIR . "$locale.mo";
    7371
  • bb-includes/locale.php

     
    112112
    113113        function _load_locale_data() {
    114114                $locale = get_locale();
    115                 $locale_file = BB_PATH . "bb-includes/languages/$locale.php";
    116                 if ( !file_exists($locale_file) )
     115                $locale_file = BB_LANG_DIR. $locale . '.php';
     116                if ( !is_file($locale_file) )
    117117                        return;
    118118
    119119                include($locale_file);
  • bb-includes/pluggable.php

     
    8181
    8282if ( !function_exists('bb_login') ) :
    8383function bb_login( $login, $password, $remember = false ) {
    84         global $wp_auth_object;
    8584        if ( $user = bb_check_login( $login, $password ) ) {
    8685                wp_set_auth_cookie( $user->ID, $remember );
    8786                do_action('bb_user_login', (int) $user->ID );
  • bb-includes/registration-functions.php

     
    1818        if (ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.
    1919                '[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.
    2020                '[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$', $email)) {
    21                 if ( $check_domain && function_exists('checkdnsrr') ) {
     21                if ( function_exists('checkdnsrr') ) {
    2222                        list (, $domain)  = explode('@', $email);
    2323                        if ( checkdnsrr($domain . '.', 'MX') || checkdnsrr($domain . '.', 'A') ) {
    2424                                $r = $email;
     
    162162 * @return bool
    163163 */
    164164function bb_send_pass( $user, $pass ) {
    165         global $bbdb;
    166165        if ( !$user = bb_get_user( $user ) )
    167166                return false;
    168167
  • bb-includes/template-functions.php

     
    128128}
    129129
    130130function post_form( $h2 = '' ) {
    131         global $bb, $page, $topic, $forum;
     131        global $page, $topic, $forum;
    132132        $add = topic_pages_add();
    133133        if ( empty($h2) && false !== $h2 ) {
    134134                if ( is_topic() )
     
    169169}
    170170
    171171function edit_form() {
    172         global $bb_post, $topic_title;
     172        global $bb_post;
    173173        echo "<form class='postform edit-form' method='post' action='" . bb_get_option('uri')  . "bb-edit.php'>\n";
    174174        echo "<fieldset>\n";
    175175        bb_load_template( 'edit-form.php', array('topic_title') );
     
    684684        if ( !is_array($bb_forums_loop->elements) )
    685685                return false;
    686686
    687         if ( $r = $bb_forums_loop->step() ) {
     687        if ( $bb_forums_loop->step() ) {
    688688                $GLOBALS['forum'] =& $bb_forums_loop->elements[key($bb_forums_loop->elements)]; // Globalize the current forum object
    689689        } else {
    690690                $bb_forums_loop->reinstate();
     
    795795}
    796796
    797797function topic_posts( $id = 0 ) {
    798         echo apply_filters( 'topic_posts', get_topic_posts( $id = 0 ), get_topic_id( $id ) );
     798        echo apply_filters( 'topic_posts', get_topic_posts( $id ), get_topic_id( $id ) );
    799799}
    800800
    801801function get_topic_posts( $id = 0 ) {
     
    892892}
    893893
    894894function get_page_number_links($page, $total) {
    895         $r = '';
    896895        $args = array();
    897896        $uri = $_SERVER['REQUEST_URI'];
    898897        if ( bb_get_option('mod_rewrite') ) {
     
    19581957
    19591958        extract($args, EXTR_SKIP);
    19601959
    1961         if ( !$forums = bb_forums( $args ) )
     1960        if ( !bb_forums( $args ) )
    19621961                return;
    19631962
    19641963        global $forum_id, $forum;
  • bb-plugins/akismet.php

     
    7979$bb_ksd_user_agent = 'bbPress/' . bb_get_option( 'version' ) . ' | bbAkismet/'. bb_get_option( 'version' );
    8080
    8181function bb_akismet_verify_key( $key ) {
    82         global $bb_ksd_pre_post_status, $bb_ksd_api_host, $bb_ksd_api_port;
     82        global $bb_ksd_api_port;
    8383        $blog = urlencode( bb_get_option('uri') );
    8484        $response = bb_ksd_http_post("key=$key&blog=$blog", 'rest.akismet.com', '/1.1/verify-key', $bb_ksd_api_port);
    8585        if ( 'valid' == $response[1] )
     
    268268}
    269269
    270270function bb_ksd_admin_page() {
    271         global $bb_current_submenu, $bb_posts, $page;
     271        global $bb_posts, $page;
    272272        if ( !bb_akismet_verify_key( bb_get_option( 'akismet_key' ) ) ) : ?>
    273273<div class="error"><p><?php printf(__('The API key you have specified is invalid.  Please double check the <strong>Akismet Key</strong> set in <a href="%s">Akismet configuration</a>.  If you don\'t have an API key yet, you can get one at <a href="%s">WordPress.com</a>.'), 'admin-base.php?plugin=bb_ksd_configuration_page', 'http://wordpress.com/api-keys/'); ?></p></div>
    274274<?php   endif;
  • bb-plugins/bozo.php

     
    3636        $limit = (int) bb_get_option('page_topics');
    3737        if ( 1 < $page )
    3838                $limit = ($limit * ($page - 1)) . ", $limit";
    39         $bozo_mkey = $bbdb->prefix . 'bozo_topics';
     39
    4040        $bb_last_countable_query = "SELECT user_id FROM $bbdb->usermeta WHERE meta_key='is_bozo' AND meta_value='1' ORDER BY umeta_id DESC LIMIT $limit";
    4141        if ( $ids = (array) $bbdb->get_col( $bb_last_countable_query ) )
    4242                bb_cache_users( $ids );
     
    103103                                        unset($indices, $index, $old[$i]);
    104104                                endif;
    105105                        endforeach;
    106                         unset($topics, $t, $i, $counts, $posters, $bozos);
     106                        unset($topics, $i, $counts, $posters, $bozos);
    107107                endif;
    108108                if ( $old ) :
    109109                        $old = join(',', array_map('intval', array_flip($old)));
     
    233233                        $user->bozo_topics[$topic_id] = 1;
    234234                else
    235235                        $user->bozo_topics = array($topic_id => 1);
    236                 bb_update_usermeta( $uid, $bbdb->prefix . 'bozo_topics', $user->bozo_topics );
     236                bb_update_usermeta( $user_id, $bbdb->prefix . 'bozo_topics', $user->bozo_topics );
    237237        }
    238238}
    239239
     
    254254               
    255255                if ( --$user->bozo_topics[$topic_id] < 1 )
    256256                        unset($user->bozo_topics[$topic_id]);
    257                 bb_update_usermeta( $uid, $bbdb->prefix . 'bozo_topics', $user->bozo_topics );
     257                bb_update_usermeta( $user_id, $bbdb->prefix . 'bozo_topics', $user->bozo_topics );
    258258        }
    259259}
    260260
    261261function bb_bozo_profile_admin_keys( $a ) {
    262         global $user;
    263262        $a['is_bozo'] = array(
    264263                0,                                                      // Required
    265264                __('This user is a bozo'),      // Label