111 if ($isNew ===
true) {
123 function &
get($id = 0)
125 $object =& $this->
create(
false);
126 $sql =
"SELECT * FROM " . $this->db->prefix(
'ranks') .
" WHERE rank_id = " . $this->db->quoteString($id);
131 while ($row = $this->db->fetchArray(
$result)) {
132 $object->assignVars($row);
153 $sql =
'SELECT rank_id, rank_title FROM ' . $this->db->prefix(
'ranks');
167 while ($myrow = $this->db->fetchArray(
$result)) {
168 $ret[$myrow[
'rank_id']] =
$myts->htmlSpecialChars($myrow[
'rank_title']);
204 foreach ($unsets as
$var) {
205 unset($this->vars[$var]);
246 if ($isNew ===
true) {
267 $sql =
' SELECT COUNT(DISTINCT u.uid) FROM ' . $this->db->prefix(
'users') .
' AS u' .
' WHERE 1=1';
269 $sql =
' SELECT COUNT(DISTINCT u.uid) FROM ' . $this->db->prefix(
'users') .
' AS u' .
' LEFT JOIN ' . $this->db->prefix(
'groups_users_link') .
' AS g ON g.uid = u.uid' .
' WHERE g.groupid IN (' . implode(
', ', array_map(
'intval',
$groups)) .
')';
274 $sql .=
' AND ' . $render;
278 list ($count) = $this->db->fetchRow(
$result);
299 $sql =
' SELECT u.* FROM ' . $this->db->prefix(
'users') .
' AS u' .
' WHERE 1=1';
302 $sql =
' SELECT u.* FROM ' . $this->db->prefix(
'users') .
' AS u' .
' LEFT JOIN ' . $this->db->prefix(
'groups_users_link') .
' AS g ON g.uid = u.uid' .
' WHERE g.groupid IN (' . implode(
', ', array_map(
'intval',
$groups)) .
')';
306 $sql .=
' AND ' . $render;
315 if (empty($orderSet))
316 $sql .=
" ORDER BY u.uid ASC";
319 while ($myrow = $this->db->fetchArray(
$result)) {
320 $object =& $this->
create(
false);
321 $object->assignVars($myrow);
322 $ret[$myrow[
"uid"]] = $object;
347 define(
'FINDUSERS_MODE_SIMPLE', 0);
348 define(
'FINDUSERS_MODE_ADVANCED', 1);
349 define(
'FINDUSERS_MODE_QUERY', 2);
356 if (empty(
$_POST[
"user_submit"])) {
357 include_once
$GLOBALS[
'xoops']->path(
'class/xoopsformloader.php');
369 $match_tray->addElement($match);
370 $match_tray->addElement($text);
371 $form->addElement($match_tray);
372 unset($text, $match, $match_tray);
383 $range_tray->addElement($less);
384 $range_tray->addElement($more);
385 $form->addElement($range_tray);
386 unset($more, $less, $range_tray);
390 $mailok_radio->addOptionArray(array(
395 $avatar_radio->addOptionArray(array(
406 $level_radio->addOptionArray($levels);
412 $group_select->addOptionArray(
$groups);
417 $rank_select->addOptionArray($ranks);
418 $form->addElement($url_text);
419 $form->addElement($location_text);
420 $form->addElement($occupation_text);
421 $form->addElement($interest_text);
422 $form->addElement($mailok_radio);
423 $form->addElement($avatar_radio);
424 $form->addElement($level_radio);
425 $form->addElement($group_select);
426 $form->addElement($rank_select);
435 $match_tray->addElement($match);
436 $match_tray->addElement($text);
437 $form->addElement($match_tray);
438 unset($text, $match, $match_tray);
443 $sort_select->addOptionArray(array(
449 $order_select->addOptionArray(array(
453 $form->addElement($sort_select);
454 $form->addElement($order_select);
465 echo
"</html><body>";
467 $modes_switch = array();
471 $modes_switch[] =
"<a href='findusers.php?target=" . htmlspecialchars(@
$_REQUEST[
"target"], ENT_QUOTES) .
"&multiple=" . htmlspecialchars(@
$_REQUEST[
"multiple"], ENT_QUOTES) .
"&token=" . htmlspecialchars(
$token, ENT_QUOTES) .
"&mode={$_mode}'>{$title}</a>";
473 echo
"<h4>" . implode(
" | ", $modes_switch) .
"</h4>";
474 echo
"(" . sprintf(
_MA_USER_ACTUS,
"<span style='color:#ff0000;'>$acttotal</span>") .
" " . sprintf(
_MA_USER_INACTUS,
"<span style='color:#ff0000;'>$inacttotal</span>") .
")";
481 if (!isset(
$_POST[
"query"])) {
484 if (!empty(
$_POST[$var])) {
486 $value = str_replace(
"_",
"\\\_",
$myts->addSlashes(trim(
$_POST[$var])));
503 if (!empty(
$_POST[
'url'])) {
507 if (!empty(
$_POST[
'user_from'])) {
510 if (!empty(
$_POST[
'user_intrest'])) {
513 if (!empty(
$_POST[
'user_occ'])) {
518 "user_regdate") as
$var) {
519 if (!empty(
$_POST[
"{$var}_more"]) && is_numeric(
$_POST[
"{$var}_more"])) {
520 $time = time() - (60 * 60 * 24 * intval(trim(
$_POST[
"{$var}_more"])));
525 if (!empty(
$_POST[
"{$var}_less"]) && is_numeric(
$_POST[
"{$var}_less"])) {
526 $time = time() - (60 * 60 * 24 * intval(trim(
$_POST[
"{$var}_less"])));
532 if (!empty(
$_POST[
'posts_more']) && is_numeric(
$_POST[
'posts_more'])) {
535 if (!empty(
$_POST[
'posts_less']) && is_numeric(
$_POST[
'posts_less'])) {
538 if (!empty(
$_POST[
'user_mailok'])) {
539 if (
$_POST[
'user_mailok'] ==
"mailng") {
541 }
else if (
$_POST[
'user_mailok'] ==
"mailok") {
545 if (!empty(
$_POST[
'user_avatar'])) {
546 if (
$_POST[
'user_avatar'] ==
"y") {
548 }
else if (
$_POST[
'user_avatar'] ==
"n") {
552 if (!empty(
$_POST[
'level'])) {
553 $level_value = array(
557 $level = isset($level_value[intval(
$_POST[
"level"])]) ? $level_value[intval(
$_POST[
"level"])] : 1;
560 if (!empty(
$_POST[
'rank'])) {
562 if ($rank_obj->getVar(
"rank_special")) {
565 if ($rank_obj->getVar(
"rank_min")) {
568 if ($rank_obj->getVar(
"rank_max")) {
580 $sort = (!in_array(
$_POST[
'user_sort'], $validsort)) ?
"uname" :
$_POST[
'user_sort'];
582 if (isset(
$_POST[
'user_order']) &&
$_POST[
'user_order'] ==
"DESC") {
593 if (preg_match(
"/select[\s]+.*[\s]+from[\s]+(" .
$xoopsDB->prefix(
"users") .
"[\s]+as[\s]+([^\s]+).*)/i",
$query, $matches)) {
594 $alias = $matches[2];
598 }
else if (preg_match(
"/select[\s]+.*[\s]+from[\s]+(" .
$xoopsDB->prefix(
"users") .
"\b.*)/i",
$query, $matches)) {
614 $object->assignVars($myrow);
621 <script type="text/javascript">
622 var multiple=' . intval(
$_REQUEST[
'multiple']) .
';
627 var mForm = document.forms["' .
$name_form .
'"];
628 for (var i=0;i!=mForm.elements.length;i++) {
629 var id=mForm.elements[i];
630 if ( ( (multiple > 0 && id.type == "checkbox") || (multiple == 0 && id.type == "radio") ) && (id.checked == true) && ( id.name == "' .
$name_userid .
'" ) ) {
631 var name = mForm.elements[++i];
632 var len = id.value.length + name.value.length;
633 sel_str += len + ":" + id.value + ":" + name.value;
641 sel_str = num + ":" + sel_str;
642 window.opener.addusers(sel_str);
646 window.opener.focus();
653 echo
"</html><body>";
654 echo
"<a href='findusers.php?target=" . htmlspecialchars(@
$_POST[
"target"], ENT_QUOTES) .
"&multiple=" . intval(@
$_POST[
"multiple"]) .
"&token=" . htmlspecialchars(
$token, ENT_QUOTES) .
"'>" .
_MA_USER_FINDUS .
"</a> <span style='font-weight:bold;'>»»</span> " .
_MA_USER_RESULTS .
"<br /><br />";
657 $hiddenform =
"<form name='findnext' action='findusers.php' method='post'>";
658 foreach (
$_POST as $k => $v) {
659 if ($k ==
'XOOPS_TOKEN_REQUEST') {
661 $hiddenform .=
$GLOBALS[
'xoopsSecurity']->getTokenHTML() .
"\n";
663 $hiddenform .=
"<input type='hidden' name='" . htmlSpecialChars($k, ENT_QUOTES) .
"' value='" . htmlSpecialChars(
$myts->stripSlashesGPC($v), ENT_QUOTES) .
"' />\n";
666 if (!isset(
$_POST[
'limit'])) {
667 $hiddenform .=
"<input type='hidden' name='limit' value='{$limit}' />\n";
669 if (!isset(
$_POST[
'start'])) {
670 $hiddenform .=
"<input type='hidden' name='start' value='{$start}' />\n";
672 $hiddenform .=
"<input type='hidden' name='token' value='" . htmlspecialchars(
$token, ENT_QUOTES) .
"' />\n";
673 $hiddenform .=
"</form>";
675 echo
"<div>" . $hiddenform;
676 echo
"<a href='#' onclick='javascript:document.findnext.start.value=0;document.findnext.user_submit.value=0;document.findnext.submit();'>" .
_MA_USER_SEARCHAGAIN .
"</a>\n";
678 }
else if (
$start < $total) {
679 if (!empty($total)) {
683 echo
"<form action='findusers.php' method='post' name='{$name_form}' id='{$name_form}'>
684 <table width='100%' border='0' cellspacing='1' cellpadding='4' class='outer'>
686 <th align='center' width='5px'>";
687 if (! empty(
$_POST[
"multiple"])) {
688 echo
"<input type='checkbox' name='memberslist_checkall' id='memberslist_checkall' onclick='xoopsCheckAll(\"{$name_form}\", \"memberslist_checkall\");' />";
699 if ($ucount % 2 == 0) {
706 echo
"<tr class='$class'>
707 <td align='center'>";
708 if (!empty(
$_POST[
"multiple"])) {
709 echo
"<input type='checkbox' name='{$name_userid}' id='{$name_userid}' value='" .
$foundusers[
$j]->getVar(
"uid") .
"' />";
710 echo
"<input type='hidden' name='{$name_username}' id='{$name_username}' value='" .
$foundusers[
$j]->getVar(
"uname") .
"' />";
712 echo
"<input type='radio' name='{$name_userid}' id='{$name_userid}' value='" .
$foundusers[
$j]->getVar(
"uid") .
"' />";
713 echo
"<input type='hidden' name='{$name_username}' id='{$name_username}' value='" .
$foundusers[
$j]->getVar(
"uname") .
"' />";
716 <td><a href='" . XOOPS_URL .
"/userinfo.php?uid=" .
$foundusers[
$j]->getVar(
"uid") .
"' target='_blank'>" .
$foundusers[
$j]->getVar(
"uname") .
"</a></td>
717 <td>" . $fuser_name .
"</td>
718 <td align='center'>" . (
$foundusers[
$j]->getVar(
"user_regdate") ? date(
"Y-m-d",
$foundusers[$j]->getVar(
"user_regdate")) :
"") .
"</td>
719 <td align='center'>" . (
$foundusers[$j]->getVar(
"last_login") ? date(
"Y-m-d H:i",
$foundusers[$j]->getVar(
"last_login")) :
"") .
"</td>
720 <td align='center'>" .
$foundusers[$j]->getVar(
"posts") .
"</td>";
723 echo
"<tr class='foot'><td colspan='6'>";
726 if (empty(
$_POST[
"target"])) {
727 echo
"<select name='fct'><option value='users'>" .
_DELETE .
"</option><option value='mailusers'>" .
_MA_USER_SENDMAIL .
"</option>";
728 echo
"</select> ";
729 echo
$GLOBALS[
'xoopsSecurity']->getTokenHTML() .
"<input type='submit' value='" .
_SUBMIT .
"' />";
735 echo
"<input type='hidden' name='token' value='" . htmlspecialchars(
$token, ENT_QUOTES) .
"' />\n";
736 echo
"</td></tr></table></form>\n";
739 $hiddenform =
"<form name='findnext' action='findusers.php' method='post'>";
740 foreach (
$_POST as $k => $v) {
741 if ($k ==
'XOOPS_TOKEN_REQUEST') {
743 $hiddenform .=
$GLOBALS[
'xoopsSecurity']->getTokenHTML() .
"\n";
745 $hiddenform .=
"<input type='hidden' name='" . htmlSpecialChars($k, ENT_QUOTES) .
"' value='" . htmlSpecialChars(
$myts->stripSlashesGPC($v), ENT_QUOTES) .
"' />\n";
748 if (!isset(
$_POST[
'limit'])) {
749 $hiddenform .=
"<input type='hidden' name='limit' value='" .
$limit .
"' />\n";
751 if (!isset(
$_POST[
'start'])) {
752 $hiddenform .=
"<input type='hidden' name='start' value='" .
$start .
"' />\n";
754 $hiddenform .=
"<input type='hidden' name='token' value='" . htmlspecialchars(
$token, ENT_QUOTES) .
"' />\n";
755 if (!isset($total) || ($totalpages = ceil($total /
$limit)) > 1) {
757 if (
$start - $limit >= 0) {
758 $hiddenform .=
"<a href='#0' onclick='javascript:document.findnext.start.value=" . $prev .
";document.findnext.submit();'>" .
_MA_USER_PREVIOUS .
"</a> \n";
762 if (!isset($total)) {
763 while ($counter <= $currentpage) {
764 if ($counter == $currentpage) {
765 $hiddenform .=
"<strong>" . $counter .
"</strong> ";
766 }
else if (($counter > $currentpage - 4 && $counter < $currentpage + 4) || $counter == 1) {
767 $hiddenform .=
"<a href='#" . $counter .
"' onclick='javascript:document.findnext.start.value=" . ($counter - 1) * $limit .
";document.findnext.submit();'>" . $counter .
"</a> ";
768 if ($counter == 1 && $currentpage > 5) {
769 $hiddenform .=
"... ";
775 while ($counter <= $totalpages) {
776 if ($counter == $currentpage) {
777 $hiddenform .=
"<strong>" . $counter .
"</strong> ";
778 }
else if (($counter > $currentpage - 4 && $counter < $currentpage + 4) || $counter == 1 || $counter == $totalpages) {
779 if ($counter == $totalpages && $currentpage < $totalpages - 4) {
780 $hiddenform .=
"... ";
782 $hiddenform .=
"<a href='#" . $counter .
"' onclick='javascript:document.findnext.start.value=" . ($counter - 1) * $limit .
";document.findnext.submit();'>" . $counter .
"</a> ";
783 if ($counter == 1 && $currentpage > 5) {
784 $hiddenform .=
"... ";
793 $hiddenform .=
" <a href='#" . $total .
"' onclick='javascript:document.findnext.start.value=" .
$next .
";document.findnext.submit();'>" .
_MA_USER_NEXT .
"</a>\n";
796 $hiddenform .=
"</form>";
798 echo
"<div>" . $hiddenform;
802 echo
"<a href='#' onclick='javascript:document.findnext.start.value=0;document.findnext.user_submit.value=0;document.findnext.submit();'>" .
_MA_USER_SEARCHAGAIN .
"</a>\n";