WordPress.org

Make WordPress Core

Changeset 1734


Ignore:
Timestamp:
10/04/2004 08:03:52 AM (14 years ago)
Author:
saxmatt
Message:

Code cleanup and some fixes from the WP Japan folks.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions-user.php

    r1525 r1734  
    11<?php
    22
    3 function verify_login($user, $password) {
    4     global $wpdb;
    5     $user = $wpdb->escape($user);
    6     $password = $password;
     3function login($username, $password, $already_md5 = false) {
     4    global $wpdb, $error;
     5    if ( !$already_md5 )
     6        $pwd = md5($password);
    77
    8     if ( $user = $wpdb->get_row("SELECT user_login, user_pass FROM $wpdb->users WHERE user_login = '$user'") ) {
    9         if ( $user->user_pass = md5($password) )
    10             return true;
    11         else
    12             return false;
    13     } else {
     8    if ( !$username )
    149        return false;
    15     }
    16 }
    1710
    18 function verify_current() {
    19     if (!empty($_COOKIE['wordpressuser_' . COOKIEHASH])) {
    20         $user_login = $_COOKIE['wordpressuser_' . COOKIEHASH];
    21         $user_pass = $_COOKIE['wordpresspass_' . COOKIEHASH];
    22     } else {
     11    if ( !$password ) {
     12        $error = __('<strong>Error</strong>: The password field is empty.');
    2313        return false;
    2414    }
    2515
    26     if ('' == $user_login)
     16    $login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'");
     17
     18    if (!$login) {
     19        $error = __('<strong>Error</strong>: Wrong login.');
     20        $pwd = '';
    2721        return false;
    28     if ('' == $user_pass)
    29         return false;
     22    } else {
    3023
    31     if ( verify_login($user_login, $user_pass) ) {
    32         return true;
    33     } else {
    34         header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
    35         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    36         header('Cache-Control: no-cache, must-revalidate');
    37         header('Pragma: no-cache');
    38         header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']) );
    39         exit();
     24        if ( $login->user_login == $username && $login->user_pass == $pwd ) {
     25            return true;
     26        } else {
     27            $error = __('<strong>Error</strong>: Incorrect password.');
     28            $pwd = '';
     29            return false;
     30        }
    4031    }
    4132}
  • trunk/wp-includes/functions.php

    r1733 r1734  
    560560// ( or just any time between timer_start() and timer_stop() )
    561561
    562 function timer_start() {
    563     global $timestart;
    564     $mtime = microtime();
    565     $mtime = explode(' ',$mtime);
    566     $mtime = $mtime[1] + $mtime[0];
    567     $timestart = $mtime;
    568     return true;
    569 }
    570 
    571562function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
    572563    global $timestart, $timeend;
  • trunk/wp-login.php

    r1733 r1734  
    11<?php
    22require('./wp-config.php');
    3 
    4 function login($username, $password, $already_md5 = false) {
    5     global $wpdb, $error;
    6     if ( !$already_md5 )
    7         $pwd = md5($password);
    8 
    9     if ( !$username )
    10         return false;
    11 
    12     if ( !$password ) {
    13         $error = __('<strong>Error</strong>: The password field is empty.');
    14         return false;
    15     }
    16 
    17     $login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'");
    18 
    19     if (!$login) {
    20         $error = __('<strong>Error</strong>: Wrong login.');
    21         $pwd = '';
    22         return false;
    23     } else {
    24 
    25         if ( $login->user_login == $username && $login->user_pass == $pwd ) {
    26             return true;
    27         } else {
    28             $error = __('<strong>Error</strong>: Incorrect password.');
    29             $pwd = '';
    30             return false;
    31         }
    32     }
    33 }
    343
    354if (!function_exists('add_magic_quotes')) {
  • trunk/wp-settings.php

    r1712 r1734  
    1010    die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' );
    1111
     12function timer_start() {
     13    global $timestart;
     14    $mtime = explode(' ', microtime() );
     15    $mtime = $mtime[1] + $mtime[0];
     16    $timestart = $mtime;
     17    return true;
     18}
     19timer_start();
    1220
    1321// Change to E_ALL for development/debugging
     
    4149
    4250require (ABSPATH . WPINC . '/functions.php');
    43 timer_start();
    4451require (ABSPATH . WPINC . '/functions-formatting.php');
    4552require (ABSPATH . WPINC . '/functions-user.php');
  • trunk/wp-trackback.php

    r1708 r1734  
    3535$excerpt = $_POST['excerpt'];
    3636$blog_name = $_POST['blog_name'];
     37$charset = $_POST['charset'];
     38
     39if ($charset)
     40    $charset = strtoupper( trim($charset) );
     41else
     42    $charset = 'auto';
     43
     44if ( function_exists('mb_convert_encoding') ) {
     45    $title = mb_convert_encoding($title, get_settings('blog_charset'), $charset);
     46    $excerpt = mb_convert_encoding($excerpt, get_settings('blog_charset'), $charset);
     47    $blog_name = mb_convert_encoding($blog_name, get_settings('blog_charset'), $charset);
     48}
    3749
    3850if ( is_single() )
Note: See TracChangeset for help on using the changeset viewer.