diff -u -r -N karmapools.orig/admin/includes/admin.app.functions.php karmapools/admin/includes/admin.app.functions.php
--- karmapools.orig/admin/includes/admin.app.functions.php 2004-09-13 20:42:52.000000000 -0500
+++ karmapools/admin/includes/admin.app.functions.php 2004-09-14 00:29:30.043577064 -0500
@@ -156,7 +156,7 @@
/*****************************************************************************
*
*****************************************************************************/
-function queryUsers($start='0',$order='un',$search='',$searchfield='') {
+function queryUsers($start='0',$order='un',$search='',$field='') {
if (!is_numeric($start)) { return false; }
@@ -171,10 +171,10 @@
$where = '';
$wherefield = '';
-if (!empty($search) and !empty($searchfield)) {
- $search = addslashes($search);
- $searchfield = addslashes($searchfield);
- switch ($searchfield) {
+if (!empty($search) and !empty($field)) {
+ $search = addslashes($search);
+ $field = addslashes($field);
+ switch ($field) {
case "un": $wherefield = 'user_name'; break;
case "ue": $wherefield = 'user_email'; break;
case "ip": $wherefield = 'user_ip'; break;
@@ -183,7 +183,12 @@
case "au": $wherefield = 'user_audit'; break;
}
if (!empty($wherefield)) {
- $where = "where $wherefield='$searchtext'";
+ $pos = strpos($search,"%");
+ if ($pos === false) {
+ $where = "where $wherefield='$search'";
+ } else {
+ $where = "where $wherefield like '$search'";
+ }
}
}
diff -u -r -N karmapools.orig/admin/includes/admin.html.functions.php karmapools/admin/includes/admin.html.functions.php
--- karmapools.orig/admin/includes/admin.html.functions.php 2004-09-13 20:40:43.000000000 -0500
+++ karmapools/admin/includes/admin.html.functions.php 2004-09-14 01:28:47.755722608 -0500
@@ -9,6 +9,31 @@
/*****************************************************************************
*
*****************************************************************************/
+function displaySearchUserList($echo=true,$order='',$search='',$field='') {
+
+$html = "
\n";
+
+if ($echo) { echo $html; } else { return $html; }
+
+}
+
+/*****************************************************************************
+ *
+ *****************************************************************************/
function displayUserList($echo=true,$qid='') {
if ($qid == '') { return false; }
@@ -53,4 +78,152 @@
}
+/*****************************************************************************
+ *
+ *****************************************************************************/
+function displayUserListHeader($echo=true,$order='',$search='',$field='') {
+
+$qs = '';
+if (isset($search) and !empty($search)) {
+ $qs .= "&q=" . urlencode($search);
+ }
+if (isset($field) and !empty($field)) {
+ $qs .= "&f=" . urlencode($field);
+ }
+
+
+$text = "";
+$o_email = $text . "ue\">Email";
+$o_ip = $text . "ip\">IP";
+$o_ua = $text . "ua\">User Agent";
+$o_access = $text . "ul\">Access";
+$o_audit = $text . "au\">Audit";
+
+$html = "
+
+
+
+
+
+
+
+
\n";
+
+if ($echo) { echo $html; } else { return $html; }
+
+}
+
+/*****************************************************************************
+ * *
+ *****************************************************************************/
+function displayUserListIndex($echo=true,$page='',$hits='',$field='',
+ $txt='') {
+
+if ($page == '' or $hits == '' ) { return false; }
+
+$num_pages = ceil($hits / MAX_ROWS);
+if ($num_pages < 2) {
+ $html = " ";
+ if ($echo) { echo $html; return true; } else { return $html; }
+ }
+if ( ! $txt == '') {
+ $qt = urlencode($txt);
+ $search = true;
+ } else {
+ $search = false;
+ }
+if ( $field !== '') { $field = urlencode($field); }
+
+$prev_page = $page - 1;
+$next_page = $page + 1;
+
+$html = "Page $page of $num_pages ";
+
+if ($prev_page > 0) {
+ $p_url = "./?a=" . LIST_USER_QS . "&p=$prev_page";
+ if ($search) { $p_url .= "&q=$qt"; }
+ if ($field) { $p_url .= "&f=$field"; }
+ $prev_url = "";
+ $prev_url .= "< ";
+ } else {
+ $prev_url = "< ";
+ }
+
+if ($next_page <= $num_pages) {
+ $n_url = "./?a=" . LIST_USER_QS . "&p=$next_page";
+ if ($search) { $n_url .= "&q=$qt"; }
+ if ($field) { $n_url .= "&f=$field"; }
+ $next_url = "> ";
+ } else {
+ $next_url = "> ";
+ }
+$html .= $prev_url;
+$maxbf = 10;
+$max_back = $page - $maxbf;
+$max_forw = $page + $maxbf;
+if ($max_back < 1) {
+ $diff = abs($max_back) + 1;
+ $max_back = ($max_back + $diff);
+ $max_forw = $max_forw + $diff;
+ }
+if (($max_forw > $num_pages) and ($num_pages > $maxbf)) {
+ $diff = $num_pages - $max_forw;
+ $max_back = $max_back + $diff;
+ $max_forw = $num_pages;
+ }
+if ($max_forw > $num_pages) { $max_forw = $num_pages; }
+// pad numbers so they don't jump around on the page list
+$max_len = strlen($num_pages);
+
+for ($j=$max_back; $j <= $max_forw; $j++ ) {
+ $nurl = "./?a=" . LIST_USER_QS . "&p=$j";
+ if ($search) { $nurl .= "&q=$qt"; }
+ if ($field) { $nurl .= "&f=$field"; }
+ $num_text = str_pad("$j",$max_len,"0",STR_PAD_LEFT);
+ if ("$j" !== "$page") {
+ $html .= "";
+ $html .= "$num_text ";
+ } else {
+ $html .= "$num_text ";
+ }
+ }
+
+$html .= $next_url;
+
+if ($echo) { echo $html; } else { return $html; }
+
+}
+
+/*****************************************************************************
+ *
+ *****************************************************************************/
+function selectUserListField($echo=true,$default='') {
+
+$tmp_ar = array();
+$tmp_ar[] = array("un","Userid");
+$tmp_ar[] = array("ue","Email");
+$tmp_ar[] = array("ip","IP");
+$tmp_ar[] = array("ua","User Agent");
+$tmp_ar[] = array("ul","Access");
+$tmp_ar[] = array("au","Audit");
+
+$html = "\n";
+
+if ($echo) { echo $html; } else { return $html; }
+
+
+}
+
?>
diff -u -r -N karmapools.orig/admin/user.list.php karmapools/admin/user.list.php
--- karmapools.orig/admin/user.list.php 2004-09-13 20:42:33.000000000 -0500
+++ karmapools/admin/user.list.php 2004-09-14 01:02:04.841402624 -0500
@@ -7,25 +7,23 @@
if (basename($PHP_SELF) == basename(__FILE__)) { die("Access Denied"); }
$cols = 7;
$title = DEFAULT_SITE_TITLE . "::Admin Menu::List Users";
-$back_qs = INCPREFIX;
$back_img = "
";
-$back_href = "";
+$back_href = "";
-$text = "";
-$o_email = $text . "ue\">Email";
-$o_ip = $text . "ip\">IP";
-$o_ua = $text . "ua\">User Agent";
-$o_access = $text . "ul\">Access";
-$o_audit = $text . "au\">Audit";
-
-$q_ar = queryUsers(0,$o);
+// set up pagination
+if (!isset($p) or empty($p)) { $page = 1; } else { $page = $p; }
+$tmp_page = $page - 1;
+if ($tmp_page > 0) {
+ $start = $tmp_page * MAX_ROWS;
+ } else {
+ $start = 0;
+ }
+$q_ar = queryUsers($start,$o,$q,$f);
if (is_array($q_ar)) {
$total_hits = $q_ar['total_hits'];
$qid = $q_ar['qid'];
$hits = db_num_rows($qid);
}
-
pageHeader(true,$title); tableOpen(true,array('width'=>'100%'));
?>
@@ -33,16 +31,22 @@
echo $title; ?>
-
-
-
-
-
-
-
-
+
+ |
+ displaySearchUserList(true,"$o","$q","$f"); ?>
+ |
+
+
+displayUserListHeader(true,$o,$q,$f);
+displayUserList(true,$qid);
+if ($total_hits > MAX_ROWS) {
+?>
+
+ |
+ displayUserListIndex(true,$page,$total_hits,$f,$q); ?>
+ |
- displayUserList(true,$qid); ?>
+ } ?>