summaryrefslogtreecommitdiff
path: root/includes/user.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2001-05-16 20:54:37 +0000
committerDries Buytaert <dries@buytaert.net>2001-05-16 20:54:37 +0000
commit6f02738cc2ca88d01d541b9b81cc7cf860980c33 (patch)
tree81ef242e0ae747e1715142dd370450bbed651ceb /includes/user.inc
parent0b13183e097ae941db44a52b5ce5dc97faef99c2 (diff)
downloadbrdo-6f02738cc2ca88d01d541b9b81cc7cf860980c33.tar.gz
brdo-6f02738cc2ca88d01d541b9b81cc7cf860980c33.tar.bz2
- Removed the "history"-field from the SQL table "users" and added
this information to the "users"-field in both nodes and comments. This database/table change reduces the number of SQL queries and makes Drupal scale better where a lot of voting/moderation takes place. Last but not least it can be considered a new and better foundation for future moderation metrics / algorithms. In other words: it is plain better. --> oops, all voting/moderation results will be lost! --> requires database update, see "2.00-to-x.xx.sql"! - Updated database/database.mysql
Diffstat (limited to 'includes/user.inc')
-rw-r--r--includes/user.inc39
1 files changed, 1 insertions, 38 deletions
diff --git a/includes/user.inc b/includes/user.inc
index 02038cf9b..74254dc2b 100644
--- a/includes/user.inc
+++ b/includes/user.inc
@@ -52,46 +52,9 @@ function user_save($account, $array) {
return user_load(($account->userid ? $account->userid : $array[userid]));
}
-function user_get($account, $column, $field) {
- $data = explode(";", $account->$column);
- for (reset($data); current($data); next($data)) {
- $entry = explode(":", current($data));
- if (reset($entry) == $field) $rval = end($entry);
- }
- return $rval;
-}
-
-function user_set($account, $column, $name, $value) {
- $field = $account->$column;
-
- if (!$value) {
- // remove entry:
- $data = explode(";", $field);
- for (reset($data); current($data); next($data)) {
- $entry = explode(":", current($data));
- if ($entry[0] != $name) $rval .= "$entry[0]:$entry[1];";
- }
- }
- else if (strstr($field, "$name:")) {
- // found: update exsisting entry:
- $data = explode(";", $field);
- for (reset($data); current($data); next($data)) {
- $entry = explode(":", current($data));
- if ($entry[0] == $name) $entry[1] = $value;
- $rval .= "$entry[0]:$entry[1];";
- }
- }
- else {
- // not found:
- $rval = "$field$name:$value;";
- }
-
- return user_save($account, array($column => $rval));
-}
-
function user_access($account, $section = 0) {
global $user;
- if ($section) return (user_get($account, "access", $section) || $account->id == 1);
+ if ($section) return (field_get($account, "access", $section) || $account->id == 1);
else return ($account->access || $account->id == 1);
}