<?php
// ------------------------------------------------------------------------- //
//                XOOPS - PHP Content Management System                      //
//                       <http://www.xoops.org/>                             //
// ------------------------------------------------------------------------- //
// Based on:								     //
// myPHPNUKE Web Portal System - http://myphpnuke.com/	  		     //
// PHP-NUKE Web Portal System - http://phpnuke.org/	  		     //
// Thatware - http://thatware.org/					     //
// ------------------------------------------------------------------------- //
//  This program is free software; you can redistribute it and/or modify     //
//  it under the terms of the GNU General Public License as published by     //
//  the Free Software Foundation; either version 2 of the License, or        //
//  (at your option) any later version.                                      //
//                                                                           //
//  This program is distributed in the hope that it will be useful,          //
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
//  GNU General Public License for more details.                             //
//                                                                           //
//  You should have received a copy of the GNU General Public License        //
//  along with this program; if not, write to the Free Software              //
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
// ------------------------------------------------------------------------- //
include("../../mainfile.php");
if ( $xoopsConfig['startpage'] == "xoopsmembers" ) {
	$xoopsOption['show_rblock'] =1;
	include(XOOPS_ROOT_PATH."/header.php");
	make_cblock();
	echo "<br />";
} else {
	$xoopsOption['show_rblock'] =0;
	include(XOOPS_ROOT_PATH."/header.php");
}
$op = "form";
if ( isset($HTTP_POST_VARS['op']) && $HTTP_POST_VARS['op'] == "submit" ) {
	$op = "submit";
}

OpenTable();

