Make WordPress Core

Changeset 1947


Ignore:
Timestamp:
12/14/2004 03:00:55 AM (20 years ago)
Author:
saxmatt
Message:

Move all auth stuff into functions.

Location:
trunk
Files:
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin.php

    r1894 r1947  
    22require_once('../wp-config.php');
    33require_once(ABSPATH . 'wp-includes/wp-l10n.php');
     4require_once(ABSPATH . 'wp-admin/admin-functions.php');
     5auth_redirect();
    46
    5 require_once(ABSPATH . 'wp-admin/auth.php');
    6 require(ABSPATH . 'wp-admin/admin-functions.php');
    77
    88$dogs = $wpdb->get_results("SELECT * FROM $wpdb->categories");
  • trunk/wp-admin/index.php

    r1429 r1947  
    22
    33require('../wp-config.php');
    4 require_once('auth.php');
     4auth_redirect();
    55
    66get_currentuserinfo();
  • trunk/wp-admin/profile.php

    r1943 r1947  
    2222
    2323require_once('../wp-config.php');
    24 require_once('auth.php');
     24auth_redirect();
    2525switch($action) {
    2626
  • trunk/wp-includes/functions.php

    r1940 r1947  
    19551955}
    19561956
     1957if ( !function_exists('wp_login') ) :
    19571958function wp_login($username, $password, $already_md5 = false) {
    19581959    global $wpdb, $error;
     
    19831984    }
    19841985}
     1986endif;
     1987
     1988if ( !function_exists('auth_redirect') ) :
     1989function auth_redirect() {
     1990    // Checks if a user is logged in, if not redirects them to the login page
     1991    if ( (!empty($_COOKIE['wordpressuser_' . COOKIEHASH]) &&
     1992    !wp_login($_COOKIE['wordpressuser_' . COOKIEHASH], $_COOKIE['wordpresspass_' . COOKIEHASH], true)) ||
     1993     (empty($_COOKIE['wordpressuser_' . COOKIEHASH])) ) {
     1994        header('Expires: Wed, 5 Jun 1979 23:41:00 GMT'); // Michel's birthday
     1995        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
     1996        header('Cache-Control: no-cache, must-revalidate');
     1997        header('Pragma: no-cache');
     1998   
     1999        header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']));
     2000        exit();
     2001    }
     2002}
     2003endif;
    19852004
    19862005function is_plugin_page() {
Note: See TracChangeset for help on using the changeset viewer.