Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal/drupal/CHANGELOG.txt,v
retrieving revision 1.146
diff -u -F^f -r1.146 CHANGELOG.txt
--- CHANGELOG.txt 14 Aug 2006 10:41:52 -0000 1.146
+++ CHANGELOG.txt 16 Aug 2006 03:01:46 -0000
@@ -1,4 +1,4 @@
-// $Id: CHANGELOG.txt,v 1.146 2006/08/14 10:41:52 dries Exp $
+// $Id: CHANGELOG.txt,v 1.147 2006/08/15 05:33:26 drumm Exp $
Drupal x.x.x, xxxx-xx-xx (development version)
------------------------
@@ -36,6 +36,7 @@
- PHP Template engine:
* add the ability to look for a series of suggested templates.
* look for page templates based upon the path.
+ * look for block templates based upon the region, module, and delta.
- content system:
* made it easier for node access modules to work well with each other.
* added configurable content types.
Index: robots.txt
===================================================================
RCS file: /cvs/drupal/drupal/robots.txt,v
retrieving revision 1.4
diff -u -F^f -r1.4 robots.txt
--- robots.txt 14 Aug 2006 20:35:10 -0000 1.4
+++ robots.txt 16 Aug 2006 03:01:46 -0000
@@ -1,3 +1,5 @@
+# $Id: robots.txt,v 1.5 2006/08/15 05:18:16 drumm Exp $
+#
# robots.txt
#
# This file aims to prevent the crawling and idexing of certain parts
Index: includes/bootstrap.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/bootstrap.inc,v
retrieving revision 1.112
diff -u -F^f -r1.112 bootstrap.inc
--- includes/bootstrap.inc 12 Aug 2006 11:47:24 -0000 1.112
+++ includes/bootstrap.inc 16 Aug 2006 03:01:46 -0000
@@ -1,5 +1,5 @@
0';
+ $result = db_fetch_object(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d'. $query, $time_period));
+ return $result->count;
+}
Index: modules/blogapi/blogapi.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blogapi/blogapi.module,v
retrieving revision 1.91
diff -u -F^f -r1.91 blogapi.module
--- modules/blogapi/blogapi.module 7 Aug 2006 21:00:26 -0000 1.91
+++ modules/blogapi/blogapi.module 16 Aug 2006 03:01:47 -0000
@@ -1,5 +1,5 @@
'select',
- '#title' => t('XML-RPC Engine'),
- '#default_value' => variable_get('blogapi_engine', 0),
- '#options' => array(0 => 'Blogger', 1 => 'MetaWeblog', 2 => 'Movabletype'),
- '#description' => t('RSD or Really-Simple-Discovery is a mechanism which allows external blogger tools to discover the APIs they can use to interact with Drupal. Here you can set the preferred method for blogger tools to interact with your site. The common XML-RPC engines are Blogger, MetaWeblog and Movabletype. If you are not sure which is the correct setting, choose Blogger.')
- );
-
$node_types = node_get_types('names');
$defaults = isset($node_types['blog']) ? array('blog' => 1) : array();
$form['blogapi_node_types'] = array(
@@ -625,8 +617,8 @@ function blogapi_rsd() {
$base
-
-
+
+
Index: modules/book/book.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/book/book.install,v
retrieving revision 1.3
diff -u -F^f -r1.3 book.install
--- modules/book/book.install 4 Aug 2006 06:58:44 -0000 1.3
+++ modules/book/book.install 16 Aug 2006 03:01:47 -0000
@@ -1,5 +1,5 @@
$name) {
$type = $types[$key];
- if (module_exist($type->module)) {
+ if (function_exists($type->module .'_form')) {
$name = check_plain($name);
$type_url_str = str_replace('_', '-', $type->type);
// Populate the operations field.
Index: modules/node/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node/node.module,v
retrieving revision 1.672
diff -u -F^f -r1.672 node.module
--- modules/node/node.module 14 Aug 2006 07:14:49 -0000 1.672
+++ modules/node/node.module 16 Aug 2006 03:01:51 -0000
@@ -1,5 +1,5 @@
'node', 'title' => t('content'),
- 'callback' => 'node_page',
+ 'callback' => 'node_page_default',
'access' => user_access('access content'),
'type' => MENU_MODIFIABLE_BY_ADMIN);
$items[] = array('path' => 'node/add', 'title' => t('create content'),
- 'callback' => 'node_page',
+ 'callback' => 'node_add',
'access' => user_access('access content'),
'type' => MENU_ITEM_GROUPING,
'weight' => 1);
@@ -1062,7 +1062,7 @@ function node_menu($may_cache) {
'type' => MENU_CALLBACK);
foreach (node_get_types() as $type) {
- if (module_exist($type->module)) {
+ if (function_exists($type->module .'_form')) {
$name = check_plain($type->name);
$type_url_str = str_replace('_', '-', $type->type);
$items[] = array(
@@ -1082,13 +1082,16 @@ function node_menu($may_cache) {
$node = node_load(arg(1));
if ($node->nid) {
$items[] = array('path' => 'node/'. arg(1), 'title' => t('view'),
- 'callback' => 'node_page',
+ 'callback' => 'node_page_view',
+ 'callback arguments' => array($node),
'access' => node_access('view', $node),
'type' => MENU_CALLBACK);
$items[] = array('path' => 'node/'. arg(1) .'/view', 'title' => t('view'),
- 'type' => MENU_DEFAULT_LOCAL_TASK, 'weight' => -10);
+ 'type' => MENU_DEFAULT_LOCAL_TASK,
+ 'weight' => -10);
$items[] = array('path' => 'node/'. arg(1) .'/edit', 'title' => t('edit'),
- 'callback' => 'node_page',
+ 'callback' => 'node_page_edit',
+ 'callback arguments' => array($node),
'access' => node_access('update', $node),
'weight' => 1,
'type' => MENU_LOCAL_TASK);
@@ -1994,7 +1997,7 @@ function theme_node_form($form) {
/**
* Present a node submission form or a set of links to such forms.
*/
-function node_add($type) {
+function node_add($type = NULL) {
global $user;
$types = node_get_types();
@@ -2010,7 +2013,7 @@ function node_add($type) {
else {
// If no (valid) node type has been provided, display a node type overview.
foreach ($types as $type) {
- if (module_exist($type->module) && node_access('create', $type->type)) {
+ if (function_exists($type->module .'_form') && node_access('create', $type->type)) {
$type_url_str = str_replace('_', '-', $type->type);
$title = t('Add a new %s.', array('%s' => check_plain($type->name)));
$out = '
'. l($type->name, "node/add/$type_url_str", array('title' => $title)) .'';
@@ -2238,7 +2241,7 @@ function node_revisions() {
}
/**
- * Generate a listing of promoted nodes.
+ * Menu callback; Generate a listing of promoted nodes.
*/
function node_page_default() {
$result = pager_query(db_rewrite_sql('SELECT n.nid, n.sticky, n.created FROM {node} n WHERE n.promote = 1 AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC'), variable_get('default_nodes_main', 10));
@@ -2286,67 +2289,34 @@ function node_page_default() {
);
$output = ''. $output .'
';
}
+ drupal_set_title('');
return $output;
}
/**
- * Menu callback; dispatches control to the appropriate operation handler.
+ * Menu callback; view a single node.
*/
-function node_page() {
- $op = arg(1);
+function node_page_view($node, $cid = NULL) {
+ drupal_set_title(check_plain($node->title));
+ return node_show($node, $cid);
+}
- if (is_numeric($op)) {
- $op = (arg(2) && !is_numeric(arg(2))) ? arg(2) : 'view';
+/**
+ * Menu callback; presents the node editing form, or redirects to delete confirmation.
+ */
+function node_page_edit($node) {
+ if ($_POST['op'] == t('Delete')) {
+ // Note: we redirect from node/nid/edit to node/nid/delete to make the tabs disappear.
+ if ($_REQUEST['destination']) {
+ $destination = drupal_get_destination();
+ unset($_REQUEST['destination']);
+ }
+ drupal_goto('node/'. $node->nid .'/delete', $destination);
}
- switch ($op) {
- case 'view':
- if (is_numeric(arg(1))) {
- $node = node_load(arg(1));
- if ($node->nid) {
- drupal_set_title(check_plain($node->title));
- return node_show($node, arg(2));
- }
- else if (db_result(db_query('SELECT nid FROM {node} WHERE nid = %d', arg(1)))) {
- drupal_access_denied();
- }
- else {
- drupal_not_found();
- }
- }
- break;
- case 'add':
- return node_add(arg(2));
- break;
- case 'edit':
- if ($_POST['op'] == t('Delete')) {
- // Note: we redirect from node/uid/edit to node/uid/delete to make the tabs disappear.
- if ($_REQUEST['destination']) {
- $destination = drupal_get_destination();
- unset($_REQUEST['destination']);
- }
- drupal_goto('node/'. arg(1) .'/delete', $destination);
- }
-
- if (is_numeric(arg(1))) {
- $node = node_load(arg(1));
- if ($node->nid) {
- drupal_set_title(check_plain($node->title));
- return node_form($node);
- }
- else if (db_result(db_query('SELECT nid FROM {node} WHERE nid = %d', arg(1)))) {
- drupal_access_denied();
- }
- else {
- drupal_not_found();
- }
- }
- break;
- default:
- drupal_set_title('');
- return node_page_default();
- }
+ drupal_set_title(check_plain($node->title));
+ return node_form($node);
}
/**
Index: modules/poll/poll.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/poll/poll.install,v
retrieving revision 1.4
diff -u -F^f -r1.4 poll.install
--- modules/poll/poll.install 6 Aug 2006 23:13:45 -0000 1.4
+++ modules/poll/poll.install 16 Aug 2006 03:01:51 -0000
@@ -1,5 +1,5 @@
= 0),
- nid uint NOT NULL default '0',
+ nid int_unsigned NOT NULL default '0',
chtext varchar(128) NOT NULL default '',
chvotes int NOT NULL default '0',
chorder int NOT NULL default '0',
Index: modules/profile/profile.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile/profile.install,v
retrieving revision 1.4
diff -u -F^f -r1.4 profile.install
--- modules/profile/profile.install 6 Aug 2006 23:13:46 -0000 1.4
+++ modules/profile/profile.install 16 Aug 2006 03:01:51 -0000
@@ -1,5 +1,5 @@
= 0)");
- db_query("CREATE DOMAIN smalluint smallint CHECK (VALUE >= 0)");
- db_query("CREATE DOMAIN biguint bigint CHECK (VALUE >= 0)");
+ db_query("CREATE DOMAIN int_unsigned integer CHECK (VALUE >= 0)");
+ db_query("CREATE DOMAIN smallint_unsigned smallint CHECK (VALUE >= 0)");
+ db_query("CREATE DOMAIN bigint_unsigned bigint CHECK (VALUE >= 0)");
db_query("CREATE TABLE {access} (
aid serial,
@@ -467,7 +467,7 @@ function system_install() {
hostname varchar(128) NOT NULL default '',
timestamp int NOT NULL default '0',
score int NOT NULL default '0',
- status smalluint NOT NULL default '0',
+ status smallint_unsigned NOT NULL default '0',
format smallint NOT NULL default '0',
thread varchar(255) NOT NULL,
users text,
@@ -483,26 +483,26 @@ function system_install() {
last_comment_timestamp int NOT NULL default '0',
last_comment_name varchar(60) default NULL,
last_comment_uid int NOT NULL default '0',
- comment_count uint NOT NULL default '0',
+ comment_count int_unsigned NOT NULL default '0',
PRIMARY KEY (nid)
)");
db_query("CREATE INDEX {node_comment_statistics}_node_comment_timestamp_idx ON {node_comment_statistics} (last_comment_timestamp)");
db_query("CREATE TABLE {files} (
- fid uint NOT NULL default 0,
- nid uint NOT NULL default 0,
+ fid int_unsigned NOT NULL default 0,
+ nid int_unsigned NOT NULL default 0,
filename varchar(255) NOT NULL default '',
filepath varchar(255) NOT NULL default '',
filemime varchar(255) NOT NULL default '',
- filesize uint NOT NULL default 0,
+ filesize int_unsigned NOT NULL default 0,
PRIMARY KEY (fid)
)");
db_query("CREATE TABLE {file_revisions} (
- fid uint NOT NULL default 0,
- vid uint NOT NULL default 0,
+ fid int_unsigned NOT NULL default 0,
+ vid int_unsigned NOT NULL default 0,
description varchar(255) NOT NULL default '',
- list smalluint NOT NULL default 0,
+ list smallint_unsigned NOT NULL default 0,
PRIMARY KEY (fid, vid)
)");
@@ -538,19 +538,19 @@ function system_install() {
db_query("CREATE TABLE {menu} (
mid serial CHECK (mid >= 0),
- pid uint NOT NULL default '0',
+ pid int_unsigned NOT NULL default '0',
path varchar(255) NOT NULL default '',
title varchar(255) NOT NULL default '',
description varchar(255) NOT NULL default '',
weight smallint NOT NULL default '0',
- type uint NOT NULL default '0',
+ type int_unsigned NOT NULL default '0',
PRIMARY KEY (mid)
)");
db_query("ALTER SEQUENCE {menu}_mid_seq MINVALUE 2 RESTART 2");
db_query("CREATE TABLE {node} (
nid serial CHECK (nid >= 0),
- vid uint NOT NULL default '0',
+ vid int_unsigned NOT NULL default '0',
type varchar(32) NOT NULL default '',
title varchar(128) NOT NULL default '',
uid int NOT NULL default '0',
@@ -576,18 +576,18 @@ function system_install() {
db_query("CREATE INDEX {node}_nid_idx ON {node} (nid)");
db_query("CREATE TABLE {node_access} (
- nid uint NOT NULL default '0',
- gid uint NOT NULL default '0',
+ nid int_unsigned NOT NULL default '0',
+ gid int_unsigned NOT NULL default '0',
realm varchar(255) NOT NULL default '',
- grant_view smalluint NOT NULL default '0',
- grant_update smalluint NOT NULL default '0',
- grant_delete smalluint NOT NULL default '0',
+ grant_view smallint_unsigned NOT NULL default '0',
+ grant_update smallint_unsigned NOT NULL default '0',
+ grant_delete smallint_unsigned NOT NULL default '0',
PRIMARY KEY (nid,gid,realm)
)");
db_query("CREATE TABLE {node_revisions} (
- nid uint NOT NULL,
- vid uint NOT NULL,
+ nid int_unsigned NOT NULL,
+ vid int_unsigned NOT NULL,
uid int NOT NULL default '0',
title varchar(128) NOT NULL default '',
body text NOT NULL default '',
@@ -601,6 +601,24 @@ function system_install() {
db_query("CREATE INDEX {node_revisions}_uid_idx ON {node_revisions} (uid)");
db_query("CREATE SEQUENCE {node_revisions}_vid_seq INCREMENT 1 START 1");
+ db_query("CREATE TABLE {node_type} (
+ type varchar(32) NOT NULL,
+ name varchar(255) NOT NULL default '',
+ module varchar(255) NOT NULL,
+ description text NOT NULL,
+ help text NOT NULL,
+ has_title smallint_unsigned NOT NULL,
+ title_label varchar(255) NOT NULL default '',
+ has_body smallint_unsigned NOT NULL,
+ body_label varchar(255) NOT NULL default '',
+ min_word_count smallint_unsigned NOT NULL,
+ custom smallint NOT NULL DEFAULT '0',
+ modified smallint NOT NULL DEFAULT '0',
+ locked smallint NOT NULL DEFAULT '0',
+ orig_type varchar(255) NOT NULL default '',
+ PRIMARY KEY (type)
+ )");
+
db_query("CREATE TABLE {url_alias} (
pid serial CHECK (pid >= 0),
src varchar(128) NOT NULL default '',
@@ -611,9 +629,9 @@ function system_install() {
db_query("CREATE INDEX {url_alias}_src_idx ON {url_alias} (src)");
db_query("CREATE TABLE {permission} (
- rid uint NOT NULL default '0',
+ rid int_unsigned NOT NULL default '0',
perm text,
- tid uint NOT NULL default '0'
+ tid int_unsigned NOT NULL default '0'
)");
db_query("CREATE INDEX {permission}_rid_idx ON {permission} (rid)");
@@ -627,12 +645,12 @@ function system_install() {
db_query("CREATE TABLE {blocks_roles} (
module varchar(64) NOT NULL,
delta varchar(32) NOT NULL,
- rid uint NOT NULL,
+ rid int_unsigned NOT NULL,
PRIMARY KEY (module, delta, rid)
)");
db_query("CREATE TABLE {sessions} (
- uid uint NOT NULL,
+ uid int_unsigned NOT NULL,
sid varchar(32) NOT NULL default '',
hostname varchar(128) NOT NULL default '',
timestamp int NOT NULL default '0',
@@ -646,15 +664,15 @@ function system_install() {
/* Only used for MySQL
db_query("CREATE TABLE {sequences} (
name varchar(255) NOT NULL default '',
- id uint NOT NULL default '0',
+ id int_unsigned NOT NULL default '0',
PRIMARY KEY (name)
)"); */
db_query("CREATE TABLE {node_counter} (
nid int NOT NULL default '0',
- totalcount biguint NOT NULL default '0',
- daycount uint NOT NULL default '0',
- timestamp uint NOT NULL default '0',
+ totalcount bigint_unsigned NOT NULL default '0',
+ daycount int_unsigned NOT NULL default '0',
+ timestamp int_unsigned NOT NULL default '0',
PRIMARY KEY (nid)
)");
db_query("CREATE INDEX {node_counter}_totalcount_idx ON {node_counter} (totalcount)");
@@ -677,7 +695,7 @@ function system_install() {
db_query("CREATE TABLE {term_data} (
tid serial CHECK (tid >= 0),
- vid uint NOT NULL default '0',
+ vid int_unsigned NOT NULL default '0',
name varchar(255) NOT NULL default '',
description text,
weight smallint NOT NULL default '0',
@@ -686,37 +704,37 @@ function system_install() {
db_query("CREATE INDEX {term_data}_vid_idx ON {term_data} (vid)");
db_query("CREATE TABLE {term_hierarchy} (
- tid uint NOT NULL default '0',
- parent uint NOT NULL default '0',
+ tid int_unsigned NOT NULL default '0',
+ parent int_unsigned NOT NULL default '0',
PRIMARY KEY (tid, parent)
)");
db_query("CREATE INDEX {term_hierarchy}_tid_idx ON {term_hierarchy} (tid)");
db_query("CREATE INDEX {term_hierarchy}_parent_idx ON {term_hierarchy} (parent)");
db_query("CREATE TABLE {term_node} (
- nid uint NOT NULL default '0',
- tid uint NOT NULL default '0',
+ nid int_unsigned NOT NULL default '0',
+ tid int_unsigned NOT NULL default '0',
PRIMARY KEY (tid,nid)
)");
db_query("CREATE INDEX {term_node}_nid_idx ON {term_node} (nid)");
db_query("CREATE INDEX {term_node}_tid_idx ON {term_node} (tid)");
db_query("CREATE TABLE {term_relation} (
- tid1 uint NOT NULL default '0',
- tid2 uint NOT NULL default '0'
+ tid1 int_unsigned NOT NULL default '0',
+ tid2 int_unsigned NOT NULL default '0'
)");
db_query("CREATE INDEX {term_relation}_tid1_idx ON {term_relation} (tid1)");
db_query("CREATE INDEX {term_relation}_tid2_idx ON {term_relation} (tid2)");
db_query("CREATE TABLE {term_synonym} (
- tid uint NOT NULL default '0',
+ tid int_unsigned NOT NULL default '0',
name varchar(255) NOT NULL default ''
)");
db_query("CREATE INDEX {term_synonym}_tid_idx ON {term_synonym} (tid)");
db_query("CREATE INDEX {term_synonym}_name_idx ON {term_synonym} (substr(name, 1, 3))");
db_query("CREATE TABLE {users} (
- uid uint NOT NULL default '0',
+ uid int_unsigned NOT NULL default '0',
name varchar(60) NOT NULL default '',
pass varchar(32) NOT NULL default '',
mail varchar(64) default '',
@@ -741,8 +759,8 @@ function system_install() {
db_query("CREATE SEQUENCE {users}_uid_seq INCREMENT 1 START 1");
db_query("CREATE TABLE {users_roles} (
- uid uint NOT NULL default '0',
- rid uint NOT NULL default '0',
+ uid int_unsigned NOT NULL default '0',
+ rid int_unsigned NOT NULL default '0',
PRIMARY KEY (uid, rid)
)");
@@ -757,18 +775,18 @@ function system_install() {
name varchar(255) NOT NULL default '',
description text,
help varchar(255) NOT NULL default '',
- relations smalluint NOT NULL default '0',
- hierarchy smalluint NOT NULL default '0',
- multiple smalluint NOT NULL default '0',
- required smalluint NOT NULL default '0',
- tags smalluint NOT NULL default '0',
+ relations smallint_unsigned NOT NULL default '0',
+ hierarchy smallint_unsigned NOT NULL default '0',
+ multiple smallint_unsigned NOT NULL default '0',
+ required smallint_unsigned NOT NULL default '0',
+ tags smallint_unsigned NOT NULL default '0',
module varchar(255) NOT NULL default '',
weight smallint NOT NULL default '0',
PRIMARY KEY (vid)
)");
db_query("CREATE TABLE {vocabulary_node_types} (
- vid uint NOT NULL DEFAULT '0',
+ vid int_unsigned NOT NULL DEFAULT '0',
type varchar(32) NOT NULL DEFAULT '',
PRIMARY KEY (vid, type)
)");
@@ -778,7 +796,7 @@ function system_install() {
uid int NOT NULL default '0',
type varchar(16) NOT NULL default '',
message text NOT NULL,
- severity smalluint NOT NULL default '0',
+ severity smallint_unsigned NOT NULL default '0',
link varchar(255) NOT NULL default '',
location varchar(128) NOT NULL default '',
referer varchar(128) NOT NULL default '',
Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.300
diff -u -F^f -r1.300 taxonomy.module
--- modules/taxonomy/taxonomy.module 8 Aug 2006 18:55:53 -0000 1.300
+++ modules/taxonomy/taxonomy.module 16 Aug 2006 03:01:53 -0000
@@ -1,5 +1,5 @@
'checkboxes',
'#title' => t('Types'),
'#default_value' => $edit['nodes'],
- '#options' => node_get_types(),
+ '#options' => node_get_types('names'),
'#description' => t('A list of node types you want to associate with this vocabulary.'),
'#required' => TRUE,
);
Index: modules/throttle/throttle.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/throttle/throttle.module,v
retrieving revision 1.63
diff -u -F^f -r1.63 throttle.module
--- modules/throttle/throttle.module 7 Aug 2006 15:04:15 -0000 1.63
+++ modules/throttle/throttle.module 16 Aug 2006 03:01:53 -0000
@@ -62,13 +62,13 @@ function throttle_exit() {
$throttle = module_invoke('throttle', 'status');
if ($max_guests = variable_get('throttle_anonymous', 0)) {
- $guests = db_result(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
+ $guests = drupal_count_sessions(time()-$time_period, TRUE);
}
else {
$guests = 0;
}
if ($max_users = variable_get('throttle_user', 0)) {
- $users = db_result(db_query('SELECT COUNT(DISTINCT(uid)) AS count FROM {sessions} WHERE timestamp >= %d AND uid != 0', time() - $time_period));
+ $users = drupal_count_sessions(time()-$time_period, FALSE);
}
else {
$users = 0;
Index: modules/user/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user/user.module,v
retrieving revision 1.653
diff -u -F^f -r1.653 user.module
--- modules/user/user.module 14 Aug 2006 20:35:11 -0000 1.653
+++ modules/user/user.module 16 Aug 2006 03:01:53 -0000
@@ -148,7 +148,7 @@ function user_save($account, $array = ar
// Delete a blocked user's sessions to kick them if they are online.
if (isset($array['status']) && $array['status'] == 0) {
- db_query('DELETE FROM {sessions} WHERE uid = %d', $account->uid);
+ sess_destroy($account->uid, 'uid');
}
// Refresh user object
@@ -553,19 +553,19 @@ function user_block($op = 'list', $delta
case 3:
if (user_access('access content')) {
// Count users with activity in the past defined period.
- $time_period = variable_get('user_block_seconds_online', 900);
+ $time_period = time() - variable_get('user_block_seconds_online', 900);
// Perform database queries to gather online user lists.
- $guests = db_fetch_object(db_query('SELECT COUNT(sid) AS count FROM {sessions} WHERE timestamp >= %d AND uid = 0', time() - $time_period));
- $users = db_query('SELECT uid, name, access FROM {users} WHERE access >= %d AND uid != 0 ORDER BY access DESC', time() - $time_period);
+ $guests = drupal_count_sessions($time_period);
+ $users = db_query('SELECT uid, name, access FROM {users} WHERE access >= %d AND uid != 0 ORDER BY access DESC', $time_period);
$total_users = db_num_rows($users);
// Format the output with proper grammar.
- if ($total_users == 1 && $guests->count == 1) {
- $output = t('There is currently %members and %visitors online.', array('%members' => format_plural($total_users, '1 user', '%count users'), '%visitors' => format_plural($guests->count, '1 guest', '%count guests')));
+ if ($total_users == 1 && $guests == 1) {
+ $output = t('There is currently %members and %visitors online.', array('%members' => format_plural($total_users, '1 user', '%count users'), '%visitors' => format_plural($guests, '1 guest', '%count guests')));
}
else {
- $output = t('There are currently %members and %visitors online.', array('%members' => format_plural($total_users, '1 user', '%count users'), '%visitors' => format_plural($guests->count, '1 guest', '%count guests')));
+ $output = t('There are currently %members and %visitors online.', array('%members' => format_plural($total_users, '1 user', '%count users'), '%visitors' => format_plural($guests, '1 guest', '%count guests')));
}
// Display a list of currently online users.
@@ -922,10 +922,7 @@ function user_login_submit($form_id, $fo
user_module_invoke('login', $form_values, $user);
- $old_session_id = session_id();
- session_regenerate_id();
- db_query("UPDATE {sessions} SET sid = '%s' WHERE sid = '%s'", session_id(), $old_session_id);
-
+ sess_regenerate();
}
}
@@ -1419,8 +1416,8 @@ function user_edit($category = 'account'
*/
function user_delete($edit, $uid) {
$account = user_load(array('uid' => $uid));
+ sess_destroy($uid, 'uid');
db_query('DELETE FROM {users} WHERE uid = %d', $uid);
- db_query('DELETE FROM {sessions} WHERE uid = %d', $uid);
db_query('DELETE FROM {users_roles} WHERE uid = %d', $uid);
db_query('DELETE FROM {authmap} WHERE uid = %d', $uid);
$array = array('%name' => theme('placeholder', $account->name), '%email' => theme('placeholder', '<'. $account->mail .'>'));