summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/statistics.module4
-rw-r--r--modules/statistics/statistics.module4
2 files changed, 4 insertions, 4 deletions
diff --git a/modules/statistics.module b/modules/statistics.module
index ec5871ddf..fe9a12b3e 100644
--- a/modules/statistics.module
+++ b/modules/statistics.module
@@ -62,13 +62,13 @@ function statistics_exit() {
if (variable_get('statistics_count_content_views', 0)) {
// We are counting content views.
- if ((arg(0) == 'node') && arg(1)) {
+ if ((arg(0) == 'node') && is_numeric(arg(1)) && arg(2) == '') {
// A node has been viewed, so update the node's counters.
db_query('UPDATE {node_counter} SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d', time(), arg(1));
// If we affected 0 rows, this is the first time viewing the node.
if (!db_affected_rows()) {
// We must create a new row to store counters for the new node.
- db_query('INSERT INTO {node_counter} (nid, daycount, totalcount, timestamp) VALUES(%d, 1, 1, %d)', arg(1), time());
+ db_query('INSERT INTO {node_counter} (nid, daycount, totalcount, timestamp) VALUES (%d, 1, 1, %d)', arg(1), time());
}
}
}
diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module
index ec5871ddf..fe9a12b3e 100644
--- a/modules/statistics/statistics.module
+++ b/modules/statistics/statistics.module
@@ -62,13 +62,13 @@ function statistics_exit() {
if (variable_get('statistics_count_content_views', 0)) {
// We are counting content views.
- if ((arg(0) == 'node') && arg(1)) {
+ if ((arg(0) == 'node') && is_numeric(arg(1)) && arg(2) == '') {
// A node has been viewed, so update the node's counters.
db_query('UPDATE {node_counter} SET daycount = daycount + 1, totalcount = totalcount + 1, timestamp = %d WHERE nid = %d', time(), arg(1));
// If we affected 0 rows, this is the first time viewing the node.
if (!db_affected_rows()) {
// We must create a new row to store counters for the new node.
- db_query('INSERT INTO {node_counter} (nid, daycount, totalcount, timestamp) VALUES(%d, 1, 1, %d)', arg(1), time());
+ db_query('INSERT INTO {node_counter} (nid, daycount, totalcount, timestamp) VALUES (%d, 1, 1, %d)', arg(1), time());
}
}
}