summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2002-08-18 12:36:02 +0000
committerDries Buytaert <dries@buytaert.net>2002-08-18 12:36:02 +0000
commit9df234e63ba0473c29806e87d730dd412e90217c (patch)
tree8b420be98f7b216b85296a5d9233eb815460a4fb
parent9c0cfb859cd589456972d8fe69ac73104e40125e (diff)
downloadbrdo-9df234e63ba0473c29806e87d730dd412e90217c.tar.gz
brdo-9df234e63ba0473c29806e87d730dd412e90217c.tar.bz2
- Removed a MySQL-ism from the user module. Patch by James.
- Fixed the "uid < 0" issue. Fix by Marco.
-rw-r--r--modules/user.module7
-rw-r--r--modules/user/user.module7
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 = "";