Make WordPress Core

Ticket #7790: 7790.003.diff

File 7790.003.diff, 8.2 KB (added by ionfish, 17 years ago)
  • wp-login.php

     
    272272switch ($action) {
    273273
    274274case 'logout' :
    275 
     275        check_admin_referer('log-out');
    276276        wp_logout();
    277277
    278278        $redirect_to = 'wp-login.php?loggedout=true';
  • wp-includes/functions.php

     
    22012201                $trans['edit']['theme']        = array( __( 'Your attempt to edit this theme file: "%s" has failed.' ), 'use_id' );
    22022202                $trans['switch']['theme']      = array( __( 'Your attempt to switch to this theme: "%s" has failed.' ), 'use_id' );
    22032203
     2204                $trans['log']['out']           = array( sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'sitename' ) ), false );
     2205
    22042206                if ( isset( $trans[$verb][$noun] ) ) {
    22052207                        if ( !empty( $trans[$verb][$noun][1] ) ) {
    22062208                                $lookup = $trans[$verb][$noun][1];
     
    22342236        $html = wp_specialchars( wp_explain_nonce( $action ) );
    22352237        if ( wp_get_referer() )
    22362238                $html .= "</p><p><a href='" . remove_query_arg( 'updated', clean_url( wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
     2239        elseif ( 'log-out' == $action )
     2240                $html .= "</p><p>" . sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_nonce_url( site_url('wp-login.php?action=logout', 'login'), 'log-out' ) );
     2241
    22372242        wp_die( $html, $title);
    22382243}
    22392244
  • wp-includes/general-template.php

     
    104104 */
    105105function wp_loginout() {
    106106        if ( ! is_user_logged_in() )
    107                 $link = '<a href="' . site_url('wp-login.php', 'login') . '">' . __('Log in') . '</a>';
     107                $link = '<a href="' . wp_login_url() . '">' . __('Log in') . '</a>';
    108108        else
    109                 $link = '<a href="' . site_url('wp-login.php?action=logout', 'login') . '">' . __('Log out') . '</a>';
     109                $link = '<a href="' . wp_logout_url() . '">' . __('Log out') . '</a>';
    110110
    111111        echo apply_filters('loginout', $link);
    112112}
    113113
    114114/**
     115 * Returns the Log Out URL.
     116 *
     117 * Returns the URL that allows the user to log out of the site
     118 *
     119 * @since 2.7
     120 * @uses wp_nonce_url() To protect against CSRF
     121 * @uses site_url() To generate the log in URL
     122 *
     123 * @param string $redirect Path to redirect to on logout.
     124 */
     125function wp_logout_url($redirect = '') {
     126        if ( strlen($redirect) )
     127                $redirect = "&redirect_to=$redirect";
     128       
     129        return wp_nonce_url( site_url("wp-login.php?action=logout$redirect", 'login'), 'log-out' );
     130}
     131
     132/**
     133 * Returns the Log In URL.
     134 *
     135 * Returns the URL that allows the user to log in to the site
     136 *
     137 * @since 2.7
     138 * @uses site_url() To generate the log in URL
     139 *
     140 * @param string $redirect Path to redirect to on login.
     141 */
     142function wp_login_url($redirect = '') {
     143        if ( strlen($redirect) )
     144                $redirect = "?redirect_to=$redirect";
     145       
     146        return site_url("wp-login.php$redirect", 'login');
     147}
     148
     149/**
    115150 * Display the Registration or Admin link.
    116151 *
    117152 * Display a link which allows the user to navigate to the registration page if
  • wp-content/themes/classic/comments.php

     
    4343
    4444<?php if ( $user_ID ) : ?>
    4545
    46 <p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php _e('Log out &raquo;'); ?></a></p>
     46<p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="<?php _e('Log out of this account') ?>"><?php _e('Log out &raquo;'); ?></a></p>
    4747
    4848<?php else : ?>
    4949
  • wp-content/themes/classic/comments-popup.php

     
    5757
    5858<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    5959<?php if ( $user_ID ) : ?>
    60 <p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php echo attribute_escape(__('Log out of this account')); ?>"><?php _e('Log out &raquo;'); ?></a></p>
     60<p><?php printf(__('Logged in as %s.'), '<a href="'.get_option('siteurl').'/wp-admin/profile.php">'.$user_identity.'</a>'); ?> <a href="<?php echo wp_logout_url(); ?>" title="<?php echo attribute_escape(__('Log out of this account')); ?>"><?php _e('Log out &raquo;'); ?></a></p>
    6161<?php else : ?>
    6262        <p>
    6363          <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
  • wp-content/themes/default/comments.php

     
    5252
    5353<?php if ( $user_ID ) : ?>
    5454
    55 <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Log out &raquo;</a></p>
     55<p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></p>
    5656
    5757<?php else : ?>
    5858
  • wp-content/themes/default/comments-popup.php

     
    5757
    5858<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    5959<?php if ( $user_ID ) : ?>
    60         <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Log out &raquo;</a></p>
     60        <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></p>
    6161<?php else : ?>
    6262        <p>
    6363          <input type="text" name="author" id="author" class="textarea" value="<?php echo $comment_author; ?>" size="28" tabindex="1" />
  • wp-admin/admin-header.php

     
    143143        </div>
    144144<?php } ?>
    145145
    146 <div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo site_url('wp-login.php?action=logout', 'login') ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>'); if ( ! $is_opera ) { ?> | <span id="gears-menu"><a href="#" onclick="wpGears.message(1);return false;"><?php _e('Turbo') ?></a></span><?php } ?></p></div>
     146<div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo wp_logout_url() ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>'); if ( ! $is_opera ) { ?> | <span id="gears-menu"><a href="#" onclick="wpGears.message(1);return false;"><?php _e('Turbo') ?></a></span><?php } ?></p></div>
    147147
    148148<?php
    149149require(ABSPATH . 'wp-admin/menu-header.php');