Make WordPress Core

Ticket #25350: 25350.03.patch

File 25350.03.patch, 3.5 KB (added by boonebgorges, 12 years ago)
  • src/wp-activate.php

     
    5252add_action( 'wp_head', 'wpmu_activate_stylesheet' );
    5353
    5454get_header();
     55
     56$key_param = wp_activation_key_param();
     57$get_activation_key = false;
     58if ( ! empty( $_GET[ $key_param ] ) ) {
     59        $get_activation_key = urldecode( $_GET[ $key_param ] );
     60} else if ( ! empty( $_GET['key'] ) ) {
     61        // Backward compatibility
     62        $get_activation_key = urldecode( $_GET['key'] );
     63}
     64
    5565?>
    5666
    5767<div id="content" class="widecolumn">
    58         <?php if ( empty($_GET['key']) && empty($_POST['key']) ) { ?>
     68        <?php if ( empty( $get_activation_key ) && empty($_POST['key']) ) { ?>
    5969
    6070                <h2><?php _e('Activation Key Required') ?></h2>
    6171                <form name="activateform" id="activateform" method="post" action="<?php echo network_site_url('wp-activate.php'); ?>">
     
    7080
    7181        <?php } else {
    7282
    73                 $key = !empty($_GET['key']) ? $_GET['key'] : $_POST['key'];
     83                $key = ! empty( $get_activation_key ) ? $get_activation_key : $_POST['key'];
    7484                $result = wpmu_activate_signup($key);
    7585                if ( is_wp_error($result) ) {
    7686                        if ( 'already_active' == $result->get_error_code() || 'blog_taken' == $result->get_error_code() ) {
     
    116126        var key_input = document.getElementById('key');
    117127        key_input && key_input.focus();
    118128</script>
    119 <?php get_footer(); ?>
    120  No newline at end of file
     129<?php get_footer(); ?>
  • src/wp-includes/ms-functions.php

     
    714714        if ( !apply_filters('wpmu_signup_blog_notification', $domain, $path, $title, $user, $user_email, $key, $meta) )
    715715                return false;
    716716
     717        $key_param = wp_activation_key_param();
     718
    717719        // Send email with activation link.
    718720        if ( !is_subdomain_install() || $current_site->id != 1 )
    719                 $activate_url = network_site_url("wp-activate.php?key=$key");
     721                $activate_url = network_site_url("wp-activate.php?$key_param=$key");
    720722        else
    721                 $activate_url = "http://{$domain}{$path}wp-activate.php?key=$key"; // @todo use *_url() API
     723                $activate_url = "http://{$domain}{$path}wp-activate.php?$key_param=$key"; // @todo use *_url() API
    722724
    723725        $activate_url = esc_url($activate_url);
    724726        $admin_email = get_site_option( 'admin_email' );
     
    773775        if ( !apply_filters('wpmu_signup_user_notification', $user, $user_email, $key, $meta) )
    774776                return false;
    775777
     778        $key_param = wp_activation_key_param();
     779
    776780        // Send email with activation link.
    777781        $admin_email = get_site_option( 'admin_email' );
    778782        if ( $admin_email == '' )
     
    784788                        __( "To activate your user, please click the following link:\n\n%s\n\nAfter you activate, you will receive *another email* with your login." ),
    785789                        $user, $user_email, $key, $meta
    786790                ),
    787                 site_url( "wp-activate.php?key=$key" )
     791                site_url( "wp-activate.php?$key_param=$key" )
    788792        );
    789793        // TODO: Don't hard code activation link.
    790794        $subject = sprintf(
     
    20592063
    20602064        return $site_results;
    20612065}
     2066
     2067/**
     2068 * Return the URL parameter to use for activation keys
     2069 *
     2070 * @since 3.7.0
     2071 *
     2072 * @return string The activation key paramater. Defaults to 'k'.
     2073 */
     2074function wp_activation_key_param() {
     2075        /**
     2076         * Filter the URL parameter to use for activation keys
     2077         *
     2078         * @since 3.7.0
     2079         * @param string The activation key parameter.
     2080         */
     2081        return urlencode( apply_filters( 'wp_activation_key_param', 'k' ) );
     2082}