Commit 9df234e6 authored by Dries's avatar Dries

- Removed a MySQL-ism from the user module.  Patch by James.

- Fixed the "uid < 0" issue.  Fix by Marco.
parent 9c0cfb85
...@@ -276,7 +276,7 @@ function user_fields() { ...@@ -276,7 +276,7 @@ function user_fields() {
static $fields; static $fields;
if (!$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)); $fields = array_keys(db_fetch_array($result));
} }
...@@ -343,9 +343,8 @@ function user_block() { ...@@ -343,9 +343,8 @@ function user_block() {
// Who's online block // Who's online block
$time = 60 * 60; // minutes * seconds $time = 60 * 60; // minutes * seconds
$limit = 5; // List the X most recent people
$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)) { if (db_num_rows($result)) {
$output = ""; $output = "";
......
...@@ -276,7 +276,7 @@ function user_fields() { ...@@ -276,7 +276,7 @@ function user_fields() {
static $fields; static $fields;
if (!$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)); $fields = array_keys(db_fetch_array($result));
} }
...@@ -343,9 +343,8 @@ function user_block() { ...@@ -343,9 +343,8 @@ function user_block() {
// Who's online block // Who's online block
$time = 60 * 60; // minutes * seconds $time = 60 * 60; // minutes * seconds
$limit = 5; // List the X most recent people
$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)) { if (db_num_rows($result)) {
$output = ""; $output = "";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment