[wp-cvs] wordpress/wp-includes functions.php,1.101.4.4,1.101.4.5
Ryan Boren
rboren at users.sourceforge.net
Sat Nov 27 22:54:55 UTC 2004
Update of /cvsroot/cafelog/wordpress/wp-includes
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19152/wp-includes
Modified Files:
Tag: WordPress-Ver-1_2-Branch
functions.php
Log Message:
Login cleanup. Port from 1.3.
Index: functions.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-includes/functions.php,v
retrieving revision 1.101.4.4
retrieving revision 1.101.4.5
diff -C2 -d -r1.101.4.4 -r1.101.4.5
*** functions.php 12 Oct 2004 14:58:00 -0000 1.101.4.4
--- functions.php 27 Nov 2004 22:54:52 -0000 1.101.4.5
***************
*** 1368,1370 ****
--- 1368,1411 ----
}
+ function wp_mail($to, $subject, $message, $headers = '', $more = '') {
+ if( $headers == '' ) {
+ $headers = "MIME-Version: 1.0\r\n" .
+ "From: " . $to . " <" . $to . ">\r\n" .
+ "Content-Type: text/plain; charset=\"" . get_settings('blog_charset') . "\"\r\n";
+ }
+ if ( function_exists('mb_send_mail') )
+ return mb_send_mail($to, $subject, $message, $headers, $more);
+ else
+ return mail($to, $subject, $message, $headers, $more);
+ }
+
+ function wp_login($username, $password, $already_md5 = false) {
+ global $wpdb, $error, $tableusers;
+
+ 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 $tableusers WHERE user_login = '$username'");
+
+ if (!$login) {
+ $error = __('<strong>Error</strong>: Wrong login.');
+ return false;
+ } else {
+ // If the password is already_md5, it has been double hashed.
+ // Otherwise, it is plain text.
+ if ( ($already_md5 && $login->user_login == $username && md5($login->user_pass) == $password) || ($login->user_login == $username && $login->user_pass == md5($password)) ) {
+ return true;
+ } else {
+ $error = __('<strong>Error</strong>: Incorrect password.');
+ $pwd = '';
+ return false;
+ }
+ }
+ }
+
?>
\ No newline at end of file
More information about the cvs
mailing list