Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.484
diff -u -r1.484 common.inc
--- includes/common.inc 8 Oct 2005 12:38:20 -0000 1.484
+++ includes/common.inc 12 Oct 2005 01:57:16 -0000
@@ -1199,6 +1199,24 @@
}
/**
+ * Returns the page size from the query string.
+ *
+ * @param $default
+ * The default page size if query string not found.
+ *
+ * @return
+ * The page size.
+ */
+function drupal_get_page_size($default) {
+ if ($_GET['page_size'] && $_GET['page_size'] > 0) {
+ return $_GET['page_size'];
+ }
+ else {
+ return $default;
+ }
+}
+
+/**
* Provide a substitute clone() function for PHP4.
*/
function drupal_clone($object) {
Index: modules/aggregator.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/aggregator.module,v
retrieving revision 1.257
diff -u -r1.257 aggregator.module
--- modules/aggregator.module 7 Oct 2005 06:51:43 -0000 1.257
+++ modules/aggregator.module 12 Oct 2005 02:07:56 -0000
@@ -964,7 +964,9 @@
$form['header'] = array(value => $header);
$output .= $form['header'][value];
- $result = pager_query($sql, 20);
+ $page_size = drupal_get_page_size(20);
+
+ $result = pager_query($sql, $page_size);
$categories = array();
while ($item = db_fetch_object($result)) {
$form['items'][$item->iid] = array(value => theme('aggregator_page_item', $item));
@@ -993,7 +995,7 @@
}
$output .= '';
$form['submit'] = array(type => 'submit', value => t('Save categories'));
- $form['pager'] = array(value => theme('pager', NULL, 20, 0));
+ $form['pager'] = array(value => theme('pager', NULL, $page_size, 0));
$output .= $form['pager'][value];
// arg(1) is undefined if we are at the top aggregator URL
@@ -1284,5 +1286,3 @@
return $output;
}
-
-
Index: modules/blog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/blog.module,v
retrieving revision 1.232
diff -u -r1.232 blog.module
--- modules/blog.module 7 Oct 2005 06:51:43 -0000 1.232
+++ modules/blog.module 12 Oct 2005 02:44:14 -0000
@@ -144,12 +144,14 @@
else {
$output = '';
}
+
+ $page_size = drupal_get_page_size(variable_get('default_nodes_main', 10));
- $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), variable_get('default_nodes_main', 10), 0, NULL, $account->uid);
+ $result = pager_query(db_rewrite_sql("SELECT n.nid, n.sticky, n.created FROM {node} n WHERE type = 'blog' AND n.uid = %d AND n.status = 1 ORDER BY n.sticky DESC, n.created DESC"), $page_size, 0, NULL, $account->uid);
while ($node = db_fetch_object($result)) {
$output .= node_view(node_load($node->nid), 1);
}
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+ $output .= theme('pager', NULL, $page_size);
$output .= theme('xml_icon', url("blog/$account->uid/feed"));
drupal_add_link(array('rel' => 'alternate',
@@ -171,12 +173,14 @@
$output = '';
- $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), variable_get('default_nodes_main', 10));
+ $page_size = drupal_get_page_size(variable_get('default_nodes_main', 10));
+
+ $result = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = 'blog' AND n.status = 1 ORDER BY n.created DESC"), $page_size);
while ($node = db_fetch_object($result)) {
$output .= node_view(node_load($node->nid), 1);
}
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+ $output .= theme('pager', NULL, $page_size);
$output .= theme('xml_icon', url('blog/feed'));
drupal_add_link(array('rel' => 'alternate',
Index: modules/comment.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/comment.module,v
retrieving revision 1.380
diff -u -r1.380 comment.module
--- modules/comment.module 8 Oct 2005 12:21:47 -0000 1.380
+++ modules/comment.module 12 Oct 2005 02:39:14 -0000
@@ -953,12 +953,14 @@
array('data' => t('Time'), 'field' => 'c.timestamp', 'sort' => 'desc'),
array('data' => t('Operations'), 'colspan' => '2')
);
-
+
+ $page_size = drupal_get_page_size(50);
+
$destination = drupal_get_destination();
$status = ($type == 'approval') ? COMMENT_NOT_PUBLISHED : COMMENT_PUBLISHED;
$sql = 'SELECT c.subject, c.nid, c.cid, c.comment, c.timestamp, c.status, c.name, c.homepage, u.name AS registered_name, u.uid FROM {comments} c INNER JOIN {users} u ON u.uid = c.uid WHERE c.status = '. db_escape_string($status);
$sql .= tablesort_sql($header);
- $result = pager_query($sql, 50);
+ $result = pager_query($sql, $page_size);
while ($comment = db_fetch_object($result)) {
$comment->name = $comment->uid ? $comment->registered_name : $comment->name;
@@ -977,7 +979,7 @@
}
$output = theme('table', $header, $rows);
- $output .= theme('pager', NULL, 50, 0, tablesort_pager());
+ $output .= theme('pager', NULL, $page_size, 0, tablesort_pager());
return $output;
}
Index: modules/node.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/node.module,v
retrieving revision 1.534
diff -u -r1.534 node.module
--- modules/node.module 8 Oct 2005 12:21:47 -0000 1.534
+++ modules/node.module 12 Oct 2005 02:39:48 -0000
@@ -964,8 +964,10 @@
$output = node_filter_form();
$filter = node_build_filter_query();
-
- $result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC', 50, 0, NULL, $filter['args']);
+
+ $page_size = drupal_get_page_size(50);
+
+ $result = pager_query('SELECT n.*, u.name, u.uid FROM {node} n '. $filter['join'] .' INNER JOIN {users} u ON n.uid = u.uid '. $filter['where'] .' ORDER BY n.changed DESC', $page_size, 0, NULL, $filter['args']);
$form['options'] = array(
type => 'fieldset', title => t('Update options'),
@@ -988,7 +990,7 @@
$form['operations'][$node->nid] = array(value => l(t('edit'), 'node/'. $node->nid .'/edit', array(), $destination));
}
$form['nodes'] = array(type => 'checkboxes', options => $nodes);
- $form['pager'] = array('value' => theme('pager', NULL, 50, 0));
+ $form['pager'] = array('value' => theme('pager', NULL, $page_size, 0));
$form[method] = 'post';
$form[action] = url('admin/node/action');
@@ -1729,7 +1731,9 @@
* 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));
+ $page_size = drupal_get_page_size(variable_get('default_nodes_main', 10));
+
+ $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'), $page_size);
if (db_num_rows($result)) {
drupal_add_link(array('rel' => 'alternate',
@@ -1741,7 +1745,7 @@
while ($node = db_fetch_object($result)) {
$output .= node_view(node_load($node->nid), 1);
}
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10));
+ $output .= theme('pager', NULL, $page_size);
}
else {
$output = t("
Index: modules/path.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/path.module,v
retrieving revision 1.66
diff -u -r1.66 path.module
--- modules/path.module 7 Oct 2005 06:09:13 -0000 1.66
+++ modules/path.module 12 Oct 2005 02:40:28 -0000
@@ -245,8 +245,11 @@
array('data' => t('System'), 'field' => 'src'),
array('data' => t('Operations'), 'colspan' => '2')
);
+
+ $page_size = drupal_get_page_size(50);
+
$sql .= tablesort_sql($header);
- $result = pager_query($sql, 50);
+ $result = pager_query($sql, $page_size);
$destination = drupal_get_destination();
while ($data = db_fetch_object($result)) {
@@ -258,7 +261,7 @@
}
$output = theme('table', $header, $rows);
- $output .= theme('pager', NULL, 50, 0, tablesort_pager());
+ $output .= theme('pager', NULL, $page_size, 0, tablesort_pager());
return $output;
}
Index: modules/profile.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/profile.module,v
retrieving revision 1.112
diff -u -r1.112 profile.module
--- modules/profile.module 7 Oct 2005 06:51:43 -0000 1.112
+++ modules/profile.module 12 Oct 2005 02:24:44 -0000
@@ -159,8 +159,10 @@
return;
}
+ $page_size = drupal_get_page_size(20);
+
// Extract the affected users:
- $result = pager_query("SELECT u.uid FROM {users} u INNER JOIN {profile_values} v ON u.uid = v.uid WHERE v.fid = %d AND $query ORDER BY u.access DESC", 20, 0, NULL, $field->fid);
+ $result = pager_query("SELECT u.uid FROM {users} u INNER JOIN {profile_values} v ON u.uid = v.uid WHERE v.fid = %d AND $query ORDER BY u.access DESC", $page_size, 0, NULL, $field->fid);
$output = '
';
while ($account = db_fetch_object($result)) {
@@ -168,7 +170,7 @@
_profile_update_user_fields($fields, $account);
$output .= theme('profile_listing', $account, $fields);
}
- $output .= theme('pager', NULL, 20);
+ $output .= theme('pager', NULL, $page_size);
if ($field->type == 'selection' || $field->type == 'list') {
$title = strtr($field->page, array('%value' => theme('placeholder', $value)));
@@ -191,9 +193,11 @@
while ($record = db_fetch_object($result)) {
$fields[] = $record;
}
-
+
+ $page_size = drupal_get_page_size(20);
+
// Extract the affected users:
- $result = pager_query("SELECT uid FROM {users} WHERE uid > 0 ORDER BY access DESC", 20, 0, NULL);
+ $result = pager_query("SELECT uid FROM {users} WHERE uid > 0 ORDER BY access DESC", $page_size, 0, NULL);
$output = '
';
while ($account = db_fetch_object($result)) {
@@ -202,7 +206,7 @@
$output .= theme('profile_listing', $account, $fields);
}
$output .= '
';
- $output .= theme('pager', NULL, 20);
+ $output .= theme('pager', NULL, $page_size);
drupal_set_title(t('user list'));
return $output;
Index: modules/search.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/search.module,v
retrieving revision 1.135
diff -u -r1.135 search.module
--- modules/search.module 7 Oct 2005 06:09:13 -0000 1.135
+++ modules/search.module 12 Oct 2005 02:20:44 -0000
@@ -679,7 +679,7 @@
$output .= theme('search_item', $entry, $type);
}
$output .= '';
- $output .= theme('pager', NULL, 15, 0);
+ $output .= theme('pager', NULL, drupal_get_page_size(15), 0);
}
}
}
Index: modules/statistics.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/statistics.module,v
retrieving revision 1.208
diff -u -r1.208 statistics.module
--- modules/statistics.module 7 Oct 2005 06:51:43 -0000 1.208
+++ modules/statistics.module 12 Oct 2005 02:18:32 -0000
@@ -168,7 +168,9 @@
array('data' => t('User'), 'field' => 'u.name'),
array('data' => t('Operations')));
- $result = pager_query('SELECT a.aid, a.timestamp, a.url, a.uid, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE a.path LIKE \'node/%d%%\'' . tablesort_sql($header), 30, 0, NULL, $node->nid);
+ $page_size = drupal_get_page_size(30);
+
+ $result = pager_query('SELECT a.aid, a.timestamp, a.url, a.uid, u.name FROM {accesslog} a LEFT JOIN {users} u ON a.uid = u.uid WHERE a.path LIKE \'node/%d%%\'' . tablesort_sql($header), $page_size, 0, NULL, $node->nid);
while ($log = db_fetch_object($result)) {
$rows[] = array(
array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
@@ -179,7 +181,7 @@
drupal_set_title(check_plain($node->title));
$output = theme('table', $header, $rows);
- $output .= theme('pager', NULL, 30, 0, tablesort_pager());
+ $output .= theme('pager', NULL, $page_size, 0, tablesort_pager());
return $output;
}
else {
@@ -195,7 +197,9 @@
array('data' => t('Page'), 'field' => 'path'),
array('data' => t('Operations')));
- $result = pager_query('SELECT aid, timestamp, path, title FROM {accesslog} WHERE uid = %d' . tablesort_sql($header), 30, 0, NULL, $account->uid);
+ $page_size = drupal_get_page_size(30);
+
+ $result = pager_query('SELECT aid, timestamp, path, title FROM {accesslog} WHERE uid = %d' . tablesort_sql($header), $page_size, 0, NULL, $account->uid);
while ($log = db_fetch_object($result)) {
$rows[] = array(
array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
@@ -205,7 +209,7 @@
drupal_set_title($account->name);
$output = theme('table', $header, $rows);
- $output .= theme('pager', NULL, 30, 0, tablesort_pager());
+ $output .= theme('pager', NULL, $page_size, 0, tablesort_pager());
return $output;
}
else {
@@ -226,7 +230,9 @@
$sql = 'SELECT a.aid, a.path, a.title, a.uid, u.name, a.timestamp FROM {accesslog} a LEFT JOIN {users} u ON u.uid = a.uid' . tablesort_sql($header);
- $result = pager_query($sql, 30);
+ $page_size = drupal_get_page_size(30);
+
+ $result = pager_query($sql, $page_size);
while ($log = db_fetch_object($result)) {
$rows[] = array(
array('data' => format_date($log->timestamp, 'small'), 'class' => 'nowrap'),
@@ -236,7 +242,7 @@
}
$output = theme('table', $header, $rows);
- $output .= theme('pager', NULL, 30, 0, tablesort_pager());
+ $output .= theme('pager', NULL, $page_size, 0, tablesort_pager());
return $output;
}
@@ -254,7 +260,10 @@
array('data' => t('Total page generation time'), 'field' => 'total_time')
);
$sql .= tablesort_sql($header);
- $result = pager_query($sql, 30, 0, $sql_cnt);
+
+ $page_size = drupal_get_page_size(30);
+
+ $result = pager_query($sql, $page_size, 0, $sql_cnt);
while ($page = db_fetch_object($result)) {
$rows[] = array($page->hits, _statistics_format_item($page->title, $page->path), t('%time ms', array('%time' => round($page->average_time))), format_interval(round($page->total_time / 1000)));
@@ -262,7 +271,7 @@
drupal_set_title(t('Top pages in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
$output = theme('table', $header, $rows);
- $output .= theme('pager', NULL, 30, 0, tablesort_pager());
+ $output .= theme('pager', NULL, $page_size, 0, tablesort_pager());
return $output;
}
@@ -277,10 +286,12 @@
array('data' => t('Total page generation time'), 'field' => 'total'),
array('data' => t('Operations'))
);
-
+
+ $page_size = drupal_get_page_size(30);
+
$sql = "SELECT COUNT(a.uid) AS hits, a.uid, u.name, a.hostname, SUM(a.timer) AS total, ac.aid FROM {accesslog} a LEFT JOIN {access} ac ON ac.type = 'host' AND LOWER(a.hostname) LIKE (ac.mask) LEFT JOIN {users} u ON a.uid = u.uid GROUP BY a.hostname". tablesort_sql($header);
$sql_cnt = "SELECT COUNT(DISTINCT(uid)) FROM {accesslog}";
- $result = pager_query($sql, 30, 0, $sql_cnt);
+ $result = pager_query($sql, $page_size, 0, $sql_cnt);
while ($account = db_fetch_object($result)) {
$qs = drupal_get_destination();
@@ -290,7 +301,7 @@
drupal_set_title(t('Top visitors in the past %interval', array('%interval' => format_interval(variable_get('statistics_flush_accesslog_timer', 259200)))));
$output = theme('table', $header, $rows);
- $output .= theme('pager', NULL, 30, 0, tablesort_pager());
+ $output .= theme('pager', NULL, $page_size, 0, tablesort_pager());
return $output;
}
@@ -307,16 +318,18 @@
array('data' => t('Url'), 'field' => 'url'),
array('data' => t('Last visit'), 'field' => 'last'),
);
-
+
+ $page_size = drupal_get_page_size(30);
+
$query .= tablesort_sql($header);
- $result = pager_query($query, 30, 0, $query_cnt, $_SERVER['HTTP_HOST']);
+ $result = pager_query($query, $page_size, 0, $query_cnt, $_SERVER['HTTP_HOST']);
while ($referrer = db_fetch_object($result)) {
$rows[] = array($referrer->hits, '
'. check_plain(_statistics_column_width($referrer->url)) .'', t('%time ago', array('%time' => format_interval(time() - $referrer->last))));
}
$output = theme('table', $header, $rows);
- $output .= theme('pager', NULL, 30, 0, tablesort_pager());
+ $output .= theme('pager', NULL, $page_size, 0, tablesort_pager());
return $output;
}
Index: modules/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy.module,v
retrieving revision 1.228
diff -u -r1.228 taxonomy.module
--- modules/taxonomy.module 8 Oct 2005 12:21:47 -0000 1.228
+++ modules/taxonomy.module 12 Oct 2005 02:47:40 -0000
@@ -398,7 +398,7 @@
drupal_set_title(check_plain($vocabulary->name));
$start_from = $_GET['page'] ? $_GET['page'] : 0;
$total_entries = 0; // total count for pager
- $page_increment = 25; // number of tids per page
+ $page_increment = drupal_get_page_size(25); // number of tids per page
$displayed_count = 0; // number of tids shown
$tree = taxonomy_get_tree($vocabulary->vid);
@@ -1009,7 +1009,7 @@
while ($node = db_fetch_object($result)) {
$output .= node_view(node_load($node->nid), 1);
}
- $output .= theme('pager', NULL, variable_get('default_nodes_main', 10), 0);
+ $output .= theme('pager', NULL, drupal_get_page_size(variable_get('default_nodes_main', 10)), 0);
}
else {
$output .= t('There are currently no posts in this category.');
Index: modules/tracker.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/tracker.module,v
retrieving revision 1.122
diff -u -r1.122 tracker.module
--- modules/tracker.module 24 Sep 2005 07:53:26 -0000 1.122
+++ modules/tracker.module 12 Oct 2005 02:03:24 -0000
@@ -71,20 +71,22 @@
global $user;
$output .= '';
+
+ $page_size = drupal_get_page_size(25);
if ($uid) {
$sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, l.last_comment_timestamp AS last_post, l.comment_count FROM {node} n INNER JOIN {node_comment_statistics} l ON n.nid = l.nid INNER JOIN {users} u ON n.uid = u.uid LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d) ORDER BY last_post DESC';
$sql = db_rewrite_sql($sql);
$sql_count = 'SELECT COUNT(DISTINCT(n.nid)) FROM {node} n LEFT JOIN {comments} c ON n.nid = c.nid AND (c.status = %d OR c.status IS NULL) WHERE n.status = 1 AND (n.uid = %d OR c.uid = %d)';
$sql_count = db_rewrite_sql($sql_count);
- $result = pager_query($sql, 25, 0, $sql_count, COMMENT_PUBLISHED, $uid, $uid);
+ $result = pager_query($sql, $page_size, 0, $sql_count, COMMENT_PUBLISHED, $uid, $uid);
}
else {
$sql = 'SELECT DISTINCT(n.nid), n.title, n.type, n.changed, n.uid, u.name, l.last_comment_timestamp AS last_post, l.comment_count FROM {node} n INNER JOIN {users} u ON n.uid = u.uid INNER JOIN {node_comment_statistics} l ON n.nid = l.nid WHERE n.status = 1 ORDER BY last_post DESC';
$sql = db_rewrite_sql($sql);
$sql_count = 'SELECT COUNT(n.nid) FROM {node} n WHERE n.status = 1';
$sql_count = db_rewrite_sql($sql_count);
- $result = pager_query($sql, 25, 0, $sql_count);
+ $result = pager_query($sql, $page_size, 0, $sql_count);
}
while ($node = db_fetch_object($result)) {
@@ -112,10 +114,9 @@
$output .= '
';
$output .= theme('table', $header, $rows);
- $output .= theme('pager', NULL, 25, 0);
+ $output .= theme('pager', $page_size, 0);
$output .= '
';
return $output;
}
-
Index: modules/user.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/user.module,v
retrieving revision 1.516
diff -u -r1.516 user.module
--- modules/user.module 9 Oct 2005 10:39:15 -0000 1.516
+++ modules/user.module 12 Oct 2005 02:04:44 -0000
@@ -1744,9 +1744,12 @@
array('data' => t('Last access'), 'field' => 'u.access'),
t('Operations')
);
+
+ $page_size = drupal_get_page_size(50);
+
$sql = 'SELECT u.uid, u.name, u.status, u.created, u.access FROM {users} u WHERE uid != 0';
$sql .= tablesort_sql($header);
- $result = pager_query($sql, 50);
+ $result = pager_query($sql, $page_size);
$status = array(t('blocked'), t('active'));
$destination = drupal_get_destination();
@@ -1759,7 +1762,7 @@
}
$output = theme('table', $header, $rows);
- $output .= theme('pager', NULL, 50, 0, tablesort_pager());
+ $output .= theme('pager', NULL, $page_size, 0, tablesort_pager());
return $output;
}
Index: modules/watchdog.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/watchdog.module,v
retrieving revision 1.129
diff -u -r1.129 watchdog.module
--- modules/watchdog.module 8 Oct 2005 12:21:47 -0000 1.129
+++ modules/watchdog.module 12 Oct 2005 02:05:38 -0000
@@ -99,8 +99,11 @@
array('data' => t('User'), 'field' => 'u.name'),
array('data' => t('Operations'), 'colspan' => '2')
);
+
+ $page_size = drupal_get_page_size(50);
+
$sql = 'SELECT w.*, u.name, u.uid FROM {watchdog} w INNER JOIN {users} u ON w.uid = u.uid '. $queries[$_SESSION['watchdog_overview_filter']] . tablesort_sql($header);
- $result = pager_query($sql, 50);
+ $result = pager_query($sql, $page_size);
while ($watchdog = db_fetch_object($result)) {
$rows[] = array('data' =>
@@ -125,7 +128,7 @@
$output .= theme('table', $header, $rows);
- $output .= theme('pager', NULL, 50, 0, tablesort_pager());
+ $output .= theme('pager', NULL, $page_size, 0, tablesort_pager());
return $output;
}
@@ -171,5 +174,3 @@
return $types;
}
-
-