Permalink
Browse files

Code cleanup and some fixes from the WP Japan folks.

git-svn-id: http://svn.automattic.com/wordpress/trunk@1734 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information...
1 parent ec34fb1 commit 551e52ff91f108f26c45d0bcd9d4f4746430df66 saxmatt committed Oct 4, 2004
Showing with 40 additions and 70 deletions.
  1. +20 −29 wp-includes/functions-user.php
  2. +0 −9 wp-includes/functions.php
  3. +0 −31 wp-login.php
  4. +8 −1 wp-settings.php
  5. +12 −0 wp-trackback.php
@@ -1,42 +1,33 @@
<?php
-function verify_login($user, $password) {
- global $wpdb;
- $user = $wpdb->escape($user);
- $password = $password;
+function login($username, $password, $already_md5 = false) {
+ global $wpdb, $error;
+ if ( !$already_md5 )
+ $pwd = md5($password);
- if ( $user = $wpdb->get_row("SELECT user_login, user_pass FROM $wpdb->users WHERE user_login = '$user'") ) {
- if ( $user->user_pass = md5($password) )
- return true;
- else
- return false;
- } else {
+ if ( !$username )
return false;
- }
-}
-function verify_current() {
- if (!empty($_COOKIE['wordpressuser_' . COOKIEHASH])) {
- $user_login = $_COOKIE['wordpressuser_' . COOKIEHASH];
- $user_pass = $_COOKIE['wordpresspass_' . COOKIEHASH];
- } else {
+ if ( !$password ) {
+ $error = __('<strong>Error</strong>: The password field is empty.');
return false;
}
- if ('' == $user_login)
- return false;
- if ('' == $user_pass)
- return false;
+ $login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'");
- if ( verify_login($user_login, $user_pass) ) {
- return true;
+ if (!$login) {
+ $error = __('<strong>Error</strong>: Wrong login.');
+ $pwd = '';
+ return false;
} else {
- header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
- header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
- header('Cache-Control: no-cache, must-revalidate');
- header('Pragma: no-cache');
- header('Location: ' . get_settings('siteurl') . '/wp-login.php?redirect_to=' . urlencode($_SERVER['REQUEST_URI']) );
- exit();
+
+ if ( $login->user_login == $username && $login->user_pass == $pwd ) {
+ return true;
+ } else {
+ $error = __('<strong>Error</strong>: Incorrect password.');
+ $pwd = '';
+ return false;
+ }
}
}
@@ -559,15 +559,6 @@ function gzip_compression() {
// functions to count the page generation time (from phpBB2)
// ( or just any time between timer_start() and timer_stop() )
-function timer_start() {
- global $timestart;
- $mtime = microtime();
- $mtime = explode(' ',$mtime);
- $mtime = $mtime[1] + $mtime[0];
- $timestart = $mtime;
- return true;
-}
-
function timer_stop($display = 0, $precision = 3) { //if called like timer_stop(1), will echo $timetotal
global $timestart, $timeend;
$mtime = microtime();
View
@@ -1,37 +1,6 @@
<?php
require('./wp-config.php');
-function login($username, $password, $already_md5 = false) {
- global $wpdb, $error;
- if ( !$already_md5 )
- $pwd = md5($password);
-
- if ( !$username )
- return false;
-
- if ( !$password ) {
- $error = __('<strong>Error</strong>: The password field is empty.');
- return false;
- }
-
- $login = $wpdb->get_row("SELECT ID, user_login, user_pass FROM $wpdb->users WHERE user_login = '$username'");
-
- if (!$login) {
- $error = __('<strong>Error</strong>: Wrong login.');
- $pwd = '';
- return false;
- } else {
-
- if ( $login->user_login == $username && $login->user_pass == $pwd ) {
- return true;
- } else {
- $error = __('<strong>Error</strong>: Incorrect password.');
- $pwd = '';
- return false;
- }
- }
-}
-
if (!function_exists('add_magic_quotes')) {
function add_magic_quotes($array) {
foreach ($array as $k => $v) {
View
@@ -9,6 +9,14 @@
if ( !(phpversion() >= '4.1') )
die( 'Your server is running PHP version ' . phpversion() . ' but WordPress requires at least 4.1' );
+function timer_start() {
+ global $timestart;
+ $mtime = explode(' ', microtime() );
+ $mtime = $mtime[1] + $mtime[0];
+ $timestart = $mtime;
+ return true;
+}
+timer_start();
// Change to E_ALL for development/debugging
error_reporting(E_ALL ^ E_NOTICE);
@@ -40,7 +48,6 @@
$tablepostmeta = $wpdb->postmeta;
require (ABSPATH . WPINC . '/functions.php');
-timer_start();
require (ABSPATH . WPINC . '/functions-formatting.php');
require (ABSPATH . WPINC . '/functions-user.php');
require (ABSPATH . WPINC . '/classes.php');
View
@@ -34,6 +34,18 @@ function trackback_response($error = 0, $error_message = '') {
$title = $_POST['title'];
$excerpt = $_POST['excerpt'];
$blog_name = $_POST['blog_name'];
+$charset = $_POST['charset'];
+
+if ($charset)
+ $charset = strtoupper( trim($charset) );
+else
+ $charset = 'auto';
+
+if ( function_exists('mb_convert_encoding') ) {
+ $title = mb_convert_encoding($title, get_settings('blog_charset'), $charset);
+ $excerpt = mb_convert_encoding($excerpt, get_settings('blog_charset'), $charset);
+ $blog_name = mb_convert_encoding($blog_name, get_settings('blog_charset'), $charset);
+}
if ( is_single() )
$tb_id = $posts[0]->ID;

0 comments on commit 551e52f

Please sign in to comment.