if ( $op == "form" ) {
	$total = XoopsUser::countAllUsers(array("level>0"));
	include_once(XOOPS_ROOT_PATH."/class/xoopsformloader.php");
	$uname_text = new XoopsFormText("", "user_uname", 30, 60);
	$uname_match = new XoopsFormSelectMatchOption("", "user_uname_match");
	$uname_tray = new XoopsFormElementTray(_MM_UNAME, "&nbsp;");
	$uname_tray->addElement($uname_match);
	$uname_tray->addElement($uname_text);
	$name_text = new XoopsFormText("", "user_name", 30, 60);
	$name_match = new XoopsFormSelectMatchOption("", "user_name_match");
	$name_tray = new XoopsFormElementTray(_MM_REALNAME, "&nbsp;");
	$name_tray->addElement($name_match);
	$name_tray->addElement($name_text);
	$email_text = new XoopsFormText("", "user_email", 30, 60);
	$email_match = new XoopsFormSelectMatchOption("", "user_email_match");
	$email_tray = new XoopsFormElementTray(_MM_EMAIL, "&nbsp;");
	$email_tray->addElement($email_match);
	$email_tray->addElement($email_text);
	$url_text = new XoopsFormText(_MM_URLC, "user_url", 30, 100);
	//$theme_select = new XoopsFormSelectTheme(_MM_THEME, "user_theme");
	//$timezone_select = new XoopsFormSelectTimezone(_MM_TIMEZONE, "user_timezone_offset");
	$icq_text = new XoopsFormText("", "user_icq", 30, 100);
	$icq_match = new XoopsFormSelectMatchOption("", "user_icq_match");
	$icq_tray = new XoopsFormElementTray(_MM_ICQ, "&nbsp;");
	$icq_tray->addElement($icq_match);
	$icq_tray->addElement($icq_text);
	$aim_text = new XoopsFormText("", "user_aim", 30, 100);
	$aim_match = new XoopsFormSelectMatchOption("", "user_aim_match");
	$aim_tray = new XoopsFormElementTray(_MM_AIM, "&nbsp;");
	$aim_tray->addElement($aim_match);
	$aim_tray->addElement($aim_text);
	$yim_text = new XoopsFormText("", "user_yim", 30, 100);
	$yim_match = new XoopsFormSelectMatchOption("", "user_yim_match");
	$yim_tray = new XoopsFormElementTray(_MM_YIM, "&nbsp;");
	$yim_tray->addElement($yim_match);
	$yim_tray->addElement($yim_text);
	$msnm_text = new XoopsFormText("", "user_msnm", 30, 100);
	$msnm_match = new XoopsFormSelectMatchOption("", "user_msnm_match");
	$msnm_tray = new XoopsFormElementTray(_MM_MSNM, "&nbsp;");
	$msnm_tray->addElement($msnm_match);
	$msnm_tray->addElement($msnm_text);
	$location_text = new XoopsFormText(_MM_LOCATION, "user_from", 30, 100);
	$occupation_text = new XoopsFormText(_MM_OCCUPATION, "user_occ", 30, 100);
	$interest_text = new XoopsFormText(_MM_INTEREST, "user_intrest", 30, 100);
	
	//$bio_text = new XoopsFormText(_MM_EXTRAINFO, "user_bio", 30, 100);
	$lastlog_more = new XoopsFormText(_MM_LASTLOGMORE, "user_lastlog_more", 10, 5);
	$lastlog_less = new XoopsFormText(_MM_LASTLOGLESS, "user_lastlog_less", 10, 5);
	$reg_more = new XoopsFormText(_MM_REGMORE, "user_reg_more", 10, 5);
	$reg_less = new XoopsFormText(_MM_REGLESS, "user_reg_less", 10, 5);
	$posts_more = new XoopsFormText(_MM_POSTSMORE, "user_posts_more", 10, 5);
	$posts_less = new XoopsFormText(_MM_POSTSLESS, "user_posts_less", 10, 5);
	$sort_select = new XoopsFormSelect(_MM_SORT, "user_sort");
	$sort_select->addOptionArray(array("uname"=>_MM_UNAME,"email"=>_MM_EMAIL,"last_login"=>_MM_LASTLOGIN,"user_regdate"=>_MM_REGDATE,"posts"=>_MM_POSTS));
	$order_select = new XoopsFormSelect(_MM_ORDER, "user_order");
	$order_select->addOptionArray(array("ASC"=>_MM_ASC,"DESC"=>_MM_DESC));
	$limit_text = new XoopsFormText(_MM_LIMIT, "limit", 6, 2);
	$op_hidden = new XoopsFormHidden("op", "submit");
	$submit_button = new XoopsFormButton("", "user_submit", _SUBMIT, "submit");

	$form = new XoopsThemeForm("", "uesr_findform", "index.php");
	$form->addElement($uname_tray);
	$form->addElement($name_tray);
	$form->addElement($email_tray);
	//$form->addElement($theme_select);
	//$form->addElement($timezone_select);
	$form->addElement($icq_tray);
	$form->addElement($aim_tray);
	$form->addElement($yim_tray);
	$form->addElement($msnm_tray);
	$form->addElement($url_text);
	$form->addElement($location_text);
	$form->addElement($occupation_text);
	$form->addElement($interest_text);
	//$form->addElement($bio_text);
	$form->addElement($lastlog_more);
	$form->addElement($lastlog_less);
	$form->addElement($reg_more);
	$form->addElement($reg_less);
	$form->addElement($posts_more);
	$form->addElement($posts_less);
	$form->addElement($sort_select);
	$form->addElement($order_select);
	$form->addElement($limit_text);
	$form->addElement($op_hidden);
	$form->addElement($submit_button);
	echo "<h4 style='text-align:left;'>"._MM_SEARCH."</h4>(".sprintf(_MM_TOTALUSERS, "<span style='color:#ff0000;'>$total</span>").")";
	$form->display();
}

