From fed106eb5781a39ccf94080c8bca1c1dc02f9879 Mon Sep 17 00:00:00 2001 From: Matt Mullenweg Date: Sat, 7 Aug 2004 01:22:17 +0000 Subject: [PATCH] Define COOKIEHASH and new get_profile function. TODO: re-org function soup git-svn-id: https://develop.svn.wordpress.org/trunk@1513 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/functions.php | 8 ++++++++ wp-settings.php | 11 +++++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index 268233180a..e2636ce814 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -12,6 +12,13 @@ if (!function_exists('floatval')) { } } +function get_profile($field, $user = false) { + global $wpdb; + if (!$user) + $user = $wpdb->escape($_COOKIE['wordpressuser_' . COOKIEHASH]); + return $wpdb->get_var("SELECT $field FROM $wpdb->users WHERE user_login = '$user'"); +} + function mysql2date($dateformatstring, $mysqlstring, $use_b2configmonthsdays = 1) { global $month, $weekday; $m = $mysqlstring; @@ -165,6 +172,7 @@ function get_currentuserinfo() { // a bit like get_userdata(), on steroids function get_userdata($userid) { global $wpdb, $cache_userdata; + $userid = (int) $userid; if ( empty($cache_userdata[$userid]) ) { $cache_userdata[$userid] = $wpdb->get_row("SELECT * FROM $wpdb->users WHERE ID = '$userid'"); diff --git a/wp-settings.php b/wp-settings.php index a2c4353b46..888ed21d56 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -61,16 +61,15 @@ if ( !update_user_cache() && !strstr($_SERVER['PHP_SELF'], 'install.php') ) die("It doesn't look like you've installed WP yet. Try running install.php."); $wpdb->show_errors(); -if (!strstr($_SERVER['PHP_SELF'], 'install.php') && !strstr($_SERVER['PHP_SELF'], 'wp-admin/import')) { - +if (!strstr($_SERVER['PHP_SELF'], 'install.php') && !strstr($_SERVER['PHP_SELF'], 'wp-admin/import')) : $querystring_start = '?'; $querystring_equal = '='; $querystring_separator = '&'; - //} - // Used to guarantee unique cookies - $cookiehash = md5(get_settings('siteurl')); -} //end !$_wp_installing + // Used to guarantee unique hash cookies + $cookiehash = md5(get_settings('siteurl')); + define('COOKIEHASH', $cookiehash); +endif; require (ABSPATH . WPINC . '/vars.php');