From 9df234e63ba0473c29806e87d730dd412e90217c Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Sun, 18 Aug 2002 12:36:02 +0000 Subject: - Removed a MySQL-ism from the user module. Patch by James. - Fixed the "uid < 0" issue. Fix by Marco. --- modules/user.module | 7 +++---- modules/user/user.module | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/user.module b/modules/user.module index 1d8959a2b..a95a3a848 100644 --- a/modules/user.module +++ b/modules/user.module @@ -276,7 +276,7 @@ function user_fields() { static $fields; if (!$fields) { - $result = db_query("SELECT * FROM users WHERE uid < 0"); + $result = db_query("SELECT * FROM users WHERE uid = 1"); $fields = array_keys(db_fetch_array($result)); } @@ -342,10 +342,9 @@ function user_block() { $block[1]["link"] = drupal_url(array("mod" => "user"), "module"); // Who's online block - $time = 60 * 60; // minutes * seconds - $limit = 5; // List the X most recent people + $time = 60 * 60; // minutes * seconds - $result = db_query("SELECT uid, name FROM users WHERE timestamp > unix_timestamp() - $time ORDER BY timestamp DESC LIMIT $limit"); + $result = db_query("SELECT uid, name FROM users WHERE timestamp > %d - %d ORDER BY timestamp DESC", time(), $time); if (db_num_rows($result)) { $output = ""; diff --git a/modules/user/user.module b/modules/user/user.module index 1d8959a2b..a95a3a848 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -276,7 +276,7 @@ function user_fields() { static $fields; if (!$fields) { - $result = db_query("SELECT * FROM users WHERE uid < 0"); + $result = db_query("SELECT * FROM users WHERE uid = 1"); $fields = array_keys(db_fetch_array($result)); } @@ -342,10 +342,9 @@ function user_block() { $block[1]["link"] = drupal_url(array("mod" => "user"), "module"); // Who's online block - $time = 60 * 60; // minutes * seconds - $limit = 5; // List the X most recent people + $time = 60 * 60; // minutes * seconds - $result = db_query("SELECT uid, name FROM users WHERE timestamp > unix_timestamp() - $time ORDER BY timestamp DESC LIMIT $limit"); + $result = db_query("SELECT uid, name FROM users WHERE timestamp > %d - %d ORDER BY timestamp DESC", time(), $time); if (db_num_rows($result)) { $output = ""; -- cgit v1.2.3