if ( $op == "submit" ) {
	$iamadmin = false;
	if ( $xoopsUser && $xoopsUser->isAdmin() ) {
		$iamadmin = true;
        }
	$myts =& MyTextSanitizer::getInstance();
	$criteria = array();
	if ( !empty($HTTP_POST_VARS['user_uname']) ) {
		$match = (!empty($HTTP_POST_VARS['user_uname_match'])) ? intval($HTTP_POST_VARS['user_uname_match']) : XOOPS_MATCH_START;
		switch ($match) {
			case XOOPS_MATCH_START:
				$criteria[] = "uname LIKE '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_uname']))."%'";
				break;
			case XOOPS_MATCH_END:
				$criteria[] = "uname LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_uname']))."'";
				break;
			case XOOPS_MATCH_EQUAL:
				$criteria[] = "uname = '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_uname']))."'";
				break;
			case XOOPS_MATCH_CONTAIN:
				$criteria[] = "uname LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_uname']))."%'";
				break;
		}
	}
	if ( !empty($HTTP_POST_VARS['user_name']) ) {
		$match = (!empty($HTTP_POST_VARS['user_name_match'])) ? intval($HTTP_POST_VARS['user_name_match']) : XOOPS_MATCH_START;
		switch ($match) {
			case XOOPS_MATCH_START:
				$criteria[] = "name LIKE '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_name']))."%'";
				break;
			case XOOPS_MATCH_END:
				$criteria[] = "name LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_name']))."'";
				break;
			case XOOPS_MATCH_EQUAL:
				$criteria[] = "name = '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_name']))."'";
				break;
			case XOOPS_MATCH_CONTAIN:
				$criteria[] = "name LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_name']))."%'";
				break;
		}
	}
	if ( !empty($HTTP_POST_VARS['user_email']) ) {
		$match = (!empty($HTTP_POST_VARS['user_email_match'])) ? intval($HTTP_POST_VARS['user_email_match']) : XOOPS_MATCH_START;
		switch ($match) {
			case XOOPS_MATCH_START:
				$criteria[] = "email LIKE '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_email']))."%'";
				break;
			case XOOPS_MATCH_END:
				$criteria[] = "email LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_email']))."'";
				break;
			case XOOPS_MATCH_EQUAL:
				$criteria[] = "email = '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_email']))."'";
				break;
			case XOOPS_MATCH_CONTAIN:
				$criteria[] = "email LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_email']))."%'";
				break;
		}
		if ( !$iamadmin ) {
			$criteria[] = "user_viewemail=1";
		}
	}
	if ( !empty($HTTP_POST_VARS['user_url']) ) {
		$url = formatURL(trim($HTTP_POST_VARS['user_url']));
		$criteria[] = "url LIKE '".$myts->oopsAddSlashes($url)."%'";
	}
	if ( !empty($HTTP_POST_VARS['user_icq']) ) {
		$match = (!empty($HTTP_POST_VARS['user_icq_match'])) ? intval($HTTP_POST_VARS['user_icq_match']) : XOOPS_MATCH_START;
		switch ($match) {
			case XOOPS_MATCH_START:
				$criteria[] = "user_icq LIKE '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_icq']))."%'";
				break;
			case XOOPS_MATCH_END:
				$criteria[] = "user_icq LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_icq']))."'";
				break;
			case XOOPS_MATCH_EQUAL:
				$criteria[] = "user_icq = '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_icq']))."'";
				break;
			case XOOPS_MATCH_CONTAIN:
				$criteria[] = "user_icq LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_icq']))."%'";
				break;
		}
	}
	if ( !empty($HTTP_POST_VARS['user_aim']) ) {
		$match = (!empty($HTTP_POST_VARS['user_aim_match'])) ? intval($HTTP_POST_VARS['user_aim_match']) : XOOPS_MATCH_START;
		switch ($match) {
			case XOOPS_MATCH_START:
				$criteria[] = "user_aim LIKE '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_aim']))."%'";
				break;
			case XOOPS_MATCH_END:
				$criteria[] = "user_aim LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_aim']))."'";
				break;
			case XOOPS_MATCH_EQUAL:
				$criteria[] = "user_aim = '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_aim']))."'";
				break;
			case XOOPS_MATCH_CONTAIN:
				$criteria[] = "user_aim LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_aim']))."%'";
				break;
		}
	}
	if ( !empty($HTTP_POST_VARS['user_yim']) ) {
		$match = (!empty($HTTP_POST_VARS['user_yim_match'])) ? intval($HTTP_POST_VARS['user_yim_match']) : XOOPS_MATCH_START;
		switch ($match) {
			case XOOPS_MATCH_START:
				$criteria[] = "user_yim LIKE '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_yim']))."%'";
				break;
			case XOOPS_MATCH_END:
				$criteria[] = "user_yim LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_yim']))."'";
				break;
			case XOOPS_MATCH_EQUAL:
				$criteria[] = "user_yim = '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_yim']))."'";
				break;
			case XOOPS_MATCH_CONTAIN:
				$criteria[] = "user_yim LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_yim']))."%'";
				break;
		}
	}
	if ( !empty($HTTP_POST_VARS['user_msnm']) ) {
		$match = (!empty($HTTP_POST_VARS['user_msnm_match'])) ? intval($HTTP_POST_VARS['user_msnm_match']) : XOOPS_MATCH_START;
		switch ($match) {
			case XOOPS_MATCH_START:
				$criteria[] = "user_msnm LIKE '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_msnm']))."%'";
				break;
			case XOOPS_MATCH_END:
				$criteria[] = "user_msnm LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_msnm']))."'";
				break;
			case XOOPS_MATCH_EQUAL:
				$criteria[] = "user_msnm = '".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_msnm']))."'";
				break;
			case XOOPS_MATCH_CONTAIN:
				$criteria[] = "user_msnm LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_msnm']))."%'";
				break;
		}
	}
	if ( !empty($HTTP_POST_VARS['user_from']) ) {
		$criteria[] = "user_from LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_from']))."%'";
	}
	if ( !empty($HTTP_POST_VARS['user_intrest']) ) {
		$criteria[] = "user_intrest LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_intrest']))."%'";
	}
	if ( !empty($HTTP_POST_VARS['user_occ']) ) {
		$criteria[] = "user_occ LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_occ']))."%'";
	}
//	if ( !empty($HTTP_POST_VARS['user_bio']) ) {
//		$criteria[] = "bio LIKE '%".$myts->oopsAddSlashes(trim($HTTP_POST_VARS['user_bio']))."%'";
//	}
//	if ( isset($HTTP_POST_VARS['user_timezone_offset']) && $HTTP_POST_VARS['user_timezone_offset'] != "" ) {
//		$criteria[] = "timezone_offset=".intval($HTTP_POST_VARS['user_timezone_offset'])."";
//	}

	if ( !empty($HTTP_POST_VARS['user_lastlog_more']) && is_numeric($HTTP_POST_VARS['user_lastlog_more']) ) {
		$f_user_lastlog_more = intval(trim($HTTP_POST_VARS['user_lastlog_more']));
		$time = time() - (60 * 60 * 24 * $f_user_lastlog_more);
		if ( $time > 0 ) {
			$criteria[] = "last_login < $time";
		}
	}
	if ( !empty($HTTP_POST_VARS['user_lastlog_less']) && is_numeric($HTTP_POST_VARS['user_lastlog_less']) ) {
		$f_user_lastlog_less = intval(trim($HTTP_POST_VARS['user_lastlog_less']));
		$time = time() - (60 * 60 * 24 * $f_user_lastlog_less);
		if ( $time > 0 ) {
			$criteria[] = "last_login > $time";
		}
	}
	if ( !empty($HTTP_POST_VARS['user_reg_more']) && is_numeric($HTTP_POST_VARS['user_reg_more']) ) {
		$f_user_reg_more = intval(trim($HTTP_POST_VARS['user_reg_more']));
		$time = time() - (60 * 60 * 24 * $f_user_reg_more);
		if ( $time > 0 ) {
			$criteria[] = "user_regdate < $time";
		}
	}
	if ( !empty($HTTP_POST_VARS['user_reg_less']) && is_numeric($HTTP_POST_VARS['user_reg_less']) ) {
		$f_user_reg_less = intval($HTTP_POST_VARS['user_reg_less']);
		$time = time() - (60 * 60 * 24 * $f_user_reg_less);
		if ( $time > 0 ) {
			$criteria[] = "user_regdate > $time";
		}
	}
	if ( !empty($HTTP_POST_VARS['user_posts_more']) && is_numeric($HTTP_POST_VARS['user_posts_more']) ) {
		$criteria[] = "posts > ".intval($HTTP_POST_VARS['user_posts_more'])."";
	}
	if ( !empty($HTTP_POST_VARS['user_posts_less']) && is_numeric($HTTP_POST_VARS['user_posts_less']) ) {
		$criteria[] = "posts < ".intval($HTTP_POST_VARS['user_posts_less'])."";
	}
	$criteria[] = "level>0";
	$validsort = array("uname", "email", "last_login", "user_regdate", "posts");
	$sort = (!in_array($HTTP_POST_VARS['user_sort'], $validsort)) ? "uname" : $HTTP_POST_VARS['user_sort'];
	$order = "ASC";
	if ( isset($HTTP_POST_VARS['user_order']) && $HTTP_POST_VARS['user_order'] == "DESC") {
		$order = "DESC";
	}
	$limit = (!empty($HTTP_POST_VARS['limit'])) ? intval($HTTP_POST_VARS['limit']) : 20;
	if ( $limit > 50 ) {
		$limit = 50;
	}
	$start = (!empty($HTTP_POST_VARS['start'])) ? intval($HTTP_POST_VARS['start']) : 0;
	$total = XoopsUser::countAllUsers($criteria);
	echo "<a href='index.php'>". _MM_SEARCH ."</a>&nbsp;<span style='font-weight:bold;'>&raquo;&raquo;</span>&nbsp;". _MM_RESULTS."<br /><br />";
	if ( $total == 0 ) {
		echo "<h4>"._MM_NOFOUND,"</h4>";
	} elseif ( $start < $total ) {
		echo "<table border='0' cellpadding='0' cellspacing='0' valign='top' width='100%'><tr><td class='bg2'>
		<table width='100%' border='0' cellspacing='1' cellpadding='4'><tr class='bg3'><td align='center'><b>"._MM_AVATAR."</b></td><td align='center'><b>"._MM_UNAME."</b></td><td align='center'><b>"._MM_REALNAME."</b></td><td align='center'><b>"._MM_EMAIL."</b></span></td><td align='center'><b>"._MM_PM."</b></td><td align='center'><b>"._MM_URL."</b></td><td align='center'><b>"._MM_REGDATE."</b></td><td align='center'><b>"._MM_LASTLOGIN."</b></td><td align='center'><b>"._MM_POSTS."</b></td>";
		if ( $iamadmin ) {
			echo "<td align='center'>&nbsp;</td>";
        	}
		echo "</tr>";
		$foundusers = XoopsUser::getAllUsers($criteria, true, "$sort $order", $limit, $start);
		foreach ($foundusers as $fuser) {
			$fuser_avatar = $fuser->getVar("user_avatar") ? "<img src='".XOOPS_URL."/images/avatar/".$fuser->getVar("user_avatar")."' alt='' />" : "&nbsp;";
			$fuser_name = $fuser->getVar("name") ? $fuser->getVar("name") : "&nbsp;";
			echo "<tr class='bg1'><td>$fuser_avatar</td><td><a href='".XOOPS_URL."/userinfo.php?uid=".$fuser->getVar("uid")."'>".$fuser->getVar("uname")."</a></td><td>".$fuser_name."</td><td align='center'>";
			if ( $fuser->getVar("user_viewemail") == 1 || $iamadmin ) {
				echo "<a href='mailto:".$fuser->getVar("email")."'><img src='".XOOPS_URL."/images/icons/email.gif' border='0' alt='";
				printf(_SENDEMAILTO,$fuser->getVar("uname", "E"));
				echo "' /></a>";
			} else {
				echo "&nbsp;";
			}
			echo "</td><td align='center'>";
			if ( $xoopsUser ) {
				echo "<a href='javascript:openWithSelfMain(\"".XOOPS_URL."/pmlite.php?send2=1&amp;to_userid=".$fuser->getVar("uid")."\",\"pmlite\",360,300);'><img src='".XOOPS_URL."/images/icons/pm.gif' border='0' alt='";
				printf(_SENDPMTO,$fuser->getVar("uname", "E"));
				echo "' /></a>";
			} else {
				echo "&nbsp;";
			}
			echo "</td><td align='center'>";
			if ( $fuser->getVar("url","E") != "" ) {
                    		echo "<a href='".$fuser->getVar("url","E")."' target='_blank'><img src='".XOOPS_URL."/images/icons/www.gif' border='0' alt='"._VISITWEBSITE."' /></a>";
			} else {
				echo "&nbsp;";
			}
			echo "</td><td align='center'>".formatTimeStamp($fuser->getVar("user_regdate"),"s")."</td><td align='center'>";
			if ( $fuser->getVar("last_login") != 0 ) {
				echo formatTimeStamp($fuser->getVar("last_login"),"m");
			} else {
				echo "&nbsp;";
			}
			echo "</td><td align='center'>".$fuser->getVar("posts")."</td>";
			if ( $iamadmin ) {
				echo "<td align='center'><a href='".XOOPS_URL."/modules/system/admin.php?fct=users&amp;uid=".$fuser->getVar("uid")."&amp;op=modifyUser'>"._EDIT."</a> | <a href='".XOOPS_URL."/modules/system/admin.php?fct=users&amp;op=delUser&amp;uid=".$fuser->getVar("uid")."'>"._DELETE."</a></td>";
			}
			echo "</tr>\n";
		}
		echo "</table></td></tr></table>\n";
		$totalpages = ceil($total / $limit);
    		if ( $totalpages > 1 ) {
			$hiddenform = "<form name='findnext' action='index.php' method='post'>";
			foreach ( $HTTP_POST_VARS as $k => $v ) {
				$hiddenform .= "<input type='hidden' name='".$myts->oopsHtmlSpecialChars($k)."' value='".$myts->makeTboxData4PreviewInForm($v)."' />\n";
			}
			if (!isset($HTTP_POST_VARS['limit'])) {
				$hiddenform .= "<input type='hidden' name='limit' value='".$limit."' />\n";
			}
			if (!isset($HTTP_POST_VARS['start'])) {
				$hiddenform .= "<input type='hidden' name='start' value='".$start."' />\n";
			}
			$prev = $start - $limit;
        		if ( $start - $limit >= 0 ) {
				$hiddenform .= "<a href='#0' onclick='javascript:document.findnext.start.value=".$prev.";document.findnext.submit();'>"._MM_PREVIOUS."</a>&nbsp;\n";
        		}
			$counter = 1;
			$currentpage = ($start+$limit) / $limit;
			while ( $counter <= $totalpages ) {
				if ( $counter == $currentpage ) {
					$hiddenform .= "<b>".$counter."</b> ";
				} elseif ( ($counter > $currentpage-4 && $counter < $currentpage+4) || $counter == 1 || $counter == $totalpages ) {
					if ( $counter == $totalpages && $currentpage < $totalpages-4 ) {
						$hiddenform .= "... ";
					}
					$hiddenform .= "<a href='#".$counter."' onclick='javascript:document.findnext.start.value=".($counter-1)*$limit.";document.findnext.submit();'>".$counter."</a> ";
					if ( $counter == 1 && $currentpage > 5 ) {
						$hiddenform .= "... ";
					}
				}
				$counter++;
			}
			$next = $start+$limit;
			if ( $total > $next ) {
				$hiddenform .= "&nbsp;<a href='#".$total."' onclick='javascript:document.findnext.start.value=".$next.";document.findnext.submit();'>"._MM_NEXT."</a>\n";
			}
			$hiddenform .= "</form>";
			echo "<div style='text-align:center'>".$hiddenform."<br />";
			printf(_MM_USERSFOUND, $total);
			echo "</div>";
		}
	}

}
CloseTable();
include_once(XOOPS_ROOT_PATH."/footer.php");
